ui/qt/toolkit.h

changeset 103
6606616eca9f
parent 0
2483f517c562
equal deleted inserted replaced
102:64ded9f6a6c6 103:6606616eca9f
33 #include "../common/context.h" 33 #include "../common/context.h"
34 #include "../common/object.h" 34 #include "../common/object.h"
35 35
36 #include <QApplication> 36 #include <QApplication>
37 37
38 class UiEventWrapper;
39
40 typedef void (*ui_prepare_event_func)(UiEvent *event, UiEventWrapper *wrapper);
41
38 class UiEventWrapper : public QObject { 42 class UiEventWrapper : public QObject {
39 Q_OBJECT 43 Q_OBJECT
40 44
41 UiObject *obj; 45 UiObject *obj;
42 ui_callback callback; 46 ui_callback callback;
43 void *userdata; 47 void *userdata;
44 48
45 public: 49 public:
50 UiVar *var;
51
52 void *customdata1 = nullptr;
53 void *customdata2 = nullptr;
54 int customvalue1 = 0;
55 int customvalue2 = 0;
56
57 ui_prepare_event_func prepare_event = nullptr;
58
46 UiEventWrapper(UiObject *obj, ui_callback f, void *userdata); 59 UiEventWrapper(UiObject *obj, ui_callback f, void *userdata);
47 60
48 public slots: 61 public slots:
49 void slot(); 62 void slot();
63 void destroy();
50 }; 64 };
51 65
66 class UiAction;
67
68 typedef void (*ui_prepare_action_event_func)(UiEvent *event, UiAction *action);
69
70 class UiAction : public QAction {
71 Q_OBJECT
72
73 UiObject *obj;
74 ui_callback callback;
75 void *userdata;
76
77 public:
78 UiVar *var;
79
80 ui_prepare_action_event_func prepare_event = nullptr;
81 void *customdata1 = nullptr;
82 void *customdata2 = nullptr;
83 int customvalue1 = 0;
84 int customvalue2 = 0;
85
86 UiAction(UiObject *obj, QString &label, ui_callback f, void *userdata);
87 ~UiAction();
88
89 private slots:
90 void trigger();
91 };
92
93 void ui_action_enable(UiAction *action, int enable);
52 94
53 #endif /* TOOLKIT_H */ 95 #endif /* TOOLKIT_H */
54 96

mercurial