diff --git a/Applications/VisualBuilder/VBForm.cpp b/Applications/VisualBuilder/VBForm.cpp index a0f6e3946f5..380a27b8629 100644 --- a/Applications/VisualBuilder/VBForm.cpp +++ b/Applications/VisualBuilder/VBForm.cpp @@ -11,15 +11,15 @@ VBForm::VBForm(const String& name, GWidget* parent) set_greedy_for_hits(true); auto box1 = VBWidget::create(WidgetType::GSpinBox, *this); - box1->set_rect({ 10, 10, 61, 21 }); + box1->set_rect({ 10, 10, 81, 25 }); m_widgets.append(move(box1)); auto box2 = VBWidget::create(WidgetType::GTextEditor, *this); - box2->set_rect({ 100, 100, 161, 141 }); + box2->set_rect({ 100, 100, 161, 161 }); m_widgets.append(move(box2)); auto button1 = VBWidget::create(WidgetType::GButton, *this); - button1->set_rect({ 200, 50, 101, 21 }); + button1->set_rect({ 200, 50, 81, 25 }); m_widgets.append(move(button1)); } diff --git a/Applications/VisualBuilder/VBForm.h b/Applications/VisualBuilder/VBForm.h index b570425663f..7f30e8fee67 100644 --- a/Applications/VisualBuilder/VBForm.h +++ b/Applications/VisualBuilder/VBForm.h @@ -29,7 +29,7 @@ private: void grabber_mousedown_event(GMouseEvent&, VBWidget&, Direction grabber); String m_name; - int m_grid_size { 5 }; + int m_grid_size { 8 }; bool m_should_snap_to_grid { true }; Vector> m_widgets; WeakPtr m_selected_widget; diff --git a/Applications/VisualBuilder/VBWidget.cpp b/Applications/VisualBuilder/VBWidget.cpp index 40c1653e8e0..2c1040b4c1c 100644 --- a/Applications/VisualBuilder/VBWidget.cpp +++ b/Applications/VisualBuilder/VBWidget.cpp @@ -17,8 +17,11 @@ static GWidget* build_gwidget(WidgetType type, GWidget* parent) return new GButton(parent); case WidgetType::GSpinBox: return new GSpinBox(parent); - case WidgetType::GTextEditor: - return new GTextEditor(GTextEditor::Type::MultiLine, parent); + case WidgetType::GTextEditor: { + auto* editor = new GTextEditor(GTextEditor::Type::MultiLine, parent); + editor->set_ruler_visible(false); + return editor; + } default: ASSERT_NOT_REACHED(); return nullptr; diff --git a/Applications/VisualBuilder/main.cpp b/Applications/VisualBuilder/main.cpp index f575b942c41..9ec5c2a579f 100644 --- a/Applications/VisualBuilder/main.cpp +++ b/Applications/VisualBuilder/main.cpp @@ -17,6 +17,8 @@ #include #include +static GWindow* make_toolbox_window(); + int main(int argc, char** argv) { GApplication app(argc, argv); @@ -47,10 +49,25 @@ int main(int argc, char** argv) auto* window = new GWindow; window->set_title(form1->name()); - window->set_rect(20, 200, 640, 400); + window->set_rect(120, 200, 640, 400); window->set_main_widget(form1); window->set_should_exit_event_loop_on_close(true); window->show(); + auto* toolbox = make_toolbox_window(); + toolbox->show(); + return app.exec(); } + +GWindow* make_toolbox_window() +{ + auto* window = new GWindow; + window->set_title("Widgets"); + window->set_rect(20, 200, 80, 300); + + auto* widget = new GWidget; + widget->set_fill_with_background_color(true); + window->set_main_widget(widget); + return window; +} diff --git a/LibGUI/GTextEditor.h b/LibGUI/GTextEditor.h index 3e964a5522f..3af851c6746 100644 --- a/LibGUI/GTextEditor.h +++ b/LibGUI/GTextEditor.h @@ -71,6 +71,9 @@ public: bool is_single_line() const { return m_type == SingleLine; } bool is_multi_line() const { return m_type == MultiLine; } + bool is_ruler_visible() const { return m_ruler_visible; } + void set_ruler_visible(bool b) { m_ruler_visible = b; } + Function on_cursor_change; void set_text(const String&);