summaryrefslogtreecommitdiff
path: root/mate-dictionary/src/gdict-window.h
blob: 5e27e60c3d719fe03b12f63817347e214d00b8a8 (plain)
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
/* Copyright (C) 2005 Emmanuele Bassi
 * Copyright (C) 2012-2021 MATE Developers
 *
 * This file is part of MATE Utils.
 *
 * MATE Utils is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * MATE Utils is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MATE Utils.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef __GDICT_WINDOW_H__
#define __GDICT_WINDOW_H__

#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
#include <libgdict/gdict.h>

G_BEGIN_DECLS

#define GDICT_TYPE_WINDOW	(gdict_window_get_type ())
#define GDICT_WINDOW(obj)	(G_TYPE_CHECK_INSTANCE_CAST ((obj), GDICT_TYPE_WINDOW, GdictWindow))
#define GDICT_IS_WINDOW(obj)	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDICT_TYPE_WINDOW))

typedef enum {
  GDICT_WINDOW_ACTION_LOOKUP,
  GDICT_WINDOW_ACTION_MATCH,
  GDICT_WINDOW_ACTION_CLEAR
} GdictWindowAction;

#define GDICT_TYPE_WINDOW_ACTION	(gdict_window_action_get_type ())
GType gdict_window_action_get_type (void) G_GNUC_CONST;

typedef struct _GdictWindow      GdictWindow;
typedef struct _GdictWindowClass GdictWindowClass;

struct _GdictWindow
{
  GtkWindow parent_instance;

  GtkWidget *main_box;
  GtkWidget *menubar;
  GtkWidget *entry;

  /* sidebar widgets */
  GtkWidget *speller;
  GtkWidget *db_chooser;
  GtkWidget *strat_chooser;
  GtkWidget *source_chooser;

  GtkWidget *sidebar;
  GtkWidget *sidebar_frame;

  GtkWidget *defbox;
  GtkWidget *defbox_frame;

  GtkWidget *status;
  GtkWidget *progress;

  GtkUIManager *ui_manager;
  GtkActionGroup *action_group;

  GtkEntryCompletion *completion;
  GtkListStore *completion_model;

  GdictWindowAction action;

  gchar *word;
  gint max_definition;
  gint last_definition;
  gint current_definition;

  gchar *source_name;
  GdictSourceLoader *loader;
  GdictContext *context;
  guint definition_id;
  guint lookup_start_id;
  guint lookup_end_id;
  guint error_id;

  gchar *database;
  gchar *strategy;
  gchar *print_font;
  gchar *defbox_font;

  GSettings *settings;
  GSettings *desktop_settings;

  GdkCursor *busy_cursor;

  gint default_width;
  gint default_height;
  gint current_width;
  gint current_height;
  gint sidebar_width;

  gchar *sidebar_page;

  guint is_maximized      : 1;
  guint sidebar_visible   : 1;
  guint statusbar_visible : 1;
  guint in_construction   : 1;

  gulong window_id;
};

struct _GdictWindowClass
{
  GtkWindowClass parent_class;

  void (*created) (GdictWindow *parent_window,
  		   GdictWindow *new_window);
};

GType      gdict_window_get_type (void) G_GNUC_CONST;
GtkWidget *gdict_window_new      (GdictWindowAction  action,
				  GdictSourceLoader *loader,
				  const gchar       *source_name,
				  const gchar       *word);

#endif /* __GDICT_WINDOW_H__ */