1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 16:07:45 +00:00

LibGUI+Userland: Add _deprecated suffix to AbstractButton::{set_,}text

This commit is contained in:
Karol Kosek 2023-02-12 11:13:18 +01:00 committed by Linus Groh
parent 61b49daf0a
commit d32b052f22
30 changed files with 83 additions and 83 deletions

View file

@ -71,9 +71,9 @@ ClockWidget::ClockWidget()
}
m_calendar->update_tiles(view_year, view_month);
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
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>();
@ -82,9 +82,9 @@ ClockWidget::ClockWidget()
m_selected_calendar_button->on_click = [&](auto) {
m_calendar->toggle_mode();
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
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>();
@ -105,9 +105,9 @@ ClockWidget::ClockWidget()
}
m_calendar->update_tiles(view_year, view_month);
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
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>();
@ -118,14 +118,14 @@ ClockWidget::ClockWidget()
calendar_container.layout()->set_margins({ 2 });
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_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_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>();
@ -238,7 +238,7 @@ void ClockWidget::jump_to_current_date()
m_calendar->toggle_mode();
m_calendar->set_selected_date(Core::DateTime::now());
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());
}
}

View file

@ -78,7 +78,7 @@ ShutdownDialog::ShutdownDialog()
auto action = options[i];
auto& radio = right_container.add<GUI::RadioButton>();
radio.set_enabled(action.enabled);
radio.set_text(action.title);
radio.set_text_deprecated(action.title);
radio.on_checked = [this, i](auto) {
m_selected_option = i;

View file

@ -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());
if (text().is_empty())
if (text_deprecated().is_empty())
return;
auto content_rect = rect().shrunken(8, 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());
if (!text().is_empty()) {
if (!text_deprecated().is_empty()) {
content_rect.translate_by(icon.width() + 4, 0);
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())
text_rect.set_width(content_rect.width());
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_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()) {

View file

@ -202,7 +202,7 @@ void TaskbarWindow::update_window_button(::Window& window, bool show_as_active)
auto* button = window.button();
if (!button)
return;
button->set_text(window.title());
button->set_text_deprecated(window.title());
button->set_tooltip(window.title());
button->set_checked(show_as_active);
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)
{
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);
}