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

LibGUI: Convert GStatusBar to ObjectPtr

This commit is contained in:
Andreas Kling 2019-09-21 16:29:47 +02:00
parent f4531c976c
commit 3476a63415
5 changed files with 12 additions and 8 deletions

View file

@ -108,12 +108,12 @@ TextEditorWidget::TextEditorWidget()
m_editor->add_custom_context_menu_action(*m_find_next_action);
m_editor->add_custom_context_menu_action(*m_find_previous_action);
auto* statusbar = new GStatusBar(this);
m_statusbar = GStatusBar::construct(this);
m_editor->on_cursor_change = [statusbar, this] {
m_editor->on_cursor_change = [this] {
StringBuilder builder;
builder.appendf("Line: %d, Column: %d", m_editor->cursor().line() + 1, m_editor->cursor().column());
statusbar->set_text(builder.to_string());
m_statusbar->set_text(builder.to_string());
};
m_new_action = GAction::create("New", { Mod_Ctrl, Key_N }, GraphicsBitmap::load_from_file("/res/icons/16x16/new.png"), [this](const GAction&) {

View file

@ -10,6 +10,7 @@
class GButton;
class GTextBox;
class GTextEditor;
class GStatusBar;
class TextEditorWidget final : public GWidget {
public:
@ -35,6 +36,8 @@ private:
RefPtr<GAction> m_find_next_action;
RefPtr<GAction> m_find_previous_action;
ObjectPtr<GStatusBar> m_statusbar;
ObjectPtr<GTextBox> m_find_textbox;
GButton* m_find_previous_button { nullptr };
GButton* m_find_next_button { nullptr };