1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

LibDraw: Put all classes in the Gfx namespace

I started adding things to a Draw namespace, but it somehow felt really
wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename
the library to LibGfx. :^)
This commit is contained in:
Andreas Kling 2020-02-06 11:56:38 +01:00
parent 939a605334
commit 11580babbf
269 changed files with 1513 additions and 1315 deletions

View file

@ -150,7 +150,7 @@ void CursorTool::on_keydown(GUI::KeyEvent& event)
}
}
void CursorTool::set_rubber_band_position(const Point& position)
void CursorTool::set_rubber_band_position(const Gfx::Point& position)
{
if (m_rubber_band_position == position)
return;

View file

@ -50,14 +50,14 @@ private:
virtual void on_keydown(GUI::KeyEvent&) override;
virtual void on_second_paint(GUI::Painter&, GUI::PaintEvent&) override;
void set_rubber_band_position(const Point&);
Rect rubber_band_rect() const;
void set_rubber_band_position(const Gfx::Point&);
Gfx::Rect rubber_band_rect() const;
Point m_drag_origin;
Gfx::Point m_drag_origin;
HashMap<GUI::Widget*, Point> m_positions_before_drag;
bool m_dragging { false };
bool m_rubber_banding { false };
Point m_rubber_band_origin;
Point m_rubber_band_position;
Gfx::Point m_rubber_band_origin;
Gfx::Point m_rubber_band_position;
};

View file

@ -114,7 +114,7 @@ static HashMap<String, String>& man_paths()
return paths;
}
void Editor::show_documentation_tooltip_if_available(const String& hovered_token, const Point& screen_location)
void Editor::show_documentation_tooltip_if_available(const String& hovered_token, const Gfx::Point& screen_location)
{
auto it = man_paths().find(hovered_token);
if (it == man_paths().end()) {

View file

@ -50,7 +50,7 @@ private:
virtual void mousemove_event(GUI::MouseEvent&) override;
virtual void cursor_did_change() override;
void show_documentation_tooltip_if_available(const String&, const Point& screen_location);
void show_documentation_tooltip_if_available(const String&, const Gfx::Point& screen_location);
void highlight_matching_token_pair();
explicit Editor(GUI::Widget* parent);

View file

@ -46,12 +46,12 @@ EditorWrapper::EditorWrapper(GUI::Widget* parent)
label_wrapper->layout()->set_margins({ 2, 0, 2, 0 });
m_filename_label = GUI::Label::construct("(Untitled)", label_wrapper);
m_filename_label->set_text_alignment(TextAlignment::CenterLeft);
m_filename_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
m_filename_label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
m_filename_label->set_preferred_size(0, 14);
m_cursor_label = GUI::Label::construct("(Cursor)", label_wrapper);
m_cursor_label->set_text_alignment(TextAlignment::CenterRight);
m_cursor_label->set_text_alignment(Gfx::TextAlignment::CenterRight);
m_cursor_label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
m_cursor_label->set_preferred_size(0, 14);
@ -75,5 +75,5 @@ EditorWrapper::~EditorWrapper()
void EditorWrapper::set_editor_has_focus(Badge<Editor>, bool focus)
{
m_filename_label->set_font(focus ? Font::default_bold_font() : Font::default_font());
m_filename_label->set_font(focus ? Gfx::Font::default_bold_font() : Gfx::Font::default_font());
}

View file

@ -92,7 +92,7 @@ public:
virtual ColumnMetadata column_metadata(int column) const override
{
if (column == Column::MatchedText) {
return { 0, TextAlignment::CenterLeft, &Font::default_fixed_width_font() };
return { 0, Gfx::TextAlignment::CenterLeft, &Gfx::Font::default_fixed_width_font() };
}
return {};
}

View file

@ -37,8 +37,8 @@ FormEditorWidget::FormEditorWidget(GUI::Widget* parent)
set_fill_with_background_color(true);
set_background_color(Color::MidGray);
set_frame_shape(FrameShape::Container);
set_frame_shadow(FrameShadow::Sunken);
set_frame_shape(Gfx::FrameShape::Container);
set_frame_shadow(Gfx::FrameShadow::Sunken);
set_frame_thickness(2);
m_form_widget = FormWidget::construct(*this);

View file

@ -33,9 +33,9 @@
extern RefPtr<Project> g_project;
extern void open_file(const String&);
static RefPtr<GraphicsBitmap> s_file_icon;
static RefPtr<GraphicsBitmap> s_cplusplus_icon;
static RefPtr<GraphicsBitmap> s_header_icon;
static RefPtr<Gfx::Bitmap> s_file_icon;
static RefPtr<Gfx::Bitmap> s_cplusplus_icon;
static RefPtr<Gfx::Bitmap> s_header_icon;
class LocatorSuggestionModel final : public GUI::Model {
public:
@ -102,9 +102,9 @@ Locator::Locator(GUI::Widget* parent)
: GUI::Widget(parent)
{
if (!s_cplusplus_icon) {
s_file_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-unknown.png");
s_cplusplus_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png");
s_header_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-header.png");
s_file_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png");
s_cplusplus_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png");
s_header_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-header.png");
}
set_layout(make<GUI::VBoxLayout>());

View file

@ -41,20 +41,20 @@ ProcessStateWidget::ProcessStateWidget(GUI::Widget* parent)
set_layout(make<GUI::HBoxLayout>());
auto pid_label_label = GUI::Label::construct("Process:", this);
pid_label_label->set_font(Font::default_bold_font());
pid_label_label->set_font(Gfx::Font::default_bold_font());
m_pid_label = GUI::Label::construct("", this);
auto state_label_label = GUI::Label::construct("State:", this);
state_label_label->set_font(Font::default_bold_font());
state_label_label->set_font(Gfx::Font::default_bold_font());
m_state_label = GUI::Label::construct("", this);
// FIXME: This should show CPU% instead.
auto cpu_label_label = GUI::Label::construct("Times scheduled:", this);
cpu_label_label->set_font(Font::default_bold_font());
cpu_label_label->set_font(Gfx::Font::default_bold_font());
m_cpu_label = GUI::Label::construct("", this);
auto memory_label_label = GUI::Label::construct("Memory (resident):", this);
memory_label_label->set_font(Font::default_bold_font());
memory_label_label->set_font(Gfx::Font::default_bold_font());
m_memory_label = GUI::Label::construct("", this);
m_timer = Core::Timer::construct(500, [this] {

View file

@ -117,7 +117,7 @@ public:
if (role == Role::Font) {
extern String g_currently_open_file;
if (node->name == g_currently_open_file)
return Font::default_bold_font();
return Gfx::Font::default_bold_font();
return {};
}
return {};
@ -169,11 +169,11 @@ Project::Project(const String& path, Vector<String>&& filenames)
{
m_name = FileSystemPath(m_path).basename();
m_file_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"));
m_cplusplus_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png"));
m_header_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-header.png"));
m_directory_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-folder.png"));
m_project_icon = GIcon(GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"));
m_file_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-unknown.png"));
m_cplusplus_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-cplusplus.png"));
m_header_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-header.png"));
m_directory_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/filetype-folder.png"));
m_project_icon = GIcon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png"));
for (auto& filename : filenames) {
m_files.append(ProjectFile::construct_with_name(filename));

View file

@ -32,7 +32,7 @@
WidgetTreeModel::WidgetTreeModel(GUI::Widget& root)
: m_root(root)
{
m_widget_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
m_widget_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
}
WidgetTreeModel::~WidgetTreeModel()

View file

@ -175,7 +175,7 @@ int main(int argc, char** argv)
return files;
};
auto new_action = GUI::Action::create("Add new file to project...", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GUI::Action&) {
auto new_action = GUI::Action::create("Add new file to project...", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"), [&](const GUI::Action&) {
auto input_box = GUI::InputBox::construct("Enter name of new file:", "Add new file to project", g_window);
if (input_box->exec() == GUI::InputBox::ExecCancel)
return;
@ -193,7 +193,7 @@ int main(int argc, char** argv)
open_file(filename);
});
auto add_existing_file_action = GUI::Action::create("Add existing file to project...", GraphicsBitmap::load_from_file("/res/icons/16x16/open.png"), [&](auto&) {
auto add_existing_file_action = GUI::Action::create("Add existing file to project...", Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"), [&](auto&) {
auto result = GUI::FilePicker::get_open_filepath("Add existing file to project");
if (!result.has_value())
return;
@ -273,7 +273,7 @@ int main(int argc, char** argv)
GUI::ActionGroup tool_actions;
tool_actions.set_exclusive(true);
auto cursor_tool_action = GUI::Action::create("Cursor", GraphicsBitmap::load_from_file("/res/icons/widgets/Cursor.png"), [&](auto&) {
auto cursor_tool_action = GUI::Action::create("Cursor", Gfx::Bitmap::load_from_file("/res/icons/widgets/Cursor.png"), [&](auto&) {
g_form_editor_widget->set_tool(make<CursorTool>(*g_form_editor_widget));
});
cursor_tool_action->set_checkable(true);
@ -284,7 +284,7 @@ int main(int argc, char** argv)
GUI::WidgetClassRegistration::for_each([&](const GUI::WidgetClassRegistration& reg) {
auto icon_path = String::format("/res/icons/widgets/%s.png", reg.class_name().characters());
auto action = GUI::Action::create(reg.class_name(), GraphicsBitmap::load_from_file(icon_path), [&reg](auto&) {
auto action = GUI::Action::create(reg.class_name(), Gfx::Bitmap::load_from_file(icon_path), [&reg](auto&) {
g_form_editor_widget->set_tool(make<WidgetTool>(*g_form_editor_widget, reg));
auto widget = reg.construct(&g_form_editor_widget->form_widget());
widget->set_relative_rect(30, 30, 30, 30);
@ -310,8 +310,8 @@ int main(int argc, char** argv)
wrapper->set_layout(make<GUI::VBoxLayout>());
auto label = GUI::Label::construct(text, wrapper);
label->set_fill_with_background_color(true);
label->set_text_alignment(TextAlignment::CenterLeft);
label->set_font(Font::default_bold_font());
label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
label->set_font(Gfx::Font::default_bold_font());
label->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
label->set_preferred_size(0, 16);
wrapper->add_child(pane_widget);
@ -395,7 +395,7 @@ int main(int argc, char** argv)
update_actions();
});
auto save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, GraphicsBitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) {
auto save_action = GUI::Action::create("Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"), [&](auto&) {
if (g_currently_open_file.is_empty())
return;
current_editor().write_to_file(g_currently_open_file);
@ -476,7 +476,7 @@ int main(int argc, char** argv)
}));
menubar->add_menu(move(edit_menu));
auto stop_action = GUI::Action::create("Stop", GraphicsBitmap::load_from_file("/res/icons/16x16/stop.png"), [&](auto&) {
auto stop_action = GUI::Action::create("Stop", Gfx::Bitmap::load_from_file("/res/icons/16x16/stop.png"), [&](auto&) {
terminal_wrapper->kill_running_command();
});
@ -485,14 +485,14 @@ int main(int argc, char** argv)
stop_action->set_enabled(false);
};
auto build_action = GUI::Action::create("Build", { Mod_Ctrl, Key_B }, GraphicsBitmap::load_from_file("/res/icons/16x16/build.png"), [&](auto&) {
auto build_action = GUI::Action::create("Build", { Mod_Ctrl, Key_B }, Gfx::Bitmap::load_from_file("/res/icons/16x16/build.png"), [&](auto&) {
reveal_action_tab(terminal_wrapper);
build(terminal_wrapper);
stop_action->set_enabled(true);
});
toolbar->add_action(build_action);
auto run_action = GUI::Action::create("Run", { Mod_Ctrl, Key_R }, GraphicsBitmap::load_from_file("/res/icons/16x16/play.png"), [&](auto&) {
auto run_action = GUI::Action::create("Run", { Mod_Ctrl, Key_R }, Gfx::Bitmap::load_from_file("/res/icons/16x16/play.png"), [&](auto&) {
reveal_action_tab(terminal_wrapper);
run(terminal_wrapper);
stop_action->set_enabled(true);
@ -514,7 +514,7 @@ int main(int argc, char** argv)
view_menu->add_action(remove_current_editor_action);
menubar->add_menu(move(view_menu));
auto small_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/app-hack-studio.png");
auto small_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hack-studio.png");
auto help_menu = GUI::Menu::construct("Help");
help_menu->add_action(GUI::Action::create("About", [&](auto&) {
@ -550,16 +550,16 @@ void run(TerminalWrapper& wrapper)
struct TextStyle {
Color color;
const Font* font { nullptr };
const Gfx::Font* font { nullptr };
};
static TextStyle style_for_token_type(CppToken::Type type)
{
switch (type) {
case CppToken::Type::Keyword:
return { Color::Black, &Font::default_bold_fixed_width_font() };
return { Color::Black, &Gfx::Font::default_bold_fixed_width_font() };
case CppToken::Type::KnownType:
return { Color::from_rgb(0x929200), &Font::default_bold_fixed_width_font() };
return { Color::from_rgb(0x929200), &Gfx::Font::default_bold_fixed_width_font() };
case CppToken::Type::Identifier:
return { Color::from_rgb(0x000092) };
case CppToken::Type::DoubleQuotedString:

View file

@ -327,7 +327,7 @@ int main(int argc, char** argv)
} else if (parameter.type == "Color") {
dbg() << " u32 " << parameter.name << "_rgba = 0;";
dbg() << " stream >> " << parameter.name << "_rgba;";
dbg() << " " << parameter.name << " = Color::from_rgba(" << parameter.name << "_rgba);";
dbg() << " " << parameter.name << " = Gfx::Color::from_rgba(" << parameter.name << "_rgba);";
} else if (parameter.type == "Size") {
dbg() << " int " << parameter.name << "_width = 0;";
dbg() << " stream >> " << parameter.name << "_width;";

View file

@ -36,8 +36,8 @@
RemoteObjectGraphModel::RemoteObjectGraphModel(RemoteProcess& process)
: m_process(process)
{
m_object_icon.set_bitmap_for_size(16, load_png("/res/icons/16x16/inspector-object.png"));
m_window_icon.set_bitmap_for_size(16, load_png("/res/icons/16x16/window.png"));
m_object_icon.set_bitmap_for_size(16, Gfx::load_png("/res/icons/16x16/inspector-object.png"));
m_window_icon.set_bitmap_for_size(16, Gfx::load_png("/res/icons/16x16/window.png"));
}
RemoteObjectGraphModel::~RemoteObjectGraphModel()

View file

@ -33,8 +33,8 @@
ProfileModel::ProfileModel(Profile& profile)
: m_profile(profile)
{
m_user_frame_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
m_kernel_frame_icon.set_bitmap_for_size(16, GraphicsBitmap::load_from_file("/res/icons/16x16/inspector-object-red.png"));
m_user_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object.png"));
m_kernel_frame_icon.set_bitmap_for_size(16, Gfx::Bitmap::load_from_file("/res/icons/16x16/inspector-object-red.png"));
}
ProfileModel::~ProfileModel()
@ -109,7 +109,7 @@ String ProfileModel::column_name(int column) const
GUI::Model::ColumnMetadata ProfileModel::column_metadata(int column) const
{
if (column == Column::SampleCount)
return ColumnMetadata { 0, TextAlignment::CenterRight };
return ColumnMetadata { 0, Gfx::TextAlignment::CenterRight };
return {};
}

View file

@ -33,8 +33,8 @@ ProfileTimelineWidget::ProfileTimelineWidget(Profile& profile, GUI::Widget* pare
, m_profile(profile)
{
set_frame_thickness(2);
set_frame_shadow(FrameShadow::Sunken);
set_frame_shape(FrameShape::Container);
set_frame_shadow(Gfx::FrameShadow::Sunken);
set_frame_shape(Gfx::FrameShape::Container);
set_background_color(Color::White);
set_fill_with_background_color(true);
set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);

View file

@ -63,13 +63,13 @@ VBForm::VBForm(const String& name, GUI::Widget* parent)
widget->gwidget()->move_to_back();
}));
m_context_menu->add_separator();
m_context_menu->add_action(GUI::Action::create("Lay out horizontally", load_png("/res/icons/16x16/layout-horizontally.png"), [this](auto&) {
m_context_menu->add_action(GUI::Action::create("Lay out horizontally", Gfx::load_png("/res/icons/16x16/layout-horizontally.png"), [this](auto&) {
if (auto* widget = single_selected_widget()) {
dbg() << "Giving " << *widget->gwidget() << " a horizontal box layout";
widget->gwidget()->set_layout(make<GUI::HBoxLayout>());
}
}));
m_context_menu->add_action(GUI::Action::create("Lay out vertically", load_png("/res/icons/16x16/layout-vertically.png"), [this](auto&) {
m_context_menu->add_action(GUI::Action::create("Lay out vertically", Gfx::load_png("/res/icons/16x16/layout-vertically.png"), [this](auto&) {
if (auto* widget = single_selected_widget()) {
dbg() << "Giving " << *widget->gwidget() << " a vertical box layout";
widget->gwidget()->set_layout(make<GUI::VBoxLayout>());
@ -138,7 +138,7 @@ bool VBForm::is_selected(const VBWidget& widget) const
return m_selected_widgets.contains(const_cast<VBWidget*>(&widget));
}
VBWidget* VBForm::widget_at(const Point& position)
VBWidget* VBForm::widget_at(const Gfx::Point& position)
{
auto result = hit_test(position, GUI::Widget::ShouldRespectGreediness::No);
if (!result.widget)

View file

@ -43,7 +43,7 @@ public:
void set_name(const String& name) { m_name = name; }
bool is_selected(const VBWidget&) const;
VBWidget* widget_at(const Point&);
VBWidget* widget_at(const Gfx::Point&);
void set_should_snap_to_grip(bool snap) { m_should_snap_to_grid = snap; }
bool should_snap_to_grid() const { return m_should_snap_to_grid; }
@ -83,8 +83,8 @@ private:
NonnullRefPtrVector<VBWidget> m_widgets;
HashMap<GUI::Widget*, VBWidget*> m_gwidget_map;
HashTable<VBWidget*> m_selected_widgets;
Point m_transform_event_origin;
Point m_next_insertion_position;
Gfx::Point m_transform_event_origin;
Gfx::Point m_next_insertion_position;
Direction m_resize_direction { Direction::None };
Direction m_mouse_direction_type { Direction::None };
RefPtr<GUI::Menu> m_context_menu;

View file

@ -64,7 +64,7 @@ Rect VBWidget::rect() const
return m_gwidget->window_relative_rect();
}
void VBWidget::set_rect(const Rect& rect)
void VBWidget::set_rect(const Gfx::Rect& rect)
{
if (rect == m_gwidget->window_relative_rect())
return;
@ -106,7 +106,7 @@ Rect VBWidget::grabber_rect(Direction direction) const
}
}
Direction VBWidget::grabber_at(const Point& position) const
Direction VBWidget::grabber_at(const Gfx::Point& position) const
{
Direction found_grabber = Direction::None;
for_each_direction([&](Direction direction) {

View file

@ -80,10 +80,10 @@ public:
bool is_selected() const;
Rect rect() const;
void set_rect(const Rect&);
void set_rect(const Gfx::Rect&);
Rect grabber_rect(Direction) const;
Direction grabber_at(const Point&) const;
Direction grabber_at(const Gfx::Point&) const;
GUI::Widget* gwidget() { return m_gwidget; }
@ -113,5 +113,5 @@ private:
RefPtr<GUI::Widget> m_gwidget;
NonnullOwnPtrVector<VBProperty> m_properties;
NonnullRefPtr<VBWidgetPropertyModel> m_property_model;
Rect m_transform_origin_rect;
Gfx::Rect m_transform_origin_rect;
};

View file

@ -61,8 +61,8 @@ GUI::Model::ColumnMetadata VBWidgetPropertyModel::column_metadata(int column) co
{
UNUSED_PARAM(column);
if (column == Column::Name)
return { 110, TextAlignment::CenterLeft, &Font::default_bold_font() };
return { 90, TextAlignment::CenterLeft };
return { 110, Gfx::TextAlignment::CenterLeft, &Gfx::Font::default_bold_font() };
return { 90, Gfx::TextAlignment::CenterLeft };
}
GUI::Variant VBWidgetPropertyModel::data(const GUI::ModelIndex& index, Role role) const

View file

@ -82,7 +82,7 @@ int main(int argc, char** argv)
auto help_menu = GUI::Menu::construct("Help");
help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) {
GUI::AboutDialog::show("Visual Builder", load_png("/res/icons/32x32/app-visual-builder.png"), window);
GUI::AboutDialog::show("Visual Builder", Gfx::load_png("/res/icons/32x32/app-visual-builder.png"), window);
}));
menubar->add_menu(move(help_menu));
@ -113,82 +113,82 @@ RefPtr<GUI::Window> make_toolbox_window()
window->set_main_widget(widget);
auto label_button = GUI::Button::construct(widget);
label_button->set_button_style(ButtonStyle::CoolBar);
label_button->set_button_style(Gfx::ButtonStyle::CoolBar);
label_button->set_tooltip("GLabel");
label_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/label.png"));
label_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/label.png"));
label_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GLabel);
};
auto button_button = GUI::Button::construct(widget);
button_button->set_button_style(ButtonStyle::CoolBar);
button_button->set_button_style(Gfx::ButtonStyle::CoolBar);
button_button->set_tooltip("GButton");
button_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/button.png"));
button_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/button.png"));
button_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GButton);
};
auto spinbox_button = GUI::Button::construct(widget);
spinbox_button->set_button_style(ButtonStyle::CoolBar);
spinbox_button->set_button_style(Gfx::ButtonStyle::CoolBar);
spinbox_button->set_tooltip("GSpinBox");
spinbox_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/spinbox.png"));
spinbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/spinbox.png"));
spinbox_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GSpinBox);
};
auto editor_button = GUI::Button::construct(widget);
editor_button->set_button_style(ButtonStyle::CoolBar);
editor_button->set_button_style(Gfx::ButtonStyle::CoolBar);
editor_button->set_tooltip("GTextEditor");
editor_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/textbox.png"));
editor_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/textbox.png"));
editor_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GTextEditor);
};
auto progress_bar_button = GUI::Button::construct(widget);
progress_bar_button->set_button_style(ButtonStyle::CoolBar);
progress_bar_button->set_button_style(Gfx::ButtonStyle::CoolBar);
progress_bar_button->set_tooltip("GProgressBar");
progress_bar_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/progressbar.png"));
progress_bar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/progressbar.png"));
progress_bar_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GProgressBar);
};
auto slider_button = GUI::Button::construct(widget);
slider_button->set_button_style(ButtonStyle::CoolBar);
slider_button->set_button_style(Gfx::ButtonStyle::CoolBar);
slider_button->set_tooltip("GSlider");
slider_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/slider.png"));
slider_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/slider.png"));
slider_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GSlider);
};
auto checkbox_button = GUI::Button::construct(widget);
checkbox_button->set_button_style(ButtonStyle::CoolBar);
checkbox_button->set_button_style(Gfx::ButtonStyle::CoolBar);
checkbox_button->set_tooltip("GCheckBox");
checkbox_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/checkbox.png"));
checkbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/checkbox.png"));
checkbox_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GCheckBox);
};
auto radiobutton_button = GUI::Button::construct(widget);
radiobutton_button->set_button_style(ButtonStyle::CoolBar);
radiobutton_button->set_button_style(Gfx::ButtonStyle::CoolBar);
radiobutton_button->set_tooltip("GRadioButton");
radiobutton_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/filled-radio-circle.png"));
radiobutton_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/filled-radio-circle.png"));
radiobutton_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GRadioButton);
};
auto scrollbar_button = GUI::Button::construct(widget);
scrollbar_button->set_button_style(ButtonStyle::CoolBar);
scrollbar_button->set_button_style(Gfx::ButtonStyle::CoolBar);
scrollbar_button->set_tooltip("GScrollBar");
scrollbar_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png"));
scrollbar_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png"));
scrollbar_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GScrollBar);
};
auto groupbox_button = GUI::Button::construct(widget);
groupbox_button->set_button_style(ButtonStyle::CoolBar);
groupbox_button->set_button_style(Gfx::ButtonStyle::CoolBar);
groupbox_button->set_tooltip("GGroupBox");
groupbox_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/groupbox.png"));
groupbox_button->set_icon(Gfx::Bitmap::load_from_file("/res/icons/vbwidgets/groupbox.png"));
groupbox_button->on_click = [](GUI::Button&) {
if (auto* form = VBForm::current())
form->insert_widget(VBWidgetType::GGroupBox);