summaryrefslogtreecommitdiff
path: root/src/ui/mobile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/mobile.c')
-rw-r--r--src/ui/mobile.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/ui/mobile.c b/src/ui/mobile.c
index 9e2dc4f7..4c183ffa 100644
--- a/src/ui/mobile.c
+++ b/src/ui/mobile.c
@@ -129,6 +129,12 @@ static iBool mainDetailSplitHandler_(iWidget *mainDetailSplit, const char *cmd)
129 } 129 }
130 arrange_Widget(mainDetailSplit); 130 arrange_Widget(mainDetailSplit);
131 } 131 }
132 else if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd)) {
133 if (focus_Widget() && class_Widget(focus_Widget()) == &Class_InputWidget) {
134 setFocus_Widget(NULL);
135 return iTrue;
136 }
137 }
132 return iFalse; 138 return iFalse;
133} 139}
134 140
@@ -331,7 +337,7 @@ static iWidget *makeValuePaddingWithHeading_(iLabelWidget *heading, iWidget *val
331 //setFixedSize_Widget(as_Widget(heading), init_I2(-1, height_Widget(value))); 337 //setFixedSize_Widget(as_Widget(heading), init_I2(-1, height_Widget(value)));
332 setFont_LabelWidget(heading, labelFont_()); 338 setFont_LabelWidget(heading, labelFont_());
333 setTextColor_LabelWidget(heading, uiTextStrong_ColorId); 339 setTextColor_LabelWidget(heading, uiTextStrong_ColorId);
334 if (isInput) { 340 if (isInput && ~value->flags & fixedWidth_WidgetFlag) {
335 addChildFlags_Widget(div, iClob(value), expand_WidgetFlag); 341 addChildFlags_Widget(div, iClob(value), expand_WidgetFlag);
336 } 342 }
337 else if (isInstance_Object(value, &Class_LabelWidget) && 343 else if (isInstance_Object(value, &Class_LabelWidget) &&
@@ -388,6 +394,27 @@ static size_t countItems_(const iMenuItem *itemsNullTerminated) {
388 return num; 394 return num;
389} 395}
390 396
397static iBool dropdownHeadingHandler_(iWidget *d, const char *cmd) {
398 if (isVisible_Widget(d) &&
399 equal_Command(cmd, "mouse.clicked") && contains_Widget(d, coord_Command(cmd)) &&
400 arg_Command(cmd)) {
401 postCommand_Widget(userData_Object(d),
402 cstr_String(command_LabelWidget(userData_Object(d))));
403 return iTrue;
404 }
405 return iFalse;
406}
407
408static iBool inputHeadingHandler_(iWidget *d, const char *cmd) {
409 if (isVisible_Widget(d) &&
410 equal_Command(cmd, "mouse.clicked") && contains_Widget(d, coord_Command(cmd)) &&
411 arg_Command(cmd)) {
412 setFocus_Widget(userData_Object(d));
413 return iTrue;
414 }
415 return iFalse;
416}
417
391void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) { 418void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) {
392 iWidget * widget = NULL; 419 iWidget * widget = NULL;
393 iLabelWidget *heading = NULL; 420 iLabelWidget *heading = NULL;
@@ -434,6 +461,8 @@ void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) {
434 frameless_WidgetFlag, iTrue); 461 frameless_WidgetFlag, iTrue);
435 setId_Widget(as_Widget(drop), id); 462 setId_Widget(as_Widget(drop), id);
436 widget = makeValuePaddingWithHeading_(heading = makeHeading_Widget(label), as_Widget(drop)); 463 widget = makeValuePaddingWithHeading_(heading = makeHeading_Widget(label), as_Widget(drop));
464 setCommandHandler_Widget(widget, dropdownHeadingHandler_);
465 setUserData_Object(widget, drop);
437 } 466 }
438 else if (equal_Command(spec, "radio") || equal_Command(spec, "buttons")) { 467 else if (equal_Command(spec, "radio") || equal_Command(spec, "buttons")) {
439 const iBool isRadio = equal_Command(spec, "radio"); 468 const iBool isRadio = equal_Command(spec, "radio");
@@ -504,6 +533,8 @@ void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) {
504 } 533 }
505 widget = makeValuePaddingWithHeading_(heading = makeHeading_Widget(label), 534 widget = makeValuePaddingWithHeading_(heading = makeHeading_Widget(label),
506 as_Widget(input)); 535 as_Widget(input));
536 setCommandHandler_Widget(widget, inputHeadingHandler_);
537 setUserData_Object(widget, input);
507 } 538 }
508 } 539 }
509 else if (equal_Command(spec, "button")) { 540 else if (equal_Command(spec, "button")) {