56
56
#define YTHICKNESS(style) (style->ythickness)
57
57
#define WINDOW_IS_MAPPED(window) ((window) && GDK_IS_WINDOW(window) && gdk_window_is_visible(window))
59
static GtkWidget* gProtoWindow;
60
static GtkWidget* gProtoLayout;
61
static GtkWidget* gButtonWidget;
62
static GtkWidget* gToggleButtonWidget;
63
static GtkWidget* gButtonArrowWidget;
64
static GtkWidget* gCheckboxWidget;
65
static GtkWidget* gRadiobuttonWidget;
66
static GtkWidget* gHorizScrollbarWidget;
67
static GtkWidget* gVertScrollbarWidget;
68
static GtkWidget* gSpinWidget;
69
static GtkWidget* gHScaleWidget;
70
static GtkWidget* gVScaleWidget;
71
static GtkWidget* gEntryWidget;
72
static GtkWidget* gComboBoxWidget;
73
static GtkWidget* gComboBoxButtonWidget;
74
static GtkWidget* gComboBoxArrowWidget;
75
static GtkWidget* gComboBoxSeparatorWidget;
76
static GtkWidget* gComboBoxEntryWidget;
77
static GtkWidget* gComboBoxEntryTextareaWidget;
78
static GtkWidget* gComboBoxEntryButtonWidget;
79
static GtkWidget* gComboBoxEntryArrowWidget;
80
static GtkWidget* gHandleBoxWidget;
81
static GtkWidget* gToolbarWidget;
82
static GtkWidget* gFrameWidget;
83
static GtkWidget* gStatusbarWidget;
84
static GtkWidget* gProgressWidget;
85
static GtkWidget* gTabWidget;
86
static GtkWidget* gTooltipWidget;
87
static GtkWidget* gMenuBarWidget;
88
static GtkWidget* gMenuBarItemWidget;
89
static GtkWidget* gMenuPopupWidget;
90
static GtkWidget* gMenuItemWidget;
91
static GtkWidget* gImageMenuItemWidget;
92
static GtkWidget* gCheckMenuItemWidget;
93
static GtkWidget* gTreeViewWidget;
94
static GtkTreeViewColumn* gMiddleTreeViewColumn;
95
static GtkWidget* gTreeHeaderCellWidget;
96
static GtkWidget* gTreeHeaderSortArrowWidget;
97
static GtkWidget* gExpanderWidget;
98
static GtkWidget* gToolbarSeparatorWidget;
99
static GtkWidget* gMenuSeparatorWidget;
100
static GtkWidget* gHPanedWidget;
101
static GtkWidget* gVPanedWidget;
102
static GtkWidget* gScrolledWindowWidget;
59
static GtkThemeParts *gParts = NULL;
104
60
static style_prop_t style_prop_func;
105
61
static gboolean have_arrow_scaling;
106
62
static gboolean is_initialized;
65
moz_gtk_use_theme_parts(GtkThemeParts* parts)
108
70
/* Because we have such an unconventional way of drawing widgets, signal to the GTK theme engine
109
71
that they are drawing for Mozilla instead of a conventional GTK app so they can do any specific
110
72
things they may want to do. */
136
102
setup_widget_prototype(GtkWidget* widget)
138
104
ensure_window_widget();
140
gProtoLayout = gtk_fixed_new();
141
gtk_container_add(GTK_CONTAINER(gProtoWindow), gProtoLayout);
105
if (!gParts->protoLayout) {
106
gParts->protoLayout = gtk_fixed_new();
107
gtk_container_add(GTK_CONTAINER(gParts->protoWindow), gParts->protoLayout);
144
gtk_container_add(GTK_CONTAINER(gProtoLayout), widget);
110
gtk_container_add(GTK_CONTAINER(gParts->protoLayout), widget);
145
111
gtk_widget_realize(widget);
146
112
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
147
113
return MOZ_GTK_SUCCESS;
181
147
ensure_toggle_button_widget()
183
if (!gToggleButtonWidget) {
184
gToggleButtonWidget = gtk_toggle_button_new();
185
setup_widget_prototype(gToggleButtonWidget);
149
if (!gParts->toggleButtonWidget) {
150
gParts->toggleButtonWidget = gtk_toggle_button_new();
151
setup_widget_prototype(gParts->toggleButtonWidget);
186
152
/* toggle button must be set active to get the right style on hover. */
187
GTK_TOGGLE_BUTTON(gToggleButtonWidget)->active = TRUE;
153
GTK_TOGGLE_BUTTON(gParts->toggleButtonWidget)->active = TRUE;
189
155
return MOZ_GTK_SUCCESS;
193
159
ensure_button_arrow_widget()
195
if (!gButtonArrowWidget) {
161
if (!gParts->buttonArrowWidget) {
196
162
ensure_toggle_button_widget();
198
gButtonArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
199
gtk_container_add(GTK_CONTAINER(gToggleButtonWidget), gButtonArrowWidget);
200
gtk_widget_realize(gButtonArrowWidget);
164
gParts->buttonArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
165
gtk_container_add(GTK_CONTAINER(gParts->toggleButtonWidget), gParts->buttonArrowWidget);
166
gtk_widget_realize(gParts->buttonArrowWidget);
202
168
return MOZ_GTK_SUCCESS;
226
192
ensure_scrollbar_widget()
228
if (!gVertScrollbarWidget) {
229
gVertScrollbarWidget = gtk_vscrollbar_new(NULL);
230
setup_widget_prototype(gVertScrollbarWidget);
194
if (!gParts->vertScrollbarWidget) {
195
gParts->vertScrollbarWidget = gtk_vscrollbar_new(NULL);
196
setup_widget_prototype(gParts->vertScrollbarWidget);
232
if (!gHorizScrollbarWidget) {
233
gHorizScrollbarWidget = gtk_hscrollbar_new(NULL);
234
setup_widget_prototype(gHorizScrollbarWidget);
198
if (!gParts->horizScrollbarWidget) {
199
gParts->horizScrollbarWidget = gtk_hscrollbar_new(NULL);
200
setup_widget_prototype(gParts->horizScrollbarWidget);
236
202
return MOZ_GTK_SUCCESS;
250
216
ensure_scale_widget()
252
if (!gHScaleWidget) {
253
gHScaleWidget = gtk_hscale_new(NULL);
254
setup_widget_prototype(gHScaleWidget);
218
if (!gParts->hScaleWidget) {
219
gParts->hScaleWidget = gtk_hscale_new(NULL);
220
setup_widget_prototype(gParts->hScaleWidget);
256
if (!gVScaleWidget) {
257
gVScaleWidget = gtk_vscale_new(NULL);
258
setup_widget_prototype(gVScaleWidget);
222
if (!gParts->vScaleWidget) {
223
gParts->vScaleWidget = gtk_vscale_new(NULL);
224
setup_widget_prototype(gParts->vScaleWidget);
260
226
return MOZ_GTK_SUCCESS;
278
244
* g_object_add_weak_pointer().
279
245
* Note that if we don't find the inner widgets (which shouldn't happen), we
280
246
* fallback to use generic "non-inner" widgets, and they don't need that kind
281
* of weak pointer since they are explicit children of gProtoWindow and as
247
* of weak pointer since they are explicit children of gParts->protoWindow and as
282
248
* such GTK holds a strong reference to them. */
284
250
moz_gtk_get_combo_box_inner_button(GtkWidget *widget, gpointer client_data)
286
252
if (GTK_IS_TOGGLE_BUTTON(widget)) {
287
gComboBoxButtonWidget = widget;
253
gParts->comboBoxButtonWidget = widget;
288
254
g_object_add_weak_pointer(G_OBJECT(widget),
289
(gpointer) &gComboBoxButtonWidget);
255
(gpointer) &gParts->comboBoxButtonWidget);
290
256
gtk_widget_realize(widget);
291
257
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
297
263
gpointer client_data)
299
265
if (GTK_IS_SEPARATOR(widget)) {
300
gComboBoxSeparatorWidget = widget;
266
gParts->comboBoxSeparatorWidget = widget;
301
267
g_object_add_weak_pointer(G_OBJECT(widget),
302
(gpointer) &gComboBoxSeparatorWidget);
268
(gpointer) &gParts->comboBoxSeparatorWidget);
303
269
} else if (GTK_IS_ARROW(widget)) {
304
gComboBoxArrowWidget = widget;
270
gParts->comboBoxArrowWidget = widget;
305
271
g_object_add_weak_pointer(G_OBJECT(widget),
306
(gpointer) &gComboBoxArrowWidget);
272
(gpointer) &gParts->comboBoxArrowWidget);
309
275
gtk_widget_realize(widget);
316
282
GtkWidget* buttonChild;
318
if (gComboBoxButtonWidget && gComboBoxArrowWidget)
284
if (gParts->comboBoxButtonWidget && gParts->comboBoxArrowWidget)
319
285
return MOZ_GTK_SUCCESS;
321
287
/* Create a ComboBox if needed */
322
if (!gComboBoxWidget) {
323
gComboBoxWidget = gtk_combo_box_new();
324
setup_widget_prototype(gComboBoxWidget);
288
if (!gParts->comboBoxWidget) {
289
gParts->comboBoxWidget = gtk_combo_box_new();
290
setup_widget_prototype(gParts->comboBoxWidget);
327
293
/* Get its inner Button */
328
gtk_container_forall(GTK_CONTAINER(gComboBoxWidget),
294
gtk_container_forall(GTK_CONTAINER(gParts->comboBoxWidget),
329
295
moz_gtk_get_combo_box_inner_button,
332
if (gComboBoxButtonWidget) {
298
if (gParts->comboBoxButtonWidget) {
333
299
/* Get the widgets inside the Button */
334
buttonChild = GTK_BIN(gComboBoxButtonWidget)->child;
300
buttonChild = GTK_BIN(gParts->comboBoxButtonWidget)->child;
335
301
if (GTK_IS_HBOX(buttonChild)) {
336
302
/* appears-as-list = FALSE, cell-view = TRUE; the button
337
303
* contains an hbox. This hbox is there because the ComboBox
343
309
} else if(GTK_IS_ARROW(buttonChild)) {
344
310
/* appears-as-list = TRUE, or cell-view = FALSE;
345
311
* the button only contains an arrow */
346
gComboBoxArrowWidget = buttonChild;
312
gParts->comboBoxArrowWidget = buttonChild;
347
313
g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer)
348
&gComboBoxArrowWidget);
349
gtk_widget_realize(gComboBoxArrowWidget);
350
g_object_set_data(G_OBJECT(gComboBoxArrowWidget),
314
&gParts->comboBoxArrowWidget);
315
gtk_widget_realize(gParts->comboBoxArrowWidget);
316
g_object_set_data(G_OBJECT(gParts->comboBoxArrowWidget),
351
317
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
355
321
* use a generic toggle button as last resort fallback to avoid
357
323
ensure_toggle_button_widget();
358
gComboBoxButtonWidget = gToggleButtonWidget;
324
gParts->comboBoxButtonWidget = gParts->toggleButtonWidget;
361
if (!gComboBoxArrowWidget) {
327
if (!gParts->comboBoxArrowWidget) {
362
328
/* Shouldn't be reached with current internal gtk implementation;
363
* we gButtonArrowWidget as last resort fallback to avoid
329
* we gParts->buttonArrowWidget as last resort fallback to avoid
365
331
ensure_button_arrow_widget();
366
gComboBoxArrowWidget = gButtonArrowWidget;
332
gParts->comboBoxArrowWidget = gParts->buttonArrowWidget;
369
/* We don't test the validity of gComboBoxSeparatorWidget since there
335
/* We don't test the validity of gParts->comboBoxSeparatorWidget since there
370
336
* is none when "appears-as-list" = TRUE or "cell-view" = FALSE; if it
371
337
* is invalid we just won't paint it. */
381
347
* g_object_add_weak_pointer().
382
348
* Note that if we don't find the inner widgets (which shouldn't happen), we
383
349
* fallback to use generic "non-inner" widgets, and they don't need that kind
384
* of weak pointer since they are explicit children of gProtoWindow and as
350
* of weak pointer since they are explicit children of gParts->protoWindow and as
385
351
* such GTK holds a strong reference to them. */
387
353
moz_gtk_get_combo_box_entry_inner_widgets(GtkWidget *widget,
388
354
gpointer client_data)
390
356
if (GTK_IS_TOGGLE_BUTTON(widget)) {
391
gComboBoxEntryButtonWidget = widget;
357
gParts->comboBoxEntryButtonWidget = widget;
392
358
g_object_add_weak_pointer(G_OBJECT(widget),
393
(gpointer) &gComboBoxEntryButtonWidget);
359
(gpointer) &gParts->comboBoxEntryButtonWidget);
394
360
} else if (GTK_IS_ENTRY(widget)) {
395
gComboBoxEntryTextareaWidget = widget;
361
gParts->comboBoxEntryTextareaWidget = widget;
396
362
g_object_add_weak_pointer(G_OBJECT(widget),
397
(gpointer) &gComboBoxEntryTextareaWidget);
363
(gpointer) &gParts->comboBoxEntryTextareaWidget);
400
366
gtk_widget_realize(widget);
405
371
moz_gtk_get_combo_box_entry_arrow(GtkWidget *widget, gpointer client_data)
407
373
if (GTK_IS_ARROW(widget)) {
408
gComboBoxEntryArrowWidget = widget;
374
gParts->comboBoxEntryArrowWidget = widget;
409
375
g_object_add_weak_pointer(G_OBJECT(widget),
410
(gpointer) &gComboBoxEntryArrowWidget);
376
(gpointer) &gParts->comboBoxEntryArrowWidget);
411
377
gtk_widget_realize(widget);
412
378
g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
419
385
GtkWidget* buttonChild;
421
if (gComboBoxEntryTextareaWidget &&
422
gComboBoxEntryButtonWidget &&
423
gComboBoxEntryArrowWidget)
387
if (gParts->comboBoxEntryTextareaWidget &&
388
gParts->comboBoxEntryButtonWidget &&
389
gParts->comboBoxEntryArrowWidget)
424
390
return MOZ_GTK_SUCCESS;
426
392
/* Create a ComboBoxEntry if needed */
427
if (!gComboBoxEntryWidget) {
428
gComboBoxEntryWidget = gtk_combo_box_entry_new();
429
setup_widget_prototype(gComboBoxEntryWidget);
393
if (!gParts->comboBoxEntryWidget) {
394
gParts->comboBoxEntryWidget = gtk_combo_box_entry_new();
395
setup_widget_prototype(gParts->comboBoxEntryWidget);
432
398
/* Get its inner Entry and Button */
433
gtk_container_forall(GTK_CONTAINER(gComboBoxEntryWidget),
399
gtk_container_forall(GTK_CONTAINER(gParts->comboBoxEntryWidget),
434
400
moz_gtk_get_combo_box_entry_inner_widgets,
437
if (!gComboBoxEntryTextareaWidget) {
403
if (!gParts->comboBoxEntryTextareaWidget) {
438
404
ensure_entry_widget();
439
gComboBoxEntryTextareaWidget = gEntryWidget;
405
gParts->comboBoxEntryTextareaWidget = gParts->entryWidget;
442
if (gComboBoxEntryButtonWidget) {
408
if (gParts->comboBoxEntryButtonWidget) {
443
409
/* Get the Arrow inside the Button */
444
buttonChild = GTK_BIN(gComboBoxEntryButtonWidget)->child;
410
buttonChild = GTK_BIN(gParts->comboBoxEntryButtonWidget)->child;
445
411
if (GTK_IS_HBOX(buttonChild)) {
446
412
/* appears-as-list = FALSE, cell-view = TRUE; the button
447
413
* contains an hbox. This hbox is there because ComboBoxEntry
456
422
} else if(GTK_IS_ARROW(buttonChild)) {
457
423
/* appears-as-list = TRUE, or cell-view = FALSE;
458
424
* the button only contains an arrow */
459
gComboBoxEntryArrowWidget = buttonChild;
425
gParts->comboBoxEntryArrowWidget = buttonChild;
460
426
g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer)
461
&gComboBoxEntryArrowWidget);
462
gtk_widget_realize(gComboBoxEntryArrowWidget);
463
g_object_set_data(G_OBJECT(gComboBoxEntryArrowWidget),
427
&gParts->comboBoxEntryArrowWidget);
428
gtk_widget_realize(gParts->comboBoxEntryArrowWidget);
429
g_object_set_data(G_OBJECT(gParts->comboBoxEntryArrowWidget),
464
430
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
468
434
* we use a generic toggle button as last resort fallback to avoid
470
436
ensure_toggle_button_widget();
471
gComboBoxEntryButtonWidget = gToggleButtonWidget;
437
gParts->comboBoxEntryButtonWidget = gParts->toggleButtonWidget;
474
if (!gComboBoxEntryArrowWidget) {
440
if (!gParts->comboBoxEntryArrowWidget) {
475
441
/* Shouldn't be reached with current internal gtk implementation;
476
* we gButtonArrowWidget as last resort fallback to avoid
442
* we gParts->buttonArrowWidget as last resort fallback to avoid
478
444
ensure_button_arrow_widget();
479
gComboBoxEntryArrowWidget = gButtonArrowWidget;
445
gParts->comboBoxEntryArrowWidget = gParts->buttonArrowWidget;
482
448
return MOZ_GTK_SUCCESS;
497
463
ensure_toolbar_widget()
499
if (!gToolbarWidget) {
465
if (!gParts->toolbarWidget) {
500
466
ensure_handlebox_widget();
501
gToolbarWidget = gtk_toolbar_new();
502
gtk_container_add(GTK_CONTAINER(gHandleBoxWidget), gToolbarWidget);
503
gtk_widget_realize(gToolbarWidget);
504
g_object_set_data(G_OBJECT(gToolbarWidget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
467
gParts->toolbarWidget = gtk_toolbar_new();
468
gtk_container_add(GTK_CONTAINER(gParts->handleBoxWidget), gParts->toolbarWidget);
469
gtk_widget_realize(gParts->toolbarWidget);
470
g_object_set_data(G_OBJECT(gParts->toolbarWidget), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
506
472
return MOZ_GTK_SUCCESS;
584
550
ensure_menu_bar_item_widget()
586
if (!gMenuBarItemWidget) {
552
if (!gParts->menuBarItemWidget) {
587
553
ensure_menu_bar_widget();
588
gMenuBarItemWidget = gtk_menu_item_new();
589
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuBarWidget),
591
gtk_widget_realize(gMenuBarItemWidget);
592
g_object_set_data(G_OBJECT(gMenuBarItemWidget),
554
gParts->menuBarItemWidget = gtk_menu_item_new();
555
gtk_menu_shell_append(GTK_MENU_SHELL(gParts->menuBarWidget),
556
gParts->menuBarItemWidget);
557
gtk_widget_realize(gParts->menuBarItemWidget);
558
g_object_set_data(G_OBJECT(gParts->menuBarItemWidget),
593
559
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
595
561
return MOZ_GTK_SUCCESS;
599
565
ensure_menu_popup_widget()
601
if (!gMenuPopupWidget) {
567
if (!gParts->menuPopupWidget) {
602
568
ensure_menu_bar_item_widget();
603
gMenuPopupWidget = gtk_menu_new();
604
gtk_menu_item_set_submenu(GTK_MENU_ITEM(gMenuBarItemWidget),
606
gtk_widget_realize(gMenuPopupWidget);
607
g_object_set_data(G_OBJECT(gMenuPopupWidget),
569
gParts->menuPopupWidget = gtk_menu_new();
570
gtk_menu_item_set_submenu(GTK_MENU_ITEM(gParts->menuBarItemWidget),
571
gParts->menuPopupWidget);
572
gtk_widget_realize(gParts->menuPopupWidget);
573
g_object_set_data(G_OBJECT(gParts->menuPopupWidget),
608
574
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
610
576
return MOZ_GTK_SUCCESS;
614
580
ensure_menu_item_widget()
616
if (!gMenuItemWidget) {
582
if (!gParts->menuItemWidget) {
617
583
ensure_menu_popup_widget();
618
gMenuItemWidget = gtk_menu_item_new_with_label("M");
619
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
621
gtk_widget_realize(gMenuItemWidget);
622
g_object_set_data(G_OBJECT(gMenuItemWidget),
584
gParts->menuItemWidget = gtk_menu_item_new_with_label("M");
585
gtk_menu_shell_append(GTK_MENU_SHELL(gParts->menuPopupWidget),
586
gParts->menuItemWidget);
587
gtk_widget_realize(gParts->menuItemWidget);
588
g_object_set_data(G_OBJECT(gParts->menuItemWidget),
623
589
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
625
591
return MOZ_GTK_SUCCESS;
629
595
ensure_image_menu_item_widget()
631
if (!gImageMenuItemWidget) {
597
if (!gParts->imageMenuItemWidget) {
632
598
ensure_menu_popup_widget();
633
gImageMenuItemWidget = gtk_image_menu_item_new();
634
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
635
gImageMenuItemWidget);
636
gtk_widget_realize(gImageMenuItemWidget);
637
g_object_set_data(G_OBJECT(gImageMenuItemWidget),
599
gParts->imageMenuItemWidget = gtk_image_menu_item_new();
600
gtk_menu_shell_append(GTK_MENU_SHELL(gParts->menuPopupWidget),
601
gParts->imageMenuItemWidget);
602
gtk_widget_realize(gParts->imageMenuItemWidget);
603
g_object_set_data(G_OBJECT(gParts->imageMenuItemWidget),
638
604
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
640
606
return MOZ_GTK_SUCCESS;
644
610
ensure_menu_separator_widget()
646
if (!gMenuSeparatorWidget) {
612
if (!gParts->menuSeparatorWidget) {
647
613
ensure_menu_popup_widget();
648
gMenuSeparatorWidget = gtk_separator_menu_item_new();
649
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
650
gMenuSeparatorWidget);
651
gtk_widget_realize(gMenuSeparatorWidget);
652
g_object_set_data(G_OBJECT(gMenuSeparatorWidget),
614
gParts->menuSeparatorWidget = gtk_separator_menu_item_new();
615
gtk_menu_shell_append(GTK_MENU_SHELL(gParts->menuPopupWidget),
616
gParts->menuSeparatorWidget);
617
gtk_widget_realize(gParts->menuSeparatorWidget);
618
g_object_set_data(G_OBJECT(gParts->menuSeparatorWidget),
653
619
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
655
621
return MOZ_GTK_SUCCESS;
659
625
ensure_check_menu_item_widget()
661
if (!gCheckMenuItemWidget) {
627
if (!gParts->checkMenuItemWidget) {
662
628
ensure_menu_popup_widget();
663
gCheckMenuItemWidget = gtk_check_menu_item_new_with_label("M");
664
gtk_menu_shell_append(GTK_MENU_SHELL(gMenuPopupWidget),
665
gCheckMenuItemWidget);
666
gtk_widget_realize(gCheckMenuItemWidget);
667
g_object_set_data(G_OBJECT(gCheckMenuItemWidget),
629
gParts->checkMenuItemWidget = gtk_check_menu_item_new_with_label("M");
630
gtk_menu_shell_append(GTK_MENU_SHELL(gParts->menuPopupWidget),
631
gParts->checkMenuItemWidget);
632
gtk_widget_realize(gParts->checkMenuItemWidget);
633
g_object_set_data(G_OBJECT(gParts->checkMenuItemWidget),
668
634
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
670
636
return MOZ_GTK_SUCCESS;
705
671
/* Create and append our three columns */
706
672
firstTreeViewColumn = gtk_tree_view_column_new();
707
673
gtk_tree_view_column_set_title(firstTreeViewColumn, "M");
708
gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget), firstTreeViewColumn);
674
gtk_tree_view_append_column(GTK_TREE_VIEW(gParts->treeViewWidget), firstTreeViewColumn);
710
gMiddleTreeViewColumn = gtk_tree_view_column_new();
711
gtk_tree_view_column_set_title(gMiddleTreeViewColumn, "M");
712
gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget),
713
gMiddleTreeViewColumn);
676
gParts->middleTreeViewColumn = gtk_tree_view_column_new();
677
gtk_tree_view_column_set_title(gParts->middleTreeViewColumn, "M");
678
gtk_tree_view_append_column(GTK_TREE_VIEW(gParts->treeViewWidget),
679
gParts->middleTreeViewColumn);
715
681
lastTreeViewColumn = gtk_tree_view_column_new();
716
682
gtk_tree_view_column_set_title(lastTreeViewColumn, "M");
717
gtk_tree_view_append_column(GTK_TREE_VIEW(gTreeViewWidget), lastTreeViewColumn);
683
gtk_tree_view_append_column(GTK_TREE_VIEW(gParts->treeViewWidget), lastTreeViewColumn);
719
685
/* Use the middle column's header for our button */
720
gTreeHeaderCellWidget = gMiddleTreeViewColumn->button;
721
gTreeHeaderSortArrowWidget = gMiddleTreeViewColumn->arrow;
722
g_object_set_data(G_OBJECT(gTreeHeaderCellWidget),
686
gParts->treeHeaderCellWidget = gParts->middleTreeViewColumn->button;
687
gParts->treeHeaderSortArrowWidget = gParts->middleTreeViewColumn->arrow;
688
g_object_set_data(G_OBJECT(gParts->treeHeaderCellWidget),
723
689
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
724
g_object_set_data(G_OBJECT(gTreeHeaderSortArrowWidget),
690
g_object_set_data(G_OBJECT(gParts->treeHeaderSortArrowWidget),
725
691
"transparent-bg-hint", GINT_TO_POINTER(TRUE));
727
693
return MOZ_GTK_SUCCESS;
937
903
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
938
904
ensure_hpaned_widget();
939
gtk_widget_style_get(gHPanedWidget, "handle_size", size, NULL);
905
gtk_widget_style_get(gParts->hpanedWidget, "handle_size", size, NULL);
941
907
ensure_vpaned_widget();
942
gtk_widget_style_get(gVPanedWidget, "handle_size", size, NULL);
908
gtk_widget_style_get(gParts->vpanedWidget, "handle_size", size, NULL);
944
910
return MOZ_GTK_SUCCESS;
1015
981
gtk_paint_option(style, drawable, state_type, shadow_type, cliprect,
1016
gRadiobuttonWidget, "radiobutton", x, y,
982
gParts->radiobuttonWidget, "radiobutton", x, y,
1018
984
if (state->focused) {
1019
985
gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect,
1020
gRadiobuttonWidget, "radiobutton", focus_x, focus_y,
986
gParts->radiobuttonWidget, "radiobutton", focus_x, focus_y,
1021
987
focus_width, focus_height);
1027
993
* must also be changed for the state to be drawn.
1029
995
if (inconsistent) {
1030
gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), TRUE);
996
gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gParts->checkboxWidget), TRUE);
1031
997
shadow_type = GTK_SHADOW_ETCHED_IN;
1033
gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), FALSE);
999
gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gParts->checkboxWidget), FALSE);
1036
1002
gtk_paint_check(style, drawable, state_type, shadow_type, cliprect,
1037
gCheckboxWidget, "checkbutton", x, y, width, height);
1003
gParts->checkboxWidget, "checkbutton", x, y, width, height);
1038
1004
if (state->focused) {
1039
1005
gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect,
1040
gCheckboxWidget, "checkbutton", focus_x, focus_y,
1006
gParts->checkboxWidget, "checkbutton", focus_x, focus_y,
1041
1007
focus_width, focus_height);
1321
1287
GtkStyle* style;
1323
1289
ensure_spin_widget();
1324
gtk_widget_set_direction(gSpinWidget, direction);
1325
style = gSpinWidget->style;
1290
gtk_widget_set_direction(gParts->spinWidget, direction);
1291
style = gParts->spinWidget->style;
1327
1293
TSOffsetStyleGCs(style, rect->x, rect->y);
1328
1294
gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL,
1329
gSpinWidget, "spinbutton",
1295
gParts->spinWidget, "spinbutton",
1330
1296
rect->x, rect->y, rect->width, rect->height);
1331
1297
return MOZ_GTK_SUCCESS;
1343
1309
GtkStyle* style;
1345
1311
ensure_spin_widget();
1346
style = gSpinWidget->style;
1347
gtk_widget_set_direction(gSpinWidget, direction);
1312
style = gParts->spinWidget->style;
1313
gtk_widget_set_direction(gParts->spinWidget, direction);
1349
1315
TSOffsetStyleGCs(style, rect->x, rect->y);
1350
gtk_paint_box(style, drawable, state_type, shadow_type, NULL, gSpinWidget,
1316
gtk_paint_box(style, drawable, state_type, shadow_type, NULL, gParts->spinWidget,
1351
1317
isDown ? "spinbutton_down" : "spinbutton_up",
1352
1318
rect->x, rect->y, rect->width, rect->height);
1359
1325
arrow_rect.y += isDown ? -1 : 1;
1361
1327
gtk_paint_arrow(style, drawable, state_type, shadow_type, NULL,
1362
gSpinWidget, "spinbutton",
1328
gParts->spinWidget, "spinbutton",
1363
1329
isDown ? GTK_ARROW_DOWN : GTK_ARROW_UP, TRUE,
1364
1330
arrow_rect.x, arrow_rect.y,
1365
1331
arrow_rect.width, arrow_rect.height);
1454
1420
GtkStyle* style;
1456
1422
ensure_handlebox_widget();
1457
gtk_widget_set_direction(gHandleBoxWidget, direction);
1423
gtk_widget_set_direction(gParts->handleBoxWidget, direction);
1459
style = gHandleBoxWidget->style;
1460
shadow_type = GTK_HANDLE_BOX(gHandleBoxWidget)->shadow_type;
1425
style = gParts->handleBoxWidget->style;
1426
shadow_type = GTK_HANDLE_BOX(gParts->handleBoxWidget)->shadow_type;
1462
1428
TSOffsetStyleGCs(style, rect->x, rect->y);
1463
1429
gtk_paint_box(style, drawable, state_type, shadow_type, cliprect,
1464
gHandleBoxWidget, "handlebox_bin", rect->x, rect->y,
1430
gParts->handleBoxWidget, "handlebox_bin", rect->x, rect->y,
1465
1431
rect->width, rect->height);
1467
1433
return MOZ_GTK_SUCCESS;
1474
1440
GtkStateType hpaned_state = ConvertGtkState(state);
1476
1442
ensure_hpaned_widget();
1477
gtk_paint_handle(gHPanedWidget->style, drawable, hpaned_state,
1478
GTK_SHADOW_NONE, cliprect, gHPanedWidget, "paned",
1443
gtk_paint_handle(gParts->hpanedWidget->style, drawable, hpaned_state,
1444
GTK_SHADOW_NONE, cliprect, gParts->hpanedWidget, "paned",
1479
1445
rect->x, rect->y, rect->width, rect->height,
1480
1446
GTK_ORIENTATION_VERTICAL);
1489
1455
GtkStateType vpaned_state = ConvertGtkState(state);
1491
1457
ensure_vpaned_widget();
1492
gtk_paint_handle(gVPanedWidget->style, drawable, vpaned_state,
1493
GTK_SHADOW_NONE, cliprect, gVPanedWidget, "paned",
1458
gtk_paint_handle(gParts->vpanedWidget->style, drawable, vpaned_state,
1459
GTK_SHADOW_NONE, cliprect, gParts->vpanedWidget, "paned",
1494
1460
rect->x, rect->y, rect->width, rect->height,
1495
1461
GTK_ORIENTATION_HORIZONTAL);
1628
1594
ensure_tree_view_widget();
1629
1595
ensure_scrolled_window_widget();
1631
gtk_widget_set_direction(gTreeViewWidget, direction);
1632
gtk_widget_set_direction(gScrolledWindowWidget, direction);
1597
gtk_widget_set_direction(gParts->treeViewWidget, direction);
1598
gtk_widget_set_direction(gParts->scrolledWindowWidget, direction);
1634
1600
/* only handle disabled and normal states, otherwise the whole background
1635
1601
* area will be painted differently with other states */
1638
1604
/* In GTK the treeview sets the background of the window
1639
1605
* which contains the cells to the treeview base color.
1640
1606
* If we don't set it here the background color will not be correct.*/
1641
gtk_widget_modify_bg(gTreeViewWidget, state_type,
1642
&gTreeViewWidget->style->base[state_type]);
1607
gtk_widget_modify_bg(gParts->treeViewWidget, state_type,
1608
&gParts->treeViewWidget->style->base[state_type]);
1644
style = gScrolledWindowWidget->style;
1610
style = gParts->scrolledWindowWidget->style;
1645
1611
xthickness = XTHICKNESS(style);
1646
1612
ythickness = YTHICKNESS(style);
1648
TSOffsetStyleGCs(gTreeViewWidget->style, rect->x, rect->y);
1614
TSOffsetStyleGCs(gParts->treeViewWidget->style, rect->x, rect->y);
1649
1615
TSOffsetStyleGCs(style, rect->x, rect->y);
1651
gtk_paint_flat_box(gTreeViewWidget->style, drawable, state_type,
1652
GTK_SHADOW_NONE, cliprect, gTreeViewWidget, "treeview",
1617
gtk_paint_flat_box(gParts->treeViewWidget->style, drawable, state_type,
1618
GTK_SHADOW_NONE, cliprect, gParts->treeViewWidget, "treeview",
1653
1619
rect->x + xthickness, rect->y + ythickness,
1654
1620
rect->width - 2 * xthickness,
1655
1621
rect->height - 2 * ythickness);
1657
1623
gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
1658
cliprect, gScrolledWindowWidget, "scrolled_window",
1624
cliprect, gParts->scrolledWindowWidget, "scrolled_window",
1659
1625
rect->x, rect->y, rect->width, rect->height);
1661
1627
return MOZ_GTK_SUCCESS;
1666
1632
GdkRectangle* cliprect, GtkWidgetState* state,
1667
1633
gboolean isSorted, GtkTextDirection direction)
1669
gtk_tree_view_column_set_sort_indicator(gMiddleTreeViewColumn,
1635
gtk_tree_view_column_set_sort_indicator(gParts->middleTreeViewColumn,
1672
1638
moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL,
1673
gTreeHeaderCellWidget, direction);
1639
gParts->treeHeaderCellWidget, direction);
1674
1640
return MOZ_GTK_SUCCESS;
1695
1661
arrow_rect.x = rect->x + (rect->width - arrow_rect.width) / 2;
1696
1662
arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2;
1698
style = gTreeHeaderSortArrowWidget->style;
1664
style = gParts->treeHeaderSortArrowWidget->style;
1699
1665
TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y);
1701
1667
gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
1702
gTreeHeaderSortArrowWidget, "arrow", arrow_type, TRUE,
1668
gParts->treeHeaderSortArrowWidget, "arrow", arrow_type, TRUE,
1703
1669
arrow_rect.x, arrow_rect.y,
1704
1670
arrow_rect.width, arrow_rect.height);
1716
1682
GtkStateType state_type;
1718
1684
ensure_tree_view_widget();
1719
gtk_widget_set_direction(gTreeViewWidget, direction);
1685
gtk_widget_set_direction(gParts->treeViewWidget, direction);
1721
style = gTreeViewWidget->style;
1687
style = gParts->treeViewWidget->style;
1723
1689
/* Because the frame we get is of the entire treeview, we can't get the precise
1724
1690
* event state of one expander, thus rendering hover and active feedback useless. */
1725
1691
state_type = state->disabled ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL;
1727
1693
TSOffsetStyleGCs(style, rect->x, rect->y);
1728
gtk_paint_expander(style, drawable, state_type, cliprect, gTreeViewWidget, "treeview",
1694
gtk_paint_expander(style, drawable, state_type, cliprect, gParts->treeViewWidget, "treeview",
1729
1695
rect->x + rect->width / 2, rect->y + rect->height / 2, expander_state);
1731
1697
return MOZ_GTK_SUCCESS;
1741
1707
GtkStateType state_type = ConvertGtkState(state);
1743
1709
ensure_expander_widget();
1744
gtk_widget_set_direction(gExpanderWidget, direction);
1710
gtk_widget_set_direction(gParts->expanderWidget, direction);
1746
style = gExpanderWidget->style;
1712
style = gParts->expanderWidget->style;
1748
1714
TSOffsetStyleGCs(style, rect->x, rect->y);
1749
gtk_paint_expander(style, drawable, state_type, cliprect, gExpanderWidget, "expander",
1715
gtk_paint_expander(style, drawable, state_type, cliprect, gParts->expanderWidget, "expander",
1750
1716
rect->x + rect->width / 2, rect->y + rect->height / 2, expander_state);
1752
1718
return MOZ_GTK_SUCCESS;
1768
1734
ensure_combo_box_widgets();
1770
/* Also sets the direction on gComboBoxButtonWidget, which is then
1736
/* Also sets the direction on gParts->comboBoxButtonWidget, which is then
1771
1737
* inherited by the separator and arrow */
1772
1738
moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL,
1773
gComboBoxButtonWidget, direction);
1739
gParts->comboBoxButtonWidget, direction);
1775
calculate_button_inner_rect(gComboBoxButtonWidget,
1741
calculate_button_inner_rect(gParts->comboBoxButtonWidget,
1776
1742
rect, &arrow_rect, direction, ishtml);
1777
1743
/* Now arrow_rect contains the inner rect ; we want to correct the width
1778
1744
* to what the arrow needs (see gtk_combo_box_size_allocate) */
1779
gtk_widget_size_request(gComboBoxArrowWidget, &arrow_req);
1745
gtk_widget_size_request(gParts->comboBoxArrowWidget, &arrow_req);
1780
1746
if (direction == GTK_TEXT_DIR_LTR)
1781
1747
arrow_rect.x += arrow_rect.width - arrow_req.width;
1782
1748
arrow_rect.width = arrow_req.width;
1784
calculate_arrow_rect(gComboBoxArrowWidget,
1750
calculate_arrow_rect(gParts->comboBoxArrowWidget,
1785
1751
&arrow_rect, &real_arrow_rect, direction);
1787
style = gComboBoxArrowWidget->style;
1753
style = gParts->comboBoxArrowWidget->style;
1788
1754
TSOffsetStyleGCs(style, rect->x, rect->y);
1790
gtk_widget_size_allocate(gComboBoxWidget, rect);
1756
gtk_widget_size_allocate(gParts->comboBoxWidget, rect);
1792
1758
gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
1793
gComboBoxArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
1759
gParts->comboBoxArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
1794
1760
real_arrow_rect.x, real_arrow_rect.y,
1795
1761
real_arrow_rect.width, real_arrow_rect.height);
1798
1764
/* If there is no separator in the theme, there's nothing left to do. */
1799
if (!gComboBoxSeparatorWidget)
1765
if (!gParts->comboBoxSeparatorWidget)
1800
1766
return MOZ_GTK_SUCCESS;
1802
style = gComboBoxSeparatorWidget->style;
1768
style = gParts->comboBoxSeparatorWidget->style;
1803
1769
TSOffsetStyleGCs(style, rect->x, rect->y);
1805
gtk_widget_style_get(gComboBoxSeparatorWidget,
1771
gtk_widget_style_get(gParts->comboBoxSeparatorWidget,
1806
1772
"wide-separators", &wide_separators,
1807
1773
"separator-width", &separator_width,
1816
1782
gtk_paint_box(style, drawable,
1817
1783
GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
1818
cliprect, gComboBoxSeparatorWidget, "vseparator",
1784
cliprect, gParts->comboBoxSeparatorWidget, "vseparator",
1819
1785
arrow_rect.x, arrow_rect.y,
1820
1786
separator_width, arrow_rect.height);
1825
1791
arrow_rect.x += arrow_rect.width;
1827
1793
gtk_paint_vline(style, drawable, GTK_STATE_NORMAL, cliprect,
1828
gComboBoxSeparatorWidget, "vseparator",
1794
gParts->comboBoxSeparatorWidget, "vseparator",
1829
1795
arrow_rect.y, arrow_rect.y + arrow_rect.height,
1843
1809
GdkRectangle arrow_rect;
1845
1811
ensure_button_arrow_widget();
1846
style = gButtonArrowWidget->style;
1812
style = gParts->buttonArrowWidget->style;
1848
calculate_arrow_rect(gButtonArrowWidget, rect, &arrow_rect,
1814
calculate_arrow_rect(gParts->buttonArrowWidget, rect, &arrow_rect,
1849
1815
GTK_TEXT_DIR_LTR);
1851
1817
TSOffsetStyleGCs(style, arrow_rect.x, arrow_rect.y);
1852
1818
gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
1853
gButtonArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
1819
gParts->buttonArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
1854
1820
arrow_rect.x, arrow_rect.y, arrow_rect.width, arrow_rect.height);
1856
1822
return MOZ_GTK_SUCCESS;
1874
1840
if (input_focus) {
1875
1841
/* Some themes draw a complementary focus ring for the dropdown button
1876
1842
* when the dropdown entry has focus */
1877
GTK_WIDGET_SET_FLAGS(gComboBoxEntryTextareaWidget, GTK_HAS_FOCUS);
1843
GTK_WIDGET_SET_FLAGS(gParts->comboBoxEntryTextareaWidget, GTK_HAS_FOCUS);
1880
1846
moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL,
1881
gComboBoxEntryButtonWidget, direction);
1847
gParts->comboBoxEntryButtonWidget, direction);
1883
1849
if (input_focus)
1884
GTK_WIDGET_UNSET_FLAGS(gComboBoxEntryTextareaWidget, GTK_HAS_FOCUS);
1850
GTK_WIDGET_UNSET_FLAGS(gParts->comboBoxEntryTextareaWidget, GTK_HAS_FOCUS);
1886
calculate_button_inner_rect(gComboBoxEntryButtonWidget,
1852
calculate_button_inner_rect(gParts->comboBoxEntryButtonWidget,
1887
1853
rect, &arrow_rect, direction, FALSE);
1888
1854
if (state_type == GTK_STATE_ACTIVE) {
1889
gtk_widget_style_get(gComboBoxEntryButtonWidget,
1855
gtk_widget_style_get(gParts->comboBoxEntryButtonWidget,
1890
1856
"child-displacement-x", &x_displacement,
1891
1857
"child-displacement-y", &y_displacement,
1894
1860
arrow_rect.y += y_displacement;
1897
calculate_arrow_rect(gComboBoxEntryArrowWidget,
1863
calculate_arrow_rect(gParts->comboBoxEntryArrowWidget,
1898
1864
&arrow_rect, &real_arrow_rect, direction);
1900
style = gComboBoxEntryArrowWidget->style;
1866
style = gParts->comboBoxEntryArrowWidget->style;
1901
1867
TSOffsetStyleGCs(style, real_arrow_rect.x, real_arrow_rect.y);
1903
1869
gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect,
1904
gComboBoxEntryArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
1870
gParts->comboBoxEntryArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE,
1905
1871
real_arrow_rect.x, real_arrow_rect.y,
1906
1872
real_arrow_rect.width, real_arrow_rect.height);
2015
1981
cliprect, rect->x, rect->y,
2016
1982
rect->width, rect->height);
2018
gtk_widget_style_get(gToolbarWidget, "shadow-type", &shadow_type, NULL);
1984
gtk_widget_style_get(gParts->toolbarWidget, "shadow-type", &shadow_type, NULL);
2020
1986
gtk_paint_box (style, drawable, GTK_STATE_NORMAL, shadow_type,
2021
cliprect, gToolbarWidget, "toolbar",
1987
cliprect, gParts->toolbarWidget, "toolbar",
2022
1988
rect->x, rect->y, rect->width, rect->height);
2024
1990
return MOZ_GTK_SUCCESS;
2039
2005
const double end_fraction = 0.8;
2041
2007
ensure_toolbar_separator_widget();
2042
gtk_widget_set_direction(gToolbarSeparatorWidget, direction);
2044
style = gToolbarSeparatorWidget->style;
2046
gtk_widget_style_get(gToolbarWidget,
2008
gtk_widget_set_direction(gParts->toolbarSeparatorWidget, direction);
2010
style = gParts->toolbarSeparatorWidget->style;
2012
gtk_widget_style_get(gParts->toolbarWidget,
2047
2013
"wide-separators", &wide_separators,
2048
2014
"separator-width", &separator_width,
2057
2023
gtk_paint_box(style, drawable,
2058
2024
GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
2059
cliprect, gToolbarWidget, "vseparator",
2025
cliprect, gParts->toolbarWidget, "vseparator",
2060
2026
rect->x + (rect->width - separator_width) / 2,
2061
2027
rect->y + rect->height * start_fraction,
2062
2028
separator_width,
2069
2035
paint_width = rect->width;
2071
2037
gtk_paint_vline(style, drawable,
2072
GTK_STATE_NORMAL, cliprect, gToolbarSeparatorWidget,
2038
GTK_STATE_NORMAL, cliprect, gParts->toolbarSeparatorWidget,
2074
2040
rect->y + rect->height * start_fraction,
2075
2041
rect->y + rect->height * end_fraction,
2086
2052
GtkStyle* style;
2088
2054
ensure_tooltip_widget();
2089
gtk_widget_set_direction(gTooltipWidget, direction);
2055
gtk_widget_set_direction(gParts->tooltipWidget, direction);
2091
2057
style = gtk_rc_get_style_by_paths(gtk_settings_get_default(),
2092
2058
"gtk-tooltips", "GtkWindow",
2093
2059
GTK_TYPE_WINDOW);
2095
style = gtk_style_attach(style, gTooltipWidget->window);
2061
style = gtk_style_attach(style, gParts->tooltipWidget->window);
2096
2062
TSOffsetStyleGCs(style, rect->x, rect->y);
2097
2063
gtk_paint_flat_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
2098
cliprect, gTooltipWidget, "tooltip",
2064
cliprect, gParts->tooltipWidget, "tooltip",
2099
2065
rect->x, rect->y, rect->width, rect->height);
2101
2067
return MOZ_GTK_SUCCESS;
2110
2076
GtkStateType state_type = ConvertGtkState(state);
2112
2078
ensure_window_widget();
2113
gtk_widget_set_direction(gProtoWindow, direction);
2079
gtk_widget_set_direction(gParts->protoWindow, direction);
2115
style = gProtoWindow->style;
2081
style = gParts->protoWindow->style;
2117
2083
TSOffsetStyleGCs(style, rect->x, rect->y);
2119
gtk_paint_resize_grip(style, drawable, state_type, cliprect, gProtoWindow,
2085
gtk_paint_resize_grip(style, drawable, state_type, cliprect, gParts->protoWindow,
2120
2086
NULL, (direction == GTK_TEXT_DIR_LTR) ?
2121
2087
GDK_WINDOW_EDGE_SOUTH_EAST :
2122
2088
GDK_WINDOW_EDGE_SOUTH_WEST,
2132
2098
GtkShadowType shadow_type;
2134
2100
ensure_frame_widget();
2135
gtk_widget_set_direction(gFrameWidget, direction);
2137
style = gFrameWidget->style;
2139
gtk_widget_style_get(gStatusbarWidget, "shadow-type", &shadow_type, NULL);
2101
gtk_widget_set_direction(gParts->frameWidget, direction);
2103
style = gParts->frameWidget->style;
2105
gtk_widget_style_get(gParts->statusbarWidget, "shadow-type", &shadow_type, NULL);
2141
2107
TSOffsetStyleGCs(style, rect->x, rect->y);
2142
2108
gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, shadow_type,
2143
cliprect, gFrameWidget, "frame", rect->x, rect->y,
2109
cliprect, gParts->frameWidget, "frame", rect->x, rect->y,
2144
2110
rect->width, rect->height);
2146
2112
return MOZ_GTK_SUCCESS;
2153
2119
GtkStyle* style;
2155
2121
ensure_progress_widget();
2156
gtk_widget_set_direction(gProgressWidget, direction);
2122
gtk_widget_set_direction(gParts->progresWidget, direction);
2158
style = gProgressWidget->style;
2124
style = gParts->progresWidget->style;
2160
2126
TSOffsetStyleGCs(style, rect->x, rect->y);
2161
2127
gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN,
2162
cliprect, gProgressWidget, "trough", rect->x, rect->y,
2128
cliprect, gParts->progresWidget, "trough", rect->x, rect->y,
2163
2129
rect->width, rect->height);
2165
2131
return MOZ_GTK_SUCCESS;
2172
2138
GtkStyle* style;
2174
2140
ensure_progress_widget();
2175
gtk_widget_set_direction(gProgressWidget, direction);
2141
gtk_widget_set_direction(gParts->progresWidget, direction);
2177
style = gProgressWidget->style;
2143
style = gParts->progresWidget->style;
2179
2145
TSOffsetStyleGCs(style, rect->x, rect->y);
2180
2146
gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
2181
cliprect, gProgressWidget, "bar", rect->x, rect->y,
2147
cliprect, gParts->progresWidget, "bar", rect->x, rect->y,
2182
2148
rect->width, rect->height);
2184
2150
return MOZ_GTK_SUCCESS;
2207
2173
GtkStyle* style;
2209
2175
ensure_tab_widget();
2210
gtk_widget_set_direction(gTabWidget, direction);
2176
gtk_widget_set_direction(gParts->tabWidget, direction);
2212
style = gTabWidget->style;
2178
style = gParts->tabWidget->style;
2213
2179
TSOffsetStyleGCs(style, rect->x, rect->y);
2215
2181
if ((flags & MOZ_GTK_TAB_SELECTED) == 0) {
2216
2182
/* Only draw the tab */
2217
2183
gtk_paint_extension(style, drawable, GTK_STATE_ACTIVE, GTK_SHADOW_OUT,
2218
cliprect, gTabWidget, "tab",
2184
cliprect, gParts->tabWidget, "tab",
2219
2185
rect->x, rect->y, rect->width, rect->height,
2220
2186
(flags & MOZ_GTK_TAB_BOTTOM) ?
2221
2187
GTK_POS_TOP : GTK_POS_BOTTOM );
2283
2249
/* Draw the tab */
2284
2250
gtk_paint_extension(style, drawable, GTK_STATE_NORMAL,
2285
GTK_SHADOW_OUT, cliprect, gTabWidget, "tab",
2251
GTK_SHADOW_OUT, cliprect, gParts->tabWidget, "tab",
2286
2252
rect->x, rect->y + gap_voffset, rect->width,
2287
2253
rect->height - gap_voffset, GTK_POS_TOP);
2296
2262
rect->width, gap_height);
2297
2263
gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
2298
cliprect, gTabWidget, "notebook",
2264
cliprect, gParts->tabWidget, "notebook",
2299
2265
rect->x - gap_loffset,
2300
2266
rect->y + gap_voffset - 3 * gap_height,
2301
2267
rect->width + gap_loffset + gap_roffset,
2308
2274
/* Draw the tab */
2309
2275
gtk_paint_extension(style, drawable, GTK_STATE_NORMAL,
2310
GTK_SHADOW_OUT, cliprect, gTabWidget, "tab",
2276
GTK_SHADOW_OUT, cliprect, gParts->tabWidget, "tab",
2311
2277
rect->x, rect->y, rect->width,
2312
2278
rect->height - gap_voffset, GTK_POS_BOTTOM);
2321
2287
rect->width, gap_height);
2322
2288
gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
2323
cliprect, gTabWidget, "notebook",
2289
cliprect, gParts->tabWidget, "notebook",
2324
2290
rect->x - gap_loffset,
2325
2291
rect->y + rect->height - gap_voffset,
2326
2292
rect->width + gap_loffset + gap_roffset,
2344
2310
GtkStyle* style;
2346
2312
ensure_tab_widget();
2347
gtk_widget_set_direction(gTabWidget, direction);
2313
gtk_widget_set_direction(gParts->tabWidget, direction);
2349
style = gTabWidget->style;
2315
style = gParts->tabWidget->style;
2351
2317
TSOffsetStyleGCs(style, rect->x, rect->y);
2352
2318
gtk_paint_box_gap(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
2353
cliprect, gTabWidget, "notebook", rect->x, rect->y,
2319
cliprect, gParts->tabWidget, "notebook", rect->x, rect->y,
2354
2320
rect->width, rect->height,
2355
2321
GTK_POS_TOP, -10, 0);
2383
2349
gtk_paint_arrow(style, drawable, state_type, shadow_type, NULL,
2384
gTabWidget, "notebook", arrow_type, TRUE,
2350
gParts->tabWidget, "notebook", arrow_type, TRUE,
2385
2351
x, y, arrow_size, arrow_size);
2387
2353
return MOZ_GTK_SUCCESS;
2394
2360
GtkStyle* style;
2395
2361
GtkShadowType shadow_type;
2396
2362
ensure_menu_bar_widget();
2397
gtk_widget_set_direction(gMenuBarWidget, direction);
2399
gtk_widget_style_get(gMenuBarWidget, "shadow-type", &shadow_type, NULL);
2401
style = gMenuBarWidget->style;
2363
gtk_widget_set_direction(gParts->menuBarWidget, direction);
2365
gtk_widget_style_get(gParts->menuBarWidget, "shadow-type", &shadow_type, NULL);
2367
style = gParts->menuBarWidget->style;
2403
2369
TSOffsetStyleGCs(style, rect->x, rect->y);
2404
2370
gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL,
2406
2372
rect->width, rect->height);
2408
2374
gtk_paint_box(style, drawable, GTK_STATE_NORMAL, shadow_type,
2409
cliprect, gMenuBarWidget, "menubar", rect->x, rect->y,
2375
cliprect, gParts->menuBarWidget, "menubar", rect->x, rect->y,
2410
2376
rect->width, rect->height);
2411
2377
return MOZ_GTK_SUCCESS;
2418
2384
GtkStyle* style;
2419
2385
ensure_menu_popup_widget();
2420
gtk_widget_set_direction(gMenuPopupWidget, direction);
2386
gtk_widget_set_direction(gParts->menuPopupWidget, direction);
2422
style = gMenuPopupWidget->style;
2388
style = gParts->menuPopupWidget->style;
2424
2390
TSOffsetStyleGCs(style, rect->x, rect->y);
2425
2391
gtk_style_apply_default_background(style, drawable, TRUE, GTK_STATE_NORMAL,
2426
2392
cliprect, rect->x, rect->y,
2427
2393
rect->width, rect->height);
2428
2394
gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
2429
cliprect, gMenuPopupWidget, "menu",
2395
cliprect, gParts->menuPopupWidget, "menu",
2430
2396
rect->x, rect->y, rect->width, rect->height);
2432
2398
return MOZ_GTK_SUCCESS;
2443
2409
gint paint_height;
2445
2411
ensure_menu_separator_widget();
2446
gtk_widget_set_direction(gMenuSeparatorWidget, direction);
2448
style = gMenuSeparatorWidget->style;
2450
gtk_widget_style_get(gMenuSeparatorWidget,
2412
gtk_widget_set_direction(gParts->menuSeparatorWidget, direction);
2414
style = gParts->menuSeparatorWidget->style;
2416
gtk_widget_style_get(gParts->menuSeparatorWidget,
2451
2417
"wide-separators", &wide_separators,
2452
2418
"separator-height", &separator_height,
2453
2419
"horizontal-padding", &horizontal_padding,
2462
2428
gtk_paint_box(style, drawable,
2463
2429
GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
2464
cliprect, gMenuSeparatorWidget, "hseparator",
2430
cliprect, gParts->menuSeparatorWidget, "hseparator",
2465
2431
rect->x + horizontal_padding + style->xthickness,
2466
2432
rect->y + (rect->height - separator_height - style->ythickness) / 2,
2467
2433
rect->width - 2 * (horizontal_padding + style->xthickness),
2472
2438
paint_height = rect->height;
2474
2440
gtk_paint_hline(style, drawable,
2475
GTK_STATE_NORMAL, cliprect, gMenuSeparatorWidget,
2441
GTK_STATE_NORMAL, cliprect, gParts->menuSeparatorWidget,
2477
2443
rect->x + horizontal_padding + style->xthickness,
2478
2444
rect->x + rect->width - horizontal_padding - style->xthickness - 1,
2494
2460
if (state->inHover && !state->disabled) {
2495
2461
if (flags & MOZ_TOPLEVEL_MENU_ITEM) {
2496
2462
ensure_menu_bar_item_widget();
2497
item_widget = gMenuBarItemWidget;
2463
item_widget = gParts->menuBarItemWidget;
2499
2465
ensure_menu_item_widget();
2500
item_widget = gMenuItemWidget;
2466
item_widget = gParts->menuItemWidget;
2502
2468
gtk_widget_set_direction(item_widget, direction);
2524
2490
GtkStateType state_type = ConvertGtkState(state);
2526
2492
ensure_menu_item_widget();
2527
gtk_widget_set_direction(gMenuItemWidget, direction);
2493
gtk_widget_set_direction(gParts->menuItemWidget, direction);
2529
style = gMenuItemWidget->style;
2495
style = gParts->menuItemWidget->style;
2531
2497
TSOffsetStyleGCs(style, rect->x, rect->y);
2532
2498
gtk_paint_arrow(style, drawable, state_type,
2533
2499
(state_type == GTK_STATE_PRELIGHT) ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
2534
cliprect, gMenuItemWidget, "menuitem",
2500
cliprect, gParts->menuItemWidget, "menuitem",
2535
2501
(direction == GTK_TEXT_DIR_LTR) ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT,
2536
2502
TRUE, rect->x, rect->y, rect->width, rect->height);
2554
2520
moz_gtk_menu_item_paint(drawable, rect, cliprect, state, FALSE, direction);
2556
2522
ensure_check_menu_item_widget();
2557
gtk_widget_set_direction(gCheckMenuItemWidget, direction);
2523
gtk_widget_set_direction(gParts->checkMenuItemWidget, direction);
2559
gtk_widget_style_get (gCheckMenuItemWidget,
2525
gtk_widget_style_get (gParts->checkMenuItemWidget,
2560
2526
"indicator-size", &indicator_size,
2563
if (checked || GTK_CHECK_MENU_ITEM(gCheckMenuItemWidget)->always_show_toggle) {
2564
style = gCheckMenuItemWidget->style;
2529
if (checked || GTK_CHECK_MENU_ITEM(gParts->checkMenuItemWidget)->always_show_toggle) {
2530
style = gParts->checkMenuItemWidget->style;
2566
offset = GTK_CONTAINER(gCheckMenuItemWidget)->border_width +
2567
gCheckMenuItemWidget->style->xthickness + 2;
2532
offset = GTK_CONTAINER(gParts->checkMenuItemWidget)->border_width +
2533
gParts->checkMenuItemWidget->style->xthickness + 2;
2569
2535
/* while normally this "3" would be the horizontal-padding style value, passing it to Gecko
2570
2536
as the value of menuitem padding causes problems with dropdowns (bug 406129), so in the menu.css
2574
2540
y = rect->y + (rect->height - indicator_size) / 2;
2576
2542
TSOffsetStyleGCs(style, x, y);
2577
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gCheckMenuItemWidget),
2543
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gParts->checkMenuItemWidget),
2581
2547
gtk_paint_option(style, drawable, state_type, shadow_type, cliprect,
2582
gCheckMenuItemWidget, "option",
2548
gParts->checkMenuItemWidget, "option",
2583
2549
x, y, indicator_size, indicator_size);
2585
2551
gtk_paint_check(style, drawable, state_type, shadow_type, cliprect,
2586
gCheckMenuItemWidget, "check",
2552
gParts->checkMenuItemWidget, "check",
2587
2553
x, y, indicator_size, indicator_size);
2598
2564
GtkStyle* style;
2600
2566
ensure_window_widget();
2601
gtk_widget_set_direction(gProtoWindow, direction);
2567
gtk_widget_set_direction(gParts->protoWindow, direction);
2603
style = gProtoWindow->style;
2569
style = gParts->protoWindow->style;
2605
2571
TSOffsetStyleGCs(style, rect->x, rect->y);
2606
2572
gtk_style_apply_default_background(style, drawable, TRUE,
2625
2591
gint focus_width, focus_pad;
2627
2593
ensure_button_widget();
2628
*left = *top = *right = *bottom = GTK_CONTAINER(gButtonWidget)->border_width;
2594
*left = *top = *right = *bottom = GTK_CONTAINER(gParts->buttonWidget)->border_width;
2630
2596
/* Don't add this padding in HTML, otherwise the buttons will
2631
2597
become too big and stuff the layout. */
2633
moz_gtk_widget_get_focus(gButtonWidget, &interior_focus, &focus_width, &focus_pad);
2634
moz_gtk_button_get_inner_border(gButtonWidget, &inner_border);
2599
moz_gtk_widget_get_focus(gParts->buttonWidget, &interior_focus, &focus_width, &focus_pad);
2600
moz_gtk_button_get_inner_border(gParts->buttonWidget, &inner_border);
2635
2601
*left += focus_width + focus_pad + inner_border.left;
2636
2602
*right += focus_width + focus_pad + inner_border.right;
2637
2603
*top += focus_width + focus_pad + inner_border.top;
2638
2604
*bottom += focus_width + focus_pad + inner_border.bottom;
2641
*left += gButtonWidget->style->xthickness;
2642
*right += gButtonWidget->style->xthickness;
2643
*top += gButtonWidget->style->ythickness;
2644
*bottom += gButtonWidget->style->ythickness;
2607
*left += gParts->buttonWidget->style->xthickness;
2608
*right += gParts->buttonWidget->style->xthickness;
2609
*top += gParts->buttonWidget->style->ythickness;
2610
*bottom += gParts->buttonWidget->style->ythickness;
2645
2611
return MOZ_GTK_SUCCESS;
2647
2613
case MOZ_GTK_ENTRY:
2648
2614
ensure_entry_widget();
2615
w = gParts->entryWidget;
2651
2617
case MOZ_GTK_TREEVIEW:
2652
2618
ensure_tree_view_widget();
2653
w = gTreeViewWidget;
2619
w = gParts->treeViewWidget;
2655
2621
case MOZ_GTK_TREE_HEADER_CELL:
2665
2631
gint focus_width, focus_pad;
2667
2633
ensure_tree_header_cell_widget();
2668
*left = *top = *right = *bottom = GTK_CONTAINER(gTreeHeaderCellWidget)->border_width;
2634
*left = *top = *right = *bottom = GTK_CONTAINER(gParts->treeHeaderCellWidget)->border_width;
2670
moz_gtk_widget_get_focus(gTreeHeaderCellWidget, &interior_focus, &focus_width, &focus_pad);
2671
moz_gtk_button_get_inner_border(gTreeHeaderCellWidget, &inner_border);
2636
moz_gtk_widget_get_focus(gParts->treeHeaderCellWidget, &interior_focus, &focus_width, &focus_pad);
2637
moz_gtk_button_get_inner_border(gParts->treeHeaderCellWidget, &inner_border);
2672
2638
*left += focus_width + focus_pad + inner_border.left;
2673
2639
*right += focus_width + focus_pad + inner_border.right;
2674
2640
*top += focus_width + focus_pad + inner_border.top;
2675
2641
*bottom += focus_width + focus_pad + inner_border.bottom;
2677
*left += gTreeHeaderCellWidget->style->xthickness;
2678
*right += gTreeHeaderCellWidget->style->xthickness;
2679
*top += gTreeHeaderCellWidget->style->ythickness;
2680
*bottom += gTreeHeaderCellWidget->style->ythickness;
2643
*left += gParts->treeHeaderCellWidget->style->xthickness;
2644
*right += gParts->treeHeaderCellWidget->style->xthickness;
2645
*top += gParts->treeHeaderCellWidget->style->ythickness;
2646
*bottom += gParts->treeHeaderCellWidget->style->ythickness;
2681
2647
return MOZ_GTK_SUCCESS;
2683
2649
case MOZ_GTK_TREE_HEADER_SORTARROW:
2684
2650
ensure_tree_header_cell_widget();
2685
w = gTreeHeaderSortArrowWidget;
2651
w = gParts->treeHeaderSortArrowWidget;
2687
2653
case MOZ_GTK_DROPDOWN_ENTRY:
2688
2654
ensure_combo_box_entry_widgets();
2689
w = gComboBoxEntryTextareaWidget;
2655
w = gParts->comboBoxEntryTextareaWidget;
2691
2657
case MOZ_GTK_DROPDOWN_ARROW:
2692
2658
ensure_combo_box_entry_widgets();
2693
w = gComboBoxEntryButtonWidget;
2659
w = gParts->comboBoxEntryButtonWidget;
2695
2661
case MOZ_GTK_DROPDOWN:
2704
2670
ensure_combo_box_widgets();
2706
*left = GTK_CONTAINER(gComboBoxButtonWidget)->border_width;
2672
*left = GTK_CONTAINER(gParts->comboBoxButtonWidget)->border_width;
2709
moz_gtk_widget_get_focus(gComboBoxButtonWidget,
2675
moz_gtk_widget_get_focus(gParts->comboBoxButtonWidget,
2710
2676
&ignored_interior_focus,
2711
2677
&focus_width, &focus_pad);
2712
2678
*left += focus_width + focus_pad;
2715
*top = *left + gComboBoxButtonWidget->style->ythickness;
2716
*left += gComboBoxButtonWidget->style->xthickness;
2681
*top = *left + gParts->comboBoxButtonWidget->style->ythickness;
2682
*left += gParts->comboBoxButtonWidget->style->xthickness;
2718
2684
*right = *left; *bottom = *top;
2720
2686
/* If there is no separator, don't try to count its width. */
2721
2687
separator_width = 0;
2722
if (gComboBoxSeparatorWidget) {
2723
gtk_widget_style_get(gComboBoxSeparatorWidget,
2688
if (gParts->comboBoxSeparatorWidget) {
2689
gtk_widget_style_get(gParts->comboBoxSeparatorWidget,
2724
2690
"wide-separators", &wide_separators,
2725
2691
"separator-width", &separator_width,
2728
2694
if (!wide_separators)
2729
2695
separator_width =
2730
XTHICKNESS(gComboBoxSeparatorWidget->style);
2696
XTHICKNESS(gParts->comboBoxSeparatorWidget->style);
2733
gtk_widget_size_request(gComboBoxArrowWidget, &arrow_req);
2699
gtk_widget_size_request(gParts->comboBoxArrowWidget, &arrow_req);
2735
2701
if (direction == GTK_TEXT_DIR_RTL)
2736
2702
*left += separator_width + arrow_req.width;
2742
2708
case MOZ_GTK_TABPANELS:
2743
2709
ensure_tab_widget();
2710
w = gParts->tabWidget;
2746
2712
case MOZ_GTK_PROGRESSBAR:
2747
2713
ensure_progress_widget();
2748
w = gProgressWidget;
2714
w = gParts->progresWidget;
2750
2716
case MOZ_GTK_SPINBUTTON_ENTRY:
2751
2717
case MOZ_GTK_SPINBUTTON_UP:
2752
2718
case MOZ_GTK_SPINBUTTON_DOWN:
2753
2719
ensure_spin_widget();
2720
w = gParts->spinWidget;
2756
2722
case MOZ_GTK_SCALE_HORIZONTAL:
2757
2723
ensure_scale_widget();
2724
w = gParts->hScaleWidget;
2760
2726
case MOZ_GTK_SCALE_VERTICAL:
2761
2727
ensure_scale_widget();
2728
w = gParts->vScaleWidget;
2764
2730
case MOZ_GTK_FRAME:
2765
2731
ensure_frame_widget();
2732
w = gParts->frameWidget;
2768
2734
case MOZ_GTK_CHECKBUTTON_LABEL:
2769
2735
case MOZ_GTK_RADIOBUTTON_LABEL:
2775
2741
(focus_width + focus_pad). */
2776
2742
if (widget == MOZ_GTK_CHECKBUTTON_LABEL) {
2777
2743
ensure_checkbox_widget();
2778
moz_gtk_widget_get_focus(gCheckboxWidget, &interior_focus,
2744
moz_gtk_widget_get_focus(gParts->checkboxWidget, &interior_focus,
2779
2745
&focus_width, &focus_pad);
2782
2748
ensure_radiobutton_widget();
2783
moz_gtk_widget_get_focus(gRadiobuttonWidget, &interior_focus,
2749
moz_gtk_widget_get_focus(gParts->radiobuttonWidget, &interior_focus,
2784
2750
&focus_width, &focus_pad);
2802
2768
of (focus_width + focus_pad). */
2803
2769
if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
2804
2770
ensure_checkbox_widget();
2805
moz_gtk_widget_get_focus(gCheckboxWidget, &interior_focus,
2771
moz_gtk_widget_get_focus(gParts->checkboxWidget, &interior_focus,
2806
2772
&focus_width, &focus_pad);
2807
w = gCheckboxWidget;
2773
w = gParts->checkboxWidget;
2809
2775
ensure_radiobutton_widget();
2810
moz_gtk_widget_get_focus(gRadiobuttonWidget, &interior_focus,
2776
moz_gtk_widget_get_focus(gParts->radiobuttonWidget, &interior_focus,
2811
2777
&focus_width, &focus_pad);
2812
w = gRadiobuttonWidget;
2778
w = gParts->radiobuttonWidget;
2815
2781
*left = *top = *right = *bottom = GTK_CONTAINER(w)->border_width;
2826
2792
case MOZ_GTK_MENUPOPUP:
2827
2793
ensure_menu_popup_widget();
2828
w = gMenuPopupWidget;
2794
w = gParts->menuPopupWidget;
2830
2796
case MOZ_GTK_MENUITEM:
2831
2797
ensure_menu_item_widget();
2832
2798
ensure_menu_bar_item_widget();
2833
w = gMenuItemWidget;
2799
w = gParts->menuItemWidget;
2835
2801
case MOZ_GTK_CHECKMENUITEM:
2836
2802
case MOZ_GTK_RADIOMENUITEM:
2837
2803
ensure_check_menu_item_widget();
2838
w = gCheckMenuItemWidget;
2804
w = gParts->checkMenuItemWidget;
2840
2806
case MOZ_GTK_TAB:
2841
2807
ensure_tab_widget();
2808
w = gParts->tabWidget;
2844
2810
/* These widgets have no borders, since they are not containers. */
2845
2811
case MOZ_GTK_SPLITTER_HORIZONTAL:
2983
2949
ensure_menu_separator_widget();
2985
gtk_widget_style_get(gMenuSeparatorWidget,
2951
gtk_widget_style_get(gParts->menuSeparatorWidget,
2986
2952
"wide-separators", &wide_separators,
2987
2953
"separator-height", &separator_height,
2990
2956
if (wide_separators)
2991
*size = separator_height + gMenuSeparatorWidget->style->ythickness;
2957
*size = separator_height + gParts->menuSeparatorWidget->style->ythickness;
2993
*size = gMenuSeparatorWidget->style->ythickness * 2;
2959
*size = gParts->menuSeparatorWidget->style->ythickness * 2;
2995
2961
return MOZ_GTK_SUCCESS;
3017
2983
ensure_scrollbar_widget();
3019
gtk_widget_style_get (gHorizScrollbarWidget,
2985
gtk_widget_style_get (gParts->horizScrollbarWidget,
3020
2986
"slider_width", &metrics->slider_width,
3021
2987
"trough_border", &metrics->trough_border,
3022
2988
"stepper_size", &metrics->stepper_size,
3054
3020
ensure_toggle_button_widget();
3055
3021
return moz_gtk_button_paint(drawable, rect, cliprect, state,
3056
3022
(GtkReliefStyle) flags,
3057
gToggleButtonWidget, direction);
3023
gParts->toggleButtonWidget, direction);
3059
3025
ensure_button_widget();
3060
3026
return moz_gtk_button_paint(drawable, rect, cliprect, state,
3061
(GtkReliefStyle) flags, gButtonWidget,
3027
(GtkReliefStyle) flags, gParts->buttonWidget,
3064
3030
case MOZ_GTK_CHECKBUTTON:
3153
3119
case MOZ_GTK_DROPDOWN_ENTRY:
3154
3120
ensure_combo_box_entry_widgets();
3155
3121
return moz_gtk_entry_paint(drawable, rect, cliprect, state,
3156
gComboBoxEntryTextareaWidget, direction);
3122
gParts->comboBoxEntryTextareaWidget, direction);
3158
3124
case MOZ_GTK_CHECKBUTTON_CONTAINER:
3159
3125
case MOZ_GTK_RADIOBUTTON_CONTAINER:
3251
3217
if (!is_initialized)
3253
3219
ensure_scrollbar_widget();
3254
return gHorizScrollbarWidget;
3220
return gParts->horizScrollbarWidget;
3258
3224
moz_gtk_shutdown()
3260
3226
GtkWidgetClass *entry_class;
3263
gtk_widget_destroy(gTooltipWidget);
3264
/* This will destroy all of our widgets */
3266
gtk_widget_destroy(gProtoWindow);
3268
gProtoWindow = NULL;
3269
gProtoLayout = NULL;
3270
gButtonWidget = NULL;
3271
gToggleButtonWidget = NULL;
3272
gButtonArrowWidget = NULL;
3273
gCheckboxWidget = NULL;
3274
gRadiobuttonWidget = NULL;
3275
gHorizScrollbarWidget = NULL;
3276
gVertScrollbarWidget = NULL;
3278
gHScaleWidget = NULL;
3279
gVScaleWidget = NULL;
3280
gEntryWidget = NULL;
3281
gComboBoxWidget = NULL;
3282
gComboBoxButtonWidget = NULL;
3283
gComboBoxSeparatorWidget = NULL;
3284
gComboBoxArrowWidget = NULL;
3285
gComboBoxEntryWidget = NULL;
3286
gComboBoxEntryButtonWidget = NULL;
3287
gComboBoxEntryArrowWidget = NULL;
3288
gComboBoxEntryTextareaWidget = NULL;
3289
gHandleBoxWidget = NULL;
3290
gToolbarWidget = NULL;
3291
gStatusbarWidget = NULL;
3292
gFrameWidget = NULL;
3293
gProgressWidget = NULL;
3295
gTooltipWidget = NULL;
3296
gMenuBarWidget = NULL;
3297
gMenuBarItemWidget = NULL;
3298
gMenuPopupWidget = NULL;
3299
gMenuItemWidget = NULL;
3300
gImageMenuItemWidget = NULL;
3301
gCheckMenuItemWidget = NULL;
3302
gTreeViewWidget = NULL;
3303
gMiddleTreeViewColumn = NULL;
3304
gTreeHeaderCellWidget = NULL;
3305
gTreeHeaderSortArrowWidget = NULL;
3306
gExpanderWidget = NULL;
3307
gToolbarSeparatorWidget = NULL;
3308
gMenuSeparatorWidget = NULL;
3309
gHPanedWidget = NULL;
3310
gVPanedWidget = NULL;
3311
gScrolledWindowWidget = NULL;
3313
3227
entry_class = g_type_class_peek(GTK_TYPE_ENTRY);
3314
3228
g_type_class_unref(entry_class);