summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-05 20:53:48 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-05 20:53:48 +0200
commit9fe6abe90dcaacfc9479b1c53edf2b239c81c4e5 (patch)
treec2edcd949fd37d7eea2a5eee849faf9812a02558 /src
parenta3457b5d756f434e887288341559a9e5fa6f9f69 (diff)
Shadow edge for popups
Diffstat (limited to 'src')
-rw-r--r--src/ui/widget.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c
index 75aa91bd..a676da6e 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -680,18 +680,30 @@ void drawBackground_Widget(const iWidget *d) {
680 if (d->flags & (hidden_WidgetFlag | noBackground_WidgetFlag)) { 680 if (d->flags & (hidden_WidgetFlag | noBackground_WidgetFlag)) {
681 return; 681 return;
682 } 682 }
683 if (flags_Widget(d) & borderTop_WidgetFlag) { 683 if (d->flags & borderTop_WidgetFlag) {
684 const iRect rect = bounds_Widget(d); 684 const iRect rect = bounds_Widget(d);
685 iPaint p; 685 iPaint p;
686 init_Paint(&p); 686 init_Paint(&p);
687 drawHLine_Paint(&p, topLeft_Rect(rect), width_Rect(rect), uiBackgroundFramelessHover_ColorId); 687 drawHLine_Paint(&p, topLeft_Rect(rect), width_Rect(rect), uiBackgroundFramelessHover_ColorId);
688 } 688 }
689 /* Popup menus have a shadowed border. */
690 if (d->flags & keepOnTop_WidgetFlag && ~d->flags & mouseModal_WidgetFlag) {
691 iPaint p;
692 init_Paint(&p);
693 const iBool isLight = isLight_ColorTheme(colorTheme_App());
694 p.alpha = isLight ? 0x40 : 0x20;
695 SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND);
696 iRect shadowRect = expanded_Rect(bounds_Widget(d), mulf_I2(gap2_UI, 1));
697 fillRect_Paint(&p, shadowRect, isLight ? white_ColorId : black_ColorId);
698 SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_NONE);
699 }
689 if (d->bgColor >= 0 || d->frameColor >= 0) { 700 if (d->bgColor >= 0 || d->frameColor >= 0) {
690 iRect rect = bounds_Widget(d); 701 iRect rect = bounds_Widget(d);
691 iPaint p; 702 iPaint p;
692 init_Paint(&p); 703 init_Paint(&p);
704 /* Dialogs fade out the entire background. */
693 if (d->flags & mouseModal_WidgetFlag) { 705 if (d->flags & mouseModal_WidgetFlag) {
694 p.alpha = 0x60; 706 p.alpha = 0x50;
695 SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND); 707 SDL_SetRenderDrawBlendMode(renderer_Window(get_Window()), SDL_BLENDMODE_BLEND);
696 int fadeColor; 708 int fadeColor;
697 switch (colorTheme_App()) { 709 switch (colorTheme_App()) {