]> www.fi.muni.cz Git - evince.git/blob - libdocument/ev-form-field.h
[dualscreen][presentation] fix Issue #9
[evince.git] / libdocument / ev-form-field.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /* this file is part of evince, a gnome document viewer
3  *
4  *  Copyright (C) 2006 Julien Rebetez
5  *
6  * Evince is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * Evince is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20
21 #if !defined (__EV_EVINCE_DOCUMENT_H_INSIDE__) && !defined (EVINCE_COMPILATION)
22 #error "Only <evince-document.h> can be included directly."
23 #endif
24
25 #ifndef EV_FORM_FIELD_H
26 #define EV_FORM_FIELD_H
27
28 #include <glib-object.h>
29
30 #include "ev-document.h"
31
32 G_BEGIN_DECLS
33
34 #define EV_TYPE_FORM_FIELD                        (ev_form_field_get_type())
35 #define EV_FORM_FIELD(object)                     (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_FORM_FIELD, EvFormField))
36 #define EV_FORM_FIELD_CLASS(klass)                (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_FORM_FIELD, EvFormFieldClass))
37 #define EV_IS_FORM_FIELD(object)                  (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_FORM_FIELD))
38 #define EV_IS_FORM_FIELD_CLASS(klass)             (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_FORM_FIELD))
39 #define EV_FORM_FIELD_GET_CLASS(object)           (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_FORM_FIELD, EvFormFieldClass)) 
40
41 #define EV_TYPE_FORM_FIELD_TEXT                   (ev_form_field_text_get_type())
42 #define EV_FORM_FIELD_TEXT(object)                (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_FORM_FIELD_TEXT, EvFormFieldText))
43 #define EV_FORM_FIELD_TEXT_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_FORM_FIELD_TEXT, EvFormFieldTextClass))
44 #define EV_IS_FORM_FIELD_TEXT(object)             (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_FORM_FIELD_TEXT))
45 #define EV_IS_FORM_FIELD_TEXT_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_FORM_FIELD_TEXT))
46 #define EV_FORM_FIELD_TEXT_GET_CLASS(object)      (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_FORM_FIELD_TEXT, EvFormFieldTextClass))
47
48 #define EV_TYPE_FORM_FIELD_BUTTON                 (ev_form_field_button_get_type())
49 #define EV_FORM_FIELD_BUTTON(object)              (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_FORM_FIELD_BUTTON, EvFormFieldButton))
50 #define EV_FORM_FIELD_BUTTON_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_FORM_FIELD_BUTTON, EvFormFieldButtonClass))
51 #define EV_IS_FORM_FIELD_BUTTON(object)           (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_FORM_FIELD_BUTTON))
52 #define EV_IS_FORM_FIELD_BUTTON_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_FORM_FIELD_BUTTON))
53 #define EV_FORM_FIELD_BUTTON_GET_CLASS(object)    (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_FORM_FIELD_BUTTON, EvFormFieldButtonClass))
54
55 #define EV_TYPE_FORM_FIELD_CHOICE                 (ev_form_field_choice_get_type())
56 #define EV_FORM_FIELD_CHOICE(object)              (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_FORM_FIELD_CHOICE, EvFormFieldChoice))
57 #define EV_FORM_FIELD_CHOICE_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_FORM_FIELD_CHOICE, EvFormFieldChoiceClass))
58 #define EV_IS_FORM_FIELD_CHOICE(object)           (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_FORM_FIELD_CHOICE))
59 #define EV_IS_FORM_FIELD_CHOICE_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_FORM_FIELD_CHOICE))
60 #define EV_FORM_FIELD_CHOICE_GET_CLASS(object)    (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_FORM_FIELD_CHOICE, EvFormFieldChoiceClass))
61
62 #define EV_TYPE_FORM_FIELD_SIGNATURE              (ev_form_field_signature_get_type())
63 #define EV_FORM_FIELD_SIGNATURE(object)           (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_FORM_FIELD_SIGNATURE, EvFormFieldSignature))
64 #define EV_FORM_FIELD_SIGNATURE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_FORM_FIELD_SIGNATURE, EvFormFieldSignatureClass))
65 #define EV_IS_FORM_FIELD_SIGNATURE(object)        (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_FORM_FIELD_SIGNATURE))
66 #define EV_IS_FORM_FIELD_SIGNATURE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_FORM_FIELD_SIGNATURE))
67 #define EV_FORM_FIELD_SIGNATURE_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_FORM_FIELD_SIGNATURE, EvFormFieldSignatureClass))
68
69 typedef struct _EvFormField               EvFormField;
70 typedef struct _EvFormFieldClass          EvFormFieldClass;
71
72 typedef struct _EvFormFieldText           EvFormFieldText;
73 typedef struct _EvFormFieldTextClass      EvFormFieldTextClass;
74
75 typedef struct _EvFormFieldButton         EvFormFieldButton;
76 typedef struct _EvFormFieldButtonClass    EvFormFieldButtonClass;
77
78 typedef struct _EvFormFieldChoice         EvFormFieldChoice;
79 typedef struct _EvFormFieldChoiceClass    EvFormFieldChoiceClass;
80
81 typedef struct _EvFormFieldSignature      EvFormFieldSignature;
82 typedef struct _EvFormFieldSignatureClass EvFormFieldSignatureClass;
83
84 typedef enum
85 {
86         EV_FORM_FIELD_TEXT_NORMAL,
87         EV_FORM_FIELD_TEXT_MULTILINE,
88         EV_FORM_FIELD_TEXT_FILE_SELECT
89 } EvFormFieldTextType;
90
91 typedef enum
92 {
93         EV_FORM_FIELD_BUTTON_PUSH,
94         EV_FORM_FIELD_BUTTON_CHECK,
95         EV_FORM_FIELD_BUTTON_RADIO
96 } EvFormFieldButtonType;
97
98 typedef enum
99 {
100         EV_FORM_FIELD_CHOICE_COMBO,
101         EV_FORM_FIELD_CHOICE_LIST
102 } EvFormFieldChoiceType;
103
104 struct _EvFormField
105 {
106         GObject parent;
107
108         gint     id;
109         gboolean is_read_only;
110         gdouble  font_size;
111
112         EvPage  *page;
113         gboolean changed;
114 };
115
116 struct _EvFormFieldClass
117 {
118         GObjectClass parent_class;
119 };
120         
121 struct _EvFormFieldText
122 {
123         EvFormField partent;
124         
125         EvFormFieldTextType type;
126         
127         gboolean do_spell_check : 1;
128         gboolean do_scroll : 1;
129         gboolean comb : 1;
130         gboolean is_rich_text : 1;
131         gboolean is_password;
132
133         gint   max_len;
134         gchar *text;
135 };
136
137 struct _EvFormFieldTextClass
138 {
139         EvFormFieldClass partent_class;
140 };
141
142 struct _EvFormFieldButton
143 {
144         EvFormField partent;
145         
146         EvFormFieldButtonType type;
147
148         gboolean state;
149 };
150
151 struct _EvFormFieldButtonClass
152 {
153         EvFormFieldClass partent_class;
154 };
155
156 struct _EvFormFieldChoice
157 {
158         EvFormField partent;
159
160         EvFormFieldChoiceType type;
161         
162         gboolean multi_select : 1;
163         gboolean is_editable : 1;
164         gboolean do_spell_check : 1;
165         gboolean commit_on_sel_change : 1;
166
167         GList *selected_items;
168         gchar *text;
169 };
170
171 struct _EvFormFieldChoiceClass
172 {
173         EvFormFieldClass partent_class;
174 };
175
176 struct _EvFormFieldSignature
177 {
178         EvFormField partent;
179         
180         /* TODO */
181 };
182
183 struct _EvFormFieldSignatureClass
184 {
185         EvFormFieldClass partent_class;
186 };
187
188 /* EvFormField base class */
189 GType        ev_form_field_get_type           (void) G_GNUC_CONST;
190
191 /* EvFormFieldText */
192 GType        ev_form_field_text_get_type      (void) G_GNUC_CONST;
193 EvFormField *ev_form_field_text_new           (gint                  id,
194                                                EvFormFieldTextType   type);
195
196 /* EvFormFieldButton */
197 GType        ev_form_field_button_get_type    (void) G_GNUC_CONST;
198 EvFormField *ev_form_field_button_new         (gint                  id,
199                                                EvFormFieldButtonType type);
200
201 /* EvFormFieldChoice */
202 GType        ev_form_field_choice_get_type    (void) G_GNUC_CONST;
203 EvFormField *ev_form_field_choice_new         (gint                  id,
204                                                EvFormFieldChoiceType type);
205
206 /* EvFormFieldSignature */
207 GType        ev_form_field_signature_get_type (void) G_GNUC_CONST;
208 EvFormField *ev_form_field_signature_new      (gint                  id);
209
210
211 G_END_DECLS
212
213 #endif /* !EV_FORM_FIELD_H */
214