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.3 2004/12/20 00:45:24 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_paned_child1 (GtkPaned *paned, guint *resize, guint *shrink)
107 *resize = paned->child1_resize;
108 *shrink = paned->child1_shrink;
110 return paned->child1;
115 gtk_paned_child2 (GtkPaned *paned, guint *resize, guint *shrink)
117 *resize = paned->child2_resize;
118 *shrink = paned->child2_shrink;
120 return paned->child2;
127 gtk_layout_get_bin_window (GtkLayout *layout)
129 return layout->bin_window;
136 gtk_drawing_area_get_size (GtkDrawingArea *darea, gint *width, gint *height)
140 widget = GTK_WIDGET (darea);
141 *width = widget->allocation.width;
142 *height = widget->allocation.height;
146 /* GtkStyle accessor functions */
162 gtk_style_get_color (GtkStyle *style, GtkColorType color_type,
167 case GTK_COLOR_WHITE:
168 return &style->white;
169 case GTK_COLOR_BLACK:
170 return &style->black;
172 return &style->fg[state];
174 return &style->bg[state];
175 case GTK_COLOR_LIGHT:
176 return &style->light[state];
178 return &style->dark[state];
180 return &style->mid[state];
182 return &style->text[state];
184 return &style->base[state];
185 case GTK_COLOR_TEXT_AA:
186 return &style->text_aa[state];
192 gtk_style_set_color (GtkStyle *style, GtkColorType color_type,
193 GtkStateType state, GdkColor *color)
197 case GTK_COLOR_WHITE:
198 style->white = *color; break;
199 case GTK_COLOR_BLACK:
200 style->black = *color; break;
202 style->fg[state] = *color; break;
204 style->bg[state] = *color; break;
205 case GTK_COLOR_LIGHT:
206 style->light[state] = *color; break;
208 style->dark[state] = *color; break;
210 style->mid[state] = *color; break;
212 style->text[state] = *color; break;
214 style->base[state] = *color; break;
215 case GTK_COLOR_TEXT_AA:
216 style->text_aa[state] = *color; break;
222 gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)
226 case GTK_COLOR_WHITE:
227 return style->white_gc;
228 case GTK_COLOR_BLACK:
229 return style->black_gc;
231 return style->fg_gc[state];
233 return style->bg_gc[state];
234 case GTK_COLOR_LIGHT:
235 return style->light_gc[state];
237 return style->dark_gc[state];
239 return style->mid_gc[state];
241 return style->text_gc[state];
243 return style->base_gc[state];
244 case GTK_COLOR_TEXT_AA:
245 return style->text_aa_gc[state];
250 gtk_style_font_desc_offset ()
254 return (int)&style.font_desc - (int)&style;