1 /* Common Lisp bindings for GTK+ v2.x
2 * Copyright 1999-2005 Espen S. Johnsen <espen@users.sf.net>
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 /* $Id: glue.c,v 1.9 2007-09-06 14:27:07 espen Exp $ */
32 * Gtk helper functions
37 gtk_query_version (guint *major, guint *minor, guint *micro)
39 *major = gtk_major_version;
40 *minor = gtk_minor_version;
41 *micro = gtk_micro_version;
48 gtk_widget_get_window (GtkWidget *widget)
50 return widget->window;
54 gtk_widget_get_state (GtkWidget *widget)
60 gtk_widget_flags (GtkWidget *widget)
62 return GTK_WIDGET_FLAGS (widget);
67 gtk_widget_get_size_allocation (GtkWidget *widget, int *width, int *height)
69 *width = widget->allocation.width;
70 *height = widget->allocation.height;
77 gtk_container_get_focus_child (GtkContainer *container)
79 return container->focus_child;
83 gtk_container_get_reallocate_redraws (GtkContainer *container)
85 return container->reallocate_redraws;
92 gtk_dialog_get_vbox (GtkDialog *dialog)
98 gtk_dialog_get_action_area (GtkDialog *dialog)
100 return dialog->action_area;
108 gtk_window_get_default (GtkWindow *window)
110 return window->default_widget;
114 gtk_window_get_group (GtkWindow *window)
116 return window->group;
124 gtk_menu_get_screen (GtkMenu *menu)
126 return (GdkScreen*)g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen");
134 gtk_toolbar_get_tooltips_object (GtkToolbar *toolbar)
136 return toolbar->tooltips;
144 gtk_tooltips_get_enabled (GtkTooltips *tooltips)
146 return tooltips->enabled;
153 gtk_layout_get_bin_window (GtkLayout *layout)
155 return layout->bin_window;
159 /* GtkStyle accessor functions */
175 gtk_style_get_color (GtkStyle *style, GtkColorType color_type,
180 case GTK_COLOR_WHITE:
181 return &style->white;
182 case GTK_COLOR_BLACK:
183 return &style->black;
185 return &style->fg[state];
187 return &style->bg[state];
188 case GTK_COLOR_LIGHT:
189 return &style->light[state];
191 return &style->dark[state];
193 return &style->mid[state];
195 return &style->text[state];
197 return &style->base[state];
198 case GTK_COLOR_TEXT_AA:
199 return &style->text_aa[state];
205 gtk_style_set_color (GtkStyle *style, GtkColorType color_type,
206 GtkStateType state, GdkColor *color)
210 case GTK_COLOR_WHITE:
211 style->white = *color; break;
212 case GTK_COLOR_BLACK:
213 style->black = *color; break;
215 style->fg[state] = *color; break;
217 style->bg[state] = *color; break;
218 case GTK_COLOR_LIGHT:
219 style->light[state] = *color; break;
221 style->dark[state] = *color; break;
223 style->mid[state] = *color; break;
225 style->text[state] = *color; break;
227 style->base[state] = *color; break;
228 case GTK_COLOR_TEXT_AA:
229 style->text_aa[state] = *color; break;
235 gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)
239 case GTK_COLOR_WHITE:
240 return style->white_gc;
241 case GTK_COLOR_BLACK:
242 return style->black_gc;
244 return style->fg_gc[state];
246 return style->bg_gc[state];
247 case GTK_COLOR_LIGHT:
248 return style->light_gc[state];
250 return style->dark_gc[state];
252 return style->mid_gc[state];
254 return style->text_gc[state];
256 return style->base_gc[state];
257 case GTK_COLOR_TEXT_AA:
258 return style->text_aa_gc[state];
263 gtk_style_font_desc_offset ()
267 return (int)&style.font_desc - (int)&style;