2 * Declarations of GTK+-specific UI utility routines
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __GUI_UTILS_H__
24 #define __GUI_UTILS_H__
26 #include "ui/ui_util.h"
28 /** @defgroup windows_group Windows
30 * There are the following toplevel windows:
32 * - @ref main_window_group
33 * - Statistic Windows (several different statistic windows)
35 * See: @ref howto_window_page for details.
39 /** @page howto_window_page How to develop a window / dialog
41 * Windows and dialogs are related to each other. Dialogs are special kind of windows, but they behave
42 * slightly different. A dialog sticks on its parent window; A normal window will be much more independent
43 * from its parent window. Dialogs should be used to ask or tell the user something, while windows should
44 * show data which is independent of the main window.
45 * Dialogs are created by calling dlg_window_new() which in turn will call window_new().
46 * After that, dialogs can be developed the same way as windows; all window related functions in gui_utils.h
47 * can be used for both.
49 * @section window_create Create a window
51 * A typical window / dialog will be created by the following calls:
53 * - window_new() will create a new window with default position and size,
54 * use dlg_window_new() if you need a dialog (transient to the main window)
55 * - gtk_window_set_default_size() will set the default size of the window. Only
56 * needed, if the initial size is not appropriate, e.g. when a scrolled_window_new() is used.
57 * - g_signal_connect(my_win, "destroy", my_destroy_cb, NULL) will create a callback if some cleanup
58 * needs to be done after the window is destroyed, e.g. free up memory, or set the window pointer
59 * of a singleton window (only one instance allowed, e.g. about dialog) back to zero
60 * - create and fill in the content and button widgets
61 * - gtk_widget_show_all() shows all the widgets in the window
62 * - window_present() will present the window on screen and
63 * (if available) set previously saved position and size
65 * @section window_events Events
67 * The following events are usually interesting:
69 * - "delete_event": the window manager's "X" (e.g. upper right edge) of the window
70 * was clicked; the default handler will call gtk_widget_destroy()
71 * - "destroy": everything is already gone; only cleanup of left over resources
72 * can/should be done now
74 * @section window_hints Hints
76 * If you want to save size and position, be sure to call window_destroy() instead of only
77 * gtk_widget_destroy(), so you will probably have to g_signal_connect() to the "delete_event"!
79 * Don't use gtk_widget_set_size_request() to set the size of a window;
80 * use gtk_window_set_default_size() for that purpose!
82 * Be sure to call window_present() / window_destroy() appropriately, if you
83 * want to have size and position of the window handled by ui_util.
88 * Utilities for Windows and other user interface functions. See: @ref howto_window_page for details.
89 * @ingroup dialog_group
90 * @ingroup windows_group
93 /** @name Window Functions
94 * @todo Move these window functions to a new file win_utils.h?
97 /** Create a new window with the Wireshark icon.
98 * If you want to create a dialog, use dlg_window_new() instead.
100 * @param type window type, typical GTK_WINDOW_TOPLEVEL
101 * @param title the title for the new window
102 * @return the newly created window
104 extern GtkWidget *window_new(GtkWindowType type, const gchar *title);
106 /** Same as window_new(), but will keep its geometry values (size, position, ...).
107 * Be sure to use window_present() and window_destroy() appropriately!
109 * @param type window type, typical GTK_WINDOW_TOPLEVEL
110 * @param title the title for the new window
111 * @param geom_name the name to distinguish this window; will also be used for the recent file (don't use special chars)
112 * @param pos the initial position of the window if a previously saved geometry was not saved or found.
113 * If the initial position does not matter, specify GTK_WIN_POS_NONE.
114 * @return the newly created window
116 extern GtkWidget *window_new_with_geom(GtkWindowType type, const gchar *title, const gchar *geom_name, GtkWindowPosition pos);
118 /** Create a new splash window, with no icon or title bar.
120 * @return the newly created window
122 extern GtkWidget *splash_window_new(void);
124 /** Present the created window on the top of the screen. This will put the window on top and
125 * (if available) set previously saved position and size.
127 * @param win the window from window_new()
129 extern void window_present(GtkWidget *win);
131 /** callback function for window_set_cancel_button() */
132 typedef void (*window_cancel_button_fct) (GtkWidget *w, gpointer data);
134 /** Register the default cancel button "Cancel"/"Close"/"Ok" of this window.
135 * This will set the callback function for this button, grab this button as the default one and
136 * set the "ESC" key handler to call the callback function if key is pressed.
138 * @param win the window from window_new()
139 * @param bt the default button of this window
140 * @param cb callback function to be called, when this button is pressed
142 extern void window_set_cancel_button(GtkWidget *win, GtkWidget *bt, window_cancel_button_fct cb);
144 /** Remember the current window position / size and then destroy the window.
145 * It's important to call this instead of gtk_widget_destroy() when using window_new_with_geom().
147 * @param win the window from window_new()
149 extern void window_destroy(GtkWidget *win);
151 /** Default callback handler for cancel button "clicked" signal.
152 * Use this for window_set_cancel_button(), if no user specific functionality required,
153 * will simply call window_destroy()
155 extern void window_cancel_button_cb(GtkWidget *w _U_, gpointer data);
157 /** Default callback handler if the window manager's X of the window was clicked (delete_event).
158 * Use this for g_signal_connect(), if no user specific functionality required,
159 * will simply call window_destroy()
161 extern gboolean window_delete_event_cb(GtkWidget *win, GdkEvent *event _U_, gpointer user_data _U_);
163 /** Get the geometry of a window.
165 * @param win the window from window_new()
166 * @param geom the current geometry values of the window; the set_xy values will not be used
167 * @todo if main uses the window_new_with_geom() to save size and such, make this function static
169 extern void window_get_geometry(GtkWidget *win, window_geometry_t *geom);
171 /** Set the geometry of a window.
173 * @param win the window from window_new()
174 * @param geom the new geometry values of the window
175 * @todo if main uses the window_new_with_geom() to save size and such, make this function static
177 extern void window_set_geometry(GtkWidget *win, window_geometry_t *geom);
179 /** Raise a top-level window and de-iconify it.
180 * This routine is used if the user has done something to
181 * ask that a window of a certain type be popped up when there can be only
182 * one such window and such a window has already been popped up - we
183 * pop up the existing one rather than creating a new one.
185 * @param win the window from window_new() to be reactivated
187 extern void reactivate_window(GtkWidget *win);
191 /** Alert box for an invalid display filter expression.
193 * @param parent parent window from which the display filter came
194 * @param dftext text of the display filter
195 * @param err_msg text of the error message for the filter
197 extern void bad_dfilter_alert_box(GtkWidget *parent, const char *dftext, gchar *err_msg);
199 /** Create a GtkScrolledWindow, set its scrollbar placement appropriately,
202 * @param hadjustment horizontal adjustment
203 * @param vadjustment vertical adjustment
204 * @return the new scrolled window
206 extern GtkWidget *scrolled_window_new(GtkAdjustment *hadjustment,
207 GtkAdjustment *vadjustment);
209 /** Create a GtkTreeView, give it the right styles, and remember it.
211 * @param model The model (the data) of this tree view.
213 extern GtkWidget *tree_view_new(GtkTreeModel *model);
215 /** Move the currently-selected item in a list store up or down one position.
217 * @param tree GtkTreeView using a GtkListStore.
218 * @param move_up TRUE to move the selected item up or FALSE to move it down.
219 * @return TRUE if successful, FALSE otherwise.
221 extern gboolean tree_view_list_store_move_selection(GtkTreeView *tree, gboolean move_up);
223 /** Find the selected row in a list store.
225 * @param tree GtkTreeView using a GtkListStore.
226 * @return The selected row number or -1 if no row is selected.
228 extern gint tree_view_list_store_get_selected_row(GtkTreeView *tree);
230 /** Create a simple list widget.
232 * @param cols number of columns
233 * @param titles the titles of all columns
234 * @return the new simple list widget
236 extern GtkWidget *simple_list_new(gint cols, const gchar **titles);
237 /** Append a row to the simple list.
239 * @param list the list from simple_list_new()
240 * @param ... row and title, finished by -1 (e.g.: 0, "first", 1, "second", -1).
242 extern void simple_list_append(GtkWidget *list, ...);
244 /*** Make a column look like a url
246 * @param list the list from simple_list_new()
247 * @param col the column to make the values lookk like urls
249 extern void simple_list_url_col(GtkWidget *list, gint col);
251 /*** Make a cell underline to look like links
253 * @param cell the cell renderer that will show the text as a link
256 extern void render_as_url(GtkCellRenderer *cell);
258 /** Set the styles of all Trees based upon user preferences. */
259 extern void set_tree_styles_all(void);
261 /** Convert an xpm picture into a GtkWidget showing it.
262 * Beware: Wireshark's main window must already be visible!
264 * @param xpm the character array containing the picture
265 * @return a newly created GtkWidget showing the picture
267 extern GtkWidget *xpm_to_widget(const char ** xpm);
270 /** Convert an xpm picture into a GtkWidget showing it.
271 * Beware: the given parent window must already be visible!
273 * @param parent the parent window of to widget to be generated
274 * @param xpm the character array containing the picture
275 * @return a newly created GtkWidget showing the picture
277 extern GtkWidget *xpm_to_widget_from_parent(GtkWidget *parent, const char ** xpm);
280 #ifdef HAVE_GDK_GRESOURCE
281 /** Convert pixbuf data to a GtkWidget
283 * @param pb_path GResource pixbuf path.
285 extern GtkWidget *pixbuf_to_widget(const char *pb_path);
287 #define PIXBUF_TO_WIDGET(pb, path) \
288 pixbuf_to_widget(path)
290 /** Convert an pixbuf data to a GtkWidget
292 * @param pb_data Inline pixbuf data. This should be created with "gdk-pixbuf-csource --raw"
294 extern GtkWidget *pixbuf_to_widget(const guint8 * pb_data);
296 #define PIXBUF_TO_WIDGET(pb, path) \
298 #endif /* HAVE_GDK_GRESOURCE */
300 /** Copy a GString to the clipboard.
302 * @param str GString that is to be copied to the clipboard.
304 extern void copy_to_clipboard(GString *str);
306 /** Copy an array of bytes to the clipboard.
307 * Copies as mime-type application/octet-stream in GTK 2.
309 * @param data_p Pointer to data to be copied.
310 * @param len Number of bytes in the data to be copied.
312 extern void copy_binary_to_clipboard(const guint8* data_p, int len);
314 /** Create a new window title that includes user-defined preference string.
316 * @param caption string you want included in title (appended to user-defined string)
317 * @return a newly created title string including user-defined preference (if specified)
319 extern gchar *create_user_window_title(const gchar *caption);
321 /** Set the title of a window based on a supplied caption and the
322 * display name for the capture file.
324 * @param win the window whose title is to be set
325 * @param caption caption string for the window
327 extern void set_window_title(GtkWidget *win, const gchar *caption);
329 /** Collapses tree item and his expanded children
331 * @param tree_view A GtkTreeView
332 * @param path Path to the field
334 extern void tree_collapse_path_all(GtkTreeView *tree_view, GtkTreePath *path);
336 /** Renders a float with two decimals precission, called from gtk_tree_view_column_set_cell_data_func().
337 * the user data must be the column number.
338 * Present floats with two decimals
340 * @param column A GtkTreeColumn
341 * @param renderer The GtkCellRenderer that is being rendered by tree_column
342 * @param model The GtkTreeModel being rendered
343 * @param iter A GtkTreeIter of the current row rendered
344 * @param user_data must be the column number to fetch the data from
346 void float_data_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data);
348 /** Renders a unsinged integer as a hexadecimal value, called from gtk_tree_view_column_set_cell_data_func()
349 * The user data must be the column number.
350 * Present value as hexadecimal.
351 * @param column A GtkTreeColumn
352 * @param renderer The GtkCellRenderer that is being rendered by tree_column
353 * @param model The GtkTreeModel being rendered
354 * @param iter A GtkTreeIter of the current row rendered
355 * @param user_data must be the column number to fetch the data from
357 void present_as_hex_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data);
359 /** Renders an unsigned 64 bits integer with space as thousand separator, called from gtk_tree_view_column_set_cell_data_func()
360 * The user data must be the column number.
361 * Present value as hexadecimal.
362 * @param column A GtkTreeColumn
363 * @param renderer The GtkCellRenderer that is being rendered by tree_column
364 * @param model The GtkTreeModel being rendered
365 * @param iter A GtkTreeIter of the current row rendered
366 * @param user_data must be the column number to fetch the data from
368 void u64_data_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data);
370 /** This function can be called from gtk_tree_view_column_set_cell_data_func()
371 * the user data must be the column number.
372 * Present value as hexadecimal.
373 * @param column A GtkTreeColumn
374 * @param renderer The GtkCellRenderer that is being rendered by tree_column
375 * @param model The GtkTreeModel being rendered
376 * @param iter A GtkTreeIter of the current row rendered
377 * @param user_data must be the column number to fetch the data from
379 void str_ptr_data_func(GtkTreeViewColumn *column, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data);
381 /** This function can be called from gtk_tree_sortable_set_sort_func()
382 * the user data must be the column number.
383 * Used together with str_ptr_data_func to sort the corresponding column.
384 * @param model The GtkTreeModel the comparison is within
385 * @param a A GtkTreeIter in model
386 * @param b Another GtkTreeIter in model
387 * @param user_data must be the column number to fetch the data from
390 gint str_ptr_sort_func(GtkTreeModel *model,
395 /** Switch a GtkTReeView to fixed columns (speed optimization)
396 * @param view A GtkTreeView
398 void switch_to_fixed_col(GtkTreeView *view);
400 /** Return the size in pixels of a string displayed with the GtkWidget's font.
401 * @param view A GtkWidget
402 * @param str UTF8 string
404 gint get_default_col_size(GtkWidget *view, const gchar *str);
407 /** --------------------------------------------------
408 * ws_combo_box_text_and_pointer convenience functions
409 * (Code adapted from GtkComboBox.c)
413 * ws_combo_box_new_text_and_pointer_full:
415 * Convenience function which constructs a new "text and pointer" combo box, which
416 * is a #GtkComboBox just displaying strings and storing a pointer associated with
417 * each combo_box entry; The pointer can be retrieved when an entry is selected.
418 * Also: optionally returns the cell renderer for the combo box.
419 * If you use this function to create a text_and_pointer combo_box,
420 * you should only manipulate its data source with the
421 * following convenience functions:
422 * ws_combo_box_append_text_and_pointer()
423 * ws_combo_box_append_text_and_pointer_full()
425 * @param cell_p pointer to return the 'GtkCellRenderer *' for the combo box (or NULL).
426 * @return A pointer to a new text_and_pointer combo_box.
428 GtkWidget *ws_combo_box_new_text_and_pointer_full(GtkCellRenderer **cell_p);
431 * ws_combo_box_new_text_and_pointer:
433 * Convenience function which constructs a new "text and pointer" combo box, which
434 * is a #GtkComboBox just displaying strings and storing a pointer associated with
435 * each combo_box entry; The pointer can be retrieved when an entry is selected.
436 * If you use this function to create a text_and_pointer combo_box,
437 * you should only manipulate its data source with the
438 * following convenience functions:
439 * ws_combo_box_append_text_and_pointer()
440 * ws_combo_box_append_text_and_pointer_full()
442 * @return A pointer to a new text_and_pointer combo_box.
444 GtkWidget *ws_combo_box_new_text_and_pointer(void);
447 * ws_combo_box_clear_text_and_pointer:
448 * @param combo_box A #GtkComboBox constructed using ws_combo_box_new_text_and_pointer()
450 * Clears all the text_and_pointer entries in the text_and_pointer combo_box.
451 * Note: A "changed" signal will be emitted after the clear if there was
452 * an active (selected) entry before the clear.
453 * You should use this function only with combo boxes constructed with
454 * ws_combo_box_new_text_and_pointer().
456 void ws_combo_box_clear_text_and_pointer(GtkComboBox *combo_box);
459 * ws_combo_box_append_text_and_pointer_full:
460 * @param combo_box A #GtkComboBox constructed using ws_combo_box_new_text_and_pointer()
461 * @param parent_iter Parent row for apending; NULL if appending to tree top-level;
462 * @param text A string to be displayed as an entry in the dropdown list of the combo_box
463 * @param ptr A pointer to be associated with this entry of the combo_box
464 * @param sensitive TRUE/FALSE to set sensitivity of the entry
465 * @return A GtkTreeIter pointing to the appended GtkVomboBox entry.
467 * Appends text and ptr to the list of strings and pointers stored in combo_box.
468 * The text and ptr can be appended to any existing level of the tree_store.
469 * The sensitivity of the row will be set as requested.
470 * Note that you can only use this function with combo boxes constructed with
471 * ws_combo_box_new_text_and_pointer().
474 ws_combo_box_append_text_and_pointer_full(GtkComboBox *combo_box,
475 GtkTreeIter *parent_iter,
481 * ws_combo_box_append_text_and_pointer:
482 * @param combo_box A #GtkComboBox constructed using ws_combo_box_new_text_and_pointer()
483 * @param text A string to be displayed as an entry in the dropdown list of the combo_box
484 * @param ptr A pointer to be associated with this entry of the combo_box
485 * @return A GtkTreeIter pointing to the appended GtkComboBox entry.
487 * Appends text and ptr to the list of strings and pointers stored in combo_box. Note that
488 * you can only use this function with combo boxes constructed with
489 * ws_combo_box_new_text_and_pointer().
492 ws_combo_box_append_text_and_pointer(GtkComboBox *combo_box,
497 * ws_combo_box_get_active_pointer:
498 * @param combo_box A #GtkComboBox constructed using ws_combo_box_new_text_and_pointer()
499 * @param ptr A pointer to a location in which to store the pointer associated with the active entry
500 * @return TRUE if an entry is selected (i.e: an active entry exists); FALSE otherwise
502 * You can only use this function with combo boxes constructed with
503 * ws_combo_box_new_text_and_pointer().
505 gboolean ws_combo_box_get_active_pointer(GtkComboBox *combo_box, gpointer *ptr);
508 * ws_combo_box_get_active:
509 * @param combo_box A #GtkComboBox constructed using ws_combo_box_new_text_and_pointer()
510 * @return Index of the active entry; -1 if no entry is selected;
511 * Note: If the active item is not an immediate child of root of the tree then
512 * the index returned is that of the top-level for the acftive entry.
514 gint ws_combo_box_get_active(GtkComboBox *combo_box);
517 * ws_combo_box_set_active:
518 * @param combo_box A #GtkComboBox constructed using ws_combo_box_new_text_and_pointer()
519 * @param idx Index of the entry which is to be set as active (ie: selected).
520 * Index refers to the immediate children of the tree.
522 void ws_combo_box_set_active(GtkComboBox *combo_box, gint idx);
525 * ws_combo_box_set_active_iter:
526 * @param combo_box A #GtkComboBox constructed using ws_combo_box_new_text_and_pointer()
527 * @param iter of the entry which is to be set as active (ie: selected).
530 ws_combo_box_set_active_iter(GtkComboBox *combo_box, GtkTreeIter *iter);
532 #ifdef HAVE_GDK_GRESOURCE
534 * ws_gdk_pixbuf_new_from_resource:
535 * @param path A GResource path
536 * @return The GdkPixbuf object
539 ws_gdk_pixbuf_new_from_resource(const char *path);
540 #endif /* HAVE_GDK_GRESOURCE */
542 #if GTK_CHECK_VERSION(2,22,0)
543 #if !GTK_CHECK_VERSION(3,0,0)
544 GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
549 #endif /* GTK_CHECK_VERSION(3,0,0) */
550 #endif /* GTK_CHECK_VERSION(2,22,0) */
554 * @param orientation the box's orientation
555 * @param spacing the number of pixels to put between children
556 * @param homogeneous a boolean value, TRUE to create equal allotments, FALSE for variable allotments
558 GtkWidget * ws_gtk_box_new(GtkOrientation orientation, gint spacing, gboolean homogeneous);
560 #if !GTK_CHECK_VERSION(3,0,0)
568 GtkWidget * gtk_button_box_new(GtkOrientation orientation);
569 GtkWidget * gtk_scrollbar_new(GtkOrientation orientation, GtkAdjustment *adjustment);
570 GtkWidget * gtk_paned_new(GtkOrientation orientation);
571 GtkWidget * gtk_separator_new (GtkOrientation orientation);
572 void gdk_cairo_set_source_rgba(cairo_t *cr, const GdkRGBA *rgba);
573 #endif /* GTK_CHECK_VERSION(3,0,0) */
575 /** Create a new frame with no border and a bold title on appropriate platforms.
577 * @param title The title for the new frame
578 * @return The newly created window
580 extern GtkWidget *frame_new(const gchar *title);
583 /* GtkTable is deprecated in Gtk3 ...
585 * ws_gtk_grid...() wrapper functions & macros matching basic GtkGrid functions
586 * have been created which can be used both on Gtk2 and Gtk3.
588 * The functionality provided matches the fairly simple Wireshatk
589 * Gtk2 GtkTable usage and is intended to replace same.
591 * The ws_gtk_grid...() functionality is implemented as follows:
592 * Gtk2: macros which effect calls to GtkTable functions
593 * (with GTK_GRID typedef'd as GTK_TABLE & etc).
594 * Gtk3: wrapper functions and macros which effect calls to gtk_grid...()
595 * and other Gtk3 functions as needed.
597 * The args to the ws_gtk_grid...() functions are identical to the corresponding
598 * Gtk3 gtk_grid...() functions (other than ws_gtk_attach_defaults() and
599 * ws_gtk_attach_extended() which have no gtk_grid...() equivalent).
601 * ws_gtk_grid_new() ;; gtk_table_new()
603 * ws_gtk_grid_attach() ;; gtk_table_attach( , , , , , ,0, 0, 0, 0)
604 * ;; that is: same as gtk_grid_attach()
605 * ;; Gt2/Gtk3: [h|v]expand = FALSE; (FILL ignored)
607 * ws_gtk_grid_attach_defaults() ;; gtk_table_attach_defaults()
608 * ;; Gtk3: sets GTK_EXPAND/GTK_FILL as default;
609 * ;; That is, the defaults used by gtk_table_attach_defaults()
610 * ws_gtk_grid_attach_extended() ;; gtk_table_attach()
611 * ;; Essentially gtk_grid_attach() with eadditional args
612 * ;; to specify 'options' and 'padding' [as used in gtk_table_attach()];
613 * ;; Gtk3: sets GTK_EXPAND/GTK_FILL & margins on child widgit
615 * ;; (See below for declaration).
616 * ws_gtk_grid_set_homogeneous() ;; gtk_table_set_homogeneous()
617 * ;; Gtk3 grid: sets both 'row-homogeneous' and 'column-homogeneous'
618 * ws_gtk_set_row_spacing() ;; gtk_table_set_row_spacings()
619 * ws_gtk_set_column_spacing() ;; gtk_table_set_col_spacings()
621 * Example: Existing Wireshark Gtk2 code:
622 * gtk_table_attach_defaults(GTK_TABLE(foo_tb), child, col, col+1, row, row+1)
624 * should be converted to:
625 * ws_gtk_grid_attach_defaults(GTK_GRID(foo_grid), child, col, row, 1, 1);
628 #if !GTK_CHECK_VERSION(3,0,0)
630 typedef GtkTable GtkGrid;
631 #define GTK_GRID(x) GTK_TABLE(x)
633 #define ws_gtk_grid_new() \
634 gtk_table_new(0, 0, FALSE)
636 #define ws_gtk_grid_attach(grid, child, left, top, width, height) \
637 gtk_table_attach(grid, child, left, left+width, top, top+height, (GtkAttachOptions)0, (GtkAttachOptions)0, 0, 0)
639 #define ws_gtk_grid_attach_defaults(grid, child, left, top, width, height) \
640 gtk_table_attach_defaults(grid, child, left, left+width, top, top+height)
642 #define ws_gtk_grid_attach_extended(grid, child, left, top, width, height, xoptions, yoptions, xpadding, ypadding) \
643 gtk_table_attach(grid, child, left, left+width, top, top+height, xoptions, yoptions, xpadding, ypadding)
645 #define ws_gtk_grid_set_homogeneous(grid, homogeneous) \
646 gtk_table_set_homogeneous(grid, homogeneous)
648 #define ws_gtk_grid_set_row_spacing(grid, spacing) \
649 gtk_table_set_row_spacings(grid, spacing)
651 #define ws_gtk_grid_set_column_spacing(grid, spacing) \
652 gtk_table_set_col_spacings(grid, spacing)
656 #define ws_gtk_grid_new() \
660 #define ws_gtk_grid_attach(grid, child, left, top, width, height) \
661 gtk_grid_attach(grid, child, left, top, width, height)
663 extern void ws_gtk_grid_attach_defaults(GtkGrid *grid, GtkWidget *child,
664 gint left, gint top, gint width, gint height);
666 extern void ws_gtk_grid_attach_extended(GtkGrid *grid, GtkWidget *child,
667 gint left, gint top, gint width, gint height,
668 GtkAttachOptions xoptions, GtkAttachOptions yoptions,
669 guint xpadding, guint ypadding);
671 extern void ws_gtk_grid_set_homogeneous(GtkGrid *grid, gboolean homogeneous);
673 #define ws_gtk_grid_set_row_spacing(grid, spacing) \
674 gtk_grid_set_row_spacing(grid, spacing)
676 #define ws_gtk_grid_set_column_spacing(grid, spacing) \
677 gtk_grid_set_column_spacing(grid, spacing)
679 #endif /* GTK_CHECK_VERSION(3,0,0) */
682 #endif /* __GUI_UTIL_H__ */