Гайд How to make the tabs not moveable[indigo]

Забаненный
Статус
Оффлайн
Регистрация
29 Ноя 2017
Сообщения
2
Реакции[?]
5
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Hello guys i post this because i think someone will find it usefully. its a totally unnecessary.
Goto gui.cpp search for "TabLabels" and change it to this code below:
Код:
IMGUI_API bool TabLabels (const char ** tabLabels, int tabSize, int & tabIndex, int * tabOrder)
{
ImGuiStyle & style = ImGui :: GetStyle ();
const ImVec2 itemSpacing = style.ItemSpacing;
const ImVec4 color = style.Colors [ImGuiCol_Button];
const ImVec4 colorActive = style.Colors [ImGuiCol_ButtonActive];
const ImVec4 colorHover = style.Colors [ImGuiCol_ButtonHovered];
const ImVec4 colorText = style.Colors [ImGuiCol_Text];
style.ItemSpacing.x = 1;
style.ItemSpacing.y = 1;
const ImVec4 colorSelectedTab = ImVec4 (color.x, color.y, color.z, color.w * 0.5f);
const ImVec4 colorSelectedTabHovered = ImVec4 (colorHover.x, colorHover.y, colorHover.z, colorHover.w * 0.5f);
const ImVec4 colorSelectedTabText = ImVec4 (colorText.x * 0.8f, colorText.y * 0.8f, colorText.z * 0.8f, colorText.w * 0.8f);
if (tabSize> 0 && (tabIndex <0 || tabIndex> = tabSize))
{
if (! tabOrder)
{
tabIndex = 0;
}
else
{
tabIndex = -1;
}
}
float windowWidth = 0.f, sumX = 0.f;
windowWidth = ImGui :: GetWindowWidth () - style.WindowPadding.x - (ImGui :: GetScrollMaxY ()> 0? style.ScrollbarSize: 0.f);
static int draggingTabIndex = -1; int draggingTabTargetIndex = -1;
static ImVec2 draggingtabSize (0, 0);
static ImVec2 draggingTabOffset (0, 0);
const bool isMMBreleased = ImGui :: IsMouseReleased (2);
const bool isMouseDragging = ImGui :: IsMouseDragging (0, 2.f);
int justClosedTabIndex = -1, newtabIndex = tabIndex;
bool selection_changed = false; bool noButtonDrawn = true;
for (int j = 0, i; j <tabSize; j ++)
{
i = tabOrder? tabOrder [j]: j;
if (i == -1) continue;
if (sumX> 0.f)
{
sumX + = style.ItemSpacing.x;
sumX + = ImGui :: CalcTextSize (tabLabels [i]). x + 2.f * style.FramePadding.x;
if (sumX> windowWidth)
{
sumX = 0.f;
}
else
{
ImGui :: SameLine ();
}
}
if (i! = tabIndex)
{
// Push the style
style.Colors [ImGuiCol_Button] = colorSelectedTab;
style.Colors [ImGuiCol_ButtonActive] = colorSelectedTab;
style.Colors [ImGuiCol_ButtonHovered] = colorSelectedTabHovered;
style.Colors [ImGuiCol_Text] = colorSelectedTabText;
}
// Draw the button
ImGui :: PushID (i); // otherwise two tabs with the same name would clash.
if (ImGui :: Button (tabLabels [i], ImVec2 (67.f, 40.f))) {selection_changed = (tabIndex! = i); newtabIndex = i; } // if you want to change the button width and hegiht x = width, y = height .;
ImGui :: PopID ();
if (i! = tabIndex)
{
// Reset the style
style.Colors [ImGuiCol_Button] = color;
style.Colors [ImGuiCol_ButtonActive] = colorActive;
style.Colors [ImGuiCol_ButtonHovered] = colorHover;
style.Colors [ImGuiCol_Text] = colorText;
}
noButtonDrawn = false;
if (sumX == 0.f) sumX = style.WindowPadding.x + ImGui :: GetItemRectSize (). x; // First element of a line
if (ImGui :: IsItemHoveredRect ())
{
if (tabOrder)
{
// tab reordering
if (isMouseDragging)
{
if (draggingTabIndex == -1)
{
draggingTabIndex = j;
draggingtabSize = ImGui :: GetItemRectSize ();
const ImVec2 & mp = ImGui :: GetIO (). MousePos;
const ImVec2 draggingTabCursorPos = ImGui :: GetCursorPos ();
draggingTabOffset = ImVec2 (
mp.x + draggingtabSize.x * 0.5f - sumX + ImGui :: GetScrollX (),
mp.y + draggingtabSize.y * 0.5f - draggingTabCursorPos.y + ImGui :: GetScrollY ()
);
}
}
else if (draggingTabIndex> = 0 && draggingTabIndex <tabSize && draggingTabIndex! = j)
{
draggingTabTargetIndex = j; // For some odd reasons this seems to get called only when draggingTabIndex < i ! (Probably during mouse dragging ImGui owns the mouse someway and sometimes ImGui::IsItemHovered() is not getting called)
}
}
}
}
tabIndex = newtabIndex;
// Restore the style
style.Colors[ImGuiCol_Button] = color;
style.Colors[ImGuiCol_ButtonActive] = colorActive;
style.Colors[ImGuiCol_ButtonHovered] = colorHover;
style.Colors[ImGuiCol_Text] = colorText;
style.ItemSpacing = itemSpacing;
return selection_changed;
}
 
Забаненный
Статус
Оффлайн
Регистрация
26 Сен 2017
Сообщения
126
Реакции[?]
3
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
ss?
 
return 0;
Забаненный
Статус
Оффлайн
Регистрация
6 Мар 2017
Сообщения
405
Реакции[?]
237
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Сверху Снизу