mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
WindowServer: Add a window switcher.
This needs some work on the window ordering and things like that, but it works quite nicely as a starting point. The keyboard shortcut is Logo+Tab. :^)
This commit is contained in:
parent
483e0a5526
commit
5c27e74fac
7 changed files with 277 additions and 50 deletions
38
WindowServer/WSWindowSwitcher.h
Normal file
38
WindowServer/WSWindowSwitcher.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#pragma once
|
||||
|
||||
#include <SharedGraphics/Rect.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
|
||||
class Painter;
|
||||
class WSKeyEvent;
|
||||
class WSWindow;
|
||||
|
||||
class WSWindowSwitcher {
|
||||
public:
|
||||
WSWindowSwitcher();
|
||||
~WSWindowSwitcher();
|
||||
|
||||
bool is_visible() const { return m_visible; }
|
||||
void set_visible(bool);
|
||||
|
||||
void show() { set_visible(true); }
|
||||
void hide() { set_visible(false); }
|
||||
|
||||
void on_key_event(const WSKeyEvent&);
|
||||
void invalidate();
|
||||
|
||||
void draw(Painter&);
|
||||
|
||||
int item_height() { return 20; }
|
||||
int padding() { return 8; }
|
||||
|
||||
WSWindow* selected_window();
|
||||
|
||||
private:
|
||||
|
||||
Rect m_rect;
|
||||
bool m_visible { false };
|
||||
Vector<WeakPtr<WSWindow>> m_windows;
|
||||
int m_selected_index { 0 };
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue