2019-02-11 14:43:43 +01:00
|
|
|
#pragma once
|
|
|
|
|
2019-03-03 12:32:15 +01:00
|
|
|
#include <AK/Badge.h>
|
|
|
|
#include <AK/HashMap.h>
|
2019-05-28 11:53:16 +02:00
|
|
|
#include <AK/OwnPtr.h>
|
2019-03-03 12:32:15 +01:00
|
|
|
#include <LibGUI/GShortcut.h>
|
2019-02-11 14:43:43 +01:00
|
|
|
|
2019-09-22 20:50:39 +02:00
|
|
|
class CEventLoop;
|
2019-03-03 12:32:15 +01:00
|
|
|
class GAction;
|
2019-07-23 18:16:25 +02:00
|
|
|
class GKeyEvent;
|
2019-02-11 14:43:43 +01:00
|
|
|
class GMenuBar;
|
2019-07-23 18:16:25 +02:00
|
|
|
class GWindow;
|
2019-04-08 18:58:44 +02:00
|
|
|
class Point;
|
2019-02-11 14:43:43 +01:00
|
|
|
|
|
|
|
class GApplication {
|
|
|
|
public:
|
2019-02-11 14:56:23 +01:00
|
|
|
static GApplication& the();
|
2019-02-11 14:43:43 +01:00
|
|
|
GApplication(int argc, char** argv);
|
2019-02-11 14:56:23 +01:00
|
|
|
~GApplication();
|
2019-02-11 14:43:43 +01:00
|
|
|
|
|
|
|
int exec();
|
2019-05-08 01:15:41 +02:00
|
|
|
void quit(int = 0);
|
2019-02-11 14:43:43 +01:00
|
|
|
|
|
|
|
void set_menubar(OwnPtr<GMenuBar>&&);
|
2019-03-03 12:32:15 +01:00
|
|
|
GAction* action_for_key_event(const GKeyEvent&);
|
|
|
|
|
2019-04-20 21:56:56 +02:00
|
|
|
void register_global_shortcut_action(Badge<GAction>, GAction&);
|
|
|
|
void unregister_global_shortcut_action(Badge<GAction>, GAction&);
|
2019-02-11 14:43:43 +01:00
|
|
|
|
2019-06-02 14:58:02 +02:00
|
|
|
void show_tooltip(const StringView&, const Point& screen_location);
|
2019-04-08 18:58:44 +02:00
|
|
|
void hide_tooltip();
|
|
|
|
|
2019-07-23 18:16:25 +02:00
|
|
|
bool quit_when_last_window_deleted() const { return m_quit_when_last_window_deleted; }
|
|
|
|
void set_quit_when_last_window_deleted(bool b) { m_quit_when_last_window_deleted = b; }
|
|
|
|
|
2019-10-25 00:23:35 -05:00
|
|
|
void did_create_window(Badge<GWindow>);
|
2019-07-23 18:16:25 +02:00
|
|
|
void did_delete_last_window(Badge<GWindow>);
|
|
|
|
|
2019-10-06 22:38:19 +11:00
|
|
|
const String& invoked_as() const { return m_invoked_as; }
|
|
|
|
const Vector<String>& args() const { return m_args; }
|
|
|
|
|
2019-02-11 14:43:43 +01:00
|
|
|
private:
|
2019-09-22 20:50:39 +02:00
|
|
|
OwnPtr<CEventLoop> m_event_loop;
|
2019-02-11 14:43:43 +01:00
|
|
|
OwnPtr<GMenuBar> m_menubar;
|
2019-04-20 21:56:56 +02:00
|
|
|
HashMap<GShortcut, GAction*> m_global_shortcut_actions;
|
2019-04-08 18:58:44 +02:00
|
|
|
class TooltipWindow;
|
|
|
|
TooltipWindow* m_tooltip_window { nullptr };
|
2019-07-23 18:16:25 +02:00
|
|
|
bool m_quit_when_last_window_deleted { true };
|
2019-10-06 22:38:19 +11:00
|
|
|
String m_invoked_as;
|
|
|
|
Vector<String> m_args;
|
2019-02-11 14:43:43 +01:00
|
|
|
};
|