Debian Codegraph @

sys/DataGui.h

raw symbols SCIP
1 #ifndef _DataGui_h_
2 #define _DataGui_h_
3 /* DataGui.h
4 *
5 * Copyright (C) 2022 Paul Boersma
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "Data.h"
22 #include "Preferences.h"
23
24 #include "DataGui_enums.h"
25
26 extern MelderColour
27 DataGuiColour_WINDOW_BACKGROUND,
28 DataGuiColour_AREA_BACKGROUND,
29 DataGuiColour_EDITABLE,
30 DataGuiColour_EDITABLE_FRAME,
31 DataGuiColour_EDITABLE_SELECTED,
32 DataGuiColour_NONEDITABLE,
33 DataGuiColour_NONEDITABLE_FRAME,
34 DataGuiColour_NONEDITABLE_SELECTED;
35
36 Thing_declare (Editor);
37 Thing_declare (EditorMenu);
38 Thing_declare (EditorCommand);
39
40 Thing_define (DataGui, Thing) {
41 /*
42 Accessors.
43 */
44 public:
45 Daata data() const { return _data; }
46 bool editable() const { return _editable; }
47 Editor boss() const { return _boss; }
48 Graphics pictureGraphics() const { return _pictureGraphics; }
49 protected:
50 void setData (Daata data) { _data = data; }
51 private:
52 Daata _data; // the data that can be displayed and edited
53 bool _editable;
54 Editor _boss;
55 Graphics _pictureGraphics;
56
57 friend void DataGui_init (DataGui me, Daata data, bool editable, Editor boss) {
58 my _data = data;
59 my _editable = editable;
60 my _boss = boss;
61 my v1_copyPreferencesToInstance ();
62 my v9_repairPreferences ();
63 }
64 friend void DataGui_openPraatPicture (DataGui me);
65 friend void DataGui_closePraatPicture (DataGui me);
66 public:
67 virtual void v_createMenuItems_prefs (EditorMenu /* fileMenu */) { }
68 virtual void v_createMenuItems_save (EditorMenu /* fileMenu */) { }
69 virtual void v_createMenuItems_edit (EditorMenu /* editMenu */) { }
70 virtual void v_createMenuItems_play (EditorMenu /* playMenu */) { }
71 virtual void v_createMenuItems_help (EditorMenu /* helpMenu */) { }
72 virtual void v_createMenus () { } // all the menus, except File, Edit, Play and Help
73 virtual void v_updateMenuItems () { }
74
75 virtual void v_prefs_addFields (EditorCommand) { }
76 virtual void v_prefs_setValues (EditorCommand) { }
77 virtual void v_prefs_getValues (EditorCommand) { }
78
79 virtual void v_form_pictureWindow (EditorCommand cmd);
80 virtual void v_ok_pictureWindow (EditorCommand cmd);
81 virtual void v_do_pictureWindow (EditorCommand cmd);
82 virtual void v_form_pictureMargins (EditorCommand cmd);
83 virtual void v_ok_pictureMargins (EditorCommand cmd);
84 virtual void v_do_pictureMargins (EditorCommand cmd);
85
86 #include "DataGui_prefs.h"
87 friend MelderColour DataGui_defaultForegroundColour (DataGui me, bool selected) {
88 return
89 my editable() ?
90 selected ? DataGuiColour_EDITABLE_SELECTED : DataGuiColour_EDITABLE
91 :
92 selected ? DataGuiColour_NONEDITABLE_SELECTED : DataGuiColour_NONEDITABLE;
93 }
94 };
95
96 /*
97 * The following two procedures are in praat_picture.cpp.
98 * They allow DataGuis to draw into the Picture window.
99 */
100 Graphics praat_picture_datagui_open (bool eraseFirst);
101 void praat_picture_datagui_close ();
102
103 /* End of file DataGui.h */
104 #endif