diff options
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index 69509e33..e83532d4 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -45,6 +45,7 @@ void init_Widget(iWidget *d) { | |||
45 | d->flags = 0; | 45 | d->flags = 0; |
46 | d->rect = zero_Rect(); | 46 | d->rect = zero_Rect(); |
47 | d->bgColor = none_ColorId; | 47 | d->bgColor = none_ColorId; |
48 | d->frameColor = none_ColorId; | ||
48 | d->children = NULL; | 49 | d->children = NULL; |
49 | d->parent = NULL; | 50 | d->parent = NULL; |
50 | d->commandHandler = NULL; | 51 | d->commandHandler = NULL; |
@@ -114,6 +115,10 @@ void setBackgroundColor_Widget(iWidget *d, int bgColor) { | |||
114 | d->bgColor = bgColor; | 115 | d->bgColor = bgColor; |
115 | } | 116 | } |
116 | 117 | ||
118 | void setFrameColor_Widget(iWidget *d, int frameColor) { | ||
119 | d->frameColor = frameColor; | ||
120 | } | ||
121 | |||
117 | void setCommandHandler_Widget(iWidget *d, iBool (*handler)(iWidget *, const char *)) { | 122 | void setCommandHandler_Widget(iWidget *d, iBool (*handler)(iWidget *, const char *)) { |
118 | d->commandHandler = handler; | 123 | d->commandHandler = handler; |
119 | } | 124 | } |
@@ -392,10 +397,16 @@ iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) { | |||
392 | 397 | ||
393 | void draw_Widget(const iWidget *d) { | 398 | void draw_Widget(const iWidget *d) { |
394 | if (d->flags & hidden_WidgetFlag) return; | 399 | if (d->flags & hidden_WidgetFlag) return; |
395 | if (d->bgColor >= 0) { | 400 | if (d->bgColor >= 0 || d->frameColor >= 0) { |
401 | const iRect rect = bounds_Widget(d); | ||
396 | iPaint p; | 402 | iPaint p; |
397 | init_Paint(&p); | 403 | init_Paint(&p); |
398 | fillRect_Paint(&p, bounds_Widget(d), d->bgColor); | 404 | if (d->bgColor >= 0) { |
405 | fillRect_Paint(&p, rect, d->bgColor); | ||
406 | } | ||
407 | if (d->frameColor >= 0) { | ||
408 | drawRect_Paint(&p, rect, d->frameColor); | ||
409 | } | ||
399 | } | 410 | } |
400 | iConstForEach(ObjectList, i, d->children) { | 411 | iConstForEach(ObjectList, i, d->children) { |
401 | const iWidget *child = constAs_Widget(i.object); | 412 | const iWidget *child = constAs_Widget(i.object); |