1 /*******************************************************************************
2 This file is part of WhiteStork.
4 WhiteStork is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 WhiteStork is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with WhiteStork; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 Copyright 2006 ComArch S.A.
19 *******************************************************************************/
20 #ifndef _WS_GUI_CALLBACKS
21 #define _WS_GUI_CALLBACKS
31 #include <sys/types.h>
37 #define TIMER_START TRUE
38 #define TIMER_STOP FALSE
42 /** \brief handle dbus signals
45 void ws_gui_signal_hander (GError *error, GArray *words, gpointer user_data);
47 /** \brief handle signal from dbus and updates progress bar(in order to caching)
50 void ws_dbus_progress_bar(GError *error, GArray *words, gpointer user_data);
51 /** \brief handle dbus signal and transfer words to the words list
54 void ws_gui_dbus_return_words (GError *error,
58 /** \brief handle dbus signal and convert message into readable text
61 void ws_gui_dbus_return_translation (GError *error,
65 /** \brief handle dbus signal and load extracted dictionary
68 void ws_dbus_server_return_extracted_dict2(GError *error,
72 /** \brief is used to free memory, which was allocated
75 void ws_gui_free_memory(gpointer user_data);
77 /** \brief handle keys press signals (hardware keys in device)
80 gboolean hildon_key_press_listener (GtkWidget * widget,
81 GdkEventKey * keyevent,
84 /** \brief allow to hide words list from menu
87 void ws_gui_words_list_hide_from_menu(GtkCheckMenuItem *checkmenuitem,
90 /** \brief allow to hide words list from toolbar
93 void ws_gui_words_list_hide(GtkToggleButton *togglebutton, gpointer user_data);
95 /** \brief add word to the words history
98 void ws_gui_history_add(char *new_word, gpointer user_data);
100 /** \brief display translation of word stored in the history (if available)
103 void ws_gui_history_back(GtkButton *button, gpointer user_data);
105 /** \brief display translation of word stored in the history (if available)
108 void ws_gui_history_next(GtkButton *button, gpointer user_data);
110 /** \brief check history and disable buttons or uncheck checkbuttons
113 void ws_gui_check_history(gpointer user_data);
115 /** \brief creates model and view of words list
118 GtkWidget * create_view_and_model (GArray *words_list, gpointer user_data);
120 /** \brief creates words list and fill it with content
123 GtkTreeModel * create_and_fill_model (GArray *words_list, gpointer user_data);
125 /** \brief handles a signal when user highlight a word from the words list
128 void ws_gui_tree_selection_changed(GtkTreeSelection *selection,
131 /** \brief switch view between full screen and normal mode
134 void ws_gui_full_screen(GtkMenuItem *menuitem, gpointer user_data);
136 /** \brief search for selected text in a dictionary
139 void ws_gui_popup_search(GtkMenuItem *menuitem, gpointer user_data);
141 /** \brief allows to select whole text in translation (html) area
144 void ws_gui_html_select_all(GtkMenuItem *menuitem, gpointer user_data);
146 /** \brief allows to copy text from translation (html) area into clipboard
149 void ws_gui_html_copy(GtkMenuItem *menuitem, gpointer user_data);
151 /** \brief allows to paste text from the clipboard into find toolbar entry
154 void ws_gui_html_paste(GtkMenuItem *menuitem, gpointer user_data);
156 /** \brief magnify translation (html) area
159 void ws_gui_html_zoom_in(GtkMenuItem *menuitem, gpointer user_data);
161 /** \brief zoom out translation (html) area.
164 void ws_gui_html_zoom_out(GtkMenuItem *menuitem, gpointer user_data);
166 /** \brief start search (sends typed word to the engine)
169 void ws_gui_search(GtkWidget * widget, gpointer user_data);
171 /** \brief abort search
174 void ws_gui_search_stop(GtkButton *button, gpointer user_data);
176 /** \brief used when user closes the application
179 void ws_gui_on_exit (GtkWidget *widget, GdkEvent *event, gpointer user_data);
181 /** \brief used when user closes the application from menu
184 void ws_gui_menu_quit(GtkMenuItem *menuitem, gpointer user_data);
186 /** \brief sets content of translation (html) area
189 void ws_gui_fill_html(char *html_context, gpointer user_data);
191 /** \brief read current adjustment value
194 void ws_gui_read_adjustment(gpointer user_data);
196 /** \brief necessary to load images into translation (html) area
199 void ws_gui_url_requested (GtkHTML *html, const char *url,
200 GtkHTMLStream *stream);
202 /** \brief handles button press event
205 gboolean ws_gui_button_press (GtkWidget *widget,
206 GdkEventButton *event,
209 /** \brief handles button release event
212 gboolean ws_gui_button_release (GtkWidget *widget,
213 GdkEventButton *event,
216 /** \brief shows popup when user clicks and holds
219 guint ws_gui_show_popup(gpointer user_data);
221 /** \brief checks clipboard content
224 void ws_gui_check_clipboard (GtkWidget *widget, gpointer user_data);
226 /** \brief checks dictionaries availablity
229 void ws_gui_dict_availablity(GtkMenuItem *menuitem, gpointer user_data);
231 /** \brief allows to format html content
234 gchar * format_html (gchar * received_string, gpointer user_data);
236 /** \brief sets sensitivity of Bookmarks menu items
239 void ws_gui_set_bookmarks_sensitivity(gpointer user_data);
241 /** \brief sets sensitivity of Bookmarks menu items due to selection made
244 void ws_gui_set_bookmark_menu_items(GtkMenuItem *menuitem, gpointer user_data);
246 /** \brief sets sensitivity of menu items due to dictionary mode
249 void ws_gui_read_active_dictionaries(gpointer user_data);
251 void ws_gui_clear_array(GArray *history);