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.4 2004/12/20 20:00:46 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_window_get_default (GtkWindow *window)
98 return window->default_widget;
105 gtk_layout_get_bin_window (GtkLayout *layout)
107 return layout->bin_window;
114 gtk_drawing_area_get_size (GtkDrawingArea *darea, gint *width, gint *height)
118 widget = GTK_WIDGET (darea);
119 *width = widget->allocation.width;
120 *height = widget->allocation.height;
124 /* GtkStyle accessor functions */
140 gtk_style_get_color (GtkStyle *style, GtkColorType color_type,
145 case GTK_COLOR_WHITE:
146 return &style->white;
147 case GTK_COLOR_BLACK:
148 return &style->black;
150 return &style->fg[state];
152 return &style->bg[state];
153 case GTK_COLOR_LIGHT:
154 return &style->light[state];
156 return &style->dark[state];
158 return &style->mid[state];
160 return &style->text[state];
162 return &style->base[state];
163 case GTK_COLOR_TEXT_AA:
164 return &style->text_aa[state];
170 gtk_style_set_color (GtkStyle *style, GtkColorType color_type,
171 GtkStateType state, GdkColor *color)
175 case GTK_COLOR_WHITE:
176 style->white = *color; break;
177 case GTK_COLOR_BLACK:
178 style->black = *color; break;
180 style->fg[state] = *color; break;
182 style->bg[state] = *color; break;
183 case GTK_COLOR_LIGHT:
184 style->light[state] = *color; break;
186 style->dark[state] = *color; break;
188 style->mid[state] = *color; break;
190 style->text[state] = *color; break;
192 style->base[state] = *color; break;
193 case GTK_COLOR_TEXT_AA:
194 style->text_aa[state] = *color; break;
200 gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)
204 case GTK_COLOR_WHITE:
205 return style->white_gc;
206 case GTK_COLOR_BLACK:
207 return style->black_gc;
209 return style->fg_gc[state];
211 return style->bg_gc[state];
212 case GTK_COLOR_LIGHT:
213 return style->light_gc[state];
215 return style->dark_gc[state];
217 return style->mid_gc[state];
219 return style->text_gc[state];
221 return style->base_gc[state];
222 case GTK_COLOR_TEXT_AA:
223 return style->text_aa_gc[state];
228 gtk_style_font_desc_offset ()
232 return (int)&style.font_desc - (int)&style;