pandemonium_engine_easy_charts/addons/easy_charts/Utilities/Legend/FunctionLegend.gd

42 lines
1.0 KiB
GDScript3
Raw Normal View History

2020-08-04 15:22:30 +02:00
tool
2020-05-14 02:36:45 +02:00
extends VBoxContainer
class_name LegendElement
2020-05-14 02:36:45 +02:00
onready var Function : Label = $Function
onready var FunctionColor : ColorRect = $Color
2020-05-14 13:55:30 +02:00
var function : String setget set_function, get_function
var color : Color setget set_function_color, get_function_color
2020-05-14 02:36:45 +02:00
var font_color : Color
var font : Font
func _ready():
Function.set("custom_fonts/font",font)
Function.set("custom_colors/font_color",font_color)
Function.set_text(function)
FunctionColor.set_frame_color(color)
2020-05-14 02:36:45 +02:00
func create_legend(text : String, color : Color, font : Font, font_color : Color):
self.function = text
self.color = color
self.font_color = font_color
self.font = font
2020-05-14 13:55:30 +02:00
func set_function( t : String ):
function = t
2020-05-14 13:55:30 +02:00
func get_function() -> String:
return function
2020-05-14 13:55:30 +02:00
func set_function_color( c : Color ):
color = c
2020-05-14 13:55:30 +02:00
func get_function_color() -> Color:
return color
func get_class() -> String:
return "Legend Element"
func _to_string() -> String:
return "%s (%s, %s) " % [get_class(), get_function(), get_function_color().to_html(true)]