]> www.fi.muni.cz Git - evince.git/blob - cut-n-paste/toolbar-editor/egg-toolbars-model.h
Implement epiphany like toolbar editor. Based on patch by
[evince.git] / cut-n-paste / toolbar-editor / egg-toolbars-model.h
1 /*
2  *  Copyright (C) 2003-2004 Marco Pesenti Gritti
3  *
4  *  This program 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, or (at your option)
7  *  any later version.
8  *
9  *  This program 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.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18
19 #ifndef EGG_TOOLBARS_MODEL_H
20 #define EGG_TOOLBARS_MODEL_H
21
22 #include <glib.h>
23 #include <glib-object.h>
24 #include <gdk/gdktypes.h>
25
26 G_BEGIN_DECLS
27
28
29 #define EGG_TYPE_TOOLBARS_MODEL             (egg_toolbars_model_get_type ())
30 #define EGG_TOOLBARS_MODEL(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TOOLBARS_MODEL, EggToolbarsModel))
31 #define EGG_TOOLBARS_MODEL_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TOOLBARS_MODEL, EggToolbarsModelClass))
32 #define EGG_IS_TOOLBARS_MODEL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TOOLBARS_MODEL))
33 #define EGG_IS_TOOLBARS_MODEL_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TOOLBARS_MODEL))
34 #define EGG_TOOLBARS_MODEL_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TOOLBARS_MODEL, EggToolbarsModelClass))
35
36 typedef struct EggToolbarsModel         EggToolbarsModel;
37 typedef struct EggToolbarsModelPrivate  EggToolbarsModelPrivate;
38 typedef struct EggToolbarsModelClass    EggToolbarsModelClass;
39
40 #define EGG_TOOLBAR_ITEM_TYPE "application/x-toolbar-item"
41
42 typedef enum
43 {
44   EGG_TB_MODEL_NOT_REMOVABLE     = 1 << 0,
45   EGG_TB_MODEL_ICONS_ONLY        = 1 << 1,
46   EGG_TB_MODEL_TEXT_ONLY         = 1 << 2,
47   EGG_TB_MODEL_ICONS_TEXT        = 1 << 3,
48   EGG_TB_MODEL_ICONS_TEXT_HORIZ  = 1 << 4,
49   EGG_TB_MODEL_ACCEPT_ITEMS_ONLY = 1 << 5
50 } EggTbModelFlags;
51
52 struct EggToolbarsModel
53 {
54   GObject parent_object;
55
56   /*< private >*/
57   EggToolbarsModelPrivate *priv;
58 };
59
60 struct EggToolbarsModelClass
61 {
62   GObjectClass parent_class;
63
64   /* Signals */
65   void (* item_added)      (EggToolbarsModel *model,
66                             int toolbar_position,
67                             int position);
68   void (* item_removed)    (EggToolbarsModel *model,
69                             int toolbar_position,
70                             int position);
71   void (* toolbar_added)   (EggToolbarsModel *model,
72                             int position);
73   void (* toolbar_changed) (EggToolbarsModel *model,
74                             int position);
75   void (* toolbar_removed) (EggToolbarsModel *model,
76                             int position);
77   char * (* get_item_type) (EggToolbarsModel *model,
78                             GdkAtom           dnd_type);
79   char * (* get_item_id)   (EggToolbarsModel *model,
80                             const char       *type,
81                             const char       *data);
82   char * (* get_item_data) (EggToolbarsModel *model,
83                             const char       *type,
84                             const char       *id);
85
86   /* Virtual Table */
87   gboolean (* add_item)    (EggToolbarsModel *t,
88                             int               toolbar_position,
89                             int               position,
90                             const char       *id,
91                             const char       *type);
92 };
93
94 GType             egg_toolbars_model_get_type       (void);
95 EggToolbarsModel *egg_toolbars_model_new            (void);
96 gboolean          egg_toolbars_model_load           (EggToolbarsModel *model,
97                                                      const char *xml_file);
98 void              egg_toolbars_model_save           (EggToolbarsModel *model,
99                                                      const char *xml_file,
100                                                      const char *version);
101 int               egg_toolbars_model_add_toolbar    (EggToolbarsModel *model,
102                                                      int               position,
103                                                      const char       *name);
104 EggTbModelFlags   egg_toolbars_model_get_flags      (EggToolbarsModel *model,
105                                                      int               toolbar_position);
106 void              egg_toolbars_model_set_flags      (EggToolbarsModel *model,
107                                                      int               toolbar_position,
108                                                      EggTbModelFlags   flags);
109 void              egg_toolbars_model_add_separator  (EggToolbarsModel *model,
110                                                      int               toolbar_position,
111                                                      int               position);
112 char             *egg_toolbars_model_get_item_type  (EggToolbarsModel *model,
113                                                      GdkAtom           dnd_type);
114 char             *egg_toolbars_model_get_item_id    (EggToolbarsModel *model,
115                                                      const char       *type,
116                                                      const char       *name);
117 char             *egg_toolbars_model_get_item_data  (EggToolbarsModel *model,
118                                                      const char       *type,
119                                                      const char       *id);
120 gboolean          egg_toolbars_model_add_item       (EggToolbarsModel *model,
121                                                      int               toolbar_position,
122                                                      int               position,
123                                                      const char       *id,
124                                                      const char       *type);
125 void              egg_toolbars_model_remove_toolbar (EggToolbarsModel *model,
126                                                      int               position);
127 void              egg_toolbars_model_remove_item    (EggToolbarsModel *model,
128                                                      int               toolbar_position,
129                                                      int               position);
130 void              egg_toolbars_model_move_item      (EggToolbarsModel *model,
131                                                      int               toolbar_position,
132                                                      int               position,
133                                                      int               new_toolbar_position,
134                                                      int               new_position);
135 int               egg_toolbars_model_n_items        (EggToolbarsModel *model,
136                                                      int               toolbar_position);
137 void              egg_toolbars_model_item_nth       (EggToolbarsModel *model,
138                                                      int               toolbar_position,
139                                                      int               position,
140                                                      gboolean         *is_separator,
141                                                      const char      **id,
142                                                      const char      **type);
143 int               egg_toolbars_model_n_toolbars     (EggToolbarsModel *model);
144 const char       *egg_toolbars_model_toolbar_nth    (EggToolbarsModel *model,
145                                                      int               position);
146
147 G_END_DECLS
148
149 #endif