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.5 2004-12-26 11:51:21 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
;
102 gtk_window_get_group (GtkWindow
*window
)
104 return window
->group
;
112 gtk_layout_get_bin_window (GtkLayout
*layout
)
114 return layout
->bin_window
;
121 gtk_drawing_area_get_size (GtkDrawingArea
*darea
, gint
*width
, gint
*height
)
125 widget
= GTK_WIDGET (darea
);
126 *width
= widget
->allocation
.width
;
127 *height
= widget
->allocation
.height
;
131 /* GtkStyle accessor functions */
147 gtk_style_get_color (GtkStyle
*style
, GtkColorType color_type
,
152 case GTK_COLOR_WHITE
:
153 return &style
->white
;
154 case GTK_COLOR_BLACK
:
155 return &style
->black
;
157 return &style
->fg
[state
];
159 return &style
->bg
[state
];
160 case GTK_COLOR_LIGHT
:
161 return &style
->light
[state
];
163 return &style
->dark
[state
];
165 return &style
->mid
[state
];
167 return &style
->text
[state
];
169 return &style
->base
[state
];
170 case GTK_COLOR_TEXT_AA
:
171 return &style
->text_aa
[state
];
177 gtk_style_set_color (GtkStyle
*style
, GtkColorType color_type
,
178 GtkStateType state
, GdkColor
*color
)
182 case GTK_COLOR_WHITE
:
183 style
->white
= *color
; break;
184 case GTK_COLOR_BLACK
:
185 style
->black
= *color
; break;
187 style
->fg
[state
] = *color
; break;
189 style
->bg
[state
] = *color
; break;
190 case GTK_COLOR_LIGHT
:
191 style
->light
[state
] = *color
; break;
193 style
->dark
[state
] = *color
; break;
195 style
->mid
[state
] = *color
; break;
197 style
->text
[state
] = *color
; break;
199 style
->base
[state
] = *color
; break;
200 case GTK_COLOR_TEXT_AA
:
201 style
->text_aa
[state
] = *color
; break;
207 gtk_style_get_gc (GtkStyle
*style
, GtkColorType color_type
, GtkStateType state
)
211 case GTK_COLOR_WHITE
:
212 return style
->white_gc
;
213 case GTK_COLOR_BLACK
:
214 return style
->black_gc
;
216 return style
->fg_gc
[state
];
218 return style
->bg_gc
[state
];
219 case GTK_COLOR_LIGHT
:
220 return style
->light_gc
[state
];
222 return style
->dark_gc
[state
];
224 return style
->mid_gc
[state
];
226 return style
->text_gc
[state
];
228 return style
->base_gc
[state
];
229 case GTK_COLOR_TEXT_AA
:
230 return style
->text_aa_gc
[state
];
235 gtk_style_font_desc_offset ()
239 return (int)&style
.font_desc
- (int)&style
;