ladybird/Servers/WindowServer/WSMenuManager.h
Jesse Buhagiar d0c11bbcc3 WindowServer: Fixed Menubar resize issue
The menubar bar wasn't being resized correctly, as the underlying Window
was never being resized when `DisplayProperties` was chaning the
resolution while the system was running. `m_window` now gets the
correct window size when it's been updated, so a reboot isn't required.
2019-10-31 19:00:35 +01:00

43 lines
961 B
C++

#pragma once
#include "WSMenu.h"
#include <LibCore/CObject.h>
#include <LibCore/CTimer.h>
#include <WindowServer/WSCPUMonitor.h>
#include <WindowServer/WSWindow.h>
class WSMenuManager final : public CObject {
C_OBJECT(WSMenuManager)
public:
WSMenuManager();
virtual ~WSMenuManager() override;
void setup();
void refresh();
virtual void event(CEvent&) override;
bool is_open(const WSMenu&) const;
Vector<WeakPtr<WSMenu>>& open_menu_stack() { return m_open_menu_stack; }
void set_needs_window_resize();
private:
WSWindow& window() { return *m_window; }
const WSWindow& window() const { return *m_window; }
void handle_menu_mouse_event(WSMenu&, const WSMouseEvent&);
void draw();
void tick_clock();
RefPtr<WSWindow> m_window;
WSCPUMonitor m_cpu_monitor;
String m_username;
RefPtr<CTimer> m_timer;
Vector<WeakPtr<WSMenu>> m_open_menu_stack;
bool m_needs_window_resize;
};