1 /* Common Lisp bindings for GTK+ v2.0
2 * Copyright (C) 1999-2000 Espen S. Johnsen <esj@stud.cs.uit.no>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 /* $Id: gtkglue.c,v 1.7 2001/10/21 23:22:53 espen Exp $ */
27 * Gtk helper functions
32 gtk_query_version (guint *major, guint *minor, guint *micro)
34 *major = gtk_major_version;
35 *minor = gtk_minor_version;
36 *micro = gtk_micro_version;
40 /* Is this necessary? */
43 gtk_object_type (GtkObject *obj)
45 return GTK_OBJECT_TYPE (obj);
53 gtk_widget_get_window (GtkWidget *widget)
55 return widget->window;
59 gtk_widget_get_state (GtkWidget *widget)
65 gtk_widget_mapped_p (GtkWidget *widget)
67 return GTK_WIDGET_MAPPED (widget);
71 gtk_widget_allocation (GtkWidget *widget, int *width, int *height)
73 *width = widget->allocation.width;
74 *height = widget->allocation.height;
81 gtk_container_get_focus_child (GtkContainer *container)
83 return container->focus_child;
90 gtk_dialog_get_vbox (GtkDialog *dialog)
96 gtk_dialog_get_action_area (GtkDialog *dialog)
98 return dialog->action_area;
106 gtk_menu_item_get_placement (GtkMenuItem* menu_item)
108 return menu_item->submenu_placement;
112 gtk_menu_item_get_show_submenu (GtkMenuItem* menu_item)
114 return menu_item->show_submenu_indicator;
118 gtk_menu_item_set_show_submenu (GtkMenuItem* menu_item, guint show)
120 menu_item->show_submenu_indicator = show;
125 /* Check menu item */
128 gtk_check_menu_item_get_active (GtkCheckMenuItem* check_menu_item)
130 return check_menu_item->active;
134 gtk_check_menu_item_get_show_toggle (GtkCheckMenuItem* check_menu_item)
136 return check_menu_item->always_show_toggle;
143 gtk_window_wmclass (GtkWindow* window, gchar* name, gchar* class)
145 name = window->wmclass_name;
146 class = window->wmclass_class;
153 gtk_file_selection_get_action_area (GtkFileSelection *filesel)
155 return filesel->action_area;
159 gtk_file_selection_get_ok_button (GtkFileSelection *filesel)
161 return filesel->ok_button;
165 gtk_file_selection_get_cancel_button (GtkFileSelection *filesel)
167 return filesel->cancel_button;
171 /* Color selection */
173 gtk_color_selection_set_color_by_values (GtkColorSelection *colorsel,
186 gtk_color_selection_set_color (colorsel, color);
190 gtk_color_selection_get_color_as_values (GtkColorSelection *colorsel,
198 gtk_color_selection_get_color (colorsel, color);
210 gtk_combo_get_entry (GtkCombo *combo)
216 gtk_combo_get_use_arrows (GtkCombo *combo)
218 return combo->use_arrows;
222 gtk_combo_get_use_arrows_always (GtkCombo *combo)
224 return combo->use_arrows_always;
228 gtk_combo_get_case_sensitive (GtkCombo *combo)
230 return combo->case_sensitive;
237 gtk_paned_child1 (GtkPaned *paned, guint *resize, guint *shrink)
239 *resize = paned->child1_resize;
240 *shrink = paned->child1_shrink;
242 return paned->child1;
247 gtk_paned_child2 (GtkPaned *paned, guint *resize, guint *shrink)
249 *resize = paned->child2_resize;
250 *shrink = paned->child2_shrink;
252 return paned->child2;
256 gtk_paned_get_position (GtkPaned *paned)
258 if (paned->position_set == TRUE)
259 return paned->child1_size;
268 gtk_layout_get_bin_window (GtkLayout *layout)
270 return layout->bin_window;
274 gtk_layout_get_xoffset (GtkLayout *layout)
276 return layout->xoffset;
280 gtk_layout_set_xoffset (GtkLayout *layout, guint xoffset)
282 return layout->xoffset = xoffset;
286 gtk_layout_get_yoffset (GtkLayout *layout)
288 return layout->yoffset;
292 gtk_layout_set_yoffset (GtkLayout *layout, guint yoffset)
294 return layout->yoffset = yoffset;
300 gtk_list_selection (GtkList *list)
302 return list->selection;
310 gtk_toolbar_num_children (GtkToolbar *toolbar)
312 return toolbar->num_children;
316 gtk_toolbar_get_tooltips (GtkToolbar *toolbar)
318 return toolbar->tooltips->enabled;
325 gtk_drawing_area_get_size (GtkDrawingArea *darea, gint *width, gint *height)
329 widget = GTK_WIDGET (darea);
330 *width = widget->allocation.width;
331 *height = widget->allocation.height;
338 gtk_progress_get_format_string (GtkProgress *progress)
340 return progress->format;
344 gtk_progress_get_adjustment (GtkProgress *progress)
346 return progress->adjustment;
353 gtk_tooltips_get_enabled (GtkTooltips *tooltips)
355 return tooltips->enabled;
359 /* GtkStyle accessor functions */
374 gtk_style_get_color (GtkStyle *style, GtkColorType color_type,
379 case GTK_COLOR_WHITE:
380 return &style->white;
381 case GTK_COLOR_BLACK:
382 return &style->black;
384 return &style->fg[state];
386 return &style->bg[state];
387 case GTK_COLOR_LIGHT:
388 return &style->light[state];
390 return &style->dark[state];
392 return &style->mid[state];
394 return &style->text[state];
396 return &style->base[state];
402 gtk_style_set_color (GtkStyle *style, GtkColorType color_type,
403 GtkStateType state, GdkColor *color)
407 case GTK_COLOR_WHITE:
408 style->white = *color; break;
409 case GTK_COLOR_BLACK:
410 style->black = *color; break;
412 style->fg[state] = *color; break;
414 style->bg[state] = *color; break;
415 case GTK_COLOR_LIGHT:
416 style->light[state] = *color; break;
418 style->dark[state] = *color; break;
420 style->mid[state] = *color; break;
422 style->text[state] = *color; break;
424 style->base[state] = *color; break;
427 return gtk_style_get_color (style, color_type, state);
432 gtk_style_get_font (GtkStyle *style)
439 gtk_style_set_font (GtkStyle *style, GdkFont *font)
441 return style->font = font;
446 gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)
450 case GTK_COLOR_WHITE:
451 return style->white_gc;
452 case GTK_COLOR_BLACK:
453 return style->black_gc;
455 return style->fg_gc[state];
457 return style->bg_gc[state];
458 case GTK_COLOR_LIGHT:
459 return style->light_gc[state];
461 return style->dark_gc[state];
463 return style->mid_gc[state];
465 return style->text_gc[state];
467 return style->base_gc[state];