Heraia  0.1.8
heraia_ui.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
3  heraia_ui.h
4  main menus, callback and utility functions
5 
6  (C) Copyright 2005 - 2011 Olivier Delhomme
7  e-mail : heraia@delhomme.org
8  URL : http://heraia.tuxfamily.org
9 
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2, or (at your option)
13  any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
23 /**
24  * @file heraia_ui.h
25  * Header file for menu, callbacks, utility functions and ui management
26  */
27 #ifndef _LIBHERAIA_HERAIA_UI_H_
28 #define _LIBHERAIA_HERAIA_UI_H_
29 
30 #define H_DEBUG 1
31 
32 /* Menu functions */
33 extern void on_quit_activate(GtkWidget *widget, gpointer data);
34 extern void on_new_activate(GtkWidget *widget, gpointer data);
35 extern void on_open_activate(GtkWidget *widget, gpointer data);
36 extern void on_close_activate(GtkWidget *widget, gpointer data);
37 extern void on_save_activate(GtkWidget *widget, gpointer data);
38 extern void on_save_as_activate(GtkWidget *widget, gpointer data);
39 extern void on_preferences_activate(GtkWidget *widget, gpointer data);
40 extern void on_delete_activate(GtkWidget *widget, gpointer data);
41 extern void a_propos_activate(GtkWidget *widget, gpointer data);
42 extern void on_undo_activate(GtkWidget *widget, gpointer data);
43 extern void on_redo_activate(GtkWidget *widget, gpointer data);
44 extern void on_cut_activate(GtkWidget *widget, gpointer data);
45 extern void on_copy_activate(GtkWidget *widget, gpointer data);
46 extern void on_paste_activate(GtkWidget *widget, gpointer data);
47 extern void on_fr_activate(GtkWidget *widget, gpointer data);
48 extern void on_find_activate(GtkWidget *widget, gpointer data);
49 extern void on_fdft_activate(GtkWidget *widget, gpointer data);
50 extern void on_DIMenu_activate(GtkWidget *widget, gpointer data);
51 extern void on_tests_menu_activate(GtkWidget *widget, gpointer data);
52 extern gboolean delete_main_window_event(GtkWidget *widget, GdkEvent *event, gpointer data);
53 
54 extern gboolean delete_dt_window_event(GtkWidget *widget, GdkEvent *event, gpointer data);
55 extern void destroy_dt_window(GtkWidget *widget, GdkEvent *event, gpointer data);
56 
57 /* file selection */
58 extern GSList *select_file_to_load(heraia_struct_t *main_struct, gboolean multiple, gchar *message);
59 extern gchar *select_a_file_to_save(heraia_struct_t *main_struct);
60 extern void set_the_working_directory(GtkFileChooser *file_chooser, gchar *filename);
61 
62 /* initialisation process */
63 extern void init_heraia_interface(heraia_struct_t *main_struct);
64 extern int load_heraia_ui(heraia_struct_t *main_struct);
65 extern void init_window_states(heraia_struct_t *main_struct);
66 extern void grey_main_widgets(GtkBuilder *main, gboolean greyed);
67 
68 /* refreshing things */
69 extern void refresh_event_handler(GtkWidget *widget, gpointer data);
70 extern void refresh_file_labels(heraia_struct_t *main_struct);
71 extern void connect_cursor_moved_signal(heraia_struct_t *main_struct, GtkWidget *hex_widget);
72 extern void connect_data_changed_signal(heraia_struct_t *main_struct, GtkWidget *hex_widget);
73 extern void data_has_changed(GtkWidget *widget, gpointer data);
74 
75 /* window positionning system */
76 extern void record_dialog_box_position(GtkWidget *dialog_box, window_prop_t *dialog_prop);
77 extern void record_all_dialog_box_positions(heraia_struct_t *main_struct);
78 extern void move_and_show_dialog_box(GtkWidget *dialog_box, window_prop_t *dialog_pos);
79 extern void record_and_hide_dialog_box(GtkWidget *dialog_box, window_prop_t *dialog_pos);
80 extern void show_hide_widget(GtkWidget *widget, gboolean show, window_prop_t *win_prop);
81 
82 /* libglade wrapper (now GtkBuilder's one) */
83 GtkWidget *heraia_get_widget(GtkBuilder *xml, gchar *widget_name);
84 
85 /* Text view */
86 extern void add_text_to_textview(GtkTextView *textview, const char *format, ...);
87 extern void kill_text_from_textview(GtkTextView *textview);
88 
89 /* RadioButton */
90 extern GtkWidget *gtk_radio_button_get_active(GSList *group);
91 extern GtkWidget *gtk_radio_button_get_active_from_widget(GtkRadioButton *radio_group_member);
92 extern void gtk_radio_button_set_active(GtkRadioButton *radio_button);
93 
94 /* CheckMenuItem */
95 extern gboolean is_cmi_checked(GtkWidget *check_menu_item);
96 
97 /* Toogle Button */
98 extern gboolean is_toggle_button_activated(GtkBuilder *main_xml, gchar *check_button);
99 
100 /* Widget */
101 extern void destroy_a_single_widget(GtkWidget *widget);
102 extern void update_main_window_name(heraia_struct_t *main_struct);
103 
104 /* NoteBook */
105 extern void set_notebook_tab_name(heraia_struct_t *main_struct);
106 extern void add_new_tab_in_main_window(heraia_struct_t *main_struct, doc_t *doc);
107 extern void set_notebook_tab_label_color(heraia_struct_t *main_struct, gboolean color);
108 extern gint find_tab_number_from_widget(heraia_struct_t *main_struct, gchar *notebook_name, GtkWidget *to_find);
109 extern GtkWidget *find_label_from_hbox(GtkWidget *hbox);
110 extern GtkWidget *create_tab_close_button(heraia_struct_t *main_struct, GtkWidget *tab_label, void *signal_handler);
111 extern gboolean file_notebook_tab_changed(GtkNotebook *notebook, GtkWidget *page, gint tab_num, gpointer data);
112 
113 #endif /* _LIBHERAIA_HERAIA_UI_H_ */
void destroy_a_single_widget(GtkWidget *widget)
Destroys a single widget if it exists.
Definition: heraia_ui.c:2207
This is the main structure.
Definition: libheraia.h:332
Window properties.
Definition: libheraia.h:243
void connect_data_changed_signal(heraia_struct_t *main_struct, GtkWidget *hex_widget)
void on_save_as_activate(GtkWidget *widget, gpointer data)
This handle the save_as menu entry (here the filename changes)
Definition: heraia_ui.c:1057
void record_and_hide_dialog_box(GtkWidget *dialog_box, window_prop_t *dialog_pos)
Record position and hide a dialog box.
Definition: heraia_ui.c:314
void refresh_event_handler(GtkWidget *widget, gpointer data)
This function is here to ensure that everything will be refreshed upon a signal event.
Definition: heraia_ui.c:676
void kill_text_from_textview(GtkTextView *textview)
Kills the text from a textview.
Definition: heraia_ui.c:2049
gint find_tab_number_from_widget(heraia_struct_t *main_struct, gchar *notebook_name, GtkWidget *to_find)
Searches in a notebook's tabs for a particular widget and returns the number of the corresponding tab...
Definition: heraia_ui.c:745
gboolean is_cmi_checked(GtkWidget *check_menu_item)
Tells whether a GtkCheckMenuItem is Checked or not.
Definition: heraia_ui.c:2146
void record_dialog_box_position(GtkWidget *dialog_box, window_prop_t *dialog_prop)
Records one dialog position.
Definition: heraia_ui.c:223
void on_fr_activate(GtkWidget *widget, gpointer data)
Find and replace, Search menu.
Definition: heraia_ui.c:553
int main(int argc, char **argv)
main program options :
Definition: heraia.c:544
void on_new_activate(GtkWidget *widget, gpointer data)
New, file menu.
Definition: heraia_ui.c:77
void destroy_dt_window(GtkWidget *widget, GdkEvent *event, gpointer data)
call back function for the data interpretor window destruction
Definition: heraia_ui.c:1217
void set_the_working_directory(GtkFileChooser *file_chooser, gchar *filename)
Sets the working directory for the file chooser to the directory of the filename (even if filename is...
Definition: heraia_ui.c:1311
GtkWidget * find_label_from_hbox(GtkWidget *hbox)
Tries to find the label contained in the hbox.
Definition: heraia_ui.c:1463
void on_cut_activate(GtkWidget *widget, gpointer data)
Cut, edit menu.
Definition: heraia_ui.c:487
void on_undo_activate(GtkWidget *widget, gpointer data)
Undo, edit menu.
Definition: heraia_ui.c:395
void record_all_dialog_box_positions(heraia_struct_t *main_struct)
Records all the positions of the displayed windows.
Definition: heraia_ui.c:250
void set_notebook_tab_name(heraia_struct_t *main_struct)
Sets notebook's tab's name.
Definition: heraia_ui.c:1506
void add_new_tab_in_main_window(heraia_struct_t *main_struct, doc_t *doc)
Adds a new tab to the main window in file's notebook.
Definition: heraia_ui.c:2547
Proposal for a structure that will group all informations about a single document.
Definition: libheraia.h:293
void on_paste_activate(GtkWidget *widget, gpointer data)
Paste, edit menu.
Definition: heraia_ui.c:520
int load_heraia_ui(heraia_struct_t *main_struct)
Loads, if possible, the gtkbuilder xml file and then connects the signals and inits the following win...
Definition: heraia_ui.c:1869
void on_delete_activate(GtkWidget *widget, gpointer data)
Delete, edit menu.
Definition: heraia_ui.c:470
void connect_cursor_moved_signal(heraia_struct_t *main_struct, GtkWidget *hex_widget)
Connects the signal that the cursor has moved to the refreshing function.
Definition: heraia_ui.c:1721
GtkWidget * heraia_get_widget(GtkBuilder *xml, gchar *widget_name)
This is a wrapper to the GtkBuilder xml get widget.
Definition: heraia_ui.c:2184
void update_main_window_name(heraia_struct_t *main_struct)
Update main window heraia's name to reflect the current edited file.
Definition: heraia_ui.c:1434
gboolean is_toggle_button_activated(GtkBuilder *main_xml, gchar *check_button)
returns the state of a named check button contained in the GtkBuilder XML description ...
Definition: heraia_ui.c:2161
void a_propos_activate(GtkWidget *widget, gpointer data)
Shows apropos's dialog box.
Definition: heraia_ui.c:172
void show_hide_widget(GtkWidget *widget, gboolean show, window_prop_t *win_prop)
To help plugins to deal with widgets, shows or hide a specific widget.
Definition: heraia_ui.c:2613
void on_DIMenu_activate(GtkWidget *widget, gpointer data)
This handles the menuitem "Data Interpretor" that shows or hides the data interpretor window...
Definition: heraia_ui.c:1106
void grey_main_widgets(GtkBuilder *main, gboolean greyed)
Hides or grey all widgets that needs an open file when boolean greyed is TRUE.
Definition: heraia_ui.c:1601
GtkWidget * gtk_radio_button_get_active_from_widget(GtkRadioButton *radio_group_member)
gets the active radio button from a radio group
Definition: heraia_ui.c:2098
void gtk_radio_button_set_active(GtkRadioButton *radio_button)
Sets the radio button active.
Definition: heraia_ui.c:2115
gchar * select_a_file_to_save(heraia_struct_t *main_struct)
This function opens a dialog box that allow one to choose a file name to the file which is about to b...
Definition: heraia_ui.c:1386
void on_tests_menu_activate(GtkWidget *widget, gpointer data)
Called when tests submenu is activated.
Definition: heraia_ui.c:1155
void init_heraia_interface(heraia_struct_t *main_struct)
Here we might init some call backs and menu options and display the interface (main && sub-windows) This ...
Definition: heraia_ui.c:1650
void on_find_activate(GtkWidget *widget, gpointer data)
Find, Search menu.
Definition: heraia_ui.c:537
void init_window_states(heraia_struct_t *main_struct)
Inits all windows states (positions, displayed, and so on...)
Definition: heraia_ui.c:2359
void on_save_activate(GtkWidget *widget, gpointer data)
Here we attemp to save the edited file.
Definition: heraia_ui.c:1027
gboolean delete_dt_window_event(GtkWidget *widget, GdkEvent *event, gpointer data)
call back function for the data interpretor window destruction
Definition: heraia_ui.c:1200
void add_text_to_textview(GtkTextView *textview, const char *format,...)
adds a text to a textview
Definition: heraia_ui.c:2025
GtkWidget * create_tab_close_button(heraia_struct_t *main_struct, GtkWidget *tab_label, void *signal_handler)
Creates an hbox containning a cross button (in order to close the tab) and a label (from tab_label)...
Definition: heraia_ui.c:2505
void on_preferences_activate(GtkWidget *widget, gpointer data)
Preferences, file menu : Displays the preference window (as a modal window)
Definition: heraia_ui.c:135
void set_notebook_tab_label_color(heraia_struct_t *main_struct, gboolean color)
Set the style for the label.
Definition: heraia_ui.c:1550
GSList * select_file_to_load(heraia_struct_t *main_struct, gboolean multiple, gchar *message)
This function does open a file selector dialog box and returns the selected filename.
Definition: heraia_ui.c:1333
void on_redo_activate(GtkWidget *widget, gpointer data)
Redo, edit menu.
Definition: heraia_ui.c:434
gboolean delete_main_window_event(GtkWidget *widget, GdkEvent *event, gpointer data)
Definition: heraia_ui.c:1183
void on_open_activate(GtkWidget *widget, gpointer data)
This handles the menuitem "Ouvrir" to open a file.
Definition: heraia_ui.c:705
void data_has_changed(GtkWidget *widget, gpointer data)
gboolean file_notebook_tab_changed(GtkNotebook *notebook, GtkWidget *page, gint tab_num, gpointer data)
What to do when a change occurs in tabs (user selected a particular tab)
Definition: heraia_ui.c:1233
void on_fdft_activate(GtkWidget *widget, gpointer data)
Find data from type, Search menu.
Definition: heraia_ui.c:569
void refresh_file_labels(heraia_struct_t *main_struct)
This function is refreshing the labels on the main window in order to reflect cursor position...
Definition: heraia_ui.c:588
void on_copy_activate(GtkWidget *widget, gpointer data)
Copy, edit menu.
Definition: heraia_ui.c:504
void move_and_show_dialog_box(GtkWidget *dialog_box, window_prop_t *dialog_pos)
Move the dialog box to the wanted position, shows it and says it in the displayed prop...
Definition: heraia_ui.c:193
void on_close_activate(GtkWidget *widget, gpointer data)
Closes an opened file.
Definition: heraia_ui.c:914
GtkWidget * gtk_radio_button_get_active(GSList *group)
Try to find the active radio button widget in a group This does not take into account inconsistant st...
Definition: heraia_ui.c:2070
void on_quit_activate(GtkWidget *widget, gpointer data)
Quit, file menu.
Definition: heraia_ui.c:57