diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-13 08:57:43 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-13 08:57:43 +0200 |
commit | 97d8767043174ba7901014cc904579e1a741ef30 (patch) | |
tree | f7eb54246df4aa8a8fa4ca2f2cdfab0a95325d0d /src/ui/lookupwidget.c | |
parent | 4d9c26488c25ecbadb3444f9d628a0bb6bc93fa2 (diff) |
Arrange URL child indicators; widget arrangement
The indicators in the URL input field are now arranged horizontally, so they don't overlap.
Improved arrangement of (un)collapsed widgets.
Diffstat (limited to 'src/ui/lookupwidget.c')
-rw-r--r-- | src/ui/lookupwidget.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c index 29ae0fee..b68d4a23 100644 --- a/src/ui/lookupwidget.c +++ b/src/ui/lookupwidget.c | |||
@@ -385,11 +385,13 @@ void init_LookupWidget(iLookupWidget *d) { | |||
385 | iWidget *w = as_Widget(d); | 385 | iWidget *w = as_Widget(d); |
386 | init_Widget(w); | 386 | init_Widget(w); |
387 | setId_Widget(w, "lookup"); | 387 | setId_Widget(w, "lookup"); |
388 | setFlags_Widget(w, focusable_WidgetFlag | resizeChildren_WidgetFlag, iTrue); | 388 | setFlags_Widget(w, focusable_WidgetFlag, iTrue); |
389 | #if defined (iPlatformAppleMobile) | 389 | #if defined (iPlatformAppleMobile) |
390 | setFlags_Widget(w, unhittable_WidgetFlag, iTrue); | 390 | setFlags_Widget(w, unhittable_WidgetFlag, iTrue); |
391 | #endif | 391 | #endif |
392 | d->list = addChild_Widget(w, iClob(new_ListWidget())); | 392 | d->list = addChildFlags_Widget(w, iClob(new_ListWidget()), |
393 | resizeToParentWidth_WidgetFlag | | ||
394 | resizeToParentHeight_WidgetFlag); | ||
393 | d->cursor = iInvalidPos; | 395 | d->cursor = iInvalidPos; |
394 | d->work = new_Thread(worker_LookupWidget_); | 396 | d->work = new_Thread(worker_LookupWidget_); |
395 | setUserData_Thread(d->work, d); | 397 | setUserData_Thread(d->work, d); |
@@ -428,7 +430,7 @@ void submit_LookupWidget(iLookupWidget *d, const iString *term) { | |||
428 | signal_Condition(&d->jobAvailable); | 430 | signal_Condition(&d->jobAvailable); |
429 | } | 431 | } |
430 | else { | 432 | else { |
431 | setFlags_Widget(as_Widget(d), hidden_WidgetFlag, iTrue); | 433 | showCollapsed_Widget(as_Widget(d), iFalse); |
432 | } | 434 | } |
433 | }); | 435 | }); |
434 | } | 436 | } |
@@ -597,7 +599,7 @@ static void presentResults_LookupWidget_(iLookupWidget *d) { | |||
597 | scrollOffset_ListWidget(d->list, 0); | 599 | scrollOffset_ListWidget(d->list, 0); |
598 | updateVisible_ListWidget(d->list); | 600 | updateVisible_ListWidget(d->list); |
599 | invalidate_ListWidget(d->list); | 601 | invalidate_ListWidget(d->list); |
600 | setFlags_Widget(as_Widget(d), hidden_WidgetFlag, numItems_ListWidget(d->list) == 0); | 602 | showCollapsed_Widget(as_Widget(d), numItems_ListWidget(d->list) != 0); |
601 | } | 603 | } |
602 | 604 | ||
603 | static iLookupItem *item_LookupWidget_(iLookupWidget *d, size_t index) { | 605 | static iLookupItem *item_LookupWidget_(iLookupWidget *d, size_t index) { |
@@ -674,7 +676,7 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { | |||
674 | } | 676 | } |
675 | if (equal_Command(cmd, "input.ended") && equal_Rangecc(range_Command(cmd, "id"), "url") && | 677 | if (equal_Command(cmd, "input.ended") && equal_Rangecc(range_Command(cmd, "id"), "url") && |
676 | !isFocused_Widget(w)) { | 678 | !isFocused_Widget(w)) { |
677 | setFlags_Widget(w, hidden_WidgetFlag, iTrue); | 679 | showCollapsed_Widget(w, iFalse); |
678 | } | 680 | } |
679 | if (isCommand_Widget(w, ev, "focus.lost")) { | 681 | if (isCommand_Widget(w, ev, "focus.lost")) { |
680 | setCursor_LookupWidget_(d, iInvalidPos); | 682 | setCursor_LookupWidget_(d, iInvalidPos); |
@@ -689,7 +691,7 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { | |||
689 | const iLookupItem *item = constItem_ListWidget(d->list, arg_Command(cmd)); | 691 | const iLookupItem *item = constItem_ListWidget(d->list, arg_Command(cmd)); |
690 | if (item && !isEmpty_String(&item->command)) { | 692 | if (item && !isEmpty_String(&item->command)) { |
691 | setText_InputWidget(url, url_DocumentWidget(document_App())); | 693 | setText_InputWidget(url, url_DocumentWidget(document_App())); |
692 | setFlags_Widget(w, hidden_WidgetFlag, iTrue); | 694 | showCollapsed_Widget(w, iFalse); |
693 | setCursor_LookupWidget_(d, iInvalidPos); | 695 | setCursor_LookupWidget_(d, iInvalidPos); |
694 | postCommandString_App(&item->command); | 696 | postCommandString_App(&item->command); |
695 | postCommand_App("focus.set id:"); /* unfocus */ | 697 | postCommand_App("focus.set id:"); /* unfocus */ |
@@ -703,7 +705,7 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) { | |||
703 | iWidget *url = findWidget_App("url"); | 705 | iWidget *url = findWidget_App("url"); |
704 | switch (key) { | 706 | switch (key) { |
705 | case SDLK_ESCAPE: | 707 | case SDLK_ESCAPE: |
706 | setFlags_Widget(w, hidden_WidgetFlag, iTrue); | 708 | showCollapsed_Widget(w, iFalse); |
707 | setCursor_LookupWidget_(d, iInvalidPos); | 709 | setCursor_LookupWidget_(d, iInvalidPos); |
708 | setFocus_Widget(url); | 710 | setFocus_Widget(url); |
709 | return iTrue; | 711 | return iTrue; |