diff --git a/Libraries/LibCore/Object.h b/Libraries/LibCore/Object.h index 9e7ff40265..ef261564c9 100644 --- a/Libraries/LibCore/Object.h +++ b/Libraries/LibCore/Object.h @@ -119,6 +119,7 @@ public: bool set_property(const StringView& name, const JsonValue& value); JsonValue property(const StringView& name); + const HashMap>& properties() const { return m_properties; } static IntrusiveList& all_objects(); diff --git a/Libraries/LibGUI/Button.cpp b/Libraries/LibGUI/Button.cpp index 25c27fb502..633d416e08 100644 --- a/Libraries/LibGUI/Button.cpp +++ b/Libraries/LibGUI/Button.cpp @@ -41,6 +41,11 @@ Button::Button(String text) set_min_width(32); set_fixed_height(22); set_focus_policy(GUI::FocusPolicy::StrongFocus); + + REGISTER_ENUM_PROPERTY( + "button_style", button_style, set_button_style, Gfx::ButtonStyle, + { Gfx::ButtonStyle::Normal, "Normal" }, + { Gfx::ButtonStyle::CoolBar, "CoolBar" }); } Button::~Button() diff --git a/Libraries/LibGUI/ColorInput.cpp b/Libraries/LibGUI/ColorInput.cpp index 6ce7a63712..94a5e22203 100644 --- a/Libraries/LibGUI/ColorInput.cpp +++ b/Libraries/LibGUI/ColorInput.cpp @@ -42,6 +42,9 @@ ColorInput::ColorInput() if (parsed_color.has_value()) set_color_without_changing_text(parsed_color.value()); }; + + REGISTER_STRING_PROPERTY("color_picker_title", color_picker_title, set_color_picker_title); + REGISTER_BOOL_PROPERTY("has_alpha_channel", has_alpha_channel, set_color_has_alpha_channel); } ColorInput::~ColorInput() diff --git a/Libraries/LibGUI/Forward.h b/Libraries/LibGUI/Forward.h index 14d53a785c..0e771b7b38 100644 --- a/Libraries/LibGUI/Forward.h +++ b/Libraries/LibGUI/Forward.h @@ -34,6 +34,8 @@ class AbstractView; class Action; class ActionGroup; class Application; +class AutocompleteBox; +class AutocompleteProvider; class BoxLayout; class Button; class CheckBox; diff --git a/Libraries/LibGUI/Frame.cpp b/Libraries/LibGUI/Frame.cpp index 7215f1d985..de0fba6270 100644 --- a/Libraries/LibGUI/Frame.cpp +++ b/Libraries/LibGUI/Frame.cpp @@ -36,6 +36,19 @@ Frame::Frame() set_frame_thickness(2); set_frame_shape(Gfx::FrameShape::Container); set_frame_shadow(Gfx::FrameShadow::Sunken); + + REGISTER_INT_PROPERTY("thickness", frame_thickness, set_frame_thickness); + REGISTER_ENUM_PROPERTY("shadow", frame_shadow, set_frame_shadow, Gfx::FrameShadow, + { Gfx::FrameShadow::Plain, "Plain" }, + { Gfx::FrameShadow::Raised, "Raised" }, + { Gfx::FrameShadow::Sunken, "Sunken" }); + REGISTER_ENUM_PROPERTY("shape", frame_shape, set_frame_shape, Gfx::FrameShape, + { Gfx::FrameShape::NoFrame, "NoFrame" }, + { Gfx::FrameShape::Box, "Box" }, + { Gfx::FrameShape::Container, "Container" }, + { Gfx::FrameShape::Panel, "Panel" }, + { Gfx::FrameShape::VerticalLine, "VerticalLine" }, + { Gfx::FrameShape::HorizontalLine, "HorizontalLine" }); } Frame::~Frame() diff --git a/Libraries/LibGUI/GMLLexer.cpp b/Libraries/LibGUI/GMLLexer.cpp index 1d999b4301..ede1272356 100644 --- a/Libraries/LibGUI/GMLLexer.cpp +++ b/Libraries/LibGUI/GMLLexer.cpp @@ -66,11 +66,6 @@ static bool is_valid_identifier_character(char ch) return isalnum(ch) || ch == '_'; } -static bool is_valid_class_start(char ch) -{ - return isalpha(ch) || ch == '_'; -} - static bool is_valid_class_character(char ch) { return isalnum(ch) || ch == '_' || ch == ':'; @@ -138,7 +133,7 @@ Vector GMLLexer::lex() continue; } - if (peek(0) == '@' && is_valid_class_start(peek(1))) { + if (peek(0) == '@') { consume_class(); continue; } @@ -160,7 +155,7 @@ Vector GMLLexer::lex() while (isspace(peek())) consume(); - if (peek(0) == '@' && is_valid_class_start(peek(1))) { + if (peek(0) == '@') { consume_class(); } else { begin_token(); diff --git a/Libraries/LibGUI/GroupBox.cpp b/Libraries/LibGUI/GroupBox.cpp index 17b722f1f2..7b10ada0d2 100644 --- a/Libraries/LibGUI/GroupBox.cpp +++ b/Libraries/LibGUI/GroupBox.cpp @@ -35,6 +35,7 @@ namespace GUI { GroupBox::GroupBox(const StringView& title) : m_title(title) { + REGISTER_STRING_PROPERTY("title", title, set_title); } GroupBox::~GroupBox() diff --git a/Libraries/LibGUI/ImageWidget.cpp b/Libraries/LibGUI/ImageWidget.cpp index ce72296648..69b251f4a0 100644 --- a/Libraries/LibGUI/ImageWidget.cpp +++ b/Libraries/LibGUI/ImageWidget.cpp @@ -40,6 +40,9 @@ ImageWidget::ImageWidget(const StringView&) set_frame_shadow(Gfx::FrameShadow::Plain); set_frame_shape(Gfx::FrameShape::NoFrame); set_auto_resize(true); + + REGISTER_BOOL_PROPERTY("auto_resize", auto_resize, set_auto_resize); + REGISTER_BOOL_PROPERTY("should_stretch", should_stretch, set_should_stretch); } ImageWidget::~ImageWidget() diff --git a/Libraries/LibGUI/ProgressBar.cpp b/Libraries/LibGUI/ProgressBar.cpp index f09f262248..227016c00c 100644 --- a/Libraries/LibGUI/ProgressBar.cpp +++ b/Libraries/LibGUI/ProgressBar.cpp @@ -35,6 +35,12 @@ namespace GUI { ProgressBar::ProgressBar() { REGISTER_STRING_PROPERTY("text", text, set_text); + REGISTER_ENUM_PROPERTY("format", format, set_format, Format, + { Format::NoText, "NoText" }, + { Format::Percentage, "Percentage" }, + { Format::ValueSlashMax, "ValueSlashMax" }); + REGISTER_INT_PROPERTY("min", min, set_min); + REGISTER_INT_PROPERTY("max", max, set_max); } ProgressBar::~ProgressBar() diff --git a/Libraries/LibGUI/ScrollBar.cpp b/Libraries/LibGUI/ScrollBar.cpp index ab7198e1bc..7af1d8c35c 100644 --- a/Libraries/LibGUI/ScrollBar.cpp +++ b/Libraries/LibGUI/ScrollBar.cpp @@ -109,6 +109,11 @@ ScrollBar::ScrollBar(Orientation orientation) m_automatic_scrolling_timer->on_timeout = [this] { on_automatic_scrolling_timer_fired(); }; + + REGISTER_INT_PROPERTY("min", min, set_min); + REGISTER_INT_PROPERTY("max", max, set_max); + REGISTER_INT_PROPERTY("step", step, set_step); + REGISTER_INT_PROPERTY("big_step", big_step, set_big_step); } ScrollBar::~ScrollBar() diff --git a/Libraries/LibGUI/Slider.cpp b/Libraries/LibGUI/Slider.cpp index bd85a0b05a..3585f33c3e 100644 --- a/Libraries/LibGUI/Slider.cpp +++ b/Libraries/LibGUI/Slider.cpp @@ -36,12 +36,30 @@ namespace GUI { Slider::Slider(Orientation orientation) : m_orientation(orientation) { + + REGISTER_INT_PROPERTY("min", min, set_min); + REGISTER_INT_PROPERTY("max", max, set_max); + REGISTER_INT_PROPERTY("step", step, set_step); + REGISTER_ENUM_PROPERTY("knob_size_mode", knob_size_mode, set_knob_size_mode, KnobSizeMode, + { KnobSizeMode::Fixed, "Fixed" }, + { KnobSizeMode::Proportional, "Proportional" }); + REGISTER_ENUM_PROPERTY("orientation", this->orientation, set_orientation, Orientation, + { Orientation::Horizontal, "Horizontal" }, + { Orientation::Vertical, "Vertical" }); } Slider::~Slider() { } +void Slider::set_orientation(Orientation value) +{ + if (m_orientation == value) + return; + m_orientation = value; + update(); +} + void Slider::set_range(int min, int max) { ASSERT(min <= max); diff --git a/Libraries/LibGUI/Slider.h b/Libraries/LibGUI/Slider.h index 6f7eee122b..18bc008ed9 100644 --- a/Libraries/LibGUI/Slider.h +++ b/Libraries/LibGUI/Slider.h @@ -40,6 +40,7 @@ public: virtual ~Slider() override; + void set_orientation(Orientation value); Orientation orientation() const { return m_orientation; } int value() const { return m_value; } diff --git a/Libraries/LibGUI/SpinBox.cpp b/Libraries/LibGUI/SpinBox.cpp index a8349bf2a2..9c608df3ad 100644 --- a/Libraries/LibGUI/SpinBox.cpp +++ b/Libraries/LibGUI/SpinBox.cpp @@ -58,6 +58,9 @@ SpinBox::SpinBox() m_decrement_button->set_focus_policy(GUI::FocusPolicy::NoFocus); m_decrement_button->on_click = [this](auto) { set_value(m_value - 1); }; m_decrement_button->set_auto_repeat_interval(150); + + REGISTER_INT_PROPERTY("min", min, set_min); + REGISTER_INT_PROPERTY("max", max, set_max); } SpinBox::~SpinBox() diff --git a/Libraries/LibGUI/StatusBar.cpp b/Libraries/LibGUI/StatusBar.cpp index 2cf538ee61..61484b0fc3 100644 --- a/Libraries/LibGUI/StatusBar.cpp +++ b/Libraries/LibGUI/StatusBar.cpp @@ -49,6 +49,8 @@ StatusBar::StatusBar(int label_count) m_labels.append(create_label()); m_corner = add(); + + REGISTER_STRING_PROPERTY("text", text, set_text); } StatusBar::~StatusBar()