17 #ifndef GTKINTERFACE_H_
18 #define GTKINTERFACE_H_
178 #define LOCKSEMAPHORE gdk_threads_enter()
179 #define UNLOCKSEMAPHORE gdk_threads_leave()
183 if (borderFillVar==-1)
185 GtkStyle *wStyle=gtk_widget_get_style(widget);
186 cairo_t *cr=gdk_cairo_create(
win->window);
187 gdk_cairo_set_source_color(cr, &wStyle->bg[GTK_STATE_NORMAL]);
188 int x,
y, width, height;
190 x=
win->allocation.x; y=widget->allocation.y; width=widget->allocation.x-
x; height=widget->allocation.height;
191 cairo_rectangle(cr, x, y, width, height);
194 x=widget->allocation.x+widget->allocation.width; y=widget->allocation.y; width=(
win->allocation.x+
win->allocation.width)-x; height=widget->allocation.height;
195 cairo_rectangle(cr, x, y, width, height);
197 if (((borderFillVar&BORDER_LEFT)!=0)&((borderFillVar&
BORDER_TOP)!=0)){
198 x=
win->allocation.x; y=
win->allocation.y; width=widget->allocation.x-
x; height=widget->allocation.y-
win->allocation.y;
199 cairo_rectangle(cr, x, y, width, height);
201 if (((borderFillVar&BORDER_RIGHT)!=0)&((borderFillVar&BORDER_TOP)!=0)){
202 x=widget->allocation.x+widget->allocation.width; y=
win->allocation.y; width=(
win->allocation.x+
win->allocation.width)-x; height=widget->allocation.y-
y;
203 cairo_rectangle(cr, x, y, width, height);
205 if (borderFillVar&BORDER_TOP){
206 x=widget->allocation.x; y=
win->allocation.y; width=widget->allocation.width; height=widget->allocation.y-
y;
207 cairo_rectangle(cr, x, y, width, height);
210 x=widget->allocation.x; y=widget->allocation.y+widget->allocation.height; width=widget->allocation.width; height=(
win->allocation.y+
win->allocation.height)-y;
211 cairo_rectangle(cr, x, y, width, height);
213 if (((borderFillVar&BORDER_LEFT)!=0)&((borderFillVar&BORDER_BOTTOM)!=0)){
214 x=
win->allocation.x; y=widget->allocation.y+widget->allocation.height; width=widget->allocation.x-
x; height=(
win->allocation.y+
win->allocation.height)-y;
215 cairo_rectangle(cr, x, y, width, height);
217 if (((borderFillVar&BORDER_RIGHT)!=0)&((borderFillVar&BORDER_BOTTOM)!=0)){
218 x=widget->allocation.x+widget->allocation.width; y=widget->allocation.y+widget->allocation.height; width=(
win->allocation.x+
win->allocation.width)-x; height=(
win->allocation.y+
win->allocation.height)-y;
219 cairo_rectangle(cr, x, y, width, height);
239 #ifdef DEBUG_GTKINTERFACE
240 cout<<
"GtkInterface: init "<<
this<<endl;
251 #ifdef DEBUG_GTKINTERFACE
252 cout<<
"GtkInterface: init "<<
this<<endl;
254 init(width, height, resiseable);
262 void init(
int width=0,
int height=0,
bool resiseable=
true){
263 win = gtk_window_new( GTK_WINDOW_TOPLEVEL );
265 gtk_widget_set_size_request(
win, width, height);
266 gtk_signal_connect( GTK_OBJECT (
win),
"delete_event", GTK_SIGNAL_FUNC (
quit), NULL );
268 gtk_widget_show(
win );
274 #ifdef DEBUG_GTKINTERFACE
275 cout<<
"GtkInterface::~GtkInterface "<<endl;
279 static gint
quit(GtkWidget *widget, GdkEvent *event, gpointer data){
291 return operator<<(static_cast<Container&>(b));
294 return operator<<(static_cast<Container*>(b));
297 gtk_container_add (GTK_CONTAINER (
win), w);
301 gtk_container_remove (GTK_CONTAINER (
win), w);
305 gtk_container_add (GTK_CONTAINER (
win), w->
getWidget());
309 gtk_container_remove (GTK_CONTAINER (
win), w->
getWidget());
317 gtk_container_remove (GTK_CONTAINER (
win), w.
getWidget());
326 gtk_widget_modify_bg(
win, state, colour);
334 GdkColor colour; gdk_color_parse (colourName, &colour);
352 static bool fillBorder(GtkWidget *widget, GdkEventExpose *event, gpointer data){
363 static bool fillBannerTop(GtkWidget *widget, GdkEventExpose *event, gpointer data){