When resizing windows make sure to resize their gradient as well

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6011 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-09-14 01:34:16 +00:00
parent e766b2f605
commit e3c884a249
2 changed files with 27 additions and 5 deletions

View File

@ -52,6 +52,8 @@ static void windowInitVtbl(window *self)
vtbl.widgetVtbl.getMinSize = windowGetMinSizeImpl; vtbl.widgetVtbl.getMinSize = windowGetMinSizeImpl;
vtbl.widgetVtbl.getMaxSize = windowGetMaxSizeImpl; vtbl.widgetVtbl.getMaxSize = windowGetMaxSizeImpl;
vtbl.widgetVtbl.resize = windowResizeImpl;
initialised = true; initialised = true;
} }
@ -63,17 +65,29 @@ static void windowInitVtbl(window *self)
self->vtbl = &vtbl; self->vtbl = &vtbl;
} }
static void windowCreateWindowPattern(window *self, int w, int h)
{
// First clean up our current pattern (if any)
if (self->windowPattern)
{
cairo_pattern_destroy(WINDOW(self)->windowPattern);
}
self->windowPattern = cairo_pattern_create_linear(0, 0, 0, h);
cairo_pattern_add_color_stop_rgba(self->windowPattern, 0, 0.000000, 0.000000, 0.235294, 0.75);
cairo_pattern_add_color_stop_rgba(self->windowPattern, 0.2, 0.176470, 0.176470, 0.372549, 0.8);
cairo_pattern_add_color_stop_rgba(self->windowPattern, 0.6, 0.176470, 0.176470, 0.372549, 0.7);
cairo_pattern_add_color_stop_rgba(self->windowPattern, 1, 0.176470, 0.176470, 0.372549, 0.7);
}
void windowInit(window *self, const char *id, int w, int h) void windowInit(window *self, const char *id, int w, int h)
{ {
// Init our parent // Init our parent
widgetInit(WIDGET(self), id); widgetInit(WIDGET(self), id);
// Patterns initialization // Patterns initialization
self->windowPattern = cairo_pattern_create_linear(0, 0, 0, 384); self->windowPattern = NULL;
cairo_pattern_add_color_stop_rgba(self->windowPattern, 0, 0.000000, 0.000000, 0.235294, 0.75); windowCreateWindowPattern(self, w, h);
cairo_pattern_add_color_stop_rgba(self->windowPattern, 0.2, 0.176470, 0.176470, 0.372549, 0.8);
cairo_pattern_add_color_stop_rgba(self->windowPattern, 0.6, 0.176470, 0.176470, 0.372549, 0.7);
cairo_pattern_add_color_stop_rgba(self->windowPattern, 1, 0.176470, 0.176470, 0.372549, 0.7);
// Prepare our vtable // Prepare our vtable
windowInitVtbl(self); windowInitVtbl(self);
@ -211,6 +225,13 @@ size windowGetMaxSizeImpl(widget *self)
return maxSize; return maxSize;
} }
void windowResizeImpl(widget *self, int w, int h)
{
windowCreateWindowPattern(WINDOW(self), w, h);
widgetResizeImpl(self, w, h);
}
void windowSetWindowVector(vector *v) void windowSetWindowVector(vector *v)
{ {
// Make sure the vector is valid // Make sure the vector is valid

View File

@ -77,6 +77,7 @@ void windowDoDrawMaskImpl(widget *self);
bool windowAddChildImpl(widget *self, widget *child); bool windowAddChildImpl(widget *self, widget *child);
size windowGetMinSizeImpl(widget *self); size windowGetMinSizeImpl(widget *self);
size windowGetMaxSizeImpl(widget *self); size windowGetMaxSizeImpl(widget *self);
void windowResizeImpl(widget *self, int w, int h);
/* /*
* Public static methods * Public static methods