diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-20 15:15:42 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-20 15:15:42 +0200 |
commit | 1ca771a41e430f866e3a3270f285fc9a7eacfc65 (patch) | |
tree | 9812569c07a0d569719e1af2ca8b8e494ef7e638 /src/ui/widget.c | |
parent | 876bde9002a5d1faa66cbdac08bf04f4d6719b6e (diff) |
iOS: Removed 2nd sidebar; background tweaks
Diffstat (limited to 'src/ui/widget.c')
-rw-r--r-- | src/ui/widget.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index 128aa39c..0e020080 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -629,7 +629,9 @@ iBool processEvent_Widget(iWidget *d, const SDL_Event *ev) { | |||
629 | } | 629 | } |
630 | 630 | ||
631 | void drawBackground_Widget(const iWidget *d) { | 631 | void drawBackground_Widget(const iWidget *d) { |
632 | if (d->flags & hidden_WidgetFlag) return; | 632 | if (d->flags & (hidden_WidgetFlag | noBackground_WidgetFlag)) { |
633 | return; | ||
634 | } | ||
633 | if (flags_Widget(d) & borderTop_WidgetFlag) { | 635 | if (flags_Widget(d) & borderTop_WidgetFlag) { |
634 | const iRect rect = bounds_Widget(d); | 636 | const iRect rect = bounds_Widget(d); |
635 | iPaint p; | 637 | iPaint p; |
@@ -637,10 +639,36 @@ void drawBackground_Widget(const iWidget *d) { | |||
637 | drawHLine_Paint(&p, topLeft_Rect(rect), width_Rect(rect), uiBackgroundFramelessHover_ColorId); | 639 | drawHLine_Paint(&p, topLeft_Rect(rect), width_Rect(rect), uiBackgroundFramelessHover_ColorId); |
638 | } | 640 | } |
639 | if (d->bgColor >= 0 || d->frameColor >= 0) { | 641 | if (d->bgColor >= 0 || d->frameColor >= 0) { |
640 | const iRect rect = bounds_Widget(d); | 642 | iRect rect = bounds_Widget(d); |
641 | iPaint p; | 643 | iPaint p; |
642 | init_Paint(&p); | 644 | init_Paint(&p); |
643 | if (d->bgColor >= 0) { | 645 | if (d->bgColor >= 0) { |
646 | #if defined (iPlatformAppleMobile) | ||
647 | if (d->flags & (drawBackgroundToHorizontalSafeArea_WidgetFlag | | ||
648 | drawBackgroundToVerticalSafeArea_WidgetFlag)) { | ||
649 | const iInt2 rootSize = rootSize_Window(get_Window()); | ||
650 | const iInt2 center = divi_I2(rootSize, 2); | ||
651 | int top = 0, right = 0, bottom = 0, left = 0; | ||
652 | if (d->flags & drawBackgroundToHorizontalSafeArea_WidgetFlag) { | ||
653 | const iBool isWide = width_Rect(rect) > rootSize.x * 9 / 10; | ||
654 | if (isWide || mid_Rect(rect).x < center.x) { | ||
655 | left = -left_Rect(rect); | ||
656 | } | ||
657 | if (isWide || mid_Rect(rect).x > center.x) { | ||
658 | right = rootSize.x - right_Rect(rect); | ||
659 | } | ||
660 | } | ||
661 | if (d->flags & drawBackgroundToVerticalSafeArea_WidgetFlag) { | ||
662 | if (top_Rect(rect) > center.y) { | ||
663 | bottom = rootSize.y - bottom_Rect(rect); | ||
664 | } | ||
665 | if (bottom_Rect(rect) < center.y) { | ||
666 | top = -top_Rect(rect); | ||
667 | } | ||
668 | } | ||
669 | adjustEdges_Rect(&rect, top, right, bottom, left); | ||
670 | } | ||
671 | #endif | ||
644 | fillRect_Paint(&p, rect, d->bgColor); | 672 | fillRect_Paint(&p, rect, d->bgColor); |
645 | } | 673 | } |
646 | if (d->frameColor >= 0 && ~d->flags & frameless_WidgetFlag) { | 674 | if (d->frameColor >= 0 && ~d->flags & frameless_WidgetFlag) { |