1 /* Common Lisp bindings for GTK+ v2.0
2 * Copyright (C) 1999-2002 Espen S. Johnsen <espen@users.sourceforge.net>
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: glue.c,v 1.2 2004/11/01 00:08:50 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;
43 gtk_widget_get_window (GtkWidget *widget)
45 return widget->window;
49 gtk_widget_get_state (GtkWidget *widget)
55 gtk_widget_mapped_p (GtkWidget *widget)
57 return GTK_WIDGET_MAPPED (widget);
61 gtk_widget_get_size_allocation (GtkWidget *widget, int *width, int *height)
63 *width = widget->allocation.width;
64 *height = widget->allocation.height;
71 gtk_container_get_focus_child (GtkContainer *container)
73 return container->focus_child;
80 gtk_dialog_get_vbox (GtkDialog *dialog)
86 gtk_dialog_get_action_area (GtkDialog *dialog)
88 return dialog->action_area;
96 gtk_check_menu_item_get_active (GtkCheckMenuItem* check_menu_item)
98 return check_menu_item->active;
102 gtk_check_menu_item_get_show_toggle (GtkCheckMenuItem* check_menu_item)
104 return check_menu_item->always_show_toggle;
112 gtk_window_get_default (GtkWindow *window)
114 return window->default_widget;
121 gtk_file_selection_get_action_area (GtkFileSelection *filesel)
123 return filesel->action_area;
127 gtk_file_selection_get_ok_button (GtkFileSelection *filesel)
129 return filesel->ok_button;
133 gtk_file_selection_get_cancel_button (GtkFileSelection *filesel)
135 return filesel->cancel_button;
139 /* Color selection */
141 gtk_color_selection_set_color_by_values (GtkColorSelection *colorsel,
154 gtk_color_selection_set_color (colorsel, color);
158 gtk_color_selection_get_color_as_values (GtkColorSelection *colorsel,
166 gtk_color_selection_get_color (colorsel, color);
178 gtk_combo_get_entry (GtkCombo *combo)
184 gtk_combo_get_use_arrows (GtkCombo *combo)
186 return combo->use_arrows;
190 gtk_combo_get_use_arrows_always (GtkCombo *combo)
192 return combo->use_arrows_always;
196 gtk_combo_get_case_sensitive (GtkCombo *combo)
198 return combo->case_sensitive;
205 gtk_paned_child1 (GtkPaned *paned, guint *resize, guint *shrink)
207 *resize = paned->child1_resize;
208 *shrink = paned->child1_shrink;
210 return paned->child1;
215 gtk_paned_child2 (GtkPaned *paned, guint *resize, guint *shrink)
217 *resize = paned->child2_resize;
218 *shrink = paned->child2_shrink;
220 return paned->child2;
227 gtk_layout_get_bin_window (GtkLayout *layout)
229 return layout->bin_window;
236 gtk_list_selection (GtkList *list)
238 return list->selection;
246 gtk_toolbar_get_tooltips (GtkToolbar *toolbar)
248 return toolbar->tooltips->enabled;
255 gtk_drawing_area_get_size (GtkDrawingArea *darea, gint *width, gint *height)
259 widget = GTK_WIDGET (darea);
260 *width = widget->allocation.width;
261 *height = widget->allocation.height;
268 gtk_progress_get_format_string (GtkProgress *progress)
270 return progress->format;
274 gtk_progress_get_adjustment (GtkProgress *progress)
276 return progress->adjustment;
283 gtk_tooltips_get_enabled (GtkTooltips *tooltips)
285 return tooltips->enabled;
289 /* GtkStyle accessor functions */
304 gtk_style_get_color (GtkStyle *style, GtkColorType color_type,
309 case GTK_COLOR_WHITE:
310 return &style->white;
311 case GTK_COLOR_BLACK:
312 return &style->black;
314 return &style->fg[state];
316 return &style->bg[state];
317 case GTK_COLOR_LIGHT:
318 return &style->light[state];
320 return &style->dark[state];
322 return &style->mid[state];
324 return &style->text[state];
326 return &style->base[state];
332 gtk_style_set_color (GtkStyle *style, GtkColorType color_type,
333 GtkStateType state, GdkColor *color)
337 case GTK_COLOR_WHITE:
338 style->white = *color; break;
339 case GTK_COLOR_BLACK:
340 style->black = *color; break;
342 style->fg[state] = *color; break;
344 style->bg[state] = *color; break;
345 case GTK_COLOR_LIGHT:
346 style->light[state] = *color; break;
348 style->dark[state] = *color; break;
350 style->mid[state] = *color; break;
352 style->text[state] = *color; break;
354 style->base[state] = *color; break;
357 return gtk_style_get_color (style, color_type, state);
362 gtk_style_get_font (GtkStyle *style)
369 gtk_style_set_font (GtkStyle *style, GdkFont *font)
371 return style->font = font;
376 gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)
380 case GTK_COLOR_WHITE:
381 return style->white_gc;
382 case GTK_COLOR_BLACK:
383 return style->black_gc;
385 return style->fg_gc[state];
387 return style->bg_gc[state];
388 case GTK_COLOR_LIGHT:
389 return style->light_gc[state];
391 return style->dark_gc[state];
393 return style->mid_gc[state];
395 return style->text_gc[state];
397 return style->base_gc[state];