diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-11 21:53:31 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-11 21:53:31 +0200 |
commit | 73c8166d5c8b397c166ee9ece0173f2b278b6ddb (patch) | |
tree | c365e8d387a0d1a02e0de69209d3f80164443157 /src/ui/labelwidget.c | |
parent | bfdda501cb01df95c968c9f5378bb91cd66eea87 (diff) |
Windows: Experimenting with a custom window frame and title bar
Added the build option ENABLE_CUSTOM_FRAME that causes the window
to be created as borderless. Lagrange's own UI widgets are used to
draw the title bar elements, including the window buttons.
There is plenty of sizing behavior still missing, for instance
snapping to fullscreen left/right side, double-clicking the frame
edges, and proper maximize mode that doesn't cover the entire screen.
The window system menu is also missing, but that can be shown
manually when appropriate.
A command-line option should also be provided to disable winbar
in case the default title bar is required.
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r-- | src/ui/labelwidget.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index 57136509..d7e6c020 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -38,6 +38,7 @@ struct Impl_LabelWidget { | |||
38 | int font; | 38 | int font; |
39 | int key; | 39 | int key; |
40 | int kmods; | 40 | int kmods; |
41 | int forceFg; | ||
41 | iString command; | 42 | iString command; |
42 | iBool alignVisual; /* align according to visible bounds, not typography */ | 43 | iBool alignVisual; /* align according to visible bounds, not typography */ |
43 | iClick click; | 44 | iClick click; |
@@ -177,6 +178,9 @@ static void getColors_LabelWidget_(const iLabelWidget *d, int *bg, int *fg, int | |||
177 | } | 178 | } |
178 | *fg = uiTextPressed_ColorId | permanent_ColorId; | 179 | *fg = uiTextPressed_ColorId | permanent_ColorId; |
179 | } | 180 | } |
181 | if (d->forceFg >= 0) { | ||
182 | *fg = d->forceFg; | ||
183 | } | ||
180 | } | 184 | } |
181 | 185 | ||
182 | static void draw_LabelWidget_(const iLabelWidget *d) { | 186 | static void draw_LabelWidget_(const iLabelWidget *d) { |
@@ -277,6 +281,7 @@ void updateSize_LabelWidget(iLabelWidget *d) { | |||
277 | void init_LabelWidget(iLabelWidget *d, const char *label, const char *cmd) { | 281 | void init_LabelWidget(iLabelWidget *d, const char *label, const char *cmd) { |
278 | init_Widget(&d->widget); | 282 | init_Widget(&d->widget); |
279 | d->font = uiLabel_FontId; | 283 | d->font = uiLabel_FontId; |
284 | d->forceFg = none_ColorId; | ||
280 | initCStr_String(&d->label, label); | 285 | initCStr_String(&d->label, label); |
281 | if (cmd) { | 286 | if (cmd) { |
282 | initCStr_String(&d->command, cmd); | 287 | initCStr_String(&d->command, cmd); |
@@ -304,6 +309,13 @@ void setFont_LabelWidget(iLabelWidget *d, int fontId) { | |||
304 | updateSize_LabelWidget(d); | 309 | updateSize_LabelWidget(d); |
305 | } | 310 | } |
306 | 311 | ||
312 | void setTextColor_LabelWidget(iLabelWidget *d, int color) { | ||
313 | if (d && d->forceFg != color) { | ||
314 | d->forceFg = color; | ||
315 | refresh_Widget(d); | ||
316 | } | ||
317 | } | ||
318 | |||
307 | void setText_LabelWidget(iLabelWidget *d, const iString *text) { | 319 | void setText_LabelWidget(iLabelWidget *d, const iString *text) { |
308 | updateText_LabelWidget(d, text); | 320 | updateText_LabelWidget(d, text); |
309 | updateSize_LabelWidget(d); | 321 | updateSize_LabelWidget(d); |