mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:47:44 +00:00
CatDog: Remove global menu and add context menu
There was no way to close catdog since it relied on global menus, this adds a context menu for opening the about dialog and quitting. Fixes #7252
This commit is contained in:
parent
9c963fa17b
commit
e5367c13d8
3 changed files with 18 additions and 9 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
@ -19,11 +20,13 @@ public:
|
|||
virtual void paint_event(GUI::PaintEvent& event) override;
|
||||
virtual void mousemove_event(GUI::MouseEvent& event) override;
|
||||
virtual void mousedown_event(GUI::MouseEvent& event) override;
|
||||
virtual void context_menu_event(GUI::ContextMenuEvent& event) override;
|
||||
|
||||
void track_cursor_globally();
|
||||
void start_the_timer() { m_timer.start(); }
|
||||
|
||||
Function<void()> on_click;
|
||||
Function<void(GUI::ContextMenuEvent&)> on_context_menu_request;
|
||||
|
||||
bool roaming() const { return m_roaming; }
|
||||
void set_roaming(bool roaming)
|
||||
|
@ -40,6 +43,7 @@ public:
|
|||
private:
|
||||
Gfx::IntPoint m_temp_pos;
|
||||
Core::ElapsedTimer m_timer;
|
||||
|
||||
int m_curr_frame = 1;
|
||||
int m_moveX, m_moveY = 0;
|
||||
bool m_up, m_down, m_left, m_right, m_sleeping = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue