mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 15:47:42 +00:00
LibGUI: Add a cancel button callback to settings window tabs
Some settings tabs, like the ones on the upcoming terminal settings, need to know when the cancel button is pressed to clean up things like temporary live updates. Therefore, the SettingsWindow::Tab now features a cancel_settings callback which does not need to be implemented.
This commit is contained in:
parent
72e9d024b9
commit
1e9554145e
2 changed files with 4 additions and 1 deletions
|
@ -58,6 +58,8 @@ SettingsWindow::SettingsWindow(StringView title, ShowDefaultsButton show_default
|
|||
m_cancel_button = button_container.add<GUI::Button>("Cancel");
|
||||
m_cancel_button->set_fixed_width(75);
|
||||
m_cancel_button->on_click = [&](auto) {
|
||||
for (auto& tab : m_tabs)
|
||||
tab.cancel_settings();
|
||||
GUI::Application::the()->quit();
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,8 @@ public:
|
|||
class Tab : public GUI::Widget {
|
||||
public:
|
||||
virtual void apply_settings() = 0;
|
||||
virtual void reset_default_values() {};
|
||||
virtual void cancel_settings() { }
|
||||
virtual void reset_default_values() { }
|
||||
};
|
||||
|
||||
enum class ShowDefaultsButton {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue