ladybird/Widgets/Size.h
Andreas Kling b0e3f73375 Start refactoring the windowing system to use an event loop.
Userspace programs can now open /dev/gui_events and read a stream of GUI_Event
structs one at a time.

I was stuck on a stupid problem where we'd reenter Scheduler::yield() due to
having one of the has_data_available_for_reading() implementations using locks.
2019-01-14 14:42:49 +01:00

32 lines
620 B
C++

#pragma once
struct GUI_Size;
class Size {
public:
Size() { }
Size(int w, int h) : m_width(w), m_height(h) { }
Size(const GUI_Size&);
bool is_empty() const { return !m_width || !m_height; }
int width() const { return m_width; }
int height() const { return m_height; }
void setWidth(int w) { m_width = w; }
void setHeight(int h) { m_height = h; }
bool operator==(const Size& other) const
{
return m_width == other.m_width &&
m_height == other.m_height;
}
operator GUI_Size() const;
private:
int m_width { 0 };
int m_height { 0 };
};