29 if (borderFillVar==-1)
31 GtkStyle *wStyle=gtk_widget_get_style(winIn);
32 cairo_t *cr=gdk_cairo_create(gtk_widget_get_window(
widget));
33 gdk_cairo_set_source_color(cr, &wStyle->bg[GTK_STATE_NORMAL]);
34 int x,
y, width, height;
35 #if GTK_MAJOR_VERSION==3 36 GtkAllocation winAlloc, widgetAlloc;
37 gtk_widget_get_allocation(
widget, &winAlloc);
38 gtk_widget_get_allocation(winIn, &widgetAlloc);
41 #if GTK_MAJOR_VERSION==2 42 x=
widget->allocation.x; y=winIn->allocation.y; width=winIn->allocation.x-
x; height=winIn->allocation.height;
44 x=winAlloc.x; y=widgetAlloc.y; width=widgetAlloc.x-
x; height=widgetAlloc.height;
46 cairo_rectangle(cr, x, y, width, height);
49 #if GTK_MAJOR_VERSION==2 50 x=winIn->allocation.x+winIn->allocation.width; y=winIn->allocation.y; width=(
widget->allocation.x+
widget->allocation.width)-x; height=winIn->allocation.height;
52 x=widgetAlloc.x+widgetAlloc.width; y=widgetAlloc.y; width=(winAlloc.x+winAlloc.width)-x; height=widgetAlloc.height;
54 cairo_rectangle(cr, x, y, width, height);
56 if (((borderFillVar&BORDER_LEFT)!=0)&((borderFillVar&
BORDER_TOP)!=0)){
57 #if GTK_MAJOR_VERSION==2 58 x=
widget->allocation.x; y=
widget->allocation.y; width=winIn->allocation.x-
x; height=winIn->allocation.y-
widget->allocation.y;
60 x=winAlloc.x; y=winAlloc.y; width=widgetAlloc.x-
x; height=widgetAlloc.y-winAlloc.y;
62 cairo_rectangle(cr, x, y, width, height);
64 if (((borderFillVar&BORDER_RIGHT)!=0)&((borderFillVar&BORDER_TOP)!=0)){
65 #if GTK_MAJOR_VERSION==2 66 x=winIn->allocation.x+winIn->allocation.width; y=
widget->allocation.y; width=(
widget->allocation.x+
widget->allocation.width)-x; height=winIn->allocation.y-
y;
68 x=widgetAlloc.x+widgetAlloc.width; y=winAlloc.y; width=(winAlloc.x+winAlloc.width)-x; height=widgetAlloc.y-
y;
70 cairo_rectangle(cr, x, y, width, height);
72 if (borderFillVar&BORDER_TOP){
73 #if GTK_MAJOR_VERSION==2 74 x=winIn->allocation.x; y=
widget->allocation.y; width=winIn->allocation.width; height=winIn->allocation.y-
y;
76 x=widgetAlloc.x; y=winAlloc.y; width=widgetAlloc.width; height=widgetAlloc.y-
y;
78 cairo_rectangle(cr, x, y, width, height);
81 #if GTK_MAJOR_VERSION==2 82 x=winIn->allocation.x; y=winIn->allocation.y+winIn->allocation.height; width=winIn->allocation.width; height=(
widget->allocation.y+
widget->allocation.height)-y;
84 x=widgetAlloc.x; y=widgetAlloc.y+widgetAlloc.height; width=widgetAlloc.width; height=(winAlloc.y+winAlloc.height)-y;
86 cairo_rectangle(cr, x, y, width, height);
88 if (((borderFillVar&BORDER_LEFT)!=0)&((borderFillVar&BORDER_BOTTOM)!=0)){
89 #if GTK_MAJOR_VERSION==2 90 x=
widget->allocation.x; y=winIn->allocation.y+winIn->allocation.height; width=winIn->allocation.x-
x; height=(
widget->allocation.y+
widget->allocation.height)-y;
92 x=winAlloc.x; y=widgetAlloc.y+widgetAlloc.height; width=widgetAlloc.x-
x; height=(winAlloc.y+winAlloc.height)-y;
94 cairo_rectangle(cr, x, y, width, height);
96 if (((borderFillVar&BORDER_RIGHT)!=0)&((borderFillVar&BORDER_BOTTOM)!=0)){
97 #if GTK_MAJOR_VERSION==2 98 x=winIn->allocation.x+winIn->allocation.width; y=winIn->allocation.y+winIn->allocation.height; width=(
widget->allocation.x+
widget->allocation.width)-x; height=(
widget->allocation.y+
widget->allocation.height)-y;
100 x=widgetAlloc.x+widgetAlloc.width; y=widgetAlloc.y+widgetAlloc.height; width=(winAlloc.x+winAlloc.width)-x; height=(winAlloc.y+winAlloc.height)-y;
102 cairo_rectangle(cr, x, y, width, height);
134 init(width, height, resiseable);
147 void init(
int width=0,
int height=0,
bool resiseable=
true){
148 widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
149 if (width!=0 & height!=0)
150 gtk_widget_set_size_request(
widget, width, height);
160 gtk_widget_modify_bg(
widget, state, colour);
168 GdkColor colour; gdk_color_parse (colourName, &colour);
static bool fillBorder(GtkWidget *widget, GdkEventExpose *event, gpointer data)
static bool fillBannerMiddle(GtkWidget *widget, GdkEventExpose *event, gpointer data)
static bool fillBannerTop(GtkWidget *widget, GdkEventExpose *event, gpointer data)
static bool fillBannerBottom(GtkWidget *widget, GdkEventExpose *event, gpointer data)
void setBackgroundColour(GdkColor *colour, GtkStateType state=GTK_STATE_NORMAL)
bool fillBorderImplementation(GtkWidget *winIn, int borderFillVar=-1)
int borderFill
Used if the fillBorder callback is in use.
void setBackgroundColour(const char *colourName, GtkStateType state=GTK_STATE_NORMAL)
void init(int width=0, int height=0, bool resiseable=true)
the initialisation of the window (common to both constructors)
Window(int width, int height, bool resiseable=true)
default constructor