mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
WindowServer+Base: Show alternate close button for "modified" windows
Windows that are marked as modified will now have another (themable) close button. This gives an additional visual clue that some action will be required by the user before the window gets closed. The default window-close-modified icon is an "X" with "..." underneath, building on the established use of "..." in menus to signify that additional user input will be required before an action is completed.
This commit is contained in:
parent
819325892a
commit
f052a66c5d
8 changed files with 13 additions and 2 deletions
|
@ -38,6 +38,7 @@ static Gfx::Bitmap* s_minimize_icon;
|
|||
static Gfx::Bitmap* s_maximize_icon;
|
||||
static Gfx::Bitmap* s_restore_icon;
|
||||
static Gfx::Bitmap* s_close_icon;
|
||||
static Gfx::Bitmap* s_close_modified_icon;
|
||||
|
||||
static String s_last_title_button_icons_path;
|
||||
static int s_last_title_button_icons_scale;
|
||||
|
@ -102,7 +103,7 @@ void WindowFrame::set_button_icons()
|
|||
if (m_window.is_frameless())
|
||||
return;
|
||||
|
||||
m_close_button->set_icon(*s_close_icon);
|
||||
m_close_button->set_icon(m_window.is_modified() ? *s_close_modified_icon : *s_close_icon);
|
||||
if (m_window.is_minimizable())
|
||||
m_minimize_button->set_icon(*s_minimize_icon);
|
||||
if (m_window.is_resizable())
|
||||
|
@ -151,6 +152,15 @@ void WindowFrame::reload_config()
|
|||
s_close_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close.png", icons_scale).leak_ref();
|
||||
full_path.clear();
|
||||
}
|
||||
if (!s_close_modified_icon || s_last_title_button_icons_path != icons_path || s_last_title_button_icons_scale != icons_scale) {
|
||||
full_path.append(icons_path);
|
||||
full_path.append("window-close-modified.png");
|
||||
if (s_close_modified_icon)
|
||||
s_close_modified_icon->unref();
|
||||
if (!(s_close_modified_icon = Gfx::Bitmap::load_from_file(full_path.to_string(), icons_scale).leak_ref()))
|
||||
s_close_modified_icon = Gfx::Bitmap::load_from_file("/res/icons/16x16/window-close-modified.png", icons_scale).leak_ref();
|
||||
full_path.clear();
|
||||
}
|
||||
|
||||
s_last_title_button_icons_path = icons_path;
|
||||
s_last_title_button_icons_scale = icons_scale;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue