Skip to content

GuiTabBar() is very limiting as a lot of its default values and behavior is hard-coded #460

@sleeptightAnsiC

Description

@sleeptightAnsiC

The usage of GuiTabBar() is very limited because its implementation makes a lot of assumptions and hard-codes many default values.

Examples:

  1. the width of every entry is hard-coded to 160
    #define RAYGUI_TABBAR_ITEM_WIDTH 160
  2. each entry can be clicked in order to close TabBar, this also draws additional button in top-right corner of every entry

    raygui/src/raygui.h

    Lines 1780 to 1781 in e4a59f0

    // Close tab with middle mouse button pressed
    if (CheckCollisionPointRec(GetMousePosition(), tabBounds) && IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) result = i;
  3. each entry appears with hard-coded icon at the beginning
    if (GuiButton(RAYGUI_CLITERAL(Rectangle){ tabBounds.x + tabBounds.width - 14 - 5, tabBounds.y + 5, 14, 14 }, GuiIconText(ICON_CROSS_SMALL, NULL))) result = i;

@raysan5 Would it be fine, if I create a PR with more flexible version of this function (e.g. GuiTabBarEx ) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions