2019-03-03 15:17:05 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Vector.h>
|
|
|
|
#include <AK/WeakPtr.h>
|
2019-04-14 05:15:22 +02:00
|
|
|
#include <LibCore/CObject.h>
|
2019-07-18 10:15:00 +02:00
|
|
|
#include <LibDraw/Rect.h>
|
2019-03-03 15:17:05 +01:00
|
|
|
|
|
|
|
class Painter;
|
|
|
|
class WSKeyEvent;
|
|
|
|
class WSWindow;
|
|
|
|
|
2019-04-14 05:15:22 +02:00
|
|
|
class WSWindowSwitcher : public CObject {
|
2019-07-25 19:49:28 +02:00
|
|
|
C_OBJECT(WSWindowSwitcher)
|
2019-03-03 15:17:05 +01:00
|
|
|
public:
|
2019-05-12 04:15:25 +02:00
|
|
|
static WSWindowSwitcher& the();
|
|
|
|
|
2019-03-03 15:17:05 +01:00
|
|
|
WSWindowSwitcher();
|
2019-03-06 10:03:10 +01:00
|
|
|
virtual ~WSWindowSwitcher() override;
|
2019-03-03 15:17:05 +01:00
|
|
|
|
|
|
|
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&);
|
2019-03-06 10:03:10 +01:00
|
|
|
void refresh();
|
2019-05-12 04:15:25 +02:00
|
|
|
void refresh_if_needed();
|
2019-03-03 15:17:05 +01:00
|
|
|
|
2019-03-06 10:03:10 +01:00
|
|
|
void draw();
|
2019-03-03 15:17:05 +01:00
|
|
|
|
2019-05-12 04:15:25 +02:00
|
|
|
int thumbnail_width() { return 40; }
|
|
|
|
int thumbnail_height() { return 40; }
|
|
|
|
|
|
|
|
int item_height() { return 10 + thumbnail_height(); }
|
2019-03-03 15:17:05 +01:00
|
|
|
int padding() { return 8; }
|
2019-04-23 22:01:33 +02:00
|
|
|
int item_padding() { return 8; }
|
2019-03-03 15:17:05 +01:00
|
|
|
|
|
|
|
WSWindow* selected_window();
|
|
|
|
|
2019-03-06 10:03:10 +01:00
|
|
|
WSWindow* switcher_window() { return m_switcher_window.ptr(); }
|
|
|
|
|
2019-03-03 15:17:05 +01:00
|
|
|
private:
|
2019-03-06 10:03:10 +01:00
|
|
|
OwnPtr<WSWindow> m_switcher_window;
|
2019-03-03 15:17:05 +01:00
|
|
|
Rect m_rect;
|
|
|
|
bool m_visible { false };
|
|
|
|
Vector<WeakPtr<WSWindow>> m_windows;
|
|
|
|
int m_selected_index { 0 };
|
|
|
|
};
|