Add Window::GetWidth()

This commit is contained in:
scorpion-26 2023-06-10 23:43:03 +02:00
parent 6815d8e017
commit a34ffd8334
2 changed files with 9 additions and 0 deletions

View file

@ -138,3 +138,10 @@ void Window::SetMargin(Anchor anchor, int32_t margin)
UpdateMargin(); UpdateMargin();
} }
} }
int Window::GetWidth() const
{
GdkRectangle rect{};
gdk_monitor_get_geometry(m_Monitor, &rect);
return rect.width;
}

View file

@ -32,6 +32,8 @@ public:
void SetMainWidget(std::unique_ptr<Widget>&& mainWidget); void SetMainWidget(std::unique_ptr<Widget>&& mainWidget);
int GetWidth() const;
private: private:
void UpdateMargin(); void UpdateMargin();