8 #ifndef Guit_Control_hpp
9 #define Guit_Control_hpp
15 #include <gcursor.hpp>
18 #define GIMPLEMENT_GADGET_TYPE(T) \
19 G##T::GType& G##T::Type() {static auto* t = new G##T::GType(#T); return *t;} \
21 #define GIMPLEMENT_GADGET(T) GIMPLEMENT_GADGET_TYPE(T) \
22 G##T& T(GString const& spec) {return *new G##T(spec);}
24 #define GIMPLEMENT_GADGET_ALL(T,Super) GIMPLEMENT_GADGET(T) \
25 G##T::G##T(GString const& spec) : Super(Type(), spec) {} \
26 G##T& G##T::clone(GClone const& c) { \
27 auto* g = new G##T; g->initClone(*this, c); return *g; \
30 #define GIMPLEMENT_PROP_TYPE(T,R) \
31 G##T::GType& G##T::Type() {static auto* t = new G##T::GType(#T,R); return *t;}
33 #define GIMPLEMENT_PROP(T,R) GIMPLEMENT_PROP_TYPE(T,R) \
34 G##T& T() {return *new G##T;} \
35 G##T& T(GString const& val) {return *new G##T(val);}
49 bool find_{}, catchedevent_{};
50 Gadget *catchedchild_{};
51 std::function<bool(Gadget&)> pred_{};
72 GEventState buttonstate{};
75 using GChannels = std::vector<GChannel*>;
78 class GHotkeys :
public std::map<uint64_t, gptr<Gadget>> {};
82 class GCore :
public GPrefs {
85 GCore(GCore
const&) =
delete;
86 GCore(GCore
const&&) =
delete;
87 void operator=(GCore
const&) =
delete;
88 void operator=(GCore
const&&) =
delete;
91 struct BeginPlainObjects {
92 BeginPlainObjects() {GCore::setPlainMode(
true);}
94 struct EndPlainObjects {
95 EndPlainObjects() {GCore::setPlainMode(
false);}
98 static int start(GWindow* mainwindow);
99 static void exit(
int status);
100 static void subLoop(
const bool& quit);
101 static bool isRunning();
102 static GTime elapsedTime();
103 static class GNatContext* natApp();
105 static GId getId(GString
const& name,
bool obtain);
106 static GId findId(GString
const& name) {
return getId(name,
false);}
107 static GId obtainId(GString
const& name) {
return getId(name,
true);}
109 static GChannel* channel(
unsigned int id);
110 static GChannel& obtainChannel();
111 static GChannel& obtainChannel(
unsigned int id);
112 static GChannels& channels();
114 static void paintAll();
115 static GWindow* mainWindow();
116 static GWindow* modalWindow();
117 static GStyle* mainWindowStyle();
118 static std::list<GWindow*>& windowList();
119 static void addWindow(GWindow&);
120 static void removeWindow(GWindow&);
121 static void setModalWindow(GWindow*);
122 static void showOverlay(GBox& overlay, Gadget* opener,
123 bool state,
bool autoclose,
bool showaswin);
124 static void updateLayout(GWindow* upd_win, Gadget* upd_root,
bool upd_css);
125 static void requestUpdate();
127 static void printClassSizes();
128 static bool plainMode();
129 static void setPlainMode(
bool mode);
131 static int inspecting() {
return inspecting_;}
132 static Gadget* inspected() {
return inspected_;}
135 static const char** argv_;
136 static class GTheme* theme_;
137 static class GInspector* inspector_;
138 static int inspecting_;
139 static Gadget* inspected_;
140 static std::function<void(Gadget*)> doinspect_;