mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
VisualBuilder: Add GScrollBar (and yes, an icon for it, too.)
This commit is contained in:
parent
f25c524f20
commit
3f67298dad
Notes:
sideshowbarker
2024-07-19 14:45:31 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3f67298dad8
4 changed files with 11 additions and 0 deletions
|
@ -7,12 +7,15 @@
|
|||
#include <LibGUI/GTextEditor.h>
|
||||
#include <LibGUI/GProgressBar.h>
|
||||
#include <LibGUI/GCheckBox.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
|
||||
static GWidget* build_gwidget(WidgetType type, GWidget* parent)
|
||||
{
|
||||
switch (type) {
|
||||
case WidgetType::GWidget:
|
||||
return new GWidget(parent);
|
||||
case WidgetType::GScrollBar:
|
||||
return new GScrollBar(Orientation::Vertical, parent);
|
||||
case WidgetType::GLabel: {
|
||||
auto* label = new GLabel(parent);
|
||||
label->set_text("label_1");
|
||||
|
|
|
@ -32,6 +32,7 @@ enum class WidgetType {
|
|||
GTextEditor,
|
||||
GProgressBar,
|
||||
GCheckBox,
|
||||
GScrollBar,
|
||||
};
|
||||
|
||||
class VBWidget : public Retainable<VBWidget>, public Weakable<VBWidget> {
|
||||
|
|
|
@ -109,5 +109,12 @@ GWindow* make_toolbox_window()
|
|||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(WidgetType::GCheckBox);
|
||||
};
|
||||
auto* scrollbar_button = new GButton(widget);
|
||||
scrollbar_button->set_tooltip("GScrollBar");
|
||||
scrollbar_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/scrollbar.png"));
|
||||
scrollbar_button->on_click = [] (GButton&) {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(WidgetType::GScrollBar);
|
||||
};
|
||||
return window;
|
||||
}
|
||||
|
|
BIN
Base/res/icons/vbwidgets/scrollbar.png
Normal file
BIN
Base/res/icons/vbwidgets/scrollbar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 239 B |
Loading…
Reference in a new issue