1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:18:11 +00:00
serenity/LibGUI/GWindow.h
Andreas Kling 7cf3c7461c Refactor GUI rendering model to be two-phased.
Instead of clients painting whenever they feel like it, we now ask that they
paint in response to a paint message.

After finishing painting, clients notify the WindowServer about the rect(s)
they painted into and then flush eventually happens, etc.

This stuff leaves us with a lot of badly named things. Need to fix that.
2019-01-26 05:20:32 +01:00

51 lines
1.1 KiB
C++

#pragma once
#include "GObject.h"
#include <SharedGraphics/Rect.h>
#include <SharedGraphics/GraphicsBitmap.h>
#include <AK/AKString.h>
class GWidget;
class GWindow final : public GObject {
public:
GWindow(GObject* parent = nullptr);
virtual ~GWindow() override;
static GWindow* from_window_id(int);
int window_id() const { return m_window_id; }
String title() const;
void set_title(String&&);
int x() const { return rect().x(); }
int y() const { return rect().y(); }
int width() const { return rect().width(); }
int height() const { return rect().height(); }
Rect rect() const;
void set_rect(const Rect&);
Point position() const { return rect().location(); }
virtual void event(GEvent&) override;
bool is_visible() const;
void close();
GWidget* main_widget() { return m_main_widget; }
const GWidget* main_widget() const { return m_main_widget; }
void set_main_widget(GWidget*);
void show();
void update(const Rect& = Rect());
private:
RetainPtr<GraphicsBitmap> m_backing;
int m_window_id { -1 };
GWidget* m_main_widget { nullptr };
};