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.7 2005-01-06 21:54:19 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;
77 gtk_container_get_reallocate_redraws (GtkContainer *container)
79 return container->reallocate_redraws;
86 gtk_dialog_get_vbox (GtkDialog *dialog)
92 gtk_dialog_get_action_area (GtkDialog *dialog)
94 return dialog->action_area;
102 gtk_window_get_default (GtkWindow *window)
104 return window->default_widget;
108 gtk_window_get_group (GtkWindow *window)
110 return window->group;
118 gtk_menu_get_screen (GtkMenu *menu)
120 return (GdkScreen*)g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen");
128 gtk_toolbar_get_tooltips_object (GtkToolbar *toolbar)
130 return toolbar->tooltips;
138 gtk_tooltips_get_enabled (GtkTooltips *tooltips)
140 return tooltips->enabled;
147 gtk_layout_get_bin_window (GtkLayout *layout)
149 return layout->bin_window;
153 /* GtkStyle accessor functions */
169 gtk_style_get_color (GtkStyle *style, GtkColorType color_type,
174 case GTK_COLOR_WHITE:
175 return &style->white;
176 case GTK_COLOR_BLACK:
177 return &style->black;
179 return &style->fg[state];
181 return &style->bg[state];
182 case GTK_COLOR_LIGHT:
183 return &style->light[state];
185 return &style->dark[state];
187 return &style->mid[state];
189 return &style->text[state];
191 return &style->base[state];
192 case GTK_COLOR_TEXT_AA:
193 return &style->text_aa[state];
199 gtk_style_set_color (GtkStyle *style, GtkColorType color_type,
200 GtkStateType state, GdkColor *color)
204 case GTK_COLOR_WHITE:
205 style->white = *color; break;
206 case GTK_COLOR_BLACK:
207 style->black = *color; break;
209 style->fg[state] = *color; break;
211 style->bg[state] = *color; break;
212 case GTK_COLOR_LIGHT:
213 style->light[state] = *color; break;
215 style->dark[state] = *color; break;
217 style->mid[state] = *color; break;
219 style->text[state] = *color; break;
221 style->base[state] = *color; break;
222 case GTK_COLOR_TEXT_AA:
223 style->text_aa[state] = *color; break;
229 gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)
233 case GTK_COLOR_WHITE:
234 return style->white_gc;
235 case GTK_COLOR_BLACK:
236 return style->black_gc;
238 return style->fg_gc[state];
240 return style->bg_gc[state];
241 case GTK_COLOR_LIGHT:
242 return style->light_gc[state];
244 return style->dark_gc[state];
246 return style->mid_gc[state];
248 return style->text_gc[state];
250 return style->base_gc[state];
251 case GTK_COLOR_TEXT_AA:
252 return style->text_aa_gc[state];
257 gtk_style_font_desc_offset ()
261 return (int)&style.font_desc - (int)&style;