summaryrefslogtreecommitdiff
path: root/src/ui/labelwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/labelwidget.c')
-rw-r--r--src/ui/labelwidget.c12
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
182static void draw_LabelWidget_(const iLabelWidget *d) { 186static void draw_LabelWidget_(const iLabelWidget *d) {
@@ -277,6 +281,7 @@ void updateSize_LabelWidget(iLabelWidget *d) {
277void init_LabelWidget(iLabelWidget *d, const char *label, const char *cmd) { 281void 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
312void setTextColor_LabelWidget(iLabelWidget *d, int color) {
313 if (d && d->forceFg != color) {
314 d->forceFg = color;
315 refresh_Widget(d);
316 }
317}
318
307void setText_LabelWidget(iLabelWidget *d, const iString *text) { 319void 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);