mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
LibGUI: Use GUI::Window::set_main_widget<WidgetType>() in clients
This commit is contained in:
parent
4697195645
commit
0f3e57a6fb
37 changed files with 203 additions and 246 deletions
|
@ -48,9 +48,7 @@ Editor::Editor()
|
|||
m_documentation_tooltip_window = GUI::Window::construct();
|
||||
m_documentation_tooltip_window->set_rect(0, 0, 500, 400);
|
||||
m_documentation_tooltip_window->set_window_type(GUI::WindowType::Tooltip);
|
||||
|
||||
m_documentation_html_view = HtmlView::construct();
|
||||
m_documentation_tooltip_window->set_main_widget(m_documentation_html_view);
|
||||
m_documentation_html_view = m_documentation_tooltip_window->set_main_widget<HtmlView>();
|
||||
}
|
||||
|
||||
Editor::~Editor()
|
||||
|
|
|
@ -150,10 +150,9 @@ Locator::Locator()
|
|||
m_popup_window->set_window_type(GUI::WindowType::Tooltip);
|
||||
m_popup_window->set_rect(0, 0, 500, 200);
|
||||
|
||||
m_suggestion_view = GUI::TableView::construct();
|
||||
m_suggestion_view = m_popup_window->set_main_widget<GUI::TableView>();
|
||||
m_suggestion_view->set_size_columns_to_fit_content(true);
|
||||
m_suggestion_view->set_headers_visible(false);
|
||||
m_popup_window->set_main_widget(m_suggestion_view);
|
||||
|
||||
m_suggestion_view->on_activation = [this](auto& index) {
|
||||
open_suggestion(index);
|
||||
|
|
|
@ -141,12 +141,11 @@ int main(int argc, char** argv)
|
|||
g_window->set_rect(90, 90, 840, 600);
|
||||
g_window->set_title("HackStudio");
|
||||
|
||||
auto widget = GUI::Widget::construct();
|
||||
g_window->set_main_widget(widget);
|
||||
auto& widget = g_window->set_main_widget<GUI::Widget>();
|
||||
|
||||
widget->set_fill_with_background_color(true);
|
||||
widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
widget->layout()->set_spacing(0);
|
||||
widget.set_fill_with_background_color(true);
|
||||
widget.set_layout<GUI::VerticalBoxLayout>();
|
||||
widget.layout()->set_spacing(0);
|
||||
|
||||
StringBuilder path;
|
||||
path.append(getenv("PATH"));
|
||||
|
@ -165,7 +164,7 @@ int main(int argc, char** argv)
|
|||
g_project = Project::load_from_file("little.files");
|
||||
ASSERT(g_project);
|
||||
|
||||
auto toolbar = widget->add<GUI::ToolBar>();
|
||||
auto toolbar = widget.add<GUI::ToolBar>();
|
||||
|
||||
auto selected_file_names = [&] {
|
||||
Vector<String> files;
|
||||
|
@ -247,7 +246,7 @@ int main(int argc, char** argv)
|
|||
project_tree_view_context_menu->add_action(add_existing_file_action);
|
||||
project_tree_view_context_menu->add_action(delete_action);
|
||||
|
||||
auto outer_splitter = widget->add<GUI::HorizontalSplitter>();
|
||||
auto outer_splitter = widget.add<GUI::HorizontalSplitter>();
|
||||
g_project_tree_view = outer_splitter->add<GUI::TreeView>();
|
||||
g_project_tree_view->set_model(g_project->model());
|
||||
g_project_tree_view->set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
|
||||
|
@ -448,7 +447,7 @@ int main(int argc, char** argv)
|
|||
auto find_in_files_widget = s_action_tab_widget->add_tab<FindInFilesWidget>("Find in files");
|
||||
auto terminal_wrapper = s_action_tab_widget->add_tab<TerminalWrapper>("Console");
|
||||
|
||||
auto locator = widget->add<Locator>();
|
||||
auto locator = widget.add<Locator>();
|
||||
|
||||
auto open_locator_action = GUI::Action::create("Open Locator...", { Mod_Ctrl, Key_K }, [&](auto&) {
|
||||
locator->open();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue