1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:17:36 +00:00

Taskbar: Don't create buttons for modal windows

Since the user can't really do much with windows that are blocked
by a modal window, there is no point in showing multiple buttons.
This commit is contained in:
Tom 2020-07-15 17:44:42 -06:00 committed by Andreas Kling
parent bbdf0665fc
commit a269e3e573
5 changed files with 114 additions and 24 deletions

View file

@ -45,7 +45,10 @@ public:
m_button->remove_from_parent();
}
WindowIdentifier identifier() const { return m_identifier; }
const WindowIdentifier& identifier() const { return m_identifier; }
void set_parent_identifier(const WindowIdentifier& parent_identifier) { m_parent_identifier = parent_identifier; }
const WindowIdentifier& parent_identifier() const { return m_parent_identifier; }
String title() const { return m_title; }
void set_title(const String& title) { m_title = title; }
@ -62,12 +65,16 @@ public:
void set_minimized(bool minimized) { m_minimized = minimized; }
bool is_minimized() const { return m_minimized; }
void set_modal(bool modal) { m_modal = modal; }
bool is_modal() const { return m_modal; }
void set_progress(int progress)
{
if (m_progress == progress)
return;
m_progress = progress;
m_button->update();
if (m_button)
m_button->update();
}
int progress() const { return m_progress; }
@ -76,12 +83,14 @@ public:
private:
WindowIdentifier m_identifier;
WindowIdentifier m_parent_identifier;
String m_title;
Gfx::IntRect m_rect;
RefPtr<GUI::Button> m_button;
RefPtr<Gfx::Bitmap> m_icon;
bool m_active { false };
bool m_minimized { false };
bool m_modal { false };
int m_progress { -1 };
};
@ -96,12 +105,11 @@ public:
callback(*it.value);
}
Window* find_parent(const Window&);
Window* window(const WindowIdentifier&);
Window& ensure_window(const WindowIdentifier&);
void remove_window(const WindowIdentifier&);
Function<NonnullRefPtr<GUI::Button>(const WindowIdentifier&)> aid_create_button;
private:
HashMap<WindowIdentifier, NonnullOwnPtr<Window>> m_windows;
};