1 /* gdict-window.h - main application window 2 * 3 * This file is part of GNOME Dictionary 4 * 5 * Copyright (C) 2005 Emmanuele Bassi 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation; either version 2 of 10 * the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifndef __GDICT_WINDOW_H__ 22 #define __GDICT_WINDOW_H__ 23 24 #include <gio/gio.h> 25 #include <gdk-pixbuf/gdk-pixbuf.h> 26 #include <gtk/gtk.h> 27 #include "gdict.h" 28 29 G_BEGIN_DECLS 30 31 #define GDICT_TYPE_WINDOW (gdict_window_get_type ()) 32 #define GDICT_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDICT_TYPE_WINDOW, GdictWindow)) 33 #define GDICT_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDICT_TYPE_WINDOW)) 34 35 typedef enum { 36 GDICT_WINDOW_ACTION_LOOKUP, 37 GDICT_WINDOW_ACTION_MATCH, 38 GDICT_WINDOW_ACTION_CLEAR 39 } GdictWindowAction; 40 41 #define GDICT_TYPE_WINDOW_ACTION (gdict_window_action_get_type ()) 42 GType gdict_window_action_get_type (void) G_GNUC_CONST; 43 44 typedef struct _GdictWindow GdictWindow; 45 typedef struct _GdictWindowClass GdictWindowClass; 46 47 struct _GdictWindow 48 { 49 GtkApplicationWindow parent_instance; 50 51 GtkWidget *header_bar; 52 GtkWidget *header_box; 53 GtkWidget *main_box; 54 GtkWidget *main_pane; 55 GtkWidget *defbox_box; 56 GtkWidget *sidebar_box; 57 GtkWidget *entry; 58 GtkWidget *spinner; 59 GtkWidget *stack; 60 61 /* sidebar widgets */ 62 GtkWidget *speller; 63 GtkWidget *db_chooser; 64 GtkWidget *strat_chooser; 65 GtkWidget *source_chooser; 66 67 GtkWidget *sidebar; 68 GtkWidget *defbox; 69 70 GtkEntryCompletion *completion; 71 GtkListStore *completion_model; 72 73 GdictWindowAction action; 74 75 gchar *word; 76 gint max_definition; 77 gint last_definition; 78 gint current_definition; 79 80 gchar *source_name; 81 GdictSourceLoader *loader; 82 GdictContext *context; 83 guint definition_id; 84 guint lookup_start_id; 85 guint lookup_end_id; 86 guint error_id; 87 88 gchar *database; 89 gchar *strategy; 90 gchar *print_font; 91 gchar *defbox_font; 92 93 GSettings *settings; 94 GSettings *desktop_settings; 95 96 GdkCursor *busy_cursor; 97 98 gint default_width; 99 gint default_height; 100 gint current_width; 101 gint current_height; 102 gdouble sidebar_width_percentage; 103 104 gchar *sidebar_page; 105 106 guint is_maximized : 1; 107 guint sidebar_visible : 1; 108 guint in_construction : 1; 109 110 gulong window_id; 111 }; 112 113 struct _GdictWindowClass 114 { 115 GtkApplicationWindowClass parent_class; 116 117 void (*created) (GdictWindow *parent_window, 118 GdictWindow *new_window); 119 }; 120 121 GType gdict_window_get_type (void) G_GNUC_CONST; 122 GtkWidget *gdict_window_new (GdictWindowAction action, 123 GtkApplication *app, 124 GdictSourceLoader *loader, 125 const gchar *source_name, 126 const gchar *database_name, 127 const gchar *strategy_name, 128 const gchar *word); 129 130 #endif /* __GDICT_WINDOW_H__ */ 131