summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ui/widget.c21
-rw-r--r--src/ui/window.c9
2 files changed, 26 insertions, 4 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c
index c8db73dc..d3f28b08 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -218,6 +218,16 @@ iRect innerBounds_Widget(const iWidget *d) {
218 return ib; 218 return ib;
219} 219}
220 220
221static size_t numArrangedChildren_Widget_(const iWidget *d) {
222 size_t count = 0;
223 iConstForEach(ObjectList, i, d->children) {
224 if (~flags_Widget(i.object) & fixedPosition_WidgetFlag) {
225 count++;
226 }
227 }
228 return count;
229}
230
221void arrange_Widget(iWidget *d) { 231void arrange_Widget(iWidget *d) {
222 if (isCollapsed_Widget_(d)) { 232 if (isCollapsed_Widget_(d)) {
223 setFlags_Widget(d, wasCollapsed_WidgetFlag, iTrue); 233 setFlags_Widget(d, wasCollapsed_WidgetFlag, iTrue);
@@ -237,7 +247,10 @@ void arrange_Widget(iWidget *d) {
237 return; 247 return;
238 } 248 }
239 /* Resize children to fill the parent widget. */ 249 /* Resize children to fill the parent widget. */
240 const size_t childCount = size_ObjectList(d->children); 250 const size_t childCount = numArrangedChildren_Widget_(d);
251 if (childCount == 0) {
252 return;
253 }
241 if (d->flags & resizeChildren_WidgetFlag) { 254 if (d->flags & resizeChildren_WidgetFlag) {
242 const iInt2 dirs = init_I2((d->flags & resizeWidthOfChildren_WidgetFlag) != 0, 255 const iInt2 dirs = init_I2((d->flags & resizeWidthOfChildren_WidgetFlag) != 0,
243 (d->flags & resizeHeightOfChildren_WidgetFlag) != 0); 256 (d->flags & resizeHeightOfChildren_WidgetFlag) != 0);
@@ -272,6 +285,9 @@ void arrange_Widget(iWidget *d) {
272 iInt2 avail = innerRect_Widget_(d).size; 285 iInt2 avail = innerRect_Widget_(d).size;
273 iConstForEach(ObjectList, i, d->children) { 286 iConstForEach(ObjectList, i, d->children) {
274 const iWidget *child = constAs_Widget(i.object); 287 const iWidget *child = constAs_Widget(i.object);
288 if (child->flags & fixedPosition_WidgetFlag) {
289 continue;
290 }
275 if (~child->flags & expand_WidgetFlag) { 291 if (~child->flags & expand_WidgetFlag) {
276 subv_I2(&avail, child->rect.size); 292 subv_I2(&avail, child->rect.size);
277 } 293 }
@@ -280,6 +296,9 @@ void arrange_Widget(iWidget *d) {
280 iForEach(ObjectList, j, d->children) { 296 iForEach(ObjectList, j, d->children) {
281 iWidget *child = as_Widget(j.object); 297 iWidget *child = as_Widget(j.object);
282 if (isCollapsed_Widget_(child)) continue; 298 if (isCollapsed_Widget_(child)) continue;
299 if (child->flags & fixedPosition_WidgetFlag) {
300 continue;
301 }
283 if (child->flags & expand_WidgetFlag) { 302 if (child->flags & expand_WidgetFlag) {
284 if (d->flags & arrangeHorizontal_WidgetFlag) { 303 if (d->flags & arrangeHorizontal_WidgetFlag) {
285 if (dirs.x) setWidth_Widget_(child, avail.x); 304 if (dirs.x) setWidth_Widget_(child, avail.x);
diff --git a/src/ui/window.c b/src/ui/window.c
index 1eb0161b..87ca2614 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -404,6 +404,10 @@ static void setupUserInterface_Window(iWindow *d) {
404 iSidebarWidget *sidebar = new_SidebarWidget(); 404 iSidebarWidget *sidebar = new_SidebarWidget();
405 addChildPos_Widget(content, iClob(sidebar), front_WidgetAddPos); 405 addChildPos_Widget(content, iClob(sidebar), front_WidgetAddPos);
406 } 406 }
407 /* Lookup results. */ {
408 iLookupWidget *lookup = new_LookupWidget();
409 addChildFlags_Widget(div, iClob(lookup), fixedPosition_WidgetFlag | hidden_WidgetFlag);
410 }
407 /* Search bar. */ { 411 /* Search bar. */ {
408 iWidget *searchBar = new_Widget(); 412 iWidget *searchBar = new_Widget();
409 setId_Widget(searchBar, "search"); 413 setId_Widget(searchBar, "search");
@@ -414,7 +418,8 @@ static void setupUserInterface_Window(iWindow *d) {
414 addChild_Widget(div, iClob(searchBar)); 418 addChild_Widget(div, iClob(searchBar));
415 setBackgroundColor_Widget(searchBar, uiBackground_ColorId); 419 setBackgroundColor_Widget(searchBar, uiBackground_ColorId);
416 setCommandHandler_Widget(searchBar, handleSearchBarCommands_); 420 setCommandHandler_Widget(searchBar, handleSearchBarCommands_);
417 addChild_Widget(searchBar, iClob(new_LabelWidget("\U0001f50d Text", 0, 0, NULL))); 421 addChildFlags_Widget(
422 searchBar, iClob(new_LabelWidget("\U0001f50d Text", 0, 0, NULL)), frameless_WidgetFlag);
418 iInputWidget *input = new_InputWidget(0); 423 iInputWidget *input = new_InputWidget(0);
419 setId_Widget(addChildFlags_Widget(searchBar, iClob(input), expand_WidgetFlag), 424 setId_Widget(addChildFlags_Widget(searchBar, iClob(input), expand_WidgetFlag),
420 "find.input"); 425 "find.input");
@@ -422,8 +427,6 @@ static void setupUserInterface_Window(iWindow *d) {
422 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9d ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev"))); 427 addChild_Widget(searchBar, iClob(newIcon_LabelWidget(" \u2b9d ", 'g', KMOD_PRIMARY | KMOD_SHIFT, "find.prev")));
423 addChild_Widget(searchBar, iClob(newIcon_LabelWidget("\u2a2f", SDLK_ESCAPE, 0, "find.close"))); 428 addChild_Widget(searchBar, iClob(newIcon_LabelWidget("\u2a2f", SDLK_ESCAPE, 0, "find.close")));
424 } 429 }
425 iLookupWidget *lookup = new_LookupWidget();
426 addChildFlags_Widget(d->root, iClob(lookup), fixedPosition_WidgetFlag | hidden_WidgetFlag);
427 iWidget *tabsMenu = makeMenu_Widget(d->root, 430 iWidget *tabsMenu = makeMenu_Widget(d->root,
428 (iMenuItem[]){ 431 (iMenuItem[]){
429 { "Close Tab", 0, 0, "tabs.close" }, 432 { "Close Tab", 0, 0, "tabs.close" },