File: gui_main_window.h

package info (click to toggle)
crystal-facet-uml 1.63.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 21,640 kB
  • sloc: ansic: 109,610; xml: 3,085; makefile: 138; sh: 113
file content (274 lines) | stat: -rw-r--r-- 10,129 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
 /* File: gui_main_window.h; Copyright and License: see below */

#ifndef GUI_MAIN_WINDOW_H
#define GUI_MAIN_WINDOW_H

/* public file for the doxygen documentation: */
/*!
 *  \file
 *  \brief Displays a main window and reacts on user events
 */

#include "gui_simple_message_to_user.h"
#include "sketch/gui_sketch_area.h"
#include "gui_toolbox.h"
#include "gui_resources.h"
#include "gui_type_resource_list.h"
#include "attributes/gui_attributes_editor.h"
#include "gui_file_use_db_dialog.h"
#include "gui_file_export_dialog.h"
#include "gui_file_action.h"
#include "gui_search_request.h"
#include "gui_search_runner.h"
#include "wrap/gui_button.h"
#include "attributes/gui_attribute_type_of_classifier.h"
#include "attributes/gui_attribute_type_of_diagram.h"
#include "attributes/gui_attribute_type_of_feature.h"
#include "attributes/gui_attribute_type_of_relationship.h"
#include "io_data_file.h"
#include "storage/data_change_message.h"
#include "ctrl_controller.h"
#include "entity/data_diagram_type.h"
#include "entity/data_classifier_type.h"
#include "entity/data_feature_type.h"
#include "entity/data_relationship_type.h"
#include "observer/observer.h"
#include "gui_gtk.h"

/*!
 *  \brief attributes of the main window
 */
struct gui_main_window_struct {
    gui_sketch_area_t sketcharea_data;  /*!< own instance of gui_sketch_area_t */
    gui_toolbox_t tools_data;  /*!< own instance of gui_toolbox_t */
    gui_marked_set_t marker_data;  /*!< own instance of a marker */
    data_change_notifier_t *data_notifier;  /*!< pointer to external data change notifier */
    gui_attributes_editor_t attributes_editor;  /*!<  own instance of gui_attributes_editor_t */
    observer_t *window_close_observer;  /*!< pointer to external observer_t listener object */
    observer_t *window_open_observer;  /*!< pointer to external observer_t listener object */
    gui_file_action_t file_action;  /*!<  own instance of gui_file_action_t */
    gui_file_use_db_dialog_t file_use_db_dialog;  /*!<  own instance of gui_file_use_db_dialog_t */
    gui_file_export_dialog_t file_export_dialog;  /*!<  own instance of gui_file_export_dialog_t */
    io_data_file_t *data_file;  /*!< pointer to external data_file */
    const gui_resources_t *resources;  /*!< pointer to external resource provider */

    GtkWidget *window;
    GtkWidget *main_stack_column;
    GtkWidget *two_panes;
    GtkWidget *sketch_stack_column;
    GtkWidget *sketcharea;

    GtkWidget *tool_row;

    gui_button_t file_new;
    gui_button_t file_open;
    gui_button_t file_save;
    gui_button_t file_export;

    GtkWidget *tool_sect_1_icon;

    gui_button_t view_new_window;
    gui_button_t view_navigate;
    gui_button_t view_edit;
    gui_button_t view_create;
    gui_button_t view_search;

    GtkWidget *tool_sect_2_icon;

    gui_button_t edit_undo;
    gui_button_t edit_redo;
    gui_button_t edit_cut;
    gui_button_t edit_copy;
    gui_button_t edit_paste;
    gui_button_t edit_delete;
    gui_button_t edit_instantiate;
    gui_button_t edit_highlight;
    gui_button_t edit_reset;

    gui_button_t help_about;

    GtkShortcutController *keyboard_shortcut_ctrl;

    GtkWidget *attr_edit_column;
    GtkWidget *attr_section_icon;
    GtkWidget *id_row;
    GtkWidget *id_search_btn_icon;
    GtkWidget *id_search_btn;
    GtkWidget *id_label;
    GtkWidget *name_label;
    GtkWidget *name_entry;
    GtkWidget *description_label;
    GtkWidget *description_text_view;
    GtkWidget *description_scroll_win;
    GtkWidget *type_label;
    GtkDropDown *type_dropdown;
    GtkGrid   *type_diag_grid;
    GtkImage  *( type_diag_img[ GUI_TYPE_RESOURCE_LIST_DIAGRAMS ] );
    GtkButton *( type_diag_btn[ GUI_TYPE_RESOURCE_LIST_DIAGRAMS ] );
    gui_attribute_type_of_diagram_t type_diag_data[ GUI_TYPE_RESOURCE_LIST_DIAGRAMS ];
    GtkGrid   *type_clas_grid;
    GtkImage  *( type_clas_img[ GUI_TYPE_RESOURCE_LIST_CLASSIFIERS ] );
    GtkButton *( type_clas_btn[ GUI_TYPE_RESOURCE_LIST_CLASSIFIERS ] );
    gui_attribute_type_of_classifier_t type_clas_data[ GUI_TYPE_RESOURCE_LIST_CLASSIFIERS ];
    GtkGrid   *type_feat_grid;
    GtkImage  *( type_feat_img[ GUI_TYPE_RESOURCE_LIST_INV_FEATURES ] );
    GtkButton *( type_feat_btn[ GUI_TYPE_RESOURCE_LIST_INV_FEATURES ] );
    gui_attribute_type_of_feature_t type_feat_data[ GUI_TYPE_RESOURCE_LIST_INV_FEATURES ];
    GtkGrid   *type_rel_grid;
    GtkImage  *( type_rel_img[ GUI_TYPE_RESOURCE_LIST_RELATIONS ] );
    GtkButton *( type_rel_btn[ GUI_TYPE_RESOURCE_LIST_RELATIONS ] );
    gui_attribute_type_of_relationship_t type_rel_data[ GUI_TYPE_RESOURCE_LIST_RELATIONS ];
    GtkWidget *stereotype_label;
    GtkWidget *stereotype_entry;

    GtkWidget *options_layout;  /*!< the grid layout container for the export options, created by file_export_dialog */

    GtkWidget *search_row;
    GtkWidget *search_label;
    GtkWidget *search_entry;
    GtkWidget *search_btn_icon;
    GtkWidget *search_button;
    gui_search_request_t search_request;  /*!<  own instance of gui_search_request_t */
    gui_search_runner_t search_runner;  /*!<  own instance of gui_search_runner_t */

    GtkWidget *message_row;
    GtkWidget *message_text_label;
    GtkWidget *message_icon_image;
    gui_simple_message_to_user_t message_to_user;  /*!<  own instance of gui_simple_message_to_user_t */
};

typedef struct gui_main_window_struct gui_main_window_t;

/*!
 *  \brief initializes the main window
 *
 *  \param this_ pointer to own object attributes
 *  \param controller pointer to a controller object which can modify the database
 *  \param data_file pointer to a data_file object
 *  \param db_reader pointer to a database reader object
 *  \param resources pointer to a resource provider
 *  \param gtk_app the gtk application object
 *  \param window_close_observer observer for a button press on the close window button
 *  \param window_open_observer observer for a button press on the open window button
 */
void gui_main_window_init( gui_main_window_t *this_,
                           ctrl_controller_t *controller,
                           io_data_file_t *data_file,
                           data_database_reader_t *db_reader,
                           gui_resources_t *resources,
                           GtkApplication *gtk_app,
                           observer_t *window_close_observer,
                           observer_t *window_open_observer
);

/*!
 *  \brief destroys the main window
 *
 *  \param this_ pointer to own object attributes
 */
void gui_main_window_destroy( gui_main_window_t *this_ );

/*!
 *  \brief initializes the widgets that belong to the toolbox group at the top of the main window
 *
 *  \param this_ pointer to own object attributes
 */
void gui_main_window_private_init_toolbox( gui_main_window_t *this_ );

/*!
 *  \brief initializes the widgets that belong to the attributes editor group at the right of the main window
 *
 *  \param this_ pointer to own object attributes
 */
void gui_main_window_private_init_attributes_editor( gui_main_window_t *this_ );

/*!
 *  \brief initializes the widgets that belong to the simple message to user group at the bottom of the main window
 *
 *  \param this_ pointer to own object attributes
 */
void gui_main_window_private_init_simple_message_to_user( gui_main_window_t *this_ );

/*!
 *  \brief initializes the widgets that belong to the sketch area group at the center of the main window,
 *         including the search bar
 *
 *  \param this_ pointer to own object attributes
 */
void gui_main_window_private_init_search_and_sketch_area( gui_main_window_t *this_ );

/*!
 *  \brief callback that is executed when the main window is destroyed
 */
void gui_main_window_destroy_event_callback( GtkWidget *widget, gpointer data );

/*!
 *  \brief callback that is executed when the main window is requested to be deleted
 *
 *  \return true if the window shall not be deleted.
 */
gboolean gui_main_window_delete_event_callback( GtkWindow *widget, gpointer data );

/*!
 *  \brief callback that informs that the new_db button was pressed
 */
void gui_main_window_new_db_btn_callback( GtkWidget* button, gpointer data );

/*!
 *  \brief callback that informs that the open_db button was pressed
 */
void gui_main_window_open_db_btn_callback( GtkWidget* button, gpointer data );

/*!
 *  \brief callback that informs that the save button was pressed
 */
void gui_main_window_save_btn_callback( GtkButton *button, gpointer user_data );

/*!
 *  \brief callback that informs that the save shortcut was activated
 */
gboolean gui_main_window_save_shortcut_callback( GtkWidget* widget, GVariant* args, gpointer user_data );

/*!
 *  \brief callback that informs that the export button was pressed
 */
void gui_main_window_export_btn_callback( GtkWidget* button, gpointer data );

/*!
 *  \brief callback that informs that the new window button was pressed
 */
void gui_main_window_new_window_btn_callback( GtkWidget* button, gpointer data );

/*!
 *  \brief callback that informs that the about button was pressed
 */
void gui_main_window_about_btn_callback( GtkWidget* button, gpointer data );

/*!
 *  \brief callback that informs that the data of an object or the whole database changed
 */
void gui_main_window_data_changed_callback( GtkWidget *window, data_change_message_t *msg, gpointer user_data );

/*!
 *  \brief callback that informs that the window was activated or dropped-to-back
 */
void gui_main_window_state_callback( GtkWidget* window, GtkStateFlags old_flags, gpointer user_data );

#endif  /* GUI_MAIN_WINDOW_H */


/*
Copyright 2016-2025 Andreas Warnke

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/