41
41
G_DEFINE_DYNAMIC_TYPE (UnicoEngine, unico_engine, GTK_TYPE_THEMING_ENGINE)
44
unico_engine_render_activity (GtkThemingEngine *engine,
51
UnicoStyleFunctions *style_functions;
52
const GtkWidgetPath *path;
56
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
57
path = gtk_theming_engine_get_path (engine);
59
if (gtk_widget_path_is_type (path, GTK_TYPE_SCALE))
60
unico_trim_scale_allocation (engine, &x, &y, &width, &height);
62
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINNER))
63
GTK_THEMING_ENGINE_CLASS (unico_engine_parent_class)->render_activity (engine, cr, x, y, width, height);
65
style_functions->draw_activity (engine, cr, x, y, width, height);
69
44
unico_engine_render_arrow (GtkThemingEngine *engine,
86
unico_engine_render_background (GtkThemingEngine *engine,
93
UnicoStyleFunctions *style_functions;
94
const GtkWidgetPath *path;
99
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
100
path = gtk_theming_engine_get_path (engine);
102
if (gtk_widget_path_is_type (path, GTK_TYPE_SCALE) &&
103
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH))
104
unico_trim_scale_allocation (engine, &x, &y, &width, &height);
106
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON) &&
107
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINBUTTON))
108
style_functions->draw_spinbutton_background (engine, cr, x, y, width, height);
109
else if (!gtk_widget_path_is_type (path, GTK_TYPE_ICON_VIEW) &&
110
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_VIEW) &&
111
gtk_theming_engine_has_region (engine, GTK_STYLE_REGION_COLUMN, &flags))
112
style_functions->draw_cell_background (engine, cr, x, y, width, height, flags);
114
style_functions->draw_common_background (engine, cr, x, y, width, height);
118
unico_engine_render_check (GtkThemingEngine *engine,
125
UnicoStyleFunctions *style_functions;
129
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
131
if (!gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENUITEM))
133
if (unico_cairo_draw_from_texture (engine, cr, x, y, width, height))
137
style_functions->draw_check (engine, cr, x, y, width, height);
141
61
unico_engine_render_expander (GtkThemingEngine *engine,
189
91
style_functions->draw_focus (engine, cr, x, y, width, height);
193
unico_engine_render_frame (GtkThemingEngine *engine,
200
UnicoStyleFunctions *style_functions;
201
const GtkWidgetPath *path;
202
GtkRegionFlags flags;
206
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
207
path = gtk_theming_engine_get_path (engine);
209
if (gtk_widget_path_is_type (path, GTK_TYPE_SCALE) &&
210
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_TROUGH))
211
unico_trim_scale_allocation (engine, &x, &y, &width, &height);
213
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SEPARATOR))
214
style_functions->draw_separator (engine, cr, x, y, width, height);
215
else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_BUTTON) &&
216
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SPINBUTTON))
217
style_functions->draw_spinbutton_frame (engine, cr, x, y, width, height);
218
else if (!gtk_widget_path_is_type (path, GTK_TYPE_ICON_VIEW) &&
219
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_VIEW) &&
220
gtk_theming_engine_has_region (engine, GTK_STYLE_REGION_COLUMN, &flags))
221
style_functions->draw_cell_frame (engine, cr, x, y, width, height, flags);
223
style_functions->draw_common_frame (engine, cr, x, y, width, height);
227
unico_engine_render_frame_gap (GtkThemingEngine *engine,
233
GtkPositionType gap_side,
237
UnicoStyleFunctions *style_functions;
241
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
243
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_NOTEBOOK))
244
style_functions->draw_notebook (engine, cr, x, y, width, height, gap_side, xy0_gap, xy1_gap);
246
style_functions->draw_frame_gap (engine, cr, x, y, width, height, gap_side, xy0_gap, xy1_gap);
250
unico_engine_render_handle (GtkThemingEngine *engine,
257
UnicoStyleFunctions *style_functions;
261
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
263
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_GRIP))
264
style_functions->draw_grip (engine, cr, x, y, width, height);
266
style_functions->draw_handle (engine, cr, x, y, width, height);
270
unico_engine_render_line (GtkThemingEngine *engine,
277
UnicoStyleFunctions *style_functions;
281
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
283
style_functions->draw_line (engine, cr, x0, y0, x1, y1);
287
unico_engine_render_option (GtkThemingEngine *engine,
294
UnicoStyleFunctions *style_functions;
298
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
300
if (!gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_MENUITEM))
302
if (unico_cairo_draw_from_texture (engine, cr, x, y, width, height))
306
style_functions->draw_radio (engine, cr, x, y, width, height);
310
unico_engine_render_slider (GtkThemingEngine *engine,
316
GtkOrientation orientation)
318
UnicoStyleFunctions *style_functions;
322
unico_lookup_functions (UNICO_ENGINE (engine), &style_functions);
324
if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SCALE))
326
if (unico_cairo_draw_from_texture (engine, cr, x, y, width, height))
330
style_functions->draw_slider (engine, cr, x, y, width, height, orientation);
334
95
unico_engine_register_types (GTypeModule *module)
348
109
GtkThemingEngineClass *engine_class = GTK_THEMING_ENGINE_CLASS (klass);
350
engine_class->render_activity = unico_engine_render_activity;
351
111
engine_class->render_arrow = unico_engine_render_arrow;
352
engine_class->render_background = unico_engine_render_background;
353
engine_class->render_check = unico_engine_render_check;
354
112
engine_class->render_expander = unico_engine_render_expander;
355
engine_class->render_extension = unico_engine_render_extension;
356
113
engine_class->render_focus = unico_engine_render_focus;
357
engine_class->render_frame = unico_engine_render_frame;
358
engine_class->render_frame_gap = unico_engine_render_frame_gap;
359
engine_class->render_handle = unico_engine_render_handle;
360
engine_class->render_line = unico_engine_render_line;
361
engine_class->render_option = unico_engine_render_option;
362
engine_class->render_slider = unico_engine_render_slider;
364
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
365
g_param_spec_boxed ("background-texture",
366
"Background texture",
367
"Background texture",
368
CAIRO_GOBJECT_TYPE_PATTERN, 0));
370
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
371
g_param_spec_boxed ("border-gradient",
374
CAIRO_GOBJECT_TYPE_PATTERN, 0));
376
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
377
g_param_spec_boxed ("bullet-color",
382
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
383
g_param_spec_boxed ("bullet-outline-color",
384
"Bullet outline color",
385
"Bullet outline color",
388
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
389
g_param_spec_boxed ("centroid-texture",
392
CAIRO_GOBJECT_TYPE_PATTERN, 0));
115
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
116
g_param_spec_boxed ("arrow-texture",
119
CAIRO_GOBJECT_TYPE_PATTERN, 0));
395
121
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
396
122
g_param_spec_boxed ("focus-border-color",
409
135
"Focus fill color",
410
136
"Focus fill color",
411
137
GDK_TYPE_RGBA, 0));
413
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
414
g_param_spec_boxed ("focus-outer-stroke-color",
415
"Focus outer stroke color",
416
"Focus outer stroke color",
419
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
420
g_param_spec_int ("glow-radius",
425
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
426
g_param_spec_boxed ("glow-color",
431
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
432
g_param_spec_boxed ("inner-stroke-color",
433
"Inner stroke color",
434
"Inner stroke color",
437
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
438
g_param_spec_boxed ("inner-stroke-top-color",
439
"Inner stroke top color",
440
"Inner stroke top color",
443
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
444
g_param_spec_boxed ("inner-stroke-right-color",
445
"Inner stroke right color",
446
"Inner stroke right color",
449
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
450
g_param_spec_boxed ("inner-stroke-bottom-color",
451
"Inner stroke bottom color",
452
"Inner stroke bottom color",
455
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
456
g_param_spec_boxed ("inner-stroke-left-color",
457
"Inner stroke left color",
458
"Inner stroke left color",
461
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
462
g_param_spec_boxed ("inner-stroke-gradient",
463
"Inner stroke gradient",
464
"Inner stroke gradient",
465
CAIRO_GOBJECT_TYPE_PATTERN, 0));
467
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
468
g_param_spec_boxed ("inner-stroke-width",
469
"Inner stroke width",
470
"Inner stroke width",
471
GTK_TYPE_BORDER, 0));
473
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
474
g_param_spec_boxed ("outer-stroke-color",
475
"Outer stroke color",
476
"Outer stroke color",
479
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
480
g_param_spec_boxed ("outer-stroke-top-color",
481
"Outer stroke top color",
482
"Outer stroke top color",
485
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
486
g_param_spec_boxed ("outer-stroke-right-color",
487
"Outer stroke right color",
488
"Outer stroke right color",
491
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
492
g_param_spec_boxed ("outer-stroke-bottom-color",
493
"Outer stroke bottom color",
494
"Outer stroke bottom color",
497
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
498
g_param_spec_boxed ("outer-stroke-left-color",
499
"Outer stroke left color",
500
"Outer stroke left color",
503
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
504
g_param_spec_boxed ("outer-stroke-gradient",
505
"Outer stroke gradient",
506
"Outer stroke gradient",
507
CAIRO_GOBJECT_TYPE_PATTERN, 0));
509
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
510
g_param_spec_boxed ("outer-stroke-width",
511
"Outer stroke width",
512
"Outer stroke width",
513
GTK_TYPE_BORDER, 0));
515
gtk_theming_engine_register_property (UNICO_NAMESPACE, NULL,
516
g_param_spec_boxed ("text-shadow-color",