diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-09 22:44:45 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-09 22:44:45 +0200 |
commit | 2002543dbedcc1666d02d11fbde55f794d692bb7 (patch) | |
tree | 853412e7593d4a1ca3f0ccdc5ca31466a3400463 /src/ui/labelwidget.c | |
parent | 5ccb0e0096dff6c2bbdfa959610620a14fdc918d (diff) |
Mobile: Revising phone-style dialogs
Sliding panels and left-edge swipes.
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r-- | src/ui/labelwidget.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index b628ac23..9af0e2e3 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
22 | 22 | ||
23 | #include "labelwidget.h" | 23 | #include "labelwidget.h" |
24 | #include "text.h" | 24 | #include "text.h" |
25 | #include "defs.h" | ||
25 | #include "color.h" | 26 | #include "color.h" |
26 | #include "paint.h" | 27 | #include "paint.h" |
27 | #include "app.h" | 28 | #include "app.h" |
@@ -147,7 +148,9 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
147 | const iBool isFrameless = (flags & frameless_WidgetFlag) != 0; | 148 | const iBool isFrameless = (flags & frameless_WidgetFlag) != 0; |
148 | const iBool isButton = d->click.button != 0; | 149 | const iBool isButton = d->click.button != 0; |
149 | /* Default color state. */ | 150 | /* Default color state. */ |
150 | *bg = isButton && ~flags & noBackground_WidgetFlag ? uiBackground_ColorId : none_ColorId; | 151 | *bg = isButton && ~flags & noBackground_WidgetFlag ? (d->widget.bgColor != none_ColorId ? |
152 | d->widget.bgColor : uiBackground_ColorId) | ||
153 | : none_ColorId; | ||
151 | *fg = uiText_ColorId; | 154 | *fg = uiText_ColorId; |
152 | *frame1 = isButton ? uiEmboss1_ColorId : d->widget.frameColor; | 155 | *frame1 = isButton ? uiEmboss1_ColorId : d->widget.frameColor; |
153 | *frame2 = isButton ? uiEmboss2_ColorId : *frame1; | 156 | *frame2 = isButton ? uiEmboss2_ColorId : *frame1; |
@@ -248,6 +251,7 @@ static void draw_LabelWidget_(const iLabelWidget *d) { | |||
248 | drawCentered_Text( | 251 | drawCentered_Text( |
249 | d->font, | 252 | d->font, |
250 | (iRect){ | 253 | (iRect){ |
254 | /* The icon position is fine-tuned; c.f. high baseline of Source Sans Pro. */ | ||
251 | add_I2(add_I2(bounds.pos, padding_(flags)), | 255 | add_I2(add_I2(bounds.pos, padding_(flags)), |
252 | init_I2((flags & extraPadding_WidgetFlag ? -2 : -1.20f) * gap_UI, -gap_UI / 8)), | 256 | init_I2((flags & extraPadding_WidgetFlag ? -2 : -1.20f) * gap_UI, -gap_UI / 8)), |
253 | init_I2(iconPad, lineHeight_Text(d->font)) }, | 257 | init_I2(iconPad, lineHeight_Text(d->font)) }, |
@@ -294,6 +298,14 @@ static void draw_LabelWidget_(const iLabelWidget *d) { | |||
294 | fg, | 298 | fg, |
295 | cstr_String(&d->label)); | 299 | cstr_String(&d->label)); |
296 | } | 300 | } |
301 | if (flags & chevron_WidgetFlag) { | ||
302 | const iRect chRect = rect; | ||
303 | const int chSize = lineHeight_Text(d->font); | ||
304 | drawCentered_Text(d->font, | ||
305 | (iRect){ addX_I2(topRight_Rect(chRect), -iconPad), | ||
306 | init_I2(chSize, height_Rect(chRect)) }, | ||
307 | iTrue, fg, rightAngle_Icon); | ||
308 | } | ||
297 | unsetClip_Paint(&p); | 309 | unsetClip_Paint(&p); |
298 | } | 310 | } |
299 | 311 | ||
@@ -436,6 +448,7 @@ iChar icon_LabelWidget(const iLabelWidget *d) { | |||
436 | } | 448 | } |
437 | 449 | ||
438 | const iString *text_LabelWidget(const iLabelWidget *d) { | 450 | const iString *text_LabelWidget(const iLabelWidget *d) { |
451 | if (!d) return collectNew_String(); | ||
439 | return &d->label; | 452 | return &d->label; |
440 | } | 453 | } |
441 | 454 | ||