Lines Matching +defs:tab +defs:width
146 // - From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.
1167 ItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout.
3136 IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key)
3677 // Store text height (note that we haven't calculated text width at all, see GitHub issues #383, #1224)
3685 // Horizontal scroll in chunks of quarter width
3771 text_size = ImVec2(size.x, InputTextCalcTextLenAndLineCount(buf_display, &buf_end) * g.FontSize); // We don't need width
4101 // FIXME: we adjust the big color square height based on item width, which may cause a flickering feedback loop (if automatic height makes a vertical scrollbar appears, affecting automatic width..)
4133 float bars_width = square_sz; // Arbitrary smallish width of Hue/Alpha picking bars
4785 const float text_offset_x = (g.FontSize + (display_frame ? padding.x*3 : padding.x*2)); // Collapser arrow width + Spacing
5132 // Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an non-visible label e.g. "##empty"
5827 static void TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab);
5938 // Restore the last visible height if no tab is visible, this reduce vertical flicker/movement when a tabs gets removed without calling SetTabItemClosed().
5961 ImGuiTabItem* tab = &tab_bar->Tabs[tab_src_n];
5962 if (tab->LastFrameVisible < tab_bar->PrevFrameVisible)
5964 if (tab->ID == tab_bar->SelectedTabId)
5975 // Setup next selected tab
6007 // Tab List Popup (will alter tab_bar->BarRect and therefore the available width!)
6022 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
6023 IM_ASSERT(tab->LastFrameVisible >= tab_bar->PrevFrameVisible);
6025 if (most_recently_selected_tab == NULL || most_recently_selected_tab->LastFrameSelected < tab->LastFrameSelected)
6026 most_recently_selected_tab = tab;
6027 if (tab->ID == tab_bar->SelectedTabId)
6030 // Refresh tab width immediately, otherwise changes of style e.g. style.FramePadding.x would noticeably lag in the tab bar.
6031 // Additionally, when using TabBarAddTab() to manipulate tab bar order we occasionally insert new tabs that don't have a width yet,
6032 // and we cannot wait for the next BeginTabItem() call. We cannot compute this width within TabBarAddTab() because font size depends on the active window.
6033 const char* tab_name = tab_bar->GetTabName(tab);
6034 tab->WidthContents = TabItemCalcSize(tab_name, (tab->Flags & ImGuiTabItemFlags_NoCloseButton) ? false : true).x;
6036 width_total_contents += (tab_n > 0 ? g.Style.ItemInnerSpacing.x : 0.0f) + tab->WidthContents;
6038 // Store data so we can build an array sorted by width if we need to shrink tabs down
6040 width_sort_buffer[tab_n].Width = tab->WidthContents;
6043 // Compute width
6070 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
6071 tab->Width = ImMin(tab->WidthContents, tab_max_width);
6079 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
6080 tab->Offset = offset_x;
6081 if (scroll_track_selected_tab_id == 0 && g.NavJustMovedToId == tab->ID)
6082 scroll_track_selected_tab_id = tab->ID;
6083 offset_x += tab->Width + g.Style.ItemInnerSpacing.x;
6094 // If we have lost the selected tab, select the next most recently active one
6100 // Lock in visible tab
6153 if (ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, tab_id))
6154 tab_bar->Tabs.erase(tab);
6161 void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
6163 if ((tab_bar->VisibleTabId == tab->ID) && !(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
6165 // This will remove a frame of lag for selecting another tab on closure.
6167 tab->LastFrameVisible = -1;
6170 else if ((tab_bar->VisibleTabId != tab->ID) && (tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
6173 tab_bar->NextSelectedTabId = tab->ID;
6183 static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
6187 int order = tab_bar->GetTabOrder(tab);
6188 float tab_x1 = tab->Offset + (order > 0 ? -margin : 0.0f);
6189 float tab_x2 = tab->Offset + tab->Width + (order + 1 < tab_bar->Tabs.Size ? margin : 1.0f);
6196 void ImGui::TabBarQueueChangeTabOrder(ImGuiTabBar* tab_bar, const ImGuiTabItem* tab, int dir)
6200 tab_bar->ReorderRequestTabId = tab->ID;
6250 tab_to_select = &tab_bar->Tabs[(target_order >= 0 && target_order < tab_bar->Tabs.Size) ? target_order : selected_order]; // If we are at the end of the list, still scroll to make our tab visible
6281 ImGuiTabItem* tab = &tab_bar->Tabs[tab_n];
6282 const char* tab_name = tab_bar->GetTabName(tab);
6283 if (Selectable(tab_name, tab_bar->SelectedTabId == tab->ID))
6284 tab_to_select = tab;
6319 ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
6320 g.CurrentWindow->IDStack.push_back(tab->ID); // We already hashed 'label' so push into the ID stack directly instead of doing another hash through PushID(label)
6334 ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
6335 if (!(tab->Flags & ImGuiTabItemFlags_NoPushId))
6341 // Layout whole tab bar if not already done
6362 // Calculate tab contents size
6365 // Acquire tab data
6366 ImGuiTabItem* tab = TabBarFindTabByID(tab_bar, id);
6368 if (tab == NULL)
6371 tab = &tab_bar->Tabs.back();
6372 tab->ID = id;
6373 tab->Width = size.x;
6376 tab_bar->LastTabItemIdx = (short)tab_bar->Tabs.index_from_ptr(tab);
6377 tab->WidthContents = size.x;
6384 const bool tab_appearing = (tab->LastFrameVisible + 1 < g.FrameCount);
6385 tab->LastFrameVisible = g.FrameCount;
6386 tab->Flags = flags;
6389 tab->NameOffset = tab_bar->TabsNames.size();
6396 tab->Offset = tab_bar->OffsetNextTab;
6397 tab_bar->OffsetNextTab += tab->Width + g.Style.ItemInnerSpacing.x;
6400 // Update selected tab
6410 // On the very first frame of a tab bar we let first tab contents be visible to minimize appearing glitches
6424 tab->LastFrameSelected = g.FrameCount;
6430 size.x = tab->Width;
6431 window->DC.CursorPos = tab_bar->BarRect.Min + ImVec2((float)(int)tab->Offset - tab_bar->ScrollingAnim, 0.0f);
6449 // Click to Select a tab
6456 if (pressed || ((flags & ImGuiTabItemFlags_SetSelected) && !tab_contents_visible)) // SetSelected can only be passed on explicit tab bar
6468 // While moving a tab it will jump on the other side of the mouse, so we also test for MouseDelta.x
6472 TabBarQueueChangeTabOrder(tab_bar, tab, -1);
6477 TabBarQueueChangeTabOrder(tab_bar, tab, +1);
6483 if (hovered && g.HoveredIdNotActiveTimer > 0.50f && bb.GetWidth() < tab->WidthContents)
6485 // Enlarge tab display when hovering
6486 bb.Max.x = bb.Min.x + (float)(int)ImLerp(bb.GetWidth(), tab->WidthContents, ImSaturate((g.HoveredIdNotActiveTimer - 0.40f) * 6.0f));
6492 // Render tab shape
6506 // Render tab label, process close button
6512 TabBarCloseTab(tab_bar, tab);
6528 // [Public] This is call is 100% optional but it allows to remove some one-frame glitches when a tab has been unexpectedly removed.
6559 const float width = bb.GetWidth();
6561 IM_ASSERT(width > 0.0f);
6562 const float rounding = ImMax(0.0f, ImMin(g.Style.TabRounding, width * 0.5f - 1.0f));
6581 // We tend to lock style.FramePadding for a given tab-bar, hence the 'frame_padding' parameter.