Serenity Operating System
at master 54 lines 1.8 kB view raw
1/* 2 * Copyright (c) 2021, Nick Vella <nick@nxk.io> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibGUI/BoxLayout.h> 8#include <LibGUI/Label.h> 9#include <LibGUI/SeparatorWidget.h> 10#include <LibGUI/Widget.h> 11#include <LibGUI/Wizards/WizardPage.h> 12#include <LibGfx/Font/FontDatabase.h> 13#include <LibGfx/SystemTheme.h> 14 15namespace GUI { 16 17WizardPage::WizardPage(DeprecatedString const& title_text, DeprecatedString const& subtitle_text) 18 : AbstractWizardPage() 19{ 20 set_layout<VerticalBoxLayout>(GUI::Margins {}, 0); 21 22 auto& header_widget = add<Widget>(); 23 header_widget.set_fill_with_background_color(true); 24 header_widget.set_background_role(Gfx::ColorRole::Base); 25 header_widget.set_fixed_height(58); 26 27 header_widget.set_layout<VerticalBoxLayout>(GUI::Margins { 15, 30, 0 }); 28 m_title_label = header_widget.add<Label>(title_text); 29 m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant()); 30 m_title_label->set_fixed_height(m_title_label->font().pixel_size_rounded_up() + 2); 31 m_title_label->set_text_alignment(Gfx::TextAlignment::TopLeft); 32 m_subtitle_label = header_widget.add<Label>(subtitle_text); 33 m_subtitle_label->set_text_alignment(Gfx::TextAlignment::TopLeft); 34 m_subtitle_label->set_fixed_height(m_subtitle_label->font().pixel_size_rounded_up()); 35 header_widget.add_spacer().release_value_but_fixme_should_propagate_errors(); 36 37 auto& separator = add<SeparatorWidget>(Gfx::Orientation::Horizontal); 38 separator.set_fixed_height(2); 39 40 m_body_widget = add<Widget>(); 41 m_body_widget->set_layout<VerticalBoxLayout>(20); 42} 43 44void WizardPage::set_page_title(DeprecatedString const& text) 45{ 46 m_title_label->set_text(text); 47} 48 49void WizardPage::set_page_subtitle(DeprecatedString const& text) 50{ 51 m_subtitle_label->set_text(text); 52} 53 54}