Debian Codegraph @

phoenix/qt/platform.moc.hpp

raw
1 namespace phoenix {
2
3 struct pApplication {
4 static XlibDisplay* display;
5
6 static void run();
7 static bool pendingEvents();
8 static void processEvents();
9 static void quit();
10
11 static void initialize();
12 static void syncX();
13 };
14
15 static QApplication* qtApplication = nullptr;
16
17 struct Settings : Configuration::Document {
18 bimap<Keyboard::Scancode, unsigned> keymap;
19
20 struct Geometry : Configuration::Node {
21 unsigned frameX;
22 unsigned frameY;
23 unsigned frameWidth;
24 unsigned frameHeight;
25 unsigned menuHeight;
26 unsigned statusHeight;
27 } geometry;
28
29 void load();
30 void save();
31 Settings();
32 };
33
34 struct pWindow;
35 struct pMenu;
36 struct pLayout;
37 struct pWidget;
38
39 struct pFont {
40 static string serif(unsigned size, string style);
41 static string sans(unsigned size, string style);
42 static string monospace(unsigned size, string style);
43 static Size size(string font, string text);
44
45 static QFont create(string description);
46 static Size size(const QFont& qtFont, string text);
47 };
48
49 struct pDesktop {
50 static Size size();
51 static Geometry workspace();
52 };
53
54 struct pMonitor {
55 static unsigned count();
56 static Geometry geometry(unsigned monitor);
57 static unsigned primary();
58 };
59
60 struct pKeyboard {
61 static bool pressed(Keyboard::Scancode scancode);
62 static vector<bool> state();
63
64 static void initialize();
65 };
66
67 struct pMouse {
68 static Position position();
69 static bool pressed(Mouse::Button button);
70 };
71
72 struct pBrowserWindow {
73 static string directory(BrowserWindow::State& state);
74 static string open(BrowserWindow::State& state);
75 static string save(BrowserWindow::State& state);
76 };
77
78 struct pMessageWindow {
79 static MessageWindow::Response error(MessageWindow::State& state);
80 static MessageWindow::Response information(MessageWindow::State& state);
81 static MessageWindow::Response question(MessageWindow::State& state);
82 static MessageWindow::Response warning(MessageWindow::State& state);
83 };
84
85 struct pObject {
86 Object& object;
87 bool locked;
88
89 pObject(Object& object) : object(object), locked(false) {}
90 virtual ~pObject() {}
91 void constructor() {}
92 void destructor() {}
93 };
94
95 struct pTimer : public QObject, public pObject {
96 Q_OBJECT
97
98 public:
99 Timer& timer;
100 QTimer* qtTimer;
101
102 void setEnabled(bool enabled);
103 void setInterval(unsigned interval);
104
105 pTimer(Timer& timer) : pObject(timer), timer(timer) {}
106 void constructor();
107 void destructor();
108
109 public slots:
110 void onActivate();
111 };
112
113 struct pWindow : public QObject, public pObject {
114 Q_OBJECT
115
116 public:
117 Window& window;
118 struct QtWindow : public QWidget {
119 pWindow& self;
120 void closeEvent(QCloseEvent*);
121 void dragEnterEvent(QDragEnterEvent*);
122 void dropEvent(QDropEvent*);
123 void keyPressEvent(QKeyEvent*);
124 void keyReleaseEvent(QKeyEvent*);
125 void moveEvent(QMoveEvent*);
126 void resizeEvent(QResizeEvent*);
127 QSize sizeHint() const;
128 QtWindow(pWindow& self) : self(self) {}
129 };
130 QtWindow* qtWindow;
131 QVBoxLayout* qtLayout;
132 QMenuBar* qtMenu;
133 QStatusBar* qtStatus;
134 QWidget* qtContainer;
135
136 void append(Layout& layout);
137 void append(Menu& menu);
138 void append(Widget& widget);
139 Geometry frameMargin();
140 bool focused();
141 Geometry geometry();
142 void remove(Layout& layout);
143 void remove(Menu& menu);
144 void remove(Widget& widget);
145 void setBackgroundColor(Color color);
146 void setDroppable(bool droppable);
147 void setFocused();
148 void setFullScreen(bool fullScreen);
149 void setGeometry(Geometry geometry);
150 void setMenuFont(string font);
151 void setMenuVisible(bool visible);
152 void setModal(bool modal);
153 void setResizable(bool resizable);
154 void setStatusFont(string font);
155 void setStatusText(string text);
156 void setStatusVisible(bool visible);
157 void setTitle(string text);
158 void setVisible(bool visible);
159 void setWidgetFont(string font);
160
161 pWindow(Window& window) : pObject(window), window(window) {}
162 void constructor();
163 void destructor();
164 void updateFrameGeometry();
165 };
166
167 struct pAction : public pObject {
168 Action& action;
169
170 void setEnabled(bool enabled);
171 void setFont(string font);
172 void setVisible(bool visible);
173
174 pAction(Action& action) : pObject(action), action(action) {}
175 void constructor();
176 void destructor();
177 };
178
179 struct pMenu : public pAction {
180 Menu& menu;
181 QMenu* qtMenu;
182
183 void append(Action& action);
184 void remove(Action& action);
185 void setFont(string font);
186 void setImage(const image& image);
187 void setText(string text);
188
189 pMenu(Menu& menu) : pAction(menu), menu(menu) {}
190 void constructor();
191 void destructor();
192 };
193
194 struct pSeparator : public pAction {
195 Separator& separator;
196 QAction* qtAction;
197
198 pSeparator(Separator& separator) : pAction(separator), separator(separator) {}
199 void constructor();
200 void destructor();
201 };
202
203 struct pItem : public QObject, public pAction {
204 Q_OBJECT
205
206 public:
207 Item& item;
208 QAction* qtAction;
209
210 void setImage(const image& image);
211 void setText(string text);
212
213 pItem(Item& item) : pAction(item), item(item) {}
214 void constructor();
215 void destructor();
216
217 public slots:
218 void onActivate();
219 };
220
221 struct pCheckItem : public QObject, public pAction {
222 Q_OBJECT
223
224 public:
225 CheckItem& checkItem;
226 QAction* qtAction;
227
228 void setChecked(bool checked);
229 void setText(string text);
230
231 pCheckItem(CheckItem& checkItem) : pAction(checkItem), checkItem(checkItem) {}
232 void constructor();
233 void destructor();
234
235 public slots:
236 void onToggle();
237 };
238
239 struct pRadioItem : public QObject, public pAction {
240 Q_OBJECT
241
242 public:
243 RadioItem& radioItem;
244 QAction* qtAction;
245 QActionGroup* qtGroup;
246
247 void setChecked();
248 void setGroup(const group<RadioItem>& group);
249 void setText(string text);
250
251 pRadioItem(RadioItem& radioItem) : pAction(radioItem), radioItem(radioItem) {}
252 void constructor();
253 void destructor();
254
255 public slots:
256 void onActivate();
257 };
258
259 struct pSizable : public pObject {
260 Sizable& sizable;
261
262 virtual Position displacement() { return {0, 0}; }
263
264 pSizable(Sizable& sizable) : pObject(sizable), sizable(sizable) {}
265
266 void constructor() {}
267 void destructor() {}
268 };
269
270 struct pLayout : public pSizable {
271 Layout& layout;
272
273 pLayout(Layout& layout) : pSizable(layout), layout(layout) {}
274
275 void constructor() {}
276 void destructor() {}
277 };
278
279 struct pWidget : public pSizable {
280 Widget& widget;
281 QWidget* qtWidget;
282
283 virtual QWidget* container(Widget& widget);
284 bool focused();
285 virtual Size minimumSize();
286 virtual void setEnabled(bool enabled);
287 void setFocused();
288 void setFont(string font);
289 virtual void setGeometry(Geometry geometry);
290 virtual void setVisible(bool visible);
291
292 pWidget(Widget& widget) : pSizable(widget), widget(widget) {}
293 void constructor();
294 void synchronizeState();
295 void destructor();
296 virtual void orphan();
297 };
298
299 struct pButton : public QObject, public pWidget {
300 Q_OBJECT
301
302 public:
303 Button& button;
304 QToolButton* qtButton;
305
306 Size minimumSize();
307 void setImage(const image& image, Orientation orientation);
308 void setText(string text);
309
310 pButton(Button& button) : pWidget(button), button(button) {}
311 void constructor();
312 void destructor();
313 void orphan();
314
315 public slots:
316 void onActivate();
317 };
318
319 struct pCanvas : public QObject, public pWidget {
320 Q_OBJECT
321
322 public:
323 Canvas& canvas;
324 QImage* surface = nullptr;
325 unsigned surfaceWidth = 0;
326 unsigned surfaceHeight = 0;
327 struct QtCanvas : public QWidget {
328 pCanvas& self;
329 void dragEnterEvent(QDragEnterEvent*);
330 void dropEvent(QDropEvent*);
331 void leaveEvent(QEvent*);
332 void mouseMoveEvent(QMouseEvent*);
333 void mousePressEvent(QMouseEvent*);
334 void mouseReleaseEvent(QMouseEvent*);
335 void paintEvent(QPaintEvent*);
336 QtCanvas(pCanvas& self);
337 };
338 QtCanvas* qtCanvas;
339
340 void setDroppable(bool droppable);
341 void setGeometry(Geometry geometry);
342 void setMode(Canvas::Mode mode);
343 void setSize(Size size);
344
345 pCanvas(Canvas& canvas) : pWidget(canvas), canvas(canvas) {}
346 void constructor();
347 void destructor();
348 void orphan();
349 void rasterize();
350 void release();
351
352 public slots:
353 };
354
355 struct pCheckButton : public QObject, public pWidget {
356 Q_OBJECT
357
358 public:
359 CheckButton& checkButton;
360 QToolButton* qtCheckButton;
361
362 Size minimumSize();
363 void setChecked(bool checked);
364 void setImage(const image& image, Orientation orientation);
365 void setText(string text);
366
367 pCheckButton(CheckButton& checkButton) : pWidget(checkButton), checkButton(checkButton) {}
368 void constructor();
369 void destructor();
370 void orphan();
371
372 public slots:
373 void onToggle(bool checked);
374 };
375
376 struct pCheckLabel : public QObject, public pWidget {
377 Q_OBJECT
378
379 public:
380 CheckLabel& checkLabel;
381 QCheckBox* qtCheckLabel;
382
383 Size minimumSize();
384 void setChecked(bool checked);
385 void setText(string text);
386
387 pCheckLabel(CheckLabel& checkLabel) : pWidget(checkLabel), checkLabel(checkLabel) {}
388 void constructor();
389 void destructor();
390 void orphan();
391
392 public slots:
393 void onToggle();
394 };
395
396 struct pComboButton : public QObject, public pWidget {
397 Q_OBJECT
398
399 public:
400 ComboButton& comboButton;
401 QComboBox* qtComboButton;
402
403 void append(string text);
404 Size minimumSize();
405 void remove(unsigned selection);
406 void reset();
407 unsigned selection();
408 void setSelection(unsigned selection);
409 void setText(unsigned selection, string text);
410
411 pComboButton(ComboButton& comboButton) : pWidget(comboButton), comboButton(comboButton) {}
412 void constructor();
413 void destructor();
414 void orphan();
415
416 public slots:
417 void onChange();
418 };
419
420 struct pConsole : public QObject, public pWidget {
421 Q_OBJECT
422
423 public:
424 Console& console;
425 struct QtConsole : public QTextEdit {
426 pConsole& self;
427 void keyPressEvent(QKeyEvent*);
428 void keyPressEventAcknowledge(QKeyEvent*);
429 QtConsole(pConsole& self) : self(self) {}
430 };
431 QtConsole* qtConsole;
432
433 void print(string text);
434 void reset();
435
436 pConsole(Console& console) : pWidget(console), console(console) {}
437 void constructor();
438 void destructor();
439 void orphan();
440 void keyPressEvent(QKeyEvent*);
441 };
442
443 struct pFrame : public QObject, public pWidget {
444 Q_OBJECT
445
446 public:
447 Frame& frame;
448 QGroupBox* qtFrame;
449
450 void setEnabled(bool enabled);
451 void setGeometry(Geometry geometry);
452 void setText(string text);
453 void setVisible(bool visible);
454
455 pFrame(Frame& frame) : pWidget(frame), frame(frame) {}
456 void constructor();
457 void destructor();
458 void orphan();
459 };
460
461 struct pHexEdit : public QObject, public pWidget {
462 Q_OBJECT
463
464 public:
465 HexEdit& hexEdit;
466 struct QtHexEdit : public QTextEdit {
467 pHexEdit& self;
468 void keyPressEvent(QKeyEvent*);
469 void keyPressEventAcknowledge(QKeyEvent*);
470 void wheelEvent(QWheelEvent*);
471 QtHexEdit(pHexEdit& self) : self(self) {}
472 };
473 struct QtHexEditScrollBar : public QScrollBar {
474 pHexEdit& self;
475 bool event(QEvent*);
476 QtHexEditScrollBar(pHexEdit& self) : QScrollBar(Qt::Vertical), self(self) {}
477 };
478 QtHexEdit* qtHexEdit;
479 QHBoxLayout* qtLayout;
480 QtHexEditScrollBar* qtScroll;
481
482 void setColumns(unsigned columns);
483 void setLength(unsigned length);
484 void setOffset(unsigned offset);
485 void setRows(unsigned rows);
486 void update();
487
488 pHexEdit(HexEdit& hexEdit) : pWidget(hexEdit), hexEdit(hexEdit) {}
489 void constructor();
490 void destructor();
491 void orphan();
492 void keyPressEvent(QKeyEvent*);
493 signed rows();
494 signed rowsScrollable();
495 void scrollTo(signed position);
496
497 public slots:
498 void onScroll();
499 };
500
501 struct pHorizontalScroller : public QObject, public pWidget {
502 Q_OBJECT
503
504 public:
505 HorizontalScroller& horizontalScroller;
506 QScrollBar* qtScroller;
507
508 Size minimumSize();
509 void setLength(unsigned length);
510 void setPosition(unsigned position);
511
512 pHorizontalScroller(HorizontalScroller& horizontalScroller) : pWidget(horizontalScroller), horizontalScroller(horizontalScroller) {}
513 void constructor();
514 void destructor();
515 void orphan();
516
517 public slots:
518 void onChange();
519 };
520
521 struct pHorizontalSlider : public QObject, public pWidget {
522 Q_OBJECT
523
524 public:
525 HorizontalSlider& horizontalSlider;
526 QSlider* qtSlider;
527
528 Size minimumSize();
529 void setLength(unsigned length);
530 void setPosition(unsigned position);
531
532 pHorizontalSlider(HorizontalSlider& horizontalSlider) : pWidget(horizontalSlider), horizontalSlider(horizontalSlider) {}
533 void constructor();
534 void destructor();
535 void orphan();
536
537 public slots:
538 void onChange();
539 };
540
541 struct pLabel : public pWidget {
542 Label& label;
543 QLabel* qtLabel;
544
545 Size minimumSize();
546 void setText(string text);
547
548 pLabel(Label& label) : pWidget(label), label(label) {}
549 void constructor();
550 void destructor();
551 void orphan();
552 };
553
554 struct pLineEdit : public QObject, public pWidget {
555 Q_OBJECT
556
557 public:
558 LineEdit& lineEdit;
559 QLineEdit* qtLineEdit;
560
561 Size minimumSize();
562 void setEditable(bool editable);
563 void setText(string text);
564 string text();
565
566 pLineEdit(LineEdit& lineEdit) : pWidget(lineEdit), lineEdit(lineEdit) {}
567 void constructor();
568 void destructor();
569 void orphan();
570
571 public slots:
572 void onActivate();
573 void onChange();
574 };
575
576 struct pListView : public QObject, public pWidget {
577 Q_OBJECT
578
579 public:
580 ListView& listView;
581 QTreeWidget* qtListView;
582
583 void append(const lstring& text);
584 void autoSizeColumns();
585 void remove(unsigned selection);
586 void reset();
587 void setCheckable(bool checkable);
588 void setChecked(unsigned selection, bool checked);
589 void setHeaderText(const lstring& text);
590 void setHeaderVisible(bool visible);
591 void setImage(unsigned selection, unsigned position, const image& image);
592 void setSelected(bool selected);
593 void setSelection(unsigned selection);
594 void setText(unsigned selection, unsigned position, string text);
595
596 pListView(ListView& listView) : pWidget(listView), listView(listView) {}
597 void constructor();
598 void destructor();
599 void orphan();
600
601 public slots:
602 void onActivate();
603 void onChange(QTreeWidgetItem* item);
604 void onToggle(QTreeWidgetItem* item);
605 };
606
607 struct pProgressBar : public pWidget {
608 ProgressBar& progressBar;
609 QProgressBar* qtProgressBar;
610
611 Size minimumSize();
612 void setPosition(unsigned position);
613
614 pProgressBar(ProgressBar& progressBar) : pWidget(progressBar), progressBar(progressBar) {}
615 void constructor();
616 void destructor();
617 void orphan();
618 };
619
620 struct pRadioLabel : public QObject, public pWidget {
621 Q_OBJECT
622
623 public:
624 RadioLabel& radioLabel;
625 QRadioButton* qtRadioLabel;
626
627 bool checked();
628 Size minimumSize();
629 void setChecked();
630 void setGroup(const group<RadioLabel>& group);
631 void setText(string text);
632
633 pRadioLabel(RadioLabel& radioLabel) : pWidget(radioLabel), radioLabel(radioLabel) {}
634 pRadioLabel& parent();
635 void constructor();
636 void destructor();
637 void orphan();
638
639 public slots:
640 void onActivate();
641 };
642
643 struct pRadioButton : public QObject, public pWidget {
644 Q_OBJECT
645
646 public:
647 RadioButton& radioButton;
648 QToolButton* qtRadioButton;
649
650 Size minimumSize();
651 void setChecked();
652 void setGroup(const group<RadioButton>& group);
653 void setImage(const image& image, Orientation orientation);
654 void setText(string text);
655
656 pRadioButton(RadioButton& radioButton) : pWidget(radioButton), radioButton(radioButton) {}
657 pRadioButton& parent();
658 void constructor();
659 void destructor();
660 void orphan();
661
662 public slots:
663 void onActivate();
664 };
665
666 struct pTabFrame : public QObject, public pWidget {
667 Q_OBJECT
668
669 public:
670 TabFrame& tabFrame;
671 QTabWidget* qtTabFrame;
672
673 void append(string text, const image& image);
674 QWidget* container(Widget& widget);
675 Position displacement();
676 void remove(unsigned selection);
677 void setEnabled(bool enabled);
678 void setGeometry(Geometry geometry);
679 void setImage(unsigned selection, const image& image);
680 void setSelection(unsigned selection);
681 void setText(unsigned selection, string text);
682 void setVisible(bool visible);
683
684 pTabFrame(TabFrame& tabFrame) : pWidget(tabFrame), tabFrame(tabFrame) {}
685 void constructor();
686 void destructor();
687 void orphan();
688 void synchronizeLayout();
689
690 public slots:
691 void onChange(int selection);
692 };
693
694 struct pTextEdit : public QObject, public pWidget {
695 Q_OBJECT
696
697 public:
698 TextEdit& textEdit;
699 QTextEdit* qtTextEdit;
700
701 void setCursorPosition(unsigned position);
702 void setEditable(bool editable);
703 void setText(string text);
704 void setWordWrap(bool wordWrap);
705 string text();
706
707 pTextEdit(TextEdit& textEdit) : pWidget(textEdit), textEdit(textEdit) {}
708 void constructor();
709 void destructor();
710 void orphan();
711
712 public slots:
713 void onChange();
714 };
715
716 struct pVerticalScroller : public QObject, public pWidget {
717 Q_OBJECT
718
719 public:
720 VerticalScroller& verticalScroller;
721 QScrollBar* qtScroller;
722
723 Size minimumSize();
724 void setLength(unsigned length);
725 void setPosition(unsigned position);
726
727 pVerticalScroller(VerticalScroller& verticalScroller) : pWidget(verticalScroller), verticalScroller(verticalScroller) {}
728 void constructor();
729 void destructor();
730 void orphan();
731
732 public slots:
733 void onChange();
734 };
735
736 struct pVerticalSlider : public QObject, public pWidget {
737 Q_OBJECT
738
739 public:
740 VerticalSlider& verticalSlider;
741 QSlider* qtSlider;
742
743 Size minimumSize();
744 void setLength(unsigned length);
745 void setPosition(unsigned position);
746
747 pVerticalSlider(VerticalSlider& verticalSlider) : pWidget(verticalSlider), verticalSlider(verticalSlider) {}
748 void constructor();
749 void destructor();
750 void orphan();
751
752 public slots:
753 void onChange();
754 };
755
756 struct pViewport : public pWidget {
757 Viewport& viewport;
758 struct QtViewport : public QWidget {
759 pViewport& self;
760 void dragEnterEvent(QDragEnterEvent*);
761 void dropEvent(QDropEvent*);
762 void leaveEvent(QEvent*);
763 void mouseMoveEvent(QMouseEvent*);
764 void mousePressEvent(QMouseEvent*);
765 void mouseReleaseEvent(QMouseEvent*);
766 QtViewport(pViewport& self);
767 };
768 QtViewport* qtViewport;
769
770 uintptr_t handle();
771 void setDroppable(bool droppable);
772
773 pViewport(Viewport& viewport) : pWidget(viewport), viewport(viewport) {}
774 void constructor();
775 void destructor();
776 void orphan();
777 };
778
779 }