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.8 2005-04-23 16:48:52 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_mapped_p (GtkWidget *widget)
62 return GTK_WIDGET_MAPPED (widget);
66 gtk_widget_get_size_allocation (GtkWidget *widget, int *width, int *height)
68 *width = widget->allocation.width;
69 *height = widget->allocation.height;
76 gtk_container_get_focus_child (GtkContainer *container)
78 return container->focus_child;
82 gtk_container_get_reallocate_redraws (GtkContainer *container)
84 return container->reallocate_redraws;
91 gtk_dialog_get_vbox (GtkDialog *dialog)
97 gtk_dialog_get_action_area (GtkDialog *dialog)
99 return dialog->action_area;
107 gtk_window_get_default (GtkWindow *window)
109 return window->default_widget;
113 gtk_window_get_group (GtkWindow *window)
115 return window->group;
123 gtk_menu_get_screen (GtkMenu *menu)
125 return (GdkScreen*)g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen");
133 gtk_toolbar_get_tooltips_object (GtkToolbar *toolbar)
135 return toolbar->tooltips;
143 gtk_tooltips_get_enabled (GtkTooltips *tooltips)
145 return tooltips->enabled;
152 gtk_layout_get_bin_window (GtkLayout *layout)
154 return layout->bin_window;
158 /* GtkStyle accessor functions */
174 gtk_style_get_color (GtkStyle *style, GtkColorType color_type,
179 case GTK_COLOR_WHITE:
180 return &style->white;
181 case GTK_COLOR_BLACK:
182 return &style->black;
184 return &style->fg[state];
186 return &style->bg[state];
187 case GTK_COLOR_LIGHT:
188 return &style->light[state];
190 return &style->dark[state];
192 return &style->mid[state];
194 return &style->text[state];
196 return &style->base[state];
197 case GTK_COLOR_TEXT_AA:
198 return &style->text_aa[state];
204 gtk_style_set_color (GtkStyle *style, GtkColorType color_type,
205 GtkStateType state, GdkColor *color)
209 case GTK_COLOR_WHITE:
210 style->white = *color; break;
211 case GTK_COLOR_BLACK:
212 style->black = *color; break;
214 style->fg[state] = *color; break;
216 style->bg[state] = *color; break;
217 case GTK_COLOR_LIGHT:
218 style->light[state] = *color; break;
220 style->dark[state] = *color; break;
222 style->mid[state] = *color; break;
224 style->text[state] = *color; break;
226 style->base[state] = *color; break;
227 case GTK_COLOR_TEXT_AA:
228 style->text_aa[state] = *color; break;
234 gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)
238 case GTK_COLOR_WHITE:
239 return style->white_gc;
240 case GTK_COLOR_BLACK:
241 return style->black_gc;
243 return style->fg_gc[state];
245 return style->bg_gc[state];
246 case GTK_COLOR_LIGHT:
247 return style->light_gc[state];
249 return style->dark_gc[state];
251 return style->mid_gc[state];
253 return style->text_gc[state];
255 return style->base_gc[state];
256 case GTK_COLOR_TEXT_AA:
257 return style->text_aa_gc[state];
262 gtk_style_font_desc_offset ()
266 return (int)&style.font_desc - (int)&style;