]> matita.cs.unibo.it Git - helm.git/blob - helm/gtkmathview-bonobo/src/view.c
snapshot
[helm.git] / helm / gtkmathview-bonobo / src / view.c
1
2 #include <config.h>
3
4 #include "view.h"
5
6 static GObjectClass* view_parent_class;
7
8 static void
9 view_object_finalize(GObject* object)
10 {
11   View* view = VIEW(object);
12   /* free resources */
13   view_parent_class->finalize(object);
14   return;
15 }
16
17 static void
18 impl_view_freeze(PortableServer_Servant servant,
19                  CORBA_Environment *ev)
20 {
21   View* view = VIEW (bonobo_object (servant));
22   gtk_math_view_freeze(view->control_data->math_view);
23   return;
24 }
25
26 static void
27 impl_view_thaw(PortableServer_Servant servant,
28                CORBA_Environment *ev)
29 {
30   View* view = VIEW (bonobo_object (servant));
31   gtk_math_view_thaw(view->control_data->math_view);
32   return;
33 }
34
35 static void
36 impl_view_load(PortableServer_Servant servant,
37                const CORBA_char *uri,
38                CORBA_Environment *ev)
39 {
40   View* view = VIEW (bonobo_object (servant));
41   gtk_math_view_load_uri(view->control_data->math_view, uri);
42   return;
43 }
44
45 static void
46 impl_view_unload(PortableServer_Servant servant,
47                  CORBA_Environment *ev)
48 {
49   View* view = VIEW (bonobo_object (servant));
50   gtk_math_view_unload(view->control_data->math_view);
51   return;
52 }
53
54 static void
55 impl_view_setIdAttribute (PortableServer_Servant servant,
56                 const CORBA_char *ns,
57                 const CORBA_char *name,
58                 CORBA_Environment *ev)
59 {
60     return;
61 }
62
63
64 static void
65 impl_view_getIdAttribute (PortableServer_Servant servant,
66                 CORBA_char *ns,
67                 CORBA_char *name,
68                 CORBA_Environment *ev)
69 {
70     return;
71 }
72
73 static void 
74 impl_view_select(PortableServer_Servant servant,
75        //in element_id elem,
76        CORBA_Environment *ev)
77 {
78     return;
79 }
80       
81 static void 
82 impl_view_unselect(PortableServer_Servant servant,
83          //in element_id elem,
84          CORBA_Environment *ev)
85 {
86     return;
87 }
88       
89 static CORBA_boolean 
90 impl_view_isSelected(PortableServer_Servant servant,
91             //in element_id elem,
92             CORBA_Environment *ev)
93 {
94     return;
95 }
96
97 static CORBA_boolean 
98 impl_view_elementBoundingBox(PortableServer_Servant servant,
99                              //in element_id elem,
100                              CORBA_short *x,CORBA_short *y,
101                              CORBA_short *width,CORBA_short *height, 
102                              CORBA_short *depth,
103                              CORBA_Environment *ev)
104 {
105     return;
106 }
107
108 static void 
109 impl_view_getBoundingBox(PortableServer_Servant servant,
110                          CORBA_short *width, 
111                          CORBA_short *height, 
112                          CORBA_short *depth,
113                          CORBA_Environment *ev)
114 {
115     return;
116 }
117
118 static void 
119 impl_view_getSize(PortableServer_Servant servant,
120                   CORBA_short *width,CORBA_short *height,
121                   CORBA_short *totalWidth,CORBA_short *totalHeight,
122                   CORBA_Environment *ev)
123 {
124     //View* view = VIEW (bonobo_object (servant));
125     //gtk_math_view_get_top(view->control_data->math_view,x,y);
126     
127     return;
128 }
129
130 static void 
131 impl_view_getTop(PortableServer_Servant servant,
132                  CORBA_short *x,CORBA_short *y,
133                  CORBA_Environment *ev)
134 {
135     View* view = VIEW (bonobo_object (servant));
136     gtk_math_view_get_top(view->control_data->math_view,x,y);
137     return;
138 }
139
140 static void 
141 impl_view_setTop (PortableServer_Servant servant,
142                   const CORBA_short x,const CORBA_short y,
143                   CORBA_Environment *ev)
144 {
145     View* view = VIEW (bonobo_object (servant));
146     gtk_math_view_set_top(view->control_data->math_view,x,y);
147     return;
148 }
149
150 static void 
151 impl_view_setDefaultFontSize(PortableServer_Servant servant,
152                              const CORBA_short size,
153                              CORBA_Environment *ev)
154 {
155     View* view = VIEW (bonobo_object (servant));
156     gtk_math_view_set_font_size(view->control_data->math_view,size);
157     return;
158 }
159
160 static short 
161 impl_view_getDefaultFontSize(PortableServer_Servant servant,
162                              CORBA_Environment *ev)
163 {
164     short int ris;
165     View* view = VIEW (bonobo_object (servant));
166     ris = gtk_math_view_get_font_size(view->control_data->math_view);
167     return ris;
168 }
169
170 static void 
171 impl_view_setVerbosity(PortableServer_Servant servant,
172                        const CORBA_short level,
173                        CORBA_Environment *ev)
174 {
175     View* view = VIEW (bonobo_object (servant));
176     gtk_math_view_set_log_verbosity(view->control_data->math_view,level); 
177     return;
178 }
179
180 static short 
181 impl_view_getVerbosity(PortableServer_Servant servant,
182                        CORBA_Environment *ev)
183 {
184     short int ris;
185     View* view = VIEW (bonobo_object (servant));
186     ris = gtk_math_view_get_log_verbosity(view->control_data->math_view);
187     return ris;
188 }
189
190 static void
191 view_class_init(ViewClass* klass)
192 {
193   GObjectClass* object_class = (GObjectClass *) klass;
194   POA_GNOME_GtkMathView_View__epv* epv = &klass->epv;
195   
196   view_parent_class = g_type_class_peek_parent (klass);
197   object_class->finalize = view_object_finalize;
198   
199   epv->freeze = impl_view_freeze;
200   epv->thaw = impl_view_thaw;
201   epv->load = impl_view_load;
202   epv->unload = impl_view_unload;
203   epv->setIdAttribute = impl_view_setIdAttribute;
204   epv->getIdAttribute = impl_view_getIdAttribute;
205   epv->select = impl_view_select;
206   epv->unselect = impl_view_unselect;
207   epv->isSelected = impl_view_isSelected;
208   epv->elementBoundingBox = impl_view_elementBoundingBox;
209   epv->getBoundingBox = impl_view_getBoundingBox;
210   epv->getSize = impl_view_getSize;
211   epv->getTop = impl_view_getTop;
212   epv->setTop = impl_view_setTop;
213   epv->setDefaultFontSize = impl_view_setDefaultFontSize;
214   epv->getDefaultFontSize = impl_view_getDefaultFontSize;
215   epv->setVerbosity = impl_view_setVerbosity;
216   epv->getVerbosity = impl_view_getVerbosity;
217
218   return;
219 }
220
221 static void
222 view_init(View* view)
223 {
224   /* do some initialization */
225 }
226
227 BONOBO_TYPE_FUNC_FULL (View, GNOME_GtkMathView_View, BONOBO_TYPE_OBJECT, view)
228
229 View*
230 view_new(GtkMathViewControlData* control_data)
231 {
232   View* view;
233   g_return_val_if_fail(control_data != NULL, NULL);
234   view = g_object_new(VIEW_TYPE, NULL);
235   view->control_data = control_data;
236   return view;
237 }