diff options
Diffstat (limited to 'src/ui/mobile.c')
-rw-r--r-- | src/ui/mobile.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/ui/mobile.c b/src/ui/mobile.c index ecfb83ed..48f17c9c 100644 --- a/src/ui/mobile.c +++ b/src/ui/mobile.c | |||
@@ -280,8 +280,8 @@ static void stripTrailingColon_(iLabelWidget *label) { | |||
280 | static iLabelWidget *makePanelButton_(const char *text, const char *command) { | 280 | static iLabelWidget *makePanelButton_(const char *text, const char *command) { |
281 | iLabelWidget *btn = new_LabelWidget(text, command); | 281 | iLabelWidget *btn = new_LabelWidget(text, command); |
282 | setFlags_Widget(as_Widget(btn), | 282 | setFlags_Widget(as_Widget(btn), |
283 | borderBottom_WidgetFlag | alignLeft_WidgetFlag | | 283 | borderTop_WidgetFlag | borderBottom_WidgetFlag | alignLeft_WidgetFlag | |
284 | frameless_WidgetFlag | extraPadding_WidgetFlag, | 284 | frameless_WidgetFlag | extraPadding_WidgetFlag, |
285 | iTrue); | 285 | iTrue); |
286 | checkIcon_LabelWidget(btn); | 286 | checkIcon_LabelWidget(btn); |
287 | setFont_LabelWidget(btn, labelFont_()); | 287 | setFont_LabelWidget(btn, labelFont_()); |
@@ -379,11 +379,13 @@ static size_t countItems_(const iMenuItem *itemsNullTerminated) { | |||
379 | } | 379 | } |
380 | 380 | ||
381 | void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) { | 381 | void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) { |
382 | const char * spec = item->label; | ||
383 | const char * id = cstr_Rangecc(range_Command(spec, "id")); | ||
384 | const char * label = format_CStr("${%s}", id); | ||
385 | iWidget * widget = NULL; | 382 | iWidget * widget = NULL; |
386 | iLabelWidget *heading = NULL; | 383 | iLabelWidget *heading = NULL; |
384 | const char * spec = item->label; | ||
385 | const char * id = cstr_Rangecc(range_Command(spec, "id")); | ||
386 | const char * label = hasLabel_Command(spec, "text") | ||
387 | ? suffixPtr_Command(spec, "text") | ||
388 | : format_CStr("${%s}", id); | ||
387 | if (hasLabel_Command(spec, "device") && deviceType_App() != argLabel_Command(spec, "device")) { | 389 | if (hasLabel_Command(spec, "device") && deviceType_App() != argLabel_Command(spec, "device")) { |
388 | return; | 390 | return; |
389 | } | 391 | } |
@@ -486,6 +488,9 @@ void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) { | |||
486 | as_Widget(input)); | 488 | as_Widget(input)); |
487 | } | 489 | } |
488 | } | 490 | } |
491 | else if (equal_Command(spec, "button")) { | ||
492 | widget = as_Widget(heading = makePanelButton_(label, item->command)); | ||
493 | } | ||
489 | else if (equal_Command(spec, "padding")) { | 494 | else if (equal_Command(spec, "padding")) { |
490 | widget = makePadding_Widget(lineHeight_Text(labelFont_()) * 1.5f); | 495 | widget = makePadding_Widget(lineHeight_Text(labelFont_()) * 1.5f); |
491 | } | 496 | } |
@@ -514,9 +519,8 @@ iWidget *makeSplitMultiPanel_Mobile(const iMenuItem *itemsNullTerminated) { | |||
514 | iWidget *sheet = new_Widget(); | 519 | iWidget *sheet = new_Widget(); |
515 | setBackgroundColor_Widget(sheet, uiBackground_ColorId); | 520 | setBackgroundColor_Widget(sheet, uiBackground_ColorId); |
516 | setFlags_Widget(sheet, | 521 | setFlags_Widget(sheet, |
517 | resizeToParentWidth_WidgetFlag | | 522 | resizeToParentWidth_WidgetFlag | resizeToParentHeight_WidgetFlag | |
518 | resizeToParentHeight_WidgetFlag | | 523 | frameless_WidgetFlag | focusRoot_WidgetFlag | commandOnClick_WidgetFlag | |
519 | frameless_WidgetFlag | focusRoot_WidgetFlag | commandOnClick_WidgetFlag | | ||
520 | overflowScrollable_WidgetFlag | leftEdgeDraggable_WidgetFlag, | 524 | overflowScrollable_WidgetFlag | leftEdgeDraggable_WidgetFlag, |
521 | iTrue); | 525 | iTrue); |
522 | /* The top-level split between main and detail panels. */ | 526 | /* The top-level split between main and detail panels. */ |
@@ -571,8 +575,10 @@ iWidget *makeSplitMultiPanel_Mobile(const iMenuItem *itemsNullTerminated) { | |||
571 | const iMenuItem *item = &itemsNullTerminated[i]; | 575 | const iMenuItem *item = &itemsNullTerminated[i]; |
572 | if (equal_Command(item->label, "panel")) { | 576 | if (equal_Command(item->label, "panel")) { |
573 | const char *id = cstr_Rangecc(range_Command(item->label, "id")); | 577 | const char *id = cstr_Rangecc(range_Command(item->label, "id")); |
574 | const iString *label = collectNewFormat_String("${%s}", id); | 578 | const iString *label = hasLabel_Command(item->label, "text") |
575 | iLabelWidget *button = | 579 | ? collect_String(suffix_Command(item->label, "text")) |
580 | : collectNewFormat_String("${%s}", id); | ||
581 | iLabelWidget * button = | ||
576 | addChildFlags_Widget(topPanel, | 582 | addChildFlags_Widget(topPanel, |
577 | iClob(makePanelButton_(cstr_String(label), "panel.open")), | 583 | iClob(makePanelButton_(cstr_String(label), "panel.open")), |
578 | chevron_WidgetFlag | borderTop_WidgetFlag); | 584 | chevron_WidgetFlag | borderTop_WidgetFlag); |