mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:42:44 +00:00 
			
		
		
		
	LibGUI+Userland: Add _deprecated suffix to AbstractButton::{set_,}text
				
					
				
			This commit is contained in:
		
							parent
							
								
									61b49daf0a
								
							
						
					
					
						commit
						d32b052f22
					
				
					 30 changed files with 83 additions and 83 deletions
				
			
		|  | @ -57,7 +57,7 @@ class ResultRow final : public GUI::Button { | ||||||
|             if (!m_context_menu) { |             if (!m_context_menu) { | ||||||
|                 m_context_menu = GUI::Menu::construct(); |                 m_context_menu = GUI::Menu::construct(); | ||||||
| 
 | 
 | ||||||
|                 if (LexicalPath path { text() }; path.is_absolute()) { |                 if (LexicalPath path { text_deprecated() }; path.is_absolute()) { | ||||||
|                     m_context_menu->add_action(GUI::Action::create("&Show in File Manager", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [=](auto&) { |                     m_context_menu->add_action(GUI::Action::create("&Show in File Manager", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [=](auto&) { | ||||||
|                         Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename())); |                         Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename())); | ||||||
|                     })); |                     })); | ||||||
|  | @ -65,7 +65,7 @@ class ResultRow final : public GUI::Button { | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 m_context_menu->add_action(GUI::Action::create("&Copy as Text", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv)), [&](auto&) { |                 m_context_menu->add_action(GUI::Action::create("&Copy as Text", MUST(Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv)), [&](auto&) { | ||||||
|                     GUI::Clipboard::the().set_plain_text(text()); |                     GUI::Clipboard::the().set_plain_text(text_deprecated()); | ||||||
|                 })); |                 })); | ||||||
|             } |             } | ||||||
|             m_context_menu->popup(event.screen_position()); |             m_context_menu->popup(event.screen_position()); | ||||||
|  | @ -256,7 +256,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) | ||||||
|             auto& result = app_state.results[i]; |             auto& result = app_state.results[i]; | ||||||
|             auto& match = results_container.add<Assistant::ResultRow>(); |             auto& match = results_container.add<Assistant::ResultRow>(); | ||||||
|             match.set_icon(result.bitmap()); |             match.set_icon(result.bitmap()); | ||||||
|             match.set_text(move(result.title())); |             match.set_text_deprecated(move(result.title())); | ||||||
|             match.set_tooltip(move(result.tooltip())); |             match.set_tooltip(move(result.tooltip())); | ||||||
|             match.on_click = [&result](auto) { |             match.on_click = [&result](auto) { | ||||||
|                 result.activate(); |                 result.activate(); | ||||||
|  |  | ||||||
|  | @ -205,7 +205,7 @@ void BookmarksBarWidget::model_did_update(unsigned) | ||||||
|         m_bookmarks.append(button); |         m_bookmarks.append(button); | ||||||
| 
 | 
 | ||||||
|         button.set_button_style(Gfx::ButtonStyle::Coolbar); |         button.set_button_style(Gfx::ButtonStyle::Coolbar); | ||||||
|         button.set_text(title); |         button.set_text_deprecated(title); | ||||||
|         button.set_icon(g_icon_bag.filetype_html); |         button.set_icon(g_icon_bag.filetype_html); | ||||||
|         button.set_fixed_size(font().width(title) + 32, 20); |         button.set_fixed_size(font().width(title) + 32, 20); | ||||||
|         button.set_relative_rect(rect); |         button.set_relative_rect(rect); | ||||||
|  | @ -264,7 +264,7 @@ void BookmarksBarWidget::update_content_size() | ||||||
|         for (size_t i = m_last_visible_index; i < m_bookmarks.size(); ++i) { |         for (size_t i = m_last_visible_index; i < m_bookmarks.size(); ++i) { | ||||||
|             auto& bookmark = m_bookmarks.at(i); |             auto& bookmark = m_bookmarks.at(i); | ||||||
|             bookmark.set_visible(false); |             bookmark.set_visible(false); | ||||||
|             m_additional_menu->add_action(GUI::Action::create(bookmark.text(), g_icon_bag.filetype_html, [&](auto&) { bookmark.on_click(0); })); |             m_additional_menu->add_action(GUI::Action::create(bookmark.text_deprecated(), g_icon_bag.filetype_html, [&](auto&) { bookmark.on_click(0); })); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -153,7 +153,7 @@ void DownloadWidget::did_finish(bool success) | ||||||
|     m_browser_image->load_from_file("/res/graphics/download-finished.gif"sv); |     m_browser_image->load_from_file("/res/graphics/download-finished.gif"sv); | ||||||
|     window()->set_title("Download finished!"); |     window()->set_title("Download finished!"); | ||||||
|     m_close_button->set_enabled(true); |     m_close_button->set_enabled(true); | ||||||
|     m_cancel_button->set_text("Open in Folder"); |     m_cancel_button->set_text_deprecated("Open in Folder"); | ||||||
|     m_cancel_button->on_click = [this](auto) { |     m_cancel_button->on_click = [this](auto) { | ||||||
|         Desktop::Launcher::open(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory(), m_url.basename())); |         Desktop::Launcher::open(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory(), m_url.basename())); | ||||||
|         window()->close(); |         window()->close(); | ||||||
|  |  | ||||||
|  | @ -112,7 +112,7 @@ FindDialog::FindDialog() | ||||||
|         auto action = options[i]; |         auto action = options[i]; | ||||||
|         auto& radio = radio_container.add<GUI::RadioButton>(); |         auto& radio = radio_container.add<GUI::RadioButton>(); | ||||||
|         radio.set_enabled(action.enabled); |         radio.set_enabled(action.enabled); | ||||||
|         radio.set_text(action.title); |         radio.set_text_deprecated(action.title); | ||||||
| 
 | 
 | ||||||
|         radio.on_checked = [this, i](auto) { |         radio.on_checked = [this, i](auto) { | ||||||
|             m_selected_option = options[i].opt; |             m_selected_option = options[i].opt; | ||||||
|  |  | ||||||
|  | @ -38,13 +38,13 @@ void KeyButton::paint_event(GUI::PaintEvent& event) | ||||||
|     painter.draw_rect(key_cap_face_border_rect, Color::from_rgb(0x8C7272), false); |     painter.draw_rect(key_cap_face_border_rect, Color::from_rgb(0x8C7272), false); | ||||||
|     painter.fill_rect(key_cap_face_rect, face_color); |     painter.fill_rect(key_cap_face_rect, face_color); | ||||||
| 
 | 
 | ||||||
|     if (text().is_empty() || text().starts_with('\0')) |     if (text_deprecated().is_empty() || text_deprecated().starts_with('\0')) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.glyph_height() }; |     Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text_deprecated()))), font.glyph_height() }; | ||||||
|     text_rect.align_within(key_cap_face_rect, Gfx::TextAlignment::Center); |     text_rect.align_within(key_cap_face_rect, Gfx::TextAlignment::Center); | ||||||
| 
 | 
 | ||||||
|     painter.draw_text(text_rect, text(), font, Gfx::TextAlignment::Center, Color::Black, Gfx::TextElision::Right); |     painter.draw_text(text_rect, text_deprecated(), font, Gfx::TextAlignment::Center, Color::Black, Gfx::TextElision::Right); | ||||||
|     if (is_focused()) |     if (is_focused()) | ||||||
|         painter.draw_rect(text_rect.inflated(6, 4), palette().focus_outline()); |         painter.draw_rect(text_rect.inflated(6, 4), palette().focus_outline()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -52,7 +52,7 @@ void KeyboardMapperWidget::create_frame() | ||||||
| 
 | 
 | ||||||
|         auto& tmp_button = main_widget.add<KeyButton>(); |         auto& tmp_button = main_widget.add<KeyButton>(); | ||||||
|         tmp_button.set_relative_rect(rect); |         tmp_button.set_relative_rect(rect); | ||||||
|         tmp_button.set_text(keys[i].name); |         tmp_button.set_text_deprecated(keys[i].name); | ||||||
|         tmp_button.set_enabled(keys[i].enabled); |         tmp_button.set_enabled(keys[i].enabled); | ||||||
| 
 | 
 | ||||||
|         tmp_button.on_click = [this, &tmp_button]() { |         tmp_button.on_click = [this, &tmp_button]() { | ||||||
|  | @ -64,7 +64,7 @@ void KeyboardMapperWidget::create_frame() | ||||||
|                 auto index = keys[i].map_index; |                 auto index = keys[i].map_index; | ||||||
|                 VERIFY(index > 0); |                 VERIFY(index > 0); | ||||||
| 
 | 
 | ||||||
|                 tmp_button.set_text(value); |                 tmp_button.set_text_deprecated(value); | ||||||
|                 u32* map = map_from_name(m_current_map_name); |                 u32* map = map_from_name(m_current_map_name); | ||||||
| 
 | 
 | ||||||
|                 if (value.length() == 0) |                 if (value.length() == 0) | ||||||
|  | @ -248,7 +248,7 @@ void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map) | ||||||
|         StringBuilder sb; |         StringBuilder sb; | ||||||
|         sb.append_code_point(map[index]); |         sb.append_code_point(map[index]); | ||||||
| 
 | 
 | ||||||
|         m_keys.at(k)->set_text(sb.to_deprecated_string()); |         m_keys.at(k)->set_text_deprecated(sb.to_deprecated_string()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     this->update(); |     this->update(); | ||||||
|  |  | ||||||
|  | @ -340,11 +340,11 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar) | ||||||
|     toolbar.add_separator(); |     toolbar.add_separator(); | ||||||
| 
 | 
 | ||||||
|     m_show_clipping_paths = toolbar.add<GUI::CheckBox>(); |     m_show_clipping_paths = toolbar.add<GUI::CheckBox>(); | ||||||
|     m_show_clipping_paths->set_text("Show clipping paths"); |     m_show_clipping_paths->set_text_deprecated("Show clipping paths"); | ||||||
|     m_show_clipping_paths->set_checked(m_viewer->show_clipping_paths(), GUI::AllowCallback::No); |     m_show_clipping_paths->set_checked(m_viewer->show_clipping_paths(), GUI::AllowCallback::No); | ||||||
|     m_show_clipping_paths->on_checked = [&](auto checked) { m_viewer->set_show_clipping_paths(checked); }; |     m_show_clipping_paths->on_checked = [&](auto checked) { m_viewer->set_show_clipping_paths(checked); }; | ||||||
|     m_show_images = toolbar.add<GUI::CheckBox>(); |     m_show_images = toolbar.add<GUI::CheckBox>(); | ||||||
|     m_show_images->set_text("Show images"); |     m_show_images->set_text_deprecated("Show images"); | ||||||
|     m_show_images->set_checked(m_viewer->show_images(), GUI::AllowCallback::No); |     m_show_images->set_checked(m_viewer->show_images(), GUI::AllowCallback::No); | ||||||
|     m_show_images->on_checked = [&](auto checked) { m_viewer->set_show_images(checked); }; |     m_show_images->on_checked = [&](auto checked) { m_viewer->set_show_images(checked); }; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -111,7 +111,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window) | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     auto& set_defaults_checkbox = main_widget->add<GUI::CheckBox>(); |     auto& set_defaults_checkbox = main_widget->add<GUI::CheckBox>(); | ||||||
|     set_defaults_checkbox.set_text("Use these settings as default"); |     set_defaults_checkbox.set_text_deprecated("Use these settings as default"); | ||||||
| 
 | 
 | ||||||
|     auto& button_container = main_widget->add<GUI::Widget>(); |     auto& button_container = main_widget->add<GUI::Widget>(); | ||||||
|     button_container.set_layout<GUI::HorizontalBoxLayout>(); |     button_container.set_layout<GUI::HorizontalBoxLayout>(); | ||||||
|  |  | ||||||
|  | @ -100,7 +100,7 @@ GUI::Widget* EraseTool::get_properties_widget() | ||||||
| 
 | 
 | ||||||
|         auto& use_secondary_color_checkbox = secondary_color_container.add<GUI::CheckBox>(); |         auto& use_secondary_color_checkbox = secondary_color_container.add<GUI::CheckBox>(); | ||||||
|         use_secondary_color_checkbox.set_checked(m_use_secondary_color); |         use_secondary_color_checkbox.set_checked(m_use_secondary_color); | ||||||
|         use_secondary_color_checkbox.set_text("Use secondary color"); |         use_secondary_color_checkbox.set_text_deprecated("Use secondary color"); | ||||||
|         use_secondary_color_checkbox.on_checked = [&](bool checked) { |         use_secondary_color_checkbox.on_checked = [&](bool checked) { | ||||||
|             m_use_secondary_color = checked; |             m_use_secondary_color = checked; | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|  | @ -487,7 +487,7 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab) | ||||||
|                     TRY(row_widget->load_from_gml(flag_property_gml)); |                     TRY(row_widget->load_from_gml(flag_property_gml)); | ||||||
| 
 | 
 | ||||||
|                     auto& checkbox = *row_widget->find_descendant_of_type_named<GUI::CheckBox>("checkbox"); |                     auto& checkbox = *row_widget->find_descendant_of_type_named<GUI::CheckBox>("checkbox"); | ||||||
|                     checkbox.set_text(to_string(role)); |                     checkbox.set_text_deprecated(to_string(role)); | ||||||
|                     checkbox.on_checked = [&, role](bool checked) { |                     checkbox.on_checked = [&, role](bool checked) { | ||||||
|                         set_flag(role, checked); |                         set_flag(role, checked); | ||||||
|                     }; |                     }; | ||||||
|  |  | ||||||
|  | @ -180,13 +180,13 @@ void Game::setup(DeprecatedString player_name, int hand_number) | ||||||
|         m_human_can_play = true; |         m_human_can_play = true; | ||||||
|         switch (passing_direction()) { |         switch (passing_direction()) { | ||||||
|         case PassingDirection::Left: |         case PassingDirection::Left: | ||||||
|             m_passing_button->set_text("Pass Left"); |             m_passing_button->set_text_deprecated("Pass Left"); | ||||||
|             break; |             break; | ||||||
|         case PassingDirection::Across: |         case PassingDirection::Across: | ||||||
|             m_passing_button->set_text("Pass Across"); |             m_passing_button->set_text_deprecated("Pass Across"); | ||||||
|             break; |             break; | ||||||
|         case PassingDirection::Right: |         case PassingDirection::Right: | ||||||
|             m_passing_button->set_text("Pass Right"); |             m_passing_button->set_text_deprecated("Pass Right"); | ||||||
|             break; |             break; | ||||||
|         default: |         default: | ||||||
|             VERIFY_NOT_REACHED(); |             VERIFY_NOT_REACHED(); | ||||||
|  | @ -871,7 +871,7 @@ void Game::pass_cards() | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     m_state = State::PassingAccept; |     m_state = State::PassingAccept; | ||||||
|     m_passing_button->set_text("OK"); |     m_passing_button->set_text_deprecated("OK"); | ||||||
|     m_passing_button->set_enabled(true); |     m_passing_button->set_enabled(true); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ namespace GUI { | ||||||
| 
 | 
 | ||||||
| AbstractButton::AbstractButton(DeprecatedString text) | AbstractButton::AbstractButton(DeprecatedString text) | ||||||
| { | { | ||||||
|     set_text(move(text)); |     set_text_deprecated(move(text)); | ||||||
| 
 | 
 | ||||||
|     set_focus_policy(GUI::FocusPolicy::StrongFocus); |     set_focus_policy(GUI::FocusPolicy::StrongFocus); | ||||||
|     set_background_role(Gfx::ColorRole::Button); |     set_background_role(Gfx::ColorRole::Button); | ||||||
|  | @ -28,13 +28,13 @@ AbstractButton::AbstractButton(DeprecatedString text) | ||||||
|         click(); |         click(); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     REGISTER_STRING_PROPERTY("text", text, set_text); |     REGISTER_STRING_PROPERTY("text", text_deprecated, set_text_deprecated); | ||||||
|     REGISTER_BOOL_PROPERTY("checked", is_checked, set_checked); |     REGISTER_BOOL_PROPERTY("checked", is_checked, set_checked); | ||||||
|     REGISTER_BOOL_PROPERTY("checkable", is_checkable, set_checkable); |     REGISTER_BOOL_PROPERTY("checkable", is_checkable, set_checkable); | ||||||
|     REGISTER_BOOL_PROPERTY("exclusive", is_exclusive, set_exclusive); |     REGISTER_BOOL_PROPERTY("exclusive", is_exclusive, set_exclusive); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void AbstractButton::set_text(DeprecatedString text) | void AbstractButton::set_text_deprecated(DeprecatedString text) | ||||||
| { | { | ||||||
|     if (m_text == text) |     if (m_text == text) | ||||||
|         return; |         return; | ||||||
|  | @ -238,14 +238,14 @@ void AbstractButton::paint_text(Painter& painter, Gfx::IntRect const& rect, Gfx: | ||||||
|     auto clipped_rect = rect.intersected(this->rect()); |     auto clipped_rect = rect.intersected(this->rect()); | ||||||
| 
 | 
 | ||||||
|     if (!is_enabled()) { |     if (!is_enabled()) { | ||||||
|         painter.draw_text(clipped_rect.translated(1, 1), text(), font, text_alignment, palette().disabled_text_back(), Gfx::TextElision::Right, text_wrapping); |         painter.draw_text(clipped_rect.translated(1, 1), text_deprecated(), font, text_alignment, palette().disabled_text_back(), Gfx::TextElision::Right, text_wrapping); | ||||||
|         painter.draw_text(clipped_rect, text(), font, text_alignment, palette().disabled_text_front(), Gfx::TextElision::Right, text_wrapping); |         painter.draw_text(clipped_rect, text_deprecated(), font, text_alignment, palette().disabled_text_front(), Gfx::TextElision::Right, text_wrapping); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (text().is_empty()) |     if (text_deprecated().is_empty()) | ||||||
|         return; |         return; | ||||||
|     painter.draw_text(clipped_rect, text(), font, text_alignment, palette().color(foreground_role()), Gfx::TextElision::Right, text_wrapping); |     painter.draw_text(clipped_rect, text_deprecated(), font, text_alignment, palette().color(foreground_role()), Gfx::TextElision::Right, text_wrapping); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void AbstractButton::change_event(Event& event) | void AbstractButton::change_event(Event& event) | ||||||
|  |  | ||||||
|  | @ -20,8 +20,8 @@ public: | ||||||
| 
 | 
 | ||||||
|     Function<void(bool)> on_checked; |     Function<void(bool)> on_checked; | ||||||
| 
 | 
 | ||||||
|     virtual void set_text(DeprecatedString); |     virtual void set_text_deprecated(DeprecatedString); | ||||||
|     DeprecatedString const& text() const { return m_text; } |     DeprecatedString const& text_deprecated() const { return m_text; } | ||||||
| 
 | 
 | ||||||
|     bool is_exclusive() const { return m_exclusive; } |     bool is_exclusive() const { return m_exclusive; } | ||||||
|     void set_exclusive(bool b) { m_exclusive = b; } |     void set_exclusive(bool b) { m_exclusive = b; } | ||||||
|  |  | ||||||
|  | @ -289,7 +289,7 @@ void Action::set_text(DeprecatedString text) | ||||||
|         return; |         return; | ||||||
|     m_text = move(text); |     m_text = move(text); | ||||||
|     for_each_toolbar_button([&](auto& button) { |     for_each_toolbar_button([&](auto& button) { | ||||||
|         button.set_text(m_text); |         button.set_text_deprecated(m_text); | ||||||
|     }); |     }); | ||||||
|     for_each_menu_item([&](auto& menu_item) { |     for_each_menu_item([&](auto& menu_item) { | ||||||
|         menu_item.update_from_action({}); |         menu_item.update_from_action({}); | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ void Breadcrumbbar::append_segment(DeprecatedString text, Gfx::Bitmap const* ico | ||||||
| { | { | ||||||
|     auto& button = add<BreadcrumbButton>(); |     auto& button = add<BreadcrumbButton>(); | ||||||
|     button.set_button_style(Gfx::ButtonStyle::Coolbar); |     button.set_button_style(Gfx::ButtonStyle::Coolbar); | ||||||
|     button.set_text(text); |     button.set_text_deprecated(text); | ||||||
|     button.set_icon(icon); |     button.set_icon(icon); | ||||||
|     button.set_tooltip(move(tooltip)); |     button.set_tooltip(move(tooltip)); | ||||||
|     button.set_focus_policy(FocusPolicy::TabFocus); |     button.set_focus_policy(FocusPolicy::TabFocus); | ||||||
|  |  | ||||||
|  | @ -61,12 +61,12 @@ void Button::paint_event(PaintEvent& event) | ||||||
| 
 | 
 | ||||||
|     Gfx::StylePainter::paint_button(painter, rect(), palette(), m_button_style, paint_pressed, is_hovered(), is_checked(), is_enabled(), is_focused(), is_default() && !another_button_has_focus()); |     Gfx::StylePainter::paint_button(painter, rect(), palette(), m_button_style, paint_pressed, is_hovered(), is_checked(), is_enabled(), is_focused(), is_default() && !another_button_has_focus()); | ||||||
| 
 | 
 | ||||||
|     if (text().is_empty() && !m_icon) |     if (text_deprecated().is_empty() && !m_icon) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     auto content_rect = rect().shrunken(8, 2); |     auto content_rect = rect().shrunken(8, 2); | ||||||
|     auto icon_location = m_icon ? content_rect.center().translated(-(m_icon->width() / 2), -(m_icon->height() / 2)) : Gfx::IntPoint(); |     auto icon_location = m_icon ? content_rect.center().translated(-(m_icon->width() / 2), -(m_icon->height() / 2)) : Gfx::IntPoint(); | ||||||
|     if (m_icon && !text().is_empty()) |     if (m_icon && !text_deprecated().is_empty()) | ||||||
|         icon_location.set_x(content_rect.x()); |         icon_location.set_x(content_rect.x()); | ||||||
| 
 | 
 | ||||||
|     if (paint_pressed || is_checked()) { |     if (paint_pressed || is_checked()) { | ||||||
|  | @ -103,12 +103,12 @@ void Button::paint_event(PaintEvent& event) | ||||||
|             m_icon->invert(); |             m_icon->invert(); | ||||||
|     } |     } | ||||||
|     auto& font = is_checked() ? this->font().bold_variant() : this->font(); |     auto& font = is_checked() ? this->font().bold_variant() : this->font(); | ||||||
|     if (m_icon && !text().is_empty()) { |     if (m_icon && !text_deprecated().is_empty()) { | ||||||
|         content_rect.translate_by(m_icon->width() + icon_spacing(), 0); |         content_rect.translate_by(m_icon->width() + icon_spacing(), 0); | ||||||
|         content_rect.set_width(content_rect.width() - m_icon->width() - icon_spacing()); |         content_rect.set_width(content_rect.width() - m_icon->width() - icon_spacing()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.glyph_height() }; |     Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text_deprecated()))), font.glyph_height() }; | ||||||
|     if (text_rect.width() > content_rect.width()) |     if (text_rect.width() > content_rect.width()) | ||||||
|         text_rect.set_width(content_rect.width()); |         text_rect.set_width(content_rect.width()); | ||||||
|     text_rect.align_within(content_rect, text_alignment()); |     text_rect.align_within(content_rect, text_alignment()); | ||||||
|  | @ -116,7 +116,7 @@ void Button::paint_event(PaintEvent& event) | ||||||
| 
 | 
 | ||||||
|     if (is_focused()) { |     if (is_focused()) { | ||||||
|         Gfx::IntRect focus_rect; |         Gfx::IntRect focus_rect; | ||||||
|         if (m_icon && !text().is_empty()) |         if (m_icon && !text_deprecated().is_empty()) | ||||||
|             focus_rect = text_rect.inflated(4, 4); |             focus_rect = text_rect.inflated(4, 4); | ||||||
|         else |         else | ||||||
|             focus_rect = rect().shrunken(8, 8); |             focus_rect = rect().shrunken(8, 8); | ||||||
|  | @ -274,9 +274,9 @@ Optional<UISize> Button::calculated_min_size() const | ||||||
| { | { | ||||||
|     int horizontal = 0, vertical = 0; |     int horizontal = 0, vertical = 0; | ||||||
| 
 | 
 | ||||||
|     if (!text().is_empty()) { |     if (!text_deprecated().is_empty()) { | ||||||
|         auto& font = this->font(); |         auto& font = this->font(); | ||||||
|         horizontal = font.width(text()) + 2; |         horizontal = font.width(text_deprecated()) + 2; | ||||||
|         vertical = font.glyph_height() + 4; // FIXME: Use actual maximum total height
 |         vertical = font.glyph_height() + 4; // FIXME: Use actual maximum total height
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -42,7 +42,7 @@ void CheckBox::paint_event(PaintEvent& event) | ||||||
|     auto text_rect = rect(); |     auto text_rect = rect(); | ||||||
|     if (m_checkbox_position == CheckBoxPosition::Left) |     if (m_checkbox_position == CheckBoxPosition::Left) | ||||||
|         text_rect.set_left(s_box_width + s_horizontal_padding); |         text_rect.set_left(s_box_width + s_horizontal_padding); | ||||||
|     text_rect.set_width(font().width(text())); |     text_rect.set_width(font().width(text_deprecated())); | ||||||
|     text_rect.set_top(height() / 2 - font().glyph_height() / 2); |     text_rect.set_top(height() / 2 - font().glyph_height() / 2); | ||||||
|     text_rect.set_height(font().glyph_height()); |     text_rect.set_height(font().glyph_height()); | ||||||
| 
 | 
 | ||||||
|  | @ -85,7 +85,7 @@ void CheckBox::set_autosize(bool autosize) | ||||||
| 
 | 
 | ||||||
| void CheckBox::size_to_fit() | void CheckBox::size_to_fit() | ||||||
| { | { | ||||||
|     set_fixed_width(s_box_width + font().width(text()) + s_horizontal_padding * 2); |     set_fixed_width(s_box_width + font().width(text_deprecated()) + s_horizontal_padding * 2); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -234,14 +234,14 @@ void ColorPicker::build_ui() | ||||||
|     button_container.layout()->add_spacer(); |     button_container.layout()->add_spacer(); | ||||||
| 
 | 
 | ||||||
|     auto& ok_button = button_container.add<DialogButton>(); |     auto& ok_button = button_container.add<DialogButton>(); | ||||||
|     ok_button.set_text("OK"); |     ok_button.set_text_deprecated("OK"); | ||||||
|     ok_button.on_click = [this](auto) { |     ok_button.on_click = [this](auto) { | ||||||
|         done(ExecResult::OK); |         done(ExecResult::OK); | ||||||
|     }; |     }; | ||||||
|     ok_button.set_default(true); |     ok_button.set_default(true); | ||||||
| 
 | 
 | ||||||
|     auto& cancel_button = button_container.add<DialogButton>(); |     auto& cancel_button = button_container.add<DialogButton>(); | ||||||
|     cancel_button.set_text("Cancel"); |     cancel_button.set_text_deprecated("Cancel"); | ||||||
|     cancel_button.on_click = [this](auto) { |     cancel_button.on_click = [this](auto) { | ||||||
|         done(ExecResult::Cancel); |         done(ExecResult::Cancel); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -217,14 +217,14 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("ok_button"); |     auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("ok_button"); | ||||||
|     ok_button.set_text(ok_button_name(m_mode)); |     ok_button.set_text_deprecated(ok_button_name(m_mode)); | ||||||
|     ok_button.on_click = [this](auto) { |     ok_button.on_click = [this](auto) { | ||||||
|         on_file_return(); |         on_file_return(); | ||||||
|     }; |     }; | ||||||
|     ok_button.set_enabled(m_mode == Mode::OpenFolder || !m_filename_textbox->text().is_empty()); |     ok_button.set_enabled(m_mode == Mode::OpenFolder || !m_filename_textbox->text().is_empty()); | ||||||
| 
 | 
 | ||||||
|     auto& cancel_button = *widget->find_descendant_of_type_named<GUI::Button>("cancel_button"); |     auto& cancel_button = *widget->find_descendant_of_type_named<GUI::Button>("cancel_button"); | ||||||
|     cancel_button.set_text("Cancel"); |     cancel_button.set_text_deprecated("Cancel"); | ||||||
|     cancel_button.on_click = [this](auto) { |     cancel_button.on_click = [this](auto) { | ||||||
|         done(ExecResult::Cancel); |         done(ExecResult::Cancel); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ IncrementalSearchBanner::IncrementalSearchBanner(TextEditor& editor) | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     m_close_button = find_descendant_of_type_named<Button>("incremental_search_banner_close_button"); |     m_close_button = find_descendant_of_type_named<Button>("incremental_search_banner_close_button"); | ||||||
|     m_close_button->set_text("\xE2\x9D\x8C"); |     m_close_button->set_text_deprecated("\xE2\x9D\x8C"); | ||||||
|     m_close_button->on_click = [this](auto) { |     m_close_button->on_click = [this](auto) { | ||||||
|         hide(); |         hide(); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -107,7 +107,7 @@ void InputBox::build() | ||||||
|     button_container_inner.layout()->add_spacer(); |     button_container_inner.layout()->add_spacer(); | ||||||
| 
 | 
 | ||||||
|     m_ok_button = button_container_inner.add<DialogButton>(); |     m_ok_button = button_container_inner.add<DialogButton>(); | ||||||
|     m_ok_button->set_text("OK"); |     m_ok_button->set_text_deprecated("OK"); | ||||||
|     m_ok_button->on_click = [this](auto) { |     m_ok_button->on_click = [this](auto) { | ||||||
|         dbgln("GUI::InputBox: OK button clicked"); |         dbgln("GUI::InputBox: OK button clicked"); | ||||||
|         done(ExecResult::OK); |         done(ExecResult::OK); | ||||||
|  | @ -115,7 +115,7 @@ void InputBox::build() | ||||||
|     m_ok_button->set_default(true); |     m_ok_button->set_default(true); | ||||||
| 
 | 
 | ||||||
|     m_cancel_button = button_container_inner.add<DialogButton>(); |     m_cancel_button = button_container_inner.add<DialogButton>(); | ||||||
|     m_cancel_button->set_text("Cancel"); |     m_cancel_button->set_text_deprecated("Cancel"); | ||||||
|     m_cancel_button->on_click = [this](auto) { |     m_cancel_button->on_click = [this](auto) { | ||||||
|         dbgln("GUI::InputBox: Cancel button clicked"); |         dbgln("GUI::InputBox: Cancel button clicked"); | ||||||
|         done(ExecResult::Cancel); |         done(ExecResult::Cancel); | ||||||
|  |  | ||||||
|  | @ -49,9 +49,9 @@ Dialog::ExecResult MessageBox::ask_about_unsaved_changes(Window* parent_window, | ||||||
|     if (parent_window) |     if (parent_window) | ||||||
|         box->set_icon(parent_window->icon()); |         box->set_icon(parent_window->icon()); | ||||||
| 
 | 
 | ||||||
|     box->m_yes_button->set_text(path.is_empty() ? "Save As..." : "Save"); |     box->m_yes_button->set_text_deprecated(path.is_empty() ? "Save As..." : "Save"); | ||||||
|     box->m_no_button->set_text("Discard"); |     box->m_no_button->set_text_deprecated("Discard"); | ||||||
|     box->m_cancel_button->set_text("Cancel"); |     box->m_cancel_button->set_text_deprecated("Cancel"); | ||||||
| 
 | 
 | ||||||
|     return box->exec(); |     return box->exec(); | ||||||
| } | } | ||||||
|  | @ -154,7 +154,7 @@ void MessageBox::build() | ||||||
|     auto add_button = [&](DeprecatedString label, ExecResult result) -> GUI::Button& { |     auto add_button = [&](DeprecatedString label, ExecResult result) -> GUI::Button& { | ||||||
|         auto& button = button_container.add<Button>(); |         auto& button = button_container.add<Button>(); | ||||||
|         button.set_fixed_width(button_width); |         button.set_fixed_width(button_width); | ||||||
|         button.set_text(label); |         button.set_text_deprecated(label); | ||||||
|         button.on_click = [this, label, result](auto) { |         button.on_click = [this, label, result](auto) { | ||||||
|             done(result); |             done(result); | ||||||
|         }; |         }; | ||||||
|  |  | ||||||
|  | @ -46,7 +46,7 @@ void RadioButton::paint_event(PaintEvent& event) | ||||||
| 
 | 
 | ||||||
|     Gfx::StylePainter::paint_radio_button(painter, circle_rect, palette(), is_checked(), is_being_pressed()); |     Gfx::StylePainter::paint_radio_button(painter, circle_rect, palette(), is_checked(), is_being_pressed()); | ||||||
| 
 | 
 | ||||||
|     Gfx::IntRect text_rect { circle_rect.right() + 7, 0, static_cast<int>(ceilf(font().width(text()))), font().glyph_height() }; |     Gfx::IntRect text_rect { circle_rect.right() + 7, 0, static_cast<int>(ceilf(font().width(text_deprecated()))), font().glyph_height() }; | ||||||
|     text_rect.center_vertically_within(rect()); |     text_rect.center_vertically_within(rect()); | ||||||
|     paint_text(painter, text_rect, font(), Gfx::TextAlignment::TopLeft); |     paint_text(painter, text_rect, font(), Gfx::TextAlignment::TopLeft); | ||||||
| 
 | 
 | ||||||
|  | @ -66,7 +66,7 @@ Optional<UISize> RadioButton::calculated_min_size() const | ||||||
|     int horizontal = 2 + 7, vertical = 0; |     int horizontal = 2 + 7, vertical = 0; | ||||||
|     auto& font = this->font(); |     auto& font = this->font(); | ||||||
|     vertical = max(font.glyph_height(), circle_size().height()); |     vertical = max(font.glyph_height(), circle_size().height()); | ||||||
|     horizontal += font.width(text()); |     horizontal += font.width(text_deprecated()); | ||||||
|     return UISize(horizontal, vertical); |     return UISize(horizontal, vertical); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -86,7 +86,7 @@ void Statusbar::update_segment(size_t index) | ||||||
|             if (!text(i).is_empty()) |             if (!text(i).is_empty()) | ||||||
|                 m_segments[i].set_visible(true); |                 m_segments[i].set_visible(true); | ||||||
|         } |         } | ||||||
|         segment.set_text(segment.restored_text()); |         segment.set_text_deprecated(segment.restored_text()); | ||||||
|         segment.set_frame_shape(Gfx::FrameShape::Panel); |         segment.set_frame_shape(Gfx::FrameShape::Panel); | ||||||
|         if (segment.mode() != Segment::Mode::Proportional) |         if (segment.mode() != Segment::Mode::Proportional) | ||||||
|             segment.set_fixed_width(segment.restored_width()); |             segment.set_fixed_width(segment.restored_width()); | ||||||
|  | @ -95,7 +95,7 @@ void Statusbar::update_segment(size_t index) | ||||||
|             if (!m_segments[i].is_clickable()) |             if (!m_segments[i].is_clickable()) | ||||||
|                 m_segments[i].set_visible(false); |                 m_segments[i].set_visible(false); | ||||||
|         } |         } | ||||||
|         segment.set_text(segment.override_text()); |         segment.set_text_deprecated(segment.override_text()); | ||||||
|         segment.set_frame_shape(Gfx::FrameShape::NoFrame); |         segment.set_frame_shape(Gfx::FrameShape::NoFrame); | ||||||
|         if (segment.mode() != Segment::Mode::Proportional) |         if (segment.mode() != Segment::Mode::Proportional) | ||||||
|             segment.set_fixed_width(SpecialDimension::Grow); |             segment.set_fixed_width(SpecialDimension::Grow); | ||||||
|  | @ -104,7 +104,7 @@ void Statusbar::update_segment(size_t index) | ||||||
| 
 | 
 | ||||||
| DeprecatedString Statusbar::text(size_t index) const | DeprecatedString Statusbar::text(size_t index) const | ||||||
| { | { | ||||||
|     return m_segments.at(index).text(); |     return m_segments.at(index).text_deprecated(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Statusbar::set_text(DeprecatedString text) | void Statusbar::set_text(DeprecatedString text) | ||||||
|  | @ -157,8 +157,8 @@ void Statusbar::Segment::paint_event(PaintEvent& event) | ||||||
| 
 | 
 | ||||||
|     if (is_clickable()) |     if (is_clickable()) | ||||||
|         Button::paint_event(event); |         Button::paint_event(event); | ||||||
|     else if (!text().is_empty()) |     else if (!text_deprecated().is_empty()) | ||||||
|         painter.draw_text(rect().shrunken(font().max_glyph_width(), 0), text(), text_alignment(), palette().color(foreground_role()), Gfx::TextElision::Right, Gfx::TextWrapping::DontWrap); |         painter.draw_text(rect().shrunken(font().max_glyph_width(), 0), text_deprecated(), text_alignment(), palette().color(foreground_role()), Gfx::TextElision::Right, Gfx::TextWrapping::DontWrap); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Statusbar::Segment::mousedown_event(MouseEvent& event) | void Statusbar::Segment::mousedown_event(MouseEvent& event) | ||||||
|  |  | ||||||
|  | @ -56,18 +56,18 @@ private: | ||||||
|         if (action.icon()) |         if (action.icon()) | ||||||
|             set_icon(action.icon()); |             set_icon(action.icon()); | ||||||
|         else |         else | ||||||
|             set_text(action.text()); |             set_text_deprecated(action.text()); | ||||||
|         set_button_style(Gfx::ButtonStyle::Coolbar); |         set_button_style(Gfx::ButtonStyle::Coolbar); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     virtual void set_text(DeprecatedString text) override |     virtual void set_text_deprecated(DeprecatedString text) override | ||||||
|     { |     { | ||||||
|         auto const* action = this->action(); |         auto const* action = this->action(); | ||||||
|         VERIFY(action); |         VERIFY(action); | ||||||
| 
 | 
 | ||||||
|         set_tooltip(tooltip(*action)); |         set_tooltip(tooltip(*action)); | ||||||
|         if (!action->icon()) |         if (!action->icon()) | ||||||
|             Button::set_text(move(text)); |             Button::set_text_deprecated(move(text)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     DeprecatedString tooltip(Action const& action) const |     DeprecatedString tooltip(Action const& action) const | ||||||
|  |  | ||||||
|  | @ -122,9 +122,9 @@ void WizardDialog::update_navigation() | ||||||
|     m_back_button->set_enabled(m_page_stack.size() > 1); |     m_back_button->set_enabled(m_page_stack.size() > 1); | ||||||
|     if (has_pages()) { |     if (has_pages()) { | ||||||
|         m_next_button->set_enabled(current_page().is_final_page() || current_page().can_go_next()); |         m_next_button->set_enabled(current_page().is_final_page() || current_page().can_go_next()); | ||||||
|         m_next_button->set_text(current_page().is_final_page() ? "Finish" : "Next >"); |         m_next_button->set_text_deprecated(current_page().is_final_page() ? "Finish" : "Next >"); | ||||||
|     } else { |     } else { | ||||||
|         m_next_button->set_text("Next >"); |         m_next_button->set_text_deprecated("Next >"); | ||||||
|         m_next_button->set_enabled(false); |         m_next_button->set_enabled(false); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -71,9 +71,9 @@ ClockWidget::ClockWidget() | ||||||
|         } |         } | ||||||
|         m_calendar->update_tiles(view_year, view_month); |         m_calendar->update_tiles(view_year, view_month); | ||||||
|         if (m_calendar->mode() == GUI::Calendar::Year) |         if (m_calendar->mode() == GUI::Calendar::Year) | ||||||
|             m_selected_calendar_button->set_text(m_calendar->formatted_date(GUI::Calendar::YearOnly)); |             m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date(GUI::Calendar::YearOnly)); | ||||||
|         else |         else | ||||||
|             m_selected_calendar_button->set_text(m_calendar->formatted_date()); |             m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date()); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     m_selected_calendar_button = navigation_container.add<GUI::Button>(); |     m_selected_calendar_button = navigation_container.add<GUI::Button>(); | ||||||
|  | @ -82,9 +82,9 @@ ClockWidget::ClockWidget() | ||||||
|     m_selected_calendar_button->on_click = [&](auto) { |     m_selected_calendar_button->on_click = [&](auto) { | ||||||
|         m_calendar->toggle_mode(); |         m_calendar->toggle_mode(); | ||||||
|         if (m_calendar->mode() == GUI::Calendar::Year) |         if (m_calendar->mode() == GUI::Calendar::Year) | ||||||
|             m_selected_calendar_button->set_text(m_calendar->formatted_date(GUI::Calendar::YearOnly)); |             m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date(GUI::Calendar::YearOnly)); | ||||||
|         else |         else | ||||||
|             m_selected_calendar_button->set_text(m_calendar->formatted_date()); |             m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date()); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     m_next_date = navigation_container.add<GUI::Button>(); |     m_next_date = navigation_container.add<GUI::Button>(); | ||||||
|  | @ -105,9 +105,9 @@ ClockWidget::ClockWidget() | ||||||
|         } |         } | ||||||
|         m_calendar->update_tiles(view_year, view_month); |         m_calendar->update_tiles(view_year, view_month); | ||||||
|         if (m_calendar->mode() == GUI::Calendar::Year) |         if (m_calendar->mode() == GUI::Calendar::Year) | ||||||
|             m_selected_calendar_button->set_text(m_calendar->formatted_date(GUI::Calendar::YearOnly)); |             m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date(GUI::Calendar::YearOnly)); | ||||||
|         else |         else | ||||||
|             m_selected_calendar_button->set_text(m_calendar->formatted_date()); |             m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date()); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     auto& separator1 = root_container->add<GUI::HorizontalSeparator>(); |     auto& separator1 = root_container->add<GUI::HorizontalSeparator>(); | ||||||
|  | @ -118,14 +118,14 @@ ClockWidget::ClockWidget() | ||||||
|     calendar_container.layout()->set_margins({ 2 }); |     calendar_container.layout()->set_margins({ 2 }); | ||||||
| 
 | 
 | ||||||
|     m_calendar = calendar_container.add<GUI::Calendar>(); |     m_calendar = calendar_container.add<GUI::Calendar>(); | ||||||
|     m_selected_calendar_button->set_text(m_calendar->formatted_date()); |     m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date()); | ||||||
| 
 | 
 | ||||||
|     m_calendar->on_tile_click = [&] { |     m_calendar->on_tile_click = [&] { | ||||||
|         m_selected_calendar_button->set_text(m_calendar->formatted_date()); |         m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date()); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     m_calendar->on_month_click = [&] { |     m_calendar->on_month_click = [&] { | ||||||
|         m_selected_calendar_button->set_text(m_calendar->formatted_date()); |         m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date()); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     auto& separator2 = root_container->add<GUI::HorizontalSeparator>(); |     auto& separator2 = root_container->add<GUI::HorizontalSeparator>(); | ||||||
|  | @ -238,7 +238,7 @@ void ClockWidget::jump_to_current_date() | ||||||
|         m_calendar->toggle_mode(); |         m_calendar->toggle_mode(); | ||||||
|     m_calendar->set_selected_date(Core::DateTime::now()); |     m_calendar->set_selected_date(Core::DateTime::now()); | ||||||
|     m_calendar->update_tiles(Core::DateTime::now().year(), Core::DateTime::now().month()); |     m_calendar->update_tiles(Core::DateTime::now().year(), Core::DateTime::now().month()); | ||||||
|     m_selected_calendar_button->set_text(m_calendar->formatted_date()); |     m_selected_calendar_button->set_text_deprecated(m_calendar->formatted_date()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -78,7 +78,7 @@ ShutdownDialog::ShutdownDialog() | ||||||
|         auto action = options[i]; |         auto action = options[i]; | ||||||
|         auto& radio = right_container.add<GUI::RadioButton>(); |         auto& radio = right_container.add<GUI::RadioButton>(); | ||||||
|         radio.set_enabled(action.enabled); |         radio.set_enabled(action.enabled); | ||||||
|         radio.set_text(action.title); |         radio.set_text_deprecated(action.title); | ||||||
| 
 | 
 | ||||||
|         radio.on_checked = [this, i](auto) { |         radio.on_checked = [this, i](auto) { | ||||||
|             m_selected_option = i; |             m_selected_option = i; | ||||||
|  |  | ||||||
|  | @ -93,20 +93,20 @@ void TaskbarButton::paint_event(GUI::PaintEvent& event) | ||||||
| 
 | 
 | ||||||
|     Gfx::StylePainter::paint_button(painter, rect(), palette(), button_style(), is_being_pressed(), is_hovered(), is_checked(), is_enabled()); |     Gfx::StylePainter::paint_button(painter, rect(), palette(), button_style(), is_being_pressed(), is_hovered(), is_checked(), is_enabled()); | ||||||
| 
 | 
 | ||||||
|     if (text().is_empty()) |     if (text_deprecated().is_empty()) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|     auto content_rect = rect().shrunken(8, 2); |     auto content_rect = rect().shrunken(8, 2); | ||||||
|     auto icon_location = content_rect.center().translated(-(icon.width() / 2), -(icon.height() / 2)); |     auto icon_location = content_rect.center().translated(-(icon.width() / 2), -(icon.height() / 2)); | ||||||
|     if (!text().is_empty()) |     if (!text_deprecated().is_empty()) | ||||||
|         icon_location.set_x(content_rect.x()); |         icon_location.set_x(content_rect.x()); | ||||||
| 
 | 
 | ||||||
|     if (!text().is_empty()) { |     if (!text_deprecated().is_empty()) { | ||||||
|         content_rect.translate_by(icon.width() + 4, 0); |         content_rect.translate_by(icon.width() + 4, 0); | ||||||
|         content_rect.set_width(content_rect.width() - icon.width() - 4); |         content_rect.set_width(content_rect.width() - icon.width() - 4); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text()))), font.glyph_height() }; |     Gfx::IntRect text_rect { 0, 0, static_cast<int>(ceilf(font.width(text_deprecated()))), font.glyph_height() }; | ||||||
|     if (text_rect.width() > content_rect.width()) |     if (text_rect.width() > content_rect.width()) | ||||||
|         text_rect.set_width(content_rect.width()); |         text_rect.set_width(content_rect.width()); | ||||||
|     text_rect.align_within(content_rect, text_alignment()); |     text_rect.align_within(content_rect, text_alignment()); | ||||||
|  | @ -123,7 +123,7 @@ void TaskbarButton::paint_event(GUI::PaintEvent& event) | ||||||
|             adjusted_rect.set_width(adjusted_rect.width() + 1); |             adjusted_rect.set_width(adjusted_rect.width() + 1); | ||||||
|             adjusted_rect.set_height(adjusted_rect.height() + 1); |             adjusted_rect.set_height(adjusted_rect.height() + 1); | ||||||
|         } |         } | ||||||
|         paint_custom_progressbar(painter, adjusted_rect, text_rect, palette(), 0, 100, window.progress().value(), text(), font, text_alignment()); |         paint_custom_progressbar(painter, adjusted_rect, text_rect, palette(), 0, 100, window.progress().value(), text_deprecated(), font, text_alignment()); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (is_enabled()) { |     if (is_enabled()) { | ||||||
|  |  | ||||||
|  | @ -202,7 +202,7 @@ void TaskbarWindow::update_window_button(::Window& window, bool show_as_active) | ||||||
|     auto* button = window.button(); |     auto* button = window.button(); | ||||||
|     if (!button) |     if (!button) | ||||||
|         return; |         return; | ||||||
|     button->set_text(window.title()); |     button->set_text_deprecated(window.title()); | ||||||
|     button->set_tooltip(window.title()); |     button->set_tooltip(window.title()); | ||||||
|     button->set_checked(show_as_active); |     button->set_checked(show_as_active); | ||||||
|     button->set_visible(is_window_on_current_workspace(window)); |     button->set_visible(is_window_on_current_workspace(window)); | ||||||
|  | @ -393,5 +393,5 @@ void TaskbarWindow::workspace_change_event(unsigned current_row, unsigned curren | ||||||
| void TaskbarWindow::set_start_button_font(Gfx::Font const& font) | void TaskbarWindow::set_start_button_font(Gfx::Font const& font) | ||||||
| { | { | ||||||
|     m_start_button->set_font(font); |     m_start_button->set_font(font); | ||||||
|     m_start_button->set_fixed_size(font.width(m_start_button->text()) + 30, 21); |     m_start_button->set_fixed_size(font.width(m_start_button->text_deprecated()) + 30, 21); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Karol Kosek
						Karol Kosek