* fixed memory allocation bugs
[ardour.git] / libs / clearlooks / clearlooks_types.h
1 #ifndef CLEARLOOKS_TYPES_H
2 #define CLEARLOOKS_TYPES_H
3
4 #include <ge-support.h>
5
6 typedef unsigned char boolean;
7 typedef unsigned char uint8;
8 typedef struct _ClearlooksStyleFunctions ClearlooksStyleFunctions;
9 typedef struct _ClearlooksStyleConstants ClearlooksStyleConstants;
10
11 typedef enum
12 {
13         CL_STYLE_CLASSIC = 0,
14         CL_STYLE_GLOSSY = 1,
15         CL_STYLE_INVERTED = 2,
16         CL_STYLE_GUMMY = 3,
17         CL_NUM_STYLES = 4
18 } ClearlooksStyles;
19
20 typedef enum
21 {
22         CL_STATE_NORMAL,
23         CL_STATE_ACTIVE,
24         CL_STATE_SELECTED,
25         CL_STATE_INSENSITIVE
26 } ClearlooksStateType;
27
28 typedef enum
29 {
30         CL_JUNCTION_NONE      = 0,
31         CL_JUNCTION_BEGIN     = 1,
32         CL_JUNCTION_END       = 2
33 } ClearlooksJunction;
34
35 typedef enum
36 {
37         CL_STEPPER_UNKNOWN    = 0,
38         CL_STEPPER_A          = 1,
39         CL_STEPPER_B          = 2,
40         CL_STEPPER_C          = 4,
41         CL_STEPPER_D          = 8
42 } ClearlooksStepper;
43
44 typedef enum
45 {
46         CL_ORDER_FIRST    = 1 << 0,
47         CL_ORDER_LAST     = 1 << 1,
48 } ClearlooksOrder;
49
50 typedef enum
51 {
52         CL_CONT_NONE       = 0,
53         CL_CONT_LEFT       = 1 << 0,
54         CL_CONT_RIGHT      = 1 << 1
55 } ClearlooksContinue;
56
57 typedef enum
58 {
59         CL_ORIENTATION_LEFT_TO_RIGHT,
60         CL_ORIENTATION_RIGHT_TO_LEFT,
61         CL_ORIENTATION_BOTTOM_TO_TOP,
62         CL_ORIENTATION_TOP_TO_BOTTOM
63 } ClearlooksOrientation;
64
65 typedef enum
66 {
67         CL_GAP_LEFT,
68         CL_GAP_RIGHT,
69         CL_GAP_TOP,
70         CL_GAP_BOTTOM
71 } ClearlooksGapSide;
72
73 typedef enum
74 {
75         CL_SHADOW_NONE,
76         CL_SHADOW_IN,
77         CL_SHADOW_OUT,
78         CL_SHADOW_ETCHED_IN,
79         CL_SHADOW_ETCHED_OUT
80 } ClearlooksShadowType;
81
82 typedef enum
83 {
84         CL_HANDLE_TOOLBAR,
85         CL_HANDLE_SPLITTER
86 } ClearlooksHandleType;
87
88 typedef enum
89 {
90         CL_ARROW_NORMAL,
91         CL_ARROW_COMBO
92 } ClearlooksArrowType;
93
94 typedef enum
95 {
96         CL_FOCUS_BUTTON,
97         CL_FOCUS_BUTTON_FLAT,
98         CL_FOCUS_LABEL,
99         CL_FOCUS_TREEVIEW,
100         CL_FOCUS_TREEVIEW_HEADER,
101         CL_FOCUS_TREEVIEW_ROW,
102         CL_FOCUS_TREEVIEW_DND,
103         CL_FOCUS_SCALE,
104         CL_FOCUS_TAB,
105         CL_FOCUS_COLOR_WHEEL_DARK,
106         CL_FOCUS_COLOR_WHEEL_LIGHT,
107         CL_FOCUS_UNKNOWN
108 } ClearlooksFocusType;
109
110
111 typedef enum
112 {
113         CL_DIRECTION_UP,
114         CL_DIRECTION_DOWN,
115         CL_DIRECTION_LEFT,
116         CL_DIRECTION_RIGHT
117 } ClearlooksDirection;
118
119 typedef enum
120 {
121         CL_PROGRESSBAR_CONTINUOUS,
122         CL_PROGRESSBAR_DISCRETE
123 } ClearlooksProgressBarStyle;
124
125 typedef enum
126 {
127         CL_WINDOW_EDGE_NORTH_WEST,
128         CL_WINDOW_EDGE_NORTH,
129         CL_WINDOW_EDGE_NORTH_EAST,
130         CL_WINDOW_EDGE_WEST,
131         CL_WINDOW_EDGE_EAST,
132         CL_WINDOW_EDGE_SOUTH_WEST,
133         CL_WINDOW_EDGE_SOUTH,
134         CL_WINDOW_EDGE_SOUTH_EAST  
135 } ClearlooksWindowEdge;
136
137 typedef struct
138 {
139         double x;
140         double y;
141         double width;
142         double height;
143 } ClearlooksRectangle;
144
145 typedef struct
146 {
147         CairoColor fg[5];
148         CairoColor bg[5];
149         CairoColor base[5];
150         CairoColor text[5];
151         
152         CairoColor shade[9];
153         CairoColor spot[3];
154 } ClearlooksColors;
155
156 typedef struct
157 {
158         boolean active;
159         boolean prelight;
160         boolean disabled;
161         boolean focus;
162         boolean is_default;
163         boolean ltr;
164         boolean enable_shadow;
165
166         gfloat  radius;
167         
168         ClearlooksStateType state_type;
169         
170         uint8 corners;
171         uint8 xthickness;
172         uint8 ythickness;
173
174         CairoColor parentbg;
175
176         ClearlooksStyleFunctions *style_functions;
177         ClearlooksStyleConstants *style_constants;
178 } WidgetParameters;
179
180 typedef struct
181 {
182         ClearlooksFocusType type;
183         ClearlooksContinue  continue_side;
184         CairoColor          color;
185         boolean             has_color;
186         gint                line_width;
187         gint                padding;
188         guint8*             dash_list;
189         boolean             interior;
190 } FocusParameters;
191
192 typedef struct
193 {
194         boolean lower;
195         boolean horizontal;
196         boolean fill_level;
197 } SliderParameters;
198
199 typedef struct
200 {
201         ClearlooksOrientation orientation;
202         boolean pulsing;
203         float value;
204 } ProgressBarParameters;
205
206 typedef struct
207 {
208         int linepos;
209 } OptionMenuParameters;
210
211 typedef struct
212 {
213         ClearlooksShadowType shadow;
214         ClearlooksGapSide gap_side;
215         int gap_x;
216         int gap_width;
217         const CairoColor *border; /* maybe changes this to some other hint ... */
218 } FrameParameters;
219
220 typedef struct
221 {
222         ClearlooksGapSide gap_side;
223         FocusParameters   focus;
224 } TabParameters;
225
226 typedef struct
227 {
228         CairoCorners    corners;
229         ClearlooksShadowType shadow;
230 } ShadowParameters;
231
232 typedef struct
233 {
234         boolean horizontal;
235 } SeparatorParameters;
236
237 typedef struct
238 {
239         ClearlooksOrder order; /* XXX: rename to position */
240         boolean         resizable;
241 } ListViewHeaderParameters;
242
243 typedef struct
244 {
245         CairoColor         color;
246         ClearlooksJunction junction; /* On which sides the slider junctions */
247         boolean            horizontal;
248         boolean            has_color;
249 } ScrollBarParameters;
250
251 typedef struct
252 {
253         ClearlooksHandleType type;
254         boolean              horizontal; 
255 } HandleParameters;
256
257 typedef struct
258 {
259         ClearlooksStepper stepper;  /* Which stepper to draw */
260 } ScrollBarStepperParameters;
261
262 typedef struct
263 {
264         ClearlooksWindowEdge edge;
265 } ResizeGripParameters;
266
267 typedef struct
268 {
269         int style;
270 } MenuBarParameters;
271
272 typedef struct
273 {
274         ClearlooksShadowType shadow_type;
275         boolean              in_cell;
276         boolean              in_menu;
277 } CheckboxParameters;
278
279 typedef struct
280 {
281         ClearlooksArrowType type;
282         ClearlooksDirection direction;
283 } ArrowParameters;
284
285 typedef struct
286 {
287         int      style;
288         boolean  topmost;
289 } ToolbarParameters;
290
291 struct _ClearlooksStyleConstants
292 {
293         gdouble topleft_highlight_shade;
294         gdouble topleft_highlight_alpha;
295 };
296
297 struct _ClearlooksStyleFunctions
298 {
299         void (*draw_top_left_highlight) (cairo_t *cr,
300                                        const CairoColor *color,
301                                        const WidgetParameters *params,
302                                        int x, int y, int width, int height,
303                                        gdouble radius,
304                                        CairoCorners corners);
305
306         void (*draw_button)           (cairo_t *cr,
307                                        const ClearlooksColors *colors,
308                                        const WidgetParameters *widget,
309                                        int x, int y, int width, int height);
310
311         void (*draw_scale_trough)     (cairo_t *cr,
312                                        const ClearlooksColors *colors,
313                                        const WidgetParameters *widget,
314                                        const SliderParameters *slider,
315                                        int x, int y, int width, int height);
316
317         void (*draw_progressbar_trough) (cairo_t        *cr,
318                                        const ClearlooksColors *colors,
319                                        const WidgetParameters *widget,
320                                        int x, int y, int width, int height);
321
322         void (*draw_progressbar_fill) (cairo_t *cr,
323                                        const ClearlooksColors *colors,
324                                        const WidgetParameters *widget,
325                                        const ProgressBarParameters      *progressbar,
326                                        int x, int y, int width, int height, gint offset);
327
328         void (*draw_slider_button)    (cairo_t *cr,
329                                        const ClearlooksColors *colors,
330                                        const WidgetParameters *widget,
331                                        const SliderParameters *slider,
332                                        int x, int y, int width, int height);
333
334         void (*draw_entry)            (cairo_t *cr,
335                                        const ClearlooksColors *colors,
336                                        const WidgetParameters *widget,
337                                        int x, int y, int width, int height);
338
339         void (*draw_spinbutton)       (cairo_t *cr,
340                                        const ClearlooksColors *colors,
341                                        const WidgetParameters *widget,
342                                        int x, int y, int width, int height);
343
344         void (*draw_spinbutton_down)  (cairo_t *cr,
345                                        const ClearlooksColors *colors,
346                                        const WidgetParameters *widget,
347                                        int x, int y, int width, int height);
348
349         void (*draw_optionmenu)       (cairo_t *cr,
350                                        const ClearlooksColors *colors,
351                                        const WidgetParameters *widget,
352                                        const OptionMenuParameters *optionmenu,
353                                        int x, int y, int width, int height);
354
355         void (*draw_inset)            (cairo_t *cr,
356                                         const CairoColor *bg_color,
357                                         double x, double y, double w, double h,
358                                         double radius, uint8 corners);
359
360         void (*draw_menubar)          (cairo_t *cr,
361                                        const ClearlooksColors *colors,
362                                        const WidgetParameters *widget,
363                                        const MenuBarParameters *menubar,
364                                        int x, int y, int width, int height);
365
366         void (*draw_tab)              (cairo_t *cr,
367                                        const ClearlooksColors *colors,
368                                        const WidgetParameters *widget,
369                                        const TabParameters *tab,
370                                        int x, int y, int width, int height);
371
372         void (*draw_frame)            (cairo_t *cr,
373                                        const ClearlooksColors *colors,
374                                        const WidgetParameters *widget,
375                                        const FrameParameters *frame,
376                                        int x, int y, int width, int height);
377
378         void (*draw_separator)        (cairo_t *cr,
379                                        const ClearlooksColors *colors,
380                                        const WidgetParameters *widget,
381                                        const SeparatorParameters *separator,
382                                        int x, int y, int width, int height);
383
384         void (*draw_menu_item_separator) (cairo_t *cr,
385                                        const ClearlooksColors *colors,
386                                        const WidgetParameters *widget,
387                                        const SeparatorParameters *separator,
388                                        int x, int y, int width, int height);
389
390         void (*draw_list_view_header) (cairo_t *cr,
391                                        const ClearlooksColors *colors,
392                                        const WidgetParameters *widget,
393                                        const ListViewHeaderParameters *header,
394                                        int x, int y, int width, int height);
395
396         void (*draw_toolbar)          (cairo_t *cr,
397                                        const ClearlooksColors *colors,
398                                        const WidgetParameters *widget,
399                                        const ToolbarParameters *toolbar,
400                                        int x, int y, int width, int height);
401
402         void (*draw_menuitem)         (cairo_t *cr,
403                                        const ClearlooksColors *colors,
404                                        const WidgetParameters *widget,
405                                        int x, int y, int width, int height);
406
407         void (*draw_menubaritem)      (cairo_t *cr,
408                                        const ClearlooksColors *colors,
409                                        const WidgetParameters *widget,
410                                        int x, int y, int width, int height);
411
412         void (*draw_selected_cell)    (cairo_t *cr,
413                                        const ClearlooksColors *colors,
414                                        const WidgetParameters *widget,
415                                        int x, int y, int width, int height);
416
417         void (*draw_scrollbar_stepper) (cairo_t *cr,
418                                         const ClearlooksColors  *colors,
419                                         const WidgetParameters  *widget,
420                                         const ScrollBarParameters *scrollbar,
421                                         const ScrollBarStepperParameters *stepper,
422                                         int x, int y, int width, int height);
423
424         void (*draw_scrollbar_slider) (cairo_t *cr,
425                                        const ClearlooksColors *colors,
426                                        const WidgetParameters *widget,
427                                        const ScrollBarParameters        *scrollbar,
428                                        int x, int y, int width, int height);
429
430         void (*draw_scrollbar_trough) (cairo_t *cr,
431                                        const ClearlooksColors *colors,
432                                        const WidgetParameters *widget,
433                                        const ScrollBarParameters        *scrollbar,
434                                        int x, int y, int width, int height);
435
436         void (*draw_statusbar)        (cairo_t *cr,
437                                        const ClearlooksColors *colors,
438                                        const WidgetParameters *widget,
439                                        int x, int y, int width, int height);
440
441         void (*draw_menu_frame)       (cairo_t *cr,
442                                        const ClearlooksColors *colors,
443                                        const WidgetParameters *widget,
444                                        int x, int y, int width, int height);
445
446         void (*draw_tooltip)          (cairo_t *cr,
447                                        const ClearlooksColors *colors,
448                                        const WidgetParameters *widget,
449                                        int x, int y, int width, int height);
450
451         void (*draw_handle)           (cairo_t *cr,
452                                        const ClearlooksColors *colors,
453                                        const WidgetParameters *widget,
454                                        const HandleParameters *handle,
455                                        int x, int y, int width, int height);
456
457         void (*draw_resize_grip)      (cairo_t *cr,
458                                        const ClearlooksColors *colors,
459                                        const WidgetParameters *widget,
460                                        const ResizeGripParameters       *grip,
461                                        int x, int y, int width, int height);
462
463         void (*draw_arrow)            (cairo_t *cr,
464                                        const ClearlooksColors *colors,
465                                        const WidgetParameters *widget,
466                                        const ArrowParameters *arrow,
467                                        int x, int y, int width, int height);
468
469         void (*draw_focus)            (cairo_t *cr,
470                                        const ClearlooksColors *colors,
471                                        const WidgetParameters *widget,
472                                        const FocusParameters *focus,
473                                        int x, int y, int width, int height);
474
475         void (*draw_checkbox)         (cairo_t *cr,
476                                        const ClearlooksColors *colors,
477                                        const WidgetParameters *widget,
478                                        const CheckboxParameters *checkbox,
479                                        int x, int y, int width, int height);
480
481         void (*draw_radiobutton)      (cairo_t *cr,
482                                        const ClearlooksColors *colors,
483                                        const WidgetParameters *widget,
484                                        const CheckboxParameters *checkbox,
485                                        int x, int y, int width, int height);
486
487         /* Style internal functions */
488         /* XXX: Only used by slider_button, inline it? */
489         void (*draw_shadow)           (cairo_t *cr,
490                                        const ClearlooksColors *colors,
491                                        gfloat radius, int width, int height);
492
493         void (*draw_slider)           (cairo_t *cr,
494                                        const ClearlooksColors *colors,
495                                        const WidgetParameters *widget,
496                                        int x, int y, int width, int height);
497
498         void (*draw_gripdots)         (cairo_t *cr,
499                                        const ClearlooksColors *colors, int x, int y,
500                                        int width, int height, int xr, int yr,
501                                        float contrast);
502 };
503
504
505 #define CLEARLOOKS_RECTANGLE_SET(rect, _x, _y, _w, _h) (rect).x      = (_x); \
506                                                        (rect).y      = (_y); \
507                                                        (rect).width  = (_w); \
508                                                        (rect).height = (_h);
509
510 #endif /* CLEARLOOKS_TYPES_H */