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.6 2004/12/29 21:17:37 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_layout_get_bin_window (GtkLayout *layout)
130 return layout->bin_window;
134 /* GtkStyle accessor functions */
150 gtk_style_get_color (GtkStyle *style, GtkColorType color_type,
155 case GTK_COLOR_WHITE:
156 return &style->white;
157 case GTK_COLOR_BLACK:
158 return &style->black;
160 return &style->fg[state];
162 return &style->bg[state];
163 case GTK_COLOR_LIGHT:
164 return &style->light[state];
166 return &style->dark[state];
168 return &style->mid[state];
170 return &style->text[state];
172 return &style->base[state];
173 case GTK_COLOR_TEXT_AA:
174 return &style->text_aa[state];
180 gtk_style_set_color (GtkStyle *style, GtkColorType color_type,
181 GtkStateType state, GdkColor *color)
185 case GTK_COLOR_WHITE:
186 style->white = *color; break;
187 case GTK_COLOR_BLACK:
188 style->black = *color; break;
190 style->fg[state] = *color; break;
192 style->bg[state] = *color; break;
193 case GTK_COLOR_LIGHT:
194 style->light[state] = *color; break;
196 style->dark[state] = *color; break;
198 style->mid[state] = *color; break;
200 style->text[state] = *color; break;
202 style->base[state] = *color; break;
203 case GTK_COLOR_TEXT_AA:
204 style->text_aa[state] = *color; break;
210 gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)
214 case GTK_COLOR_WHITE:
215 return style->white_gc;
216 case GTK_COLOR_BLACK:
217 return style->black_gc;
219 return style->fg_gc[state];
221 return style->bg_gc[state];
222 case GTK_COLOR_LIGHT:
223 return style->light_gc[state];
225 return style->dark_gc[state];
227 return style->mid_gc[state];
229 return style->text_gc[state];
231 return style->base_gc[state];
232 case GTK_COLOR_TEXT_AA:
233 return style->text_aa_gc[state];
238 gtk_style_font_desc_offset ()
242 return (int)&style.font_desc - (int)&style;