mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:47:34 +00:00
LibGUI: Convert GTextBox, GTextEditor and GResizeCorner to ObjectPtr
This commit is contained in:
parent
4ea229accd
commit
93851c3832
25 changed files with 38 additions and 36 deletions
|
@ -9,7 +9,7 @@ CalculatorWidget::CalculatorWidget(GWidget* parent)
|
|||
{
|
||||
set_fill_with_background_color(true);
|
||||
|
||||
m_entry = new GTextBox(this);
|
||||
m_entry = GTextBox::construct(this);
|
||||
m_entry->set_relative_rect(5, 5, 244, 26);
|
||||
m_entry->set_text_alignment(TextAlignment::CenterRight);
|
||||
|
||||
|
|
|
@ -25,6 +25,6 @@ private:
|
|||
Calculator m_calculator;
|
||||
Keypad m_keypad;
|
||||
|
||||
GTextBox* m_entry { nullptr };
|
||||
ObjectPtr<GTextBox> m_entry;
|
||||
ObjectPtr<GLabel> m_label;
|
||||
};
|
||||
|
|
|
@ -56,7 +56,7 @@ int main(int argc, char** argv)
|
|||
auto location_label = GLabel::construct("Location: ", location_toolbar);
|
||||
location_label->size_to_fit();
|
||||
|
||||
auto* location_textbox = new GTextEditor(GTextEditor::SingleLine, location_toolbar);
|
||||
auto location_textbox = GTextEditor::construct(GTextEditor::SingleLine, location_toolbar);
|
||||
|
||||
auto* splitter = new GSplitter(Orientation::Horizontal, widget);
|
||||
auto* tree_view = new GTreeView(splitter);
|
||||
|
@ -312,7 +312,7 @@ int main(int argc, char** argv)
|
|||
main_toolbar->add_action(*view_as_icons_action);
|
||||
main_toolbar->add_action(*view_as_table_action);
|
||||
|
||||
directory_view->on_path_change = [window, location_textbox, &file_system_model, tree_view, &go_forward_action, &go_back_action, directory_view](const String& new_path) {
|
||||
directory_view->on_path_change = [&](const String& new_path) {
|
||||
window->set_title(String::format("File Manager: %s", new_path.characters()));
|
||||
location_textbox->set_text(new_path);
|
||||
auto new_index = file_system_model->index(new_path);
|
||||
|
|
|
@ -41,7 +41,7 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
|
|||
member_view->set_activates_on_selection(true);
|
||||
}
|
||||
|
||||
m_text_editor = new GTextEditor(GTextEditor::SingleLine, this);
|
||||
m_text_editor = GTextEditor::construct(GTextEditor::SingleLine, this);
|
||||
m_text_editor->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_text_editor->set_preferred_size(0, 19);
|
||||
m_text_editor->on_return_pressed = [this] {
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
Type m_type;
|
||||
String m_name;
|
||||
GTableView* m_table_view { nullptr };
|
||||
GTextEditor* m_text_editor { nullptr };
|
||||
ObjectPtr<GTextEditor> m_text_editor;
|
||||
RefPtr<IRCLogBuffer> m_log_buffer;
|
||||
int m_unread_count { 0 };
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ ProcessStacksWidget::ProcessStacksWidget(GWidget* parent)
|
|||
{
|
||||
set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
layout()->set_margins({ 4, 4, 4, 4 });
|
||||
m_stacks_editor = new GTextEditor(GTextEditor::Type::MultiLine, this);
|
||||
m_stacks_editor = GTextEditor::construct(GTextEditor::Type::MultiLine, this);
|
||||
m_stacks_editor->set_readonly(true);
|
||||
|
||||
m_timer = CTimer::create(1000, [this] { refresh(); }, this);
|
||||
|
|
|
@ -17,6 +17,6 @@ public:
|
|||
|
||||
private:
|
||||
pid_t m_pid { -1 };
|
||||
GTextEditor* m_stacks_editor { nullptr };
|
||||
ObjectPtr<GTextEditor> m_stacks_editor;
|
||||
ObjectPtr<CTimer> m_timer;
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@ TextEditorWidget::TextEditorWidget()
|
|||
layout()->set_spacing(0);
|
||||
|
||||
auto* toolbar = new GToolBar(this);
|
||||
m_editor = new GTextEditor(GTextEditor::MultiLine, this);
|
||||
m_editor = GTextEditor::construct(GTextEditor::MultiLine, this);
|
||||
m_editor->set_ruler_visible(true);
|
||||
m_editor->set_automatic_indentation_enabled(true);
|
||||
m_editor->set_line_wrapping_enabled(true);
|
||||
|
@ -42,7 +42,7 @@ TextEditorWidget::TextEditorWidget()
|
|||
m_find_widget->layout()->set_margins({ 2, 2, 2, 2 });
|
||||
m_find_widget->set_visible(false);
|
||||
|
||||
m_find_textbox = new GTextBox(m_find_widget);
|
||||
m_find_textbox = GTextBox::construct(m_find_widget);
|
||||
|
||||
m_find_next_action = GAction::create("Find next", { Mod_Ctrl, Key_G }, [&](auto&) {
|
||||
auto needle = m_find_textbox->text();
|
||||
|
|
|
@ -22,7 +22,7 @@ private:
|
|||
void set_path(const FileSystemPath& file);
|
||||
void update_title();
|
||||
|
||||
GTextEditor* m_editor { nullptr };
|
||||
ObjectPtr<GTextEditor> m_editor;
|
||||
String m_path;
|
||||
String m_name;
|
||||
String m_extension;
|
||||
|
@ -35,7 +35,7 @@ private:
|
|||
RefPtr<GAction> m_find_next_action;
|
||||
RefPtr<GAction> m_find_previous_action;
|
||||
|
||||
GTextBox* m_find_textbox { nullptr };
|
||||
ObjectPtr<GTextBox> m_find_textbox;
|
||||
GButton* m_find_previous_button { nullptr };
|
||||
GButton* m_find_next_button { nullptr };
|
||||
GWidget* m_find_widget { nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue