ladybird/Widgets/AbstractScreen.h

41 lines
1.1 KiB
C
Raw Normal View History

2018-10-10 15:12:38 +02:00
#pragma once
2018-10-10 16:49:36 +02:00
#include "Object.h"
2018-10-14 00:21:42 +02:00
#include "Rect.h"
#include "Size.h"
#include "PS2MouseDevice.h"
2018-10-10 16:49:36 +02:00
class AbstractScreen : public Object, public MouseClient {
2018-10-10 15:12:38 +02:00
public:
virtual ~AbstractScreen();
int width() const { return m_width; }
int height() const { return m_height; }
2018-10-10 15:12:38 +02:00
static AbstractScreen& the();
Size size() const { return { width(), height() }; }
2018-10-14 00:21:42 +02:00
Rect rect() const { return { 0, 0, width(), height() }; }
static void initialize();
Point cursor_location() const { return m_cursor_location; }
bool left_mouse_button_pressed() const { return m_left_mouse_button_pressed; }
bool right_mouse_button_pressed() const { return m_right_mouse_button_pressed; }
2018-10-10 15:12:38 +02:00
protected:
AbstractScreen(unsigned width, unsigned height);
private:
// ^MouseClient
virtual void did_receive_mouse_data(int dx, int dy, bool left_button, bool right_button) final;
int m_width { 0 };
int m_height { 0 };
Point m_cursor_location;
bool m_left_mouse_button_pressed { false };
bool m_right_mouse_button_pressed { false };
2018-10-10 15:12:38 +02:00
};