Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/widget/gtk/gtkdrawing.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
/**
7
 * gtkdrawing.h: GTK widget rendering utilities
8
 *
9
 * gtkdrawing provides an API for rendering GTK widgets in the
10
 * current theme to a pixmap or window, without requiring an actual
11
 * widget instantiation, similar to the Macintosh Appearance Manager
12
 * or Windows XP's DrawThemeBackground() API.
13
 */
14
15
#ifndef _GTK_DRAWING_H_
16
#define _GTK_DRAWING_H_
17
18
#include <gdk/gdk.h>
19
#include <gtk/gtk.h>
20
#include <algorithm>
21
22
/*** type definitions ***/
23
typedef struct {
24
  guint8 active;
25
  guint8 focused;
26
  guint8 selected;
27
  guint8 inHover;
28
  guint8 disabled;
29
  guint8 isDefault;
30
  guint8 canDefault;
31
  /* The depressed state is for buttons which remain active for a longer period:
32
   * activated toggle buttons or buttons showing a popup menu. */
33
  guint8 depressed;
34
  guint8 backdrop;
35
  gint32 curpos; /* curpos and maxpos are used for scrollbars */
36
  gint32 maxpos;
37
  gint32 scale;  /* actual widget scale */
38
} GtkWidgetState;
39
40
/**
41
 * A size in the same GTK pixel units as GtkBorder and GdkRectangle.
42
 */
43
struct MozGtkSize {
44
  gint width;
45
  gint height;
46
47
  MozGtkSize& operator+=(const GtkBorder& aBorder)
48
0
  {
49
0
    width += aBorder.left + aBorder.right;
50
0
    height += aBorder.top + aBorder.bottom;
51
0
    return *this;
52
0
  }
53
  MozGtkSize operator+(const GtkBorder& aBorder) const
54
0
  {
55
0
    MozGtkSize result = *this;
56
0
    return result += aBorder;
57
0
  }
58
  bool operator<(const MozGtkSize &aOther) const
59
0
  {
60
0
    return (width < aOther.width && height <= aOther.height) ||
61
0
           (width <= aOther.width && height < aOther.height);
62
0
  }
63
  void Include(MozGtkSize aOther)
64
0
  {
65
0
    width = std::max(width, aOther.width);
66
0
    height = std::max(height, aOther.height);
67
0
  }
68
  void Rotate()
69
0
  {
70
0
    gint tmp = width;
71
0
    width = height;
72
0
    height = tmp;
73
0
  }
74
};
75
76
typedef struct {
77
  bool initialized;
78
  struct {
79
    MozGtkSize scrollbar;
80
    MozGtkSize thumb;
81
    MozGtkSize button;
82
  } size;
83
  struct {
84
    GtkBorder scrollbar;
85
    GtkBorder track;
86
  } border;
87
  struct {
88
    GtkBorder thumb;
89
  } margin;
90
} ScrollbarGTKMetrics;
91
92
typedef struct {
93
  bool initialized;
94
  MozGtkSize minSizeWithBorder;
95
  GtkBorder borderAndPadding;
96
} ToggleGTKMetrics;
97
98
typedef struct {
99
  MozGtkSize minSizeWithBorderMargin;
100
  GtkBorder  buttonMargin;
101
  gint iconXPosition;
102
  gint iconYPosition;
103
  bool visible;
104
  bool firstButton;
105
  bool lastButton;
106
} ToolbarButtonGTKMetrics;
107
108
0
#define TOOLBAR_BUTTONS 3
109
typedef struct {
110
  bool initialized;
111
  ToolbarButtonGTKMetrics button[TOOLBAR_BUTTONS];
112
} ToolbarGTKMetrics;
113
114
typedef enum {
115
  MOZ_GTK_STEPPER_DOWN        = 1 << 0,
116
  MOZ_GTK_STEPPER_BOTTOM      = 1 << 1,
117
  MOZ_GTK_STEPPER_VERTICAL    = 1 << 2
118
} GtkScrollbarButtonFlags;
119
120
typedef enum {
121
  MOZ_GTK_TRACK_OPAQUE        = 1 << 0
122
} GtkScrollbarTrackFlags;
123
124
/** flags for tab state **/
125
typedef enum {
126
  /* first eight bits are used to pass a margin */
127
  MOZ_GTK_TAB_MARGIN_MASK     = 0xFF,
128
  /* the first tab in the group */
129
  MOZ_GTK_TAB_FIRST           = 1 << 9,
130
  /* the selected tab */
131
  MOZ_GTK_TAB_SELECTED        = 1 << 10
132
} GtkTabFlags;
133
134
/*** result/error codes ***/
135
0
#define MOZ_GTK_SUCCESS 0
136
0
#define MOZ_GTK_UNKNOWN_WIDGET -1
137
#define MOZ_GTK_UNSAFE_THEME -2
138
139
/*** checkbox/radio flags ***/
140
0
#define MOZ_GTK_WIDGET_CHECKED 1
141
0
#define MOZ_GTK_WIDGET_INCONSISTENT (1 << 1)
142
143
/*** widget type constants ***/
144
typedef enum {
145
  /* Paints a GtkButton. flags is a GtkReliefStyle. */
146
  MOZ_GTK_BUTTON,
147
  /* Paints a button with image and no text */
148
  MOZ_GTK_TOOLBAR_BUTTON,
149
  /* Paints a toggle button */
150
  MOZ_GTK_TOGGLE_BUTTON,
151
  /* Paints a button arrow */
152
  MOZ_GTK_BUTTON_ARROW,
153
154
  /* Paints the container part of a GtkCheckButton. */
155
  MOZ_GTK_CHECKBUTTON_CONTAINER,
156
  /* Paints a GtkCheckButton. flags is a boolean, 1=checked, 0=not checked. */
157
  MOZ_GTK_CHECKBUTTON,
158
  /* Paints the label of a GtkCheckButton (focus outline) */
159
  MOZ_GTK_CHECKBUTTON_LABEL,
160
161
  /* Paints the container part of a GtkRadioButton. */
162
  MOZ_GTK_RADIOBUTTON_CONTAINER,
163
  /* Paints a GtkRadioButton. flags is a boolean, 1=checked, 0=not checked. */
164
  MOZ_GTK_RADIOBUTTON,
165
  /* Paints the label of a GtkRadioButton (focus outline) */
166
  MOZ_GTK_RADIOBUTTON_LABEL,
167
  /**
168
   * Paints the button of a GtkScrollbar. flags is a GtkArrowType giving
169
   * the arrow direction.
170
   */
171
  MOZ_GTK_SCROLLBAR_BUTTON,
172
173
  /* Horizontal GtkScrollbar counterparts */
174
  MOZ_GTK_SCROLLBAR_HORIZONTAL,
175
  MOZ_GTK_SCROLLBAR_CONTENTS_HORIZONTAL,
176
  /* Paints the trough (track) of a GtkScrollbar. */
177
  MOZ_GTK_SCROLLBAR_TROUGH_HORIZONTAL,
178
  /* Paints the slider (thumb) of a GtkScrollbar. */
179
  MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL,
180
181
  /* Vertical GtkScrollbar counterparts */
182
  MOZ_GTK_SCROLLBAR_VERTICAL,
183
  MOZ_GTK_SCROLLBAR_CONTENTS_VERTICAL,
184
  MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL,
185
  MOZ_GTK_SCROLLBAR_THUMB_VERTICAL,
186
187
  /* Paints a GtkScale. */
188
  MOZ_GTK_SCALE_HORIZONTAL,
189
  MOZ_GTK_SCALE_VERTICAL,
190
  /* Paints a GtkScale trough. */
191
  MOZ_GTK_SCALE_CONTENTS_HORIZONTAL,
192
  MOZ_GTK_SCALE_CONTENTS_VERTICAL,
193
  MOZ_GTK_SCALE_TROUGH_HORIZONTAL,
194
  MOZ_GTK_SCALE_TROUGH_VERTICAL,
195
  /* Paints a GtkScale thumb. */
196
  MOZ_GTK_SCALE_THUMB_HORIZONTAL,
197
  MOZ_GTK_SCALE_THUMB_VERTICAL,
198
  /* Paints a GtkSpinButton */
199
  MOZ_GTK_INNER_SPIN_BUTTON,
200
  MOZ_GTK_SPINBUTTON,
201
  MOZ_GTK_SPINBUTTON_UP,
202
  MOZ_GTK_SPINBUTTON_DOWN,
203
  MOZ_GTK_SPINBUTTON_ENTRY,
204
  /* Paints the gripper of a GtkHandleBox. */
205
  MOZ_GTK_GRIPPER,
206
  /* Paints a GtkEntry. */
207
  MOZ_GTK_ENTRY,
208
  /* Paints a GtkExpander. */
209
  MOZ_GTK_EXPANDER,
210
  /* Paints a GtkTextView or gets the style context corresponding to the
211
     root node of a GtkTextView. */
212
  MOZ_GTK_TEXT_VIEW,
213
  /* The "text" window or node of a GtkTextView */
214
  MOZ_GTK_TEXT_VIEW_TEXT,
215
  /* Paints a GtkOptionMenu. */
216
  MOZ_GTK_DROPDOWN,
217
  /* Paints a dropdown arrow (a GtkButton containing a down GtkArrow). */
218
  MOZ_GTK_DROPDOWN_ARROW,
219
  /* Paints an entry in an editable option menu */
220
  MOZ_GTK_DROPDOWN_ENTRY,
221
222
  /* Paints the background of a GtkHandleBox. */
223
  MOZ_GTK_TOOLBAR,
224
  /* Paints a toolbar separator */
225
  MOZ_GTK_TOOLBAR_SEPARATOR,
226
  /* Paints a GtkToolTip */
227
  MOZ_GTK_TOOLTIP,
228
  /* Paints a GtkBox from GtkToolTip  */
229
  MOZ_GTK_TOOLTIP_BOX,
230
  /* Paints a GtkLabel of GtkToolTip */
231
  MOZ_GTK_TOOLTIP_BOX_LABEL,
232
  /* Paints a GtkFrame (e.g. a status bar panel). */
233
  MOZ_GTK_FRAME,
234
  /* Paints the border of a GtkFrame */
235
  MOZ_GTK_FRAME_BORDER,
236
  /* Paints a resize grip for a GtkTextView */
237
  MOZ_GTK_RESIZER,
238
  /* Paints a GtkProgressBar. */
239
  MOZ_GTK_PROGRESSBAR,
240
  /* Paints a trough (track) of a GtkProgressBar */
241
  MOZ_GTK_PROGRESS_TROUGH,
242
  /* Paints a progress chunk of a GtkProgressBar. */
243
  MOZ_GTK_PROGRESS_CHUNK,
244
  /* Paints a progress chunk of an indeterminated GtkProgressBar. */
245
  MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE,
246
  /* Paints a progress chunk of a vertical indeterminated GtkProgressBar. */
247
  MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE,
248
  /* Used as root style of whole GtkNotebook widget */
249
  MOZ_GTK_NOTEBOOK,
250
  /* Used as root style of active GtkNotebook area which contains tabs and arrows. */
251
  MOZ_GTK_NOTEBOOK_HEADER,
252
  /* Paints a tab of a GtkNotebook. flags is a GtkTabFlags, defined above. */
253
  MOZ_GTK_TAB_TOP,
254
  /* Paints a tab of a GtkNotebook. flags is a GtkTabFlags, defined above. */
255
  MOZ_GTK_TAB_BOTTOM,
256
  /* Paints the background and border of a GtkNotebook. */
257
  MOZ_GTK_TABPANELS,
258
  /* Paints a GtkArrow for a GtkNotebook. flags is a GtkArrowType. */
259
  MOZ_GTK_TAB_SCROLLARROW,
260
  /* Paints the expander and border of a GtkTreeView */
261
  MOZ_GTK_TREEVIEW,
262
  /* Paints the border of a GtkTreeView */
263
  MOZ_GTK_TREEVIEW_VIEW,
264
  /* Paints treeheader cells */
265
  MOZ_GTK_TREE_HEADER_CELL,
266
  /* Paints sort arrows in treeheader cells */
267
  MOZ_GTK_TREE_HEADER_SORTARROW,
268
  /* Paints an expander for a GtkTreeView */
269
  MOZ_GTK_TREEVIEW_EXPANDER,
270
  /* Paints the background of the menu bar. */
271
  MOZ_GTK_MENUBAR,
272
  /* Paints the background of menus, context menus. */
273
  MOZ_GTK_MENUPOPUP,
274
  /* Paints the arrow of menuitems that contain submenus */
275
  MOZ_GTK_MENUARROW,
276
  /* Paints an arrow in a toolbar button. flags is a GtkArrowType. */
277
  MOZ_GTK_TOOLBARBUTTON_ARROW,
278
  /* Paints items of menubar. */
279
  MOZ_GTK_MENUBARITEM,
280
  /* Paints items of popup menus. */
281
  MOZ_GTK_MENUITEM,
282
  /* Paints a menuitem with check indicator, or the gets the style context for
283
     a menuitem that contains a checkbox. */
284
  MOZ_GTK_CHECKMENUITEM,
285
  /* Gets the style context for a checkbox in a check menuitem. */
286
  MOZ_GTK_CHECKMENUITEM_INDICATOR,
287
  MOZ_GTK_RADIOMENUITEM,
288
  MOZ_GTK_RADIOMENUITEM_INDICATOR,
289
  MOZ_GTK_MENUSEPARATOR,
290
  /* GtkVPaned base class */
291
  MOZ_GTK_SPLITTER_HORIZONTAL,
292
  /* GtkHPaned base class */
293
  MOZ_GTK_SPLITTER_VERTICAL,
294
  /* Paints a GtkVPaned separator */
295
  MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL,
296
  /* Paints a GtkHPaned separator */
297
  MOZ_GTK_SPLITTER_SEPARATOR_VERTICAL,
298
  /* Paints the background of a window, dialog or page. */
299
  MOZ_GTK_WINDOW,
300
  /* Used only as a container for MOZ_GTK_HEADER_BAR. */
301
  MOZ_GTK_HEADERBAR_WINDOW,
302
  /* Used only as a container for MOZ_GTK_HEADER_BAR_MAXIMIZED. */
303
  MOZ_GTK_HEADERBAR_WINDOW_MAXIMIZED,
304
  /* Window container for all widgets */
305
  MOZ_GTK_WINDOW_CONTAINER,
306
  /* Paints a GtkInfoBar, for notifications. */
307
  MOZ_GTK_INFO_BAR,
308
  /* Used for widget tree construction. */
309
  MOZ_GTK_COMBOBOX,
310
  /* Paints a GtkComboBox button widget. */
311
  MOZ_GTK_COMBOBOX_BUTTON,
312
  /* Paints a GtkComboBox arrow widget. */
313
  MOZ_GTK_COMBOBOX_ARROW,
314
  /* Paints a GtkComboBox separator widget. */
315
  MOZ_GTK_COMBOBOX_SEPARATOR,
316
  /* Used for widget tree construction. */
317
  MOZ_GTK_COMBOBOX_ENTRY,
318
  /* Paints a GtkComboBox entry widget. */
319
  MOZ_GTK_COMBOBOX_ENTRY_TEXTAREA,
320
  /* Paints a GtkComboBox entry button widget. */
321
  MOZ_GTK_COMBOBOX_ENTRY_BUTTON,
322
  /* Paints a GtkComboBox entry arrow widget. */
323
  MOZ_GTK_COMBOBOX_ENTRY_ARROW,
324
  /* Used for scrolled window shell. */
325
  MOZ_GTK_SCROLLED_WINDOW,
326
  /* Paints a GtkHeaderBar */
327
  MOZ_GTK_HEADER_BAR,
328
  /* Paints a GtkHeaderBar in maximized state */
329
  MOZ_GTK_HEADER_BAR_MAXIMIZED,
330
  /* Paints GtkHeaderBar title buttons.
331
   * Keep the order here as MOZ_GTK_HEADER_BAR_BUTTON_* are processed
332
   * as an array from MOZ_GTK_HEADER_BAR_BUTTON_CLOSE to the last one.
333
   */
334
  MOZ_GTK_HEADER_BAR_BUTTON_CLOSE,
335
  MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE,
336
  MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE,
337
338
  /* MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE_RESTORE is a state of
339
   * MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE button and it's used as
340
   * an icon placeholder only.
341
   */
342
  MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE_RESTORE,
343
344
  /* Client-side window decoration node. Available on GTK 3.20+. */
345
  MOZ_GTK_WINDOW_DECORATION,
346
  MOZ_GTK_WINDOW_DECORATION_SOLID,
347
348
  MOZ_GTK_WIDGET_NODE_COUNT
349
} WidgetNodeType;
350
351
/*** General library functions ***/
352
/**
353
 * Initializes the drawing library.  You must call this function
354
 * prior to using any other functionality.
355
 * returns: MOZ_GTK_SUCCESS if there were no errors
356
 *          MOZ_GTK_UNSAFE_THEME if the current theme engine is known
357
 *                               to crash with gtkdrawing.
358
 */
359
gint moz_gtk_init();
360
361
/**
362
 * Updates the drawing library when the theme changes.
363
 */
364
void moz_gtk_refresh();
365
366
/**
367
 * Perform cleanup of the drawing library. You should call this function
368
 * when your program exits, or you no longer need the library.
369
 *
370
 * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
371
 */
372
gint moz_gtk_shutdown();
373
374
/*** Widget drawing ***/
375
/**
376
 * Paint a widget in the current theme.
377
 * widget:    a constant giving the widget to paint
378
 * drawable:  the drawable to paint to;
379
 *            it's colormap must be moz_gtk_widget_get_colormap().
380
 * rect:      the bounding rectangle for the widget
381
 * state:     the state of the widget.  ignored for some widgets.
382
 * flags:     widget-dependant flags; see the WidgetNodeType definition.
383
 * direction: the text direction, to draw the widget correctly LTR and RTL.
384
 */
385
gint
386
moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
387
                     GdkRectangle* rect,
388
                     GtkWidgetState* state, gint flags,
389
                     GtkTextDirection direction);
390
391
392
/*** Widget metrics ***/
393
/**
394
 * Get the border size of a widget
395
 * left/right:  [OUT] the widget's left/right border
396
 * top/bottom:  [OUT] the widget's top/bottom border
397
 * direction:   the text direction for the widget.  Callers depend on this
398
 *              being used only for MOZ_GTK_DROPDOWN widgets, and cache
399
 *              results for other widget types across direction values.
400
 *
401
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
402
 */
403
gint moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
404
                               gint* right, gint* bottom, GtkTextDirection direction);
405
406
/**
407
 * Get the border size of a notebook tab
408
 * left/right:  [OUT] the tab's left/right border
409
 * top/bottom:  [OUT] the tab's top/bottom border
410
 * direction:   the text direction for the widget
411
 * flags:       tab-dependant flags; see the GtkTabFlags definition.
412
 * widget:      tab widget
413
 *
414
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
415
 */
416
gint
417
moz_gtk_get_tab_border(gint* left, gint* top, gint* right, gint* bottom,
418
                       GtkTextDirection direction, GtkTabFlags flags,
419
                       WidgetNodeType widget);
420
421
/**
422
 * Get the desired size of a GtkCheckButton
423
 * indicator_size:     [OUT] the indicator size
424
 * indicator_spacing:  [OUT] the spacing between the indicator and its
425
 *                     container
426
 *
427
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
428
 */
429
gint
430
moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing);
431
432
/**
433
 * Get metrics of the toggle (radio or checkbox)
434
 * isRadio:            [IN] true when requesting metrics for the radio button
435
 * returns:    pointer to ToggleGTKMetrics struct
436
 */
437
const ToggleGTKMetrics*
438
GetToggleMetrics(bool isRadio);
439
440
/**
441
 * Get the desired size of a GtkRadioButton
442
 * indicator_size:     [OUT] the indicator size
443
 * indicator_spacing:  [OUT] the spacing between the indicator and its
444
 *                     container
445
 *
446
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
447
 */
448
gint
449
moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing);
450
451
/** Get the extra size for the focus ring for outline:auto.
452
 * widget:             [IN]  the widget to get the focus metrics for
453
 * focus_h_width:      [OUT] the horizontal width
454
 * focus_v_width:      [OUT] the vertical width
455
 *
456
 * returns:    MOZ_GTK_SUCCESS
457
 */
458
gint
459
moz_gtk_get_focus_outline_size(gint* focus_h_width, gint* focus_v_width);
460
461
/** Get the horizontal padding for the menuitem widget or checkmenuitem widget.
462
 * horizontal_padding: [OUT] The left and right padding of the menuitem or checkmenuitem
463
 *
464
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
465
 */
466
gint
467
moz_gtk_menuitem_get_horizontal_padding(gint* horizontal_padding);
468
469
gint
470
moz_gtk_checkmenuitem_get_horizontal_padding(gint* horizontal_padding);
471
472
/**
473
 * Some GTK themes draw their indication for the default button outside
474
 * the button (e.g. the glow in New Wave). This gets the extra space necessary.
475
 *
476
 * border_top:  [OUT] extra space to add above
477
 * border_left:  [OUT] extra space to add to the left
478
 * border_bottom:  [OUT] extra space to add underneath
479
 * border_right:  [OUT] extra space to add to the right
480
 *
481
 * returns:   MOZ_GTK_SUCCESS if there was no error, an error code otherwise
482
 */
483
gint
484
moz_gtk_button_get_default_overflow(gint* border_top, gint* border_left,
485
                                    gint* border_bottom, gint* border_right);
486
487
/**
488
 * Gets the minimum size of a GtkScale.
489
 * orient:           [IN] the scale orientation
490
 * scale_width:      [OUT] the width of the scale
491
 * scale_height:     [OUT] the height of the scale
492
 */
493
void
494
moz_gtk_get_scale_metrics(GtkOrientation orient, gint* scale_width,
495
                          gint* scale_height);
496
497
/**
498
 * Get the desired size of a GtkScale thumb
499
 * orient:           [IN] the scale orientation
500
 * thumb_length:     [OUT] the length of the thumb
501
 * thumb_height:     [OUT] the height of the thumb
502
 *
503
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
504
 */
505
gint
506
moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length, gint* thumb_height);
507
508
/**
509
 * Get the metrics in GTK pixels for a scrollbar.
510
 * aOrientation:     [IN] the scrollbar orientation
511
 */
512
const ScrollbarGTKMetrics*
513
GetScrollbarMetrics(GtkOrientation aOrientation);
514
515
/**
516
 * Get the metrics in GTK pixels for a scrollbar which is active
517
 * (selected by mouse pointer).
518
 * aOrientation:     [IN] the scrollbar orientation
519
 */
520
const ScrollbarGTKMetrics*
521
GetActiveScrollbarMetrics(GtkOrientation aOrientation);
522
523
/**
524
 * Get the desired size of a dropdown arrow button
525
 * width:   [OUT] the desired width
526
 * height:  [OUT] the desired height
527
 *
528
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
529
 */
530
gint moz_gtk_get_combo_box_entry_button_size(gint* width, gint* height);
531
532
/**
533
 * Get the desired size of a scroll arrow widget
534
 * width:   [OUT] the desired width
535
 * height:  [OUT] the desired height
536
 *
537
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
538
 */
539
gint moz_gtk_get_tab_scroll_arrow_size(gint* width, gint* height);
540
541
/**
542
 * Get the desired size of an arrow in a button
543
 *
544
 * widgetType: [IN]  the widget for which to get the arrow size
545
 * width:      [OUT] the desired width
546
 * height:     [OUT] the desired height
547
 */
548
void
549
moz_gtk_get_arrow_size(WidgetNodeType widgetType,
550
                       gint* width, gint* height);
551
552
/**
553
 * Get the minimum height of a entry widget
554
 * size:    [OUT] the minimum height
555
 *
556
 */
557
void moz_gtk_get_entry_min_height(gint* height);
558
559
/**
560
 * Get the desired size of a toolbar separator
561
 * size:    [OUT] the desired width
562
 *
563
 * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
564
 */
565
gint moz_gtk_get_toolbar_separator_width(gint* size);
566
567
/**
568
 * Get the size of a regular GTK expander that shows/hides content
569
 * size:    [OUT] the size of the GTK expander, size = width = height.
570
 *
571
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
572
 */
573
gint moz_gtk_get_expander_size(gint* size);
574
575
/**
576
 * Get the size of a treeview's expander (we call them twisties)
577
 * size:    [OUT] the size of the GTK expander, size = width = height.
578
 *
579
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
580
 */
581
gint moz_gtk_get_treeview_expander_size(gint* size);
582
583
/**
584
 * Get the desired height of a menu separator
585
 * size:    [OUT] the desired height
586
 *
587
 * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
588
 */
589
gint moz_gtk_get_menu_separator_height(gint* size);
590
591
/**
592
 * Get the desired size of a splitter
593
 * orientation:   [IN]  GTK_ORIENTATION_HORIZONTAL or GTK_ORIENTATION_VERTICAL
594
 * size:          [OUT] width or height of the splitter handle
595
 *
596
 * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
597
 */
598
gint moz_gtk_splitter_get_metrics(gint orientation, gint* size);
599
600
/**
601
 * Get the YTHICKNESS of a tab (notebook extension).
602
 */
603
gint
604
moz_gtk_get_tab_thickness(WidgetNodeType aNodeType);
605
606
607
/**
608
 * Get ToolbarButtonGTKMetrics for recent theme.
609
 */
610
const ToolbarButtonGTKMetrics*
611
GetToolbarButtonMetrics(WidgetNodeType aWidgetType);
612
613
/**
614
 * Get toolbar button layout.
615
 * aButtonLayout:  [IN][OUT] An array which will be filled by WidgetNodeType
616
 *                           references to visible titlebar buttons.
617
                             Must contains at least TOOLBAR_BUTTONS entries.
618
 * aMaxButtonNums: [IN] Allocated aButtonLayout entries. Must be at least
619
                        TOOLBAR_BUTTONS wide.
620
 *
621
 * returns:    Number of returned entries at aButtonLayout.
622
 */
623
int
624
GetGtkHeaderBarButtonLayout(WidgetNodeType* aButtonLayout, int aMaxButtonNums);
625
626
/**
627
 * Get size of CSD window extents of given GtkWindow.
628
 *
629
 * aGtkWindow      [IN]  Decorated window.
630
 * aDecorationSize [OUT] Returns calculated (or estimated) decoration
631
 *                       size of given aGtkWindow.
632
 *
633
 * returns:    True if we have extract decoration size (for GTK 3.20+)
634
 *             False if we have only an estimation (for GTK+ before  3.20+)
635
 */
636
bool
637
GetCSDDecorationSize(GtkWindow *aGtkWindow, GtkBorder* aDecorationSize);
638
639
#endif