carb/simplegui/SimpleGuiTypes.h

File members: carb/simplegui/SimpleGuiTypes.h

// Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//

#pragma once

#include "../Types.h"

namespace carb
{

namespace input
{
struct Keyboard;
struct Mouse;
struct Gamepad;
struct KeyboardEvent;
struct MouseEvent;
} // namespace input

namespace windowing
{
struct Window;
}

namespace simplegui
{

struct Context;

struct Font;

struct DockNode;

struct ContextDesc
{
    Float2 displaySize;
    windowing::Window* window;
    input::Keyboard* keyboard;
    input::Mouse* mouse;
    input::Gamepad* gamepad;
};

typedef uint32_t KeyModifiers;

const KeyModifiers kKeyModifierNone = 0;
const KeyModifiers kKeyModifierCtrl = 1 << 0;
const KeyModifiers kKeyModifierShift = 1 << 1;
const KeyModifiers kKeyModifierAlt = 1 << 2;
const KeyModifiers kKeyModifierSuper = 1 << 3;

typedef uint32_t WindowFlags;

const WindowFlags kWindowFlagNone = 0;
const WindowFlags kWindowFlagNoTitleBar = 1 << 0;
const WindowFlags kWindowFlagNoResize = 1 << 1;
const WindowFlags kWindowFlagNoMove = 1 << 2;
const WindowFlags kWindowFlagNoScrollbar = 1 << 3;
const WindowFlags kWindowFlagNoScrollWithMouse = 1 << 4;
const WindowFlags kWindowFlagNoCollapse = 1 << 5;
const WindowFlags kWindowFlagAlwaysAutoResize = 1 << 6;
const WindowFlags kWindowFlagNoBackground = 1 << 7;
const WindowFlags kWindowFlagNoSavedSettings = 1 << 8;
const WindowFlags kWindowFlagNoMouseInputs = 1 << 9;
const WindowFlags kWindowFlagMenuBar = 1 << 10;
const WindowFlags kWindowFlagHorizontalScrollbar = 1 << 11;
const WindowFlags kWindowFlagNoFocusOnAppearing = 1 << 12;
const WindowFlags kWindowFlagNoBringToFrontOnFocus = 1 << 13;
const WindowFlags kWindowFlagAlwaysVerticalScrollbar = 1 << 14;
const WindowFlags kWindowFlagAlwaysHorizontalScrollbar = 1 << 15;
const WindowFlags kWindowFlagAlwaysUseWindowPadding = 1 << 16;
const WindowFlags kWindowFlagNoNavInputs = 1 << 18;
const WindowFlags kWindowFlagNoNavFocus = 1 << 19;
const WindowFlags kWindowFlagUnsavedDocument = 1 << 20;
const WindowFlags kWindowFlagNoDocking = 1 << 21;

const WindowFlags kWindowFlagNoNav = kWindowFlagNoNavInputs | kWindowFlagNoNavFocus;

const WindowFlags kWindowFlagNoDecoration =
    kWindowFlagNoTitleBar | kWindowFlagNoResize | kWindowFlagNoScrollbar | kWindowFlagNoCollapse;

const WindowFlags kWindowFlagNoInput = kWindowFlagNoMouseInputs | kWindowFlagNoNavInputs | kWindowFlagNoNavFocus;

typedef uint32_t ItemFlags;

const ItemFlags kItemFlagDefault = 0;
const ItemFlags kItemFlagsNoTabStop = 1 << 0;
const ItemFlags kItemFlagButtonRepeat = 1 << 1;
const ItemFlags kItemFlagDisabled = 1 << 2;
const ItemFlags kItemFlagNoNav = 1 << 3;
const ItemFlags kItemFlagNoNavDefaultFocus = 1 << 4;
const ItemFlags kItemFlagSelectableDontClosePopup = 1 << 5;

typedef uint32_t InputTextFlags;

const InputTextFlags kInputTextFlagNone = 0;
const InputTextFlags kInputTextFlagCharsDecimal = 1 << 0;
const InputTextFlags kInputTextFlagCharsHexadecimal = 1 << 1;
const InputTextFlags kInputTextFlagCharsUppercase = 1 << 2;
const InputTextFlags kInputTextFlagCharsNoBlank = 1 << 3;
const InputTextFlags kInputTextFlagAutoSelectAll = 1 << 4;
const InputTextFlags kInputTextFlagEnterReturnsTrue = 1 << 5;
const InputTextFlags kInputTextFlagCallbackCompletion = 1 << 6;
const InputTextFlags kInputTextFlagCallbackHistory = 1 << 7;
const InputTextFlags kInputTextFlagCallbackAlways = 1 << 8;
const InputTextFlags kInputTextFlagCallbackCharFilter = 1 << 9;
const InputTextFlags kInputTextFlagAllowTabInput = 1 << 10;
const InputTextFlags kInputTextFlagCtrlEnterForNewLine = 1 << 11;
const InputTextFlags kInputTextFlagNoHorizontalScroll = 1 << 12;
const InputTextFlags kInputTextFlagAlwaysInsertMode = 1 << 13;
const InputTextFlags kInputTextFlagReadOnly = 1 << 14;
const InputTextFlags kInputTextFlagPassword = 1 << 15;
const InputTextFlags kInputTextFlagNoUndoRedo = 1 << 16;
const InputTextFlags kInputTextFlagCharsScientific = 1 << 17;
const InputTextFlags kInputTextFlagCallbackResize = 1 << 18;

typedef uint32_t TreeNodeFlags;

const TreeNodeFlags kTreeNodeFlagNone = 0;
const TreeNodeFlags kTreeNodeFlagSelected = 1 << 0;
const TreeNodeFlags kTreeNodeFlagFramed = 1 << 1;
const TreeNodeFlags kTreeNodeFlagAllowItemOverlap = 1 << 2;
const TreeNodeFlags kTreeNodeFlagNoTreePushOnOpen = 1 << 3;
const TreeNodeFlags kTreeNodeFlagNoAutoOpenOnLog = 1 << 4;
const TreeNodeFlags kTreeNodeFlagDefaultOpen = 1 << 5;
const TreeNodeFlags kTreeNodeFlagOpenOnDoubleClick = 1 << 6;
const TreeNodeFlags kTreeNodeFlagOpenOnArrow = 1 << 7;
const TreeNodeFlags kTreeNodeFlagLeaf = 1 << 8;
const TreeNodeFlags kTreeNodeFlagBullet = 1 << 9;
const TreeNodeFlags kTreeNodeFlagFramePadding = 1 << 10;
const TreeNodeFlags kTreeNodeFlagNavLeftJumpsBackHere = 1 << 13;

const TreeNodeFlags kTreeNodeFlagCollapsingHeader =
    kTreeNodeFlagFramed | kTreeNodeFlagNoTreePushOnOpen | kTreeNodeFlagNoAutoOpenOnLog;

typedef uint32_t SelectableFlags;

const SelectableFlags kSelectableFlagNone = 0;
const SelectableFlags kSelectableFlagDontClosePopups = 1 << 0;
const SelectableFlags kSelectableFlagSpanAllColumns = 1 << 1;
const SelectableFlags kSelectableFlagAllowDoubleClick = 1 << 2;
const SelectableFlags kSelectableFlagDisabled = 1 << 3;

typedef uint32_t ComboFlags;

const ComboFlags kComboFlagNone = 0;
const ComboFlags kComboFlagPopupAlignLeft = 1 << 0;
const ComboFlags kComboFlagHeightSmall = 1 << 1;
const ComboFlags kComboFlagHeightRegular = 1 << 2;
const ComboFlags kComboFlagHeightLarge = 1 << 3;
const ComboFlags kComboFlagHeightLargest = 1 << 4;
const ComboFlags kComboFlagNoArrowButton = 1 << 5;
const ComboFlags kComboFlagNoPreview = 1 << 6;
const ComboFlags kComboFlagHeightMask =
    kComboFlagHeightSmall | kComboFlagHeightRegular | kComboFlagHeightLarge | kComboFlagHeightLargest;

typedef uint32_t TabBarFlags;

const TabBarFlags kTabBarFlagNone = 0;
const TabBarFlags kTabBarFlagReorderable = 1 << 0;
const TabBarFlags kTabBarFlagAutoSelectNewTabs = 1 << 1;
const TabBarFlags kTabBarFlagTabListPopupButton = 1 << 2;
const TabBarFlags kTabBarFlagNoCloseWithMiddleMouseButton = 1 << 3;
const TabBarFlags kTabBarFlagNoTabListScrollingButtons = 1 << 4;
const TabBarFlags kTabBarFlagNoTooltip = 1 << 5;
const TabBarFlags kTabBarFlagFittingPolicyResizeDown = 1 << 6;
const TabBarFlags kTabBarFlagFittingPolicyScroll = 1 << 7;
const TabBarFlags kTabBarFlagFittingPolicyMask =
    kTabBarFlagFittingPolicyResizeDown | kTabBarFlagFittingPolicyScroll;
const TabBarFlags kTabBarFlagFittingPolicyDefault = kTabBarFlagFittingPolicyResizeDown;

typedef uint32_t TabItemFlags;

const TabItemFlags kTabItemFlagNone = 0;
const TabItemFlags kTabItemFlagUnsavedDocument = 1 << 0;
const TabItemFlags kTabItemFlagSetSelected = 1 << 1;
const TabItemFlags kTabItemFlagNoCloseWithMiddleMouseButton = 1 << 2;
const TabItemFlags kTabItemFlagNoPushId = 1 << 3;

typedef uint32_t DockNodeFlags;

const DockNodeFlags kDockNodeFlagNone = 0;
const DockNodeFlags kDockNodeFlagKeepAliveOnly = 1 << 0;
// const DockNodeFlags kDockNodeFlagNoCentralNode = 1 << 1;   //!<  Disable Central Node (the node which can stay empty)
const DockNodeFlags kDockNodeFlagNoDockingInCentralNode = 1 << 2;
const DockNodeFlags kDockNodeFlagPassthruCentralNode = 1 << 3;
const DockNodeFlags kDockNodeFlagNoSplit = 1 << 4;
const DockNodeFlags kDockNodeFlagNoResize = 1 << 5;
const DockNodeFlags kDockNodeFlagAutoHideTabBar = 1 << 6;

typedef uint32_t FocusedFlags;

const FocusedFlags kFocusedFlagNone = 0;
const FocusedFlags kFocusedFlagChildWindows = 1 << 0;
const FocusedFlags kFocusedFlagRootWindow = 1 << 1;
const FocusedFlags kFocusedFlagAnyWindow = 1 << 2;
const FocusedFlags kFocusedFlagRootAndChildWindows = kFocusedFlagRootWindow | kFocusedFlagChildWindows;

typedef uint32_t HoveredFlags;

const HoveredFlags kHoveredFlagNone = 0;
const HoveredFlags kHoveredFlagChildWindows = 1 << 0;
const HoveredFlags kHoveredFlagRootWindow = 1 << 1;
const HoveredFlags kHoveredFlagAnyWindow = 1 << 2;
const HoveredFlags kHoveredFlagAllowWhenBlockedByPopup = 1 << 3;
const HoveredFlags kHoveredFlagAllowWhenBlockedByActiveItem = 1 << 5;
const HoveredFlags kHoveredFlagAllowWhenOverlapped = 1 << 6;
const HoveredFlags kHoveredFlagAllowWhenDisabled = 1 << 7;
const HoveredFlags kHoveredFlagRectOnly = kHoveredFlagAllowWhenBlockedByPopup | kHoveredFlagAllowWhenBlockedByActiveItem |
                                          kHoveredFlagAllowWhenOverlapped;
const HoveredFlags kHoveredFlagRootAndChildWindows = kHoveredFlagRootWindow | kHoveredFlagChildWindows;

typedef uint32_t DragDropFlags;

const DragDropFlags kDragDropFlagNone = 0;
// BeginDragDropSource() flags
const DragDropFlags kDragDropFlagSourceNoPreviewTooltip = 1 << 0;
const DragDropFlags kDragDropFlagSourceNoDisableHover = 1 << 1;
const DragDropFlags kDragDropFlagSourceNoHoldToOpenOthers = 1 << 2;
const DragDropFlags kDragDropFlagSourceAllowNullID = 1 << 3;
const DragDropFlags kDragDropFlagSourceExtern = 1 << 4;
const DragDropFlags kDragDropFlagSourceAutoExpirePayload = 1 << 5;
// AcceptDragDropPayload() flags
const DragDropFlags kDragDropFlagAcceptBeforeDelivery = 1 << 10;
const DragDropFlags kDragDropFlagAcceptNoDrawDefaultRect = 1 << 11;
const DragDropFlags kDragDropFlagAcceptNoPreviewTooltip = 1 << 12;
const DragDropFlags kDragDropFlagAcceptPeekOnly =
    kDragDropFlagAcceptBeforeDelivery | kDragDropFlagAcceptNoDrawDefaultRect;

enum class DataType
{
    eS8,
    eU8,
    eS16,
    eU16,
    eS32,
    eU32,
    eS64,
    eU64,
    eFloat,
    eDouble,
    eCount
};

enum class Direction
{
    eNone = -1,
    eLeft = 0,
    eRight = 1,
    eUp = 2, //<! Up
    eDown = 3,
    eCount
};

enum class StyleColor
{
    eText,
    eTextDisabled,
    eWindowBg,
    eChildBg,
    ePopupBg,
    eBorder,
    eBorderShadow,
    eFrameBg,
    eFrameBgHovered,
    eFrameBgActive,
    eTitleBg,
    eTitleBgActive,
    eTitleBgCollapsed,
    eMenuBarBg,
    eScrollbarBg,
    eScrollbarGrab,
    eScrollbarGrabHovered,
    eScrollbarGrabActive,
    eCheckMark,
    eSliderGrab,
    eSliderGrabActive,
    eButton,
    eButtonHovered,
    eButtonActive,
    eHeader,
    eHeaderHovered,
    eHeaderActive,
    eSeparator,
    eSeparatorHovered,
    eSeparatorActive,
    eResizeGrip,
    eResizeGripHovered,
    eResizeGripActive,
    eTab,
    eTabHovered,
    eTabActive,
    eTabUnfocused,
    eTabUnfocusedActive,
    eDockingPreview,
    eDockingEmptyBg,
    ePlotLines,
    ePlotLinesHovered,
    ePlotHistogram,
    ePlotHistogramHovered,
    eTableHeaderBg,
    eTableBorderStrong,
    eTableBorderLight,
    eTableRowBg,
    eTableRowBgAlt,
    eTextSelectedBg,
    eDragDropTarget,
    eNavHighlight,
    eNavWindowingHighlight,
    eNavWindowingDimBg,
    eModalWindowDimBg,
    eWindowShadow,
#ifdef IMGUI_NVIDIA
    eCustomChar,
#endif
    eCount
};

enum class StyleVar
{
    eAlpha,
    eWindowPadding,
    eWindowRounding,
    eWindowBorderSize,
    eWindowMinSize,
    eWindowTitleAlign,
    eChildRounding,
    eChildBorderSize,
    ePopupRounding,
    ePopupBorderSize,
    eFramePadding,
    eFrameRounding,
    eFrameBorderSize,
    eItemSpacing,
    eItemInnerSpacing,
    eIndentSpacing,
    eCellPadding,
    eScrollbarSize,
    eScrollbarRounding,
    eGrabMinSize,
    eGrabRounding,
    eTabRounding,
    eButtonTextAlign,
    eSelectableTextAlign,
#ifdef IMGUI_NVIDIA
    eDockSplitterSize,
#endif
    eCount
};

typedef uint32_t ColorEditFlags;

const ColorEditFlags kColorEditFlagNone = 0;
const ColorEditFlags kColorEditFlagNoAlpha = 1 << 1;
const ColorEditFlags kColorEditFlagNoPicker = 1 << 2;
const ColorEditFlags kColorEditFlagNoOptions = 1 << 3;
const ColorEditFlags kColorEditFlagNoSmallPreview = 1 << 4;
const ColorEditFlags kColorEditFlagNoInputs = 1 << 5;
const ColorEditFlags kColorEditFlagNoTooltip = 1 << 6;
const ColorEditFlags kColorEditFlagNoLabel = 1 << 7;
const ColorEditFlags kColorEditFlagNoSidePreview = 1 << 8;
// User Options (right-click on widget to change some of them). You can set application defaults using
// SetColorEditOptions(). The idea is that you probably don't want to override them in most of your calls, let the user
// choose and/or call SetColorEditOptions() during startup.
const ColorEditFlags kColorEditFlagAlphaBar = 1 << 9;
const ColorEditFlags kColorEditFlagAlphaPreview = 1 << 10;
const ColorEditFlags kColorEditFlagAlphaPreviewHalf = 1 << 11;
const ColorEditFlags kColorEditFlagHDR = 1 << 12;
const ColorEditFlags kColorEditFlagRGB = 1 << 13;
const ColorEditFlags kColorEditFlagHSV = 1 << 14;
const ColorEditFlags kColorEditFlagHEX = 1 << 15;
const ColorEditFlags kColorEditFlagUint8 = 1 << 16;
const ColorEditFlags kColorEditFlagFloat = 1 << 17;
const ColorEditFlags kColorEditFlagPickerHueBar = 1 << 18;
const ColorEditFlags kColorEditFlagPickerHueWheel = 1 << 19;

typedef uint32_t DrawCornerFlags;

const DrawCornerFlags kDrawCornerFlagTopLeft = 1 << 0;
const DrawCornerFlags kDrawCornerFlagTopRight = 1 << 1;
const DrawCornerFlags kDrawCornerFlagBotLeft = 1 << 2;
const DrawCornerFlags kDrawCornerFlagBotRight = 1 << 3;
const DrawCornerFlags kDrawCornerFlagTop = kDrawCornerFlagTopLeft | kDrawCornerFlagTopRight;
const DrawCornerFlags kDrawCornerFlagBot = kDrawCornerFlagBotLeft | kDrawCornerFlagBotRight;
const DrawCornerFlags kDrawCornerFlagLeft = kDrawCornerFlagTopLeft | kDrawCornerFlagBotLeft;
const DrawCornerFlags kDrawCornerFlagRight = kDrawCornerFlagTopRight | kDrawCornerFlagBotRight;
const DrawCornerFlags kDrawCornerFlagAll = 0xF;

enum class MouseCursor
{
    eNone = -1,
    eArrow = 0,
    eTextInput,
    eResizeAll,
    eResizeNS,
    eResizeEW,
    eResizeNESW,
    eResizeNWSE,
    eHand,
    eNotAllowed,
    eCount
};

enum class Condition
{
    eAlways = 1 << 0,
    eOnce = 1 << 1,
    eFirstUseEver = 1 << 2,
    eAppearing = 1 << 3,
};

struct Style
{
    float alpha;
    Float2 windowPadding;
    float windowRounding;
    float windowBorderSize;
    Float2 windowMinSize;
    Float2 windowTitleAlign;
    Direction windowMenuButtonPosition;
    float childRounding;
    float childBorderSize;
    float popupRounding;
    float popupBorderSize;
    Float2 framePadding;
    float frameRounding;
    float frameBorderSize;
    Float2 itemSpacing;
    Float2 itemInnerSpacing;
    Float2 cellPadding;
    Float2 touchExtraPadding;
    float indentSpacing;
    float columnsMinSpacing;
    float scrollbarSize;
    float scrollbarRounding;
    float grabMinSize;
    float grabRounding;
    float tabRounding;
    float tabBorderSize;
    float tabMinWidthForUnselectedCloseButton;
    Direction colorButtonPosition;
    Float2 buttonTextAlign;
    Float2 selectableTextAlign;
    Float2 displayWindowPadding;
    Float2 displaySafeAreaPadding;
    float mouseCursorScale;
    bool antiAliasedLines;
    bool antiAliasedFill;
    float curveTessellationTol;
    float circleSegmentMaxError;
    float windowShadowSize;
    float windowShadowOffsetDist;
    float windowShadowOffsetAngle;
    Float4 colors[(size_t)StyleColor::eCount];

#ifdef IMGUI_NVIDIA
    float dockSplitterSize;
    uint16_t customCharBegin;
#endif

    Style()
    {
    }
};

enum class StyleColorsPreset
{
    eNvidiaDark,
    eNvidiaLight,
    eDark,
    eLight,
    eClassic,
    eCount
};

struct DrawCommand;
struct DrawData;

typedef void* TextureId;

typedef void (*DrawCallback)(const DrawData* drawData, const DrawCommand* cmd);

typedef bool (*FontEnumFn)(Font* font, void* user);

struct DrawCommand
{
    uint32_t elementCount;
    carb::Float4 clipRect;
    TextureId textureId;
    DrawCallback userCallback;
    void* userCallbackData;
};

struct DrawVertex
{
    Float2 position;
    Float2 texCoord;
    uint32_t color;
};

struct DrawList
{
    uint32_t commandBufferCount;
    DrawCommand* commandBuffers;
    uint32_t indexBufferSize;
    uint32_t* indexBuffer;
    uint32_t vertexBufferSize;
    DrawVertex* vertexBuffer;
};

struct DrawData
{
    uint32_t commandListCount;
    DrawList* commandLists;
    uint32_t vertexCount;
    uint32_t indexCount;
};

typedef unsigned short Wchar;

struct FontConfig
{
    void* fontData;
    int fontDataSize;
    bool fontDataOwnedByAtlas;
    int fontNo;
    float sizePixels;
    int oversampleH;
    int oversampleV;
    bool pixelSnapH;
    Float2 glyphExtraSpacing;
    Float2 glyphOffset;
    const Wchar* glyphRanges;
    float glyphMinAdvanceX;
    float glyphMaxAdvanceX;
    bool mergeMode;
    uint32_t rasterizerFlags;
    float rasterizerMultiply;
    char name[40];
    Font* dstFont;

    FontConfig()
    {
        fontData = nullptr;
        fontDataSize = 0;
        fontDataOwnedByAtlas = true;
        fontNo = 0;
        sizePixels = 0.0f;
        oversampleH = 3;
        oversampleV = 1;
        pixelSnapH = false;
        glyphExtraSpacing = Float2{ 0.0f, 0.0f };
        glyphOffset = Float2{ 0.0f, 0.0f };
        glyphRanges = nullptr;
        glyphMinAdvanceX = 0.0f;
        glyphMaxAdvanceX = CARB_FLOAT_MAX;
        mergeMode = false;
        rasterizerFlags = 0x00;
        rasterizerMultiply = 1.0f;
        memset(name, 0, sizeof(name));
        dstFont = nullptr;
    }
};

struct FontCustomRect
{
    uint32_t id;
    uint16_t width;
    uint16_t height;
    uint16_t x;
    uint16_t y;
    float glyphAdvanceX;
    carb::Float2 glyphOffset;
    Font* font;
    FontCustomRect()
    {
        id = 0xFFFFFFFF;
        width = height = 0;
        x = y = 0xFFFF;
        glyphAdvanceX = 0.0f;
        glyphOffset = { 0.0f, 0.0f };
        font = nullptr;
    }
    bool isPacked() const
    {
        return x != 0xFFFF;
    }
};

struct TextEditCallbackData
{
    InputTextFlags eventFlag;
    InputTextFlags flags;
    void* userData;
    uint16_t eventChar;
    int eventKey;
    char* buf;
    int bufTextLen;
    int bufSize;
    bool bufDirty;
    int cursorPos;
    int selectionStart;
    int selectionEnd;
};

typedef int (*TextEditCallback)(TextEditCallbackData* data);

struct Payload
{
    // Members
    void* data;
    int dataSize;

    // [Internal]
    uint32_t sourceId;
    uint32_t sourceParentId;
    int dataFrameCount;
    char dataType[32 + 1];
    bool preview;
    bool delivery;

    Payload()
    {
        clear();
    }
    void clear()
    {
        sourceId = sourceParentId = 0;
        data = nullptr;
        dataSize = 0;
        memset(dataType, 0, sizeof(dataType));
        dataFrameCount = -1;
        preview = delivery = false;
    }
    bool isDataType(const char* type) const
    {
        return dataFrameCount != -1 && strcmp(type, dataType) == 0;
    }
    bool isPreview() const
    {
        return preview;
    }
    bool isDelivery() const
    {
        return delivery;
    }
};

typedef uint32_t ViewportFlags;

const ViewportFlags kViewportFlagNone = 0;
const ViewportFlags kViewportFlagNoDecoration = 1 << 0;
const ViewportFlags kViewportFlagNoTaskBarIcon = 1 << 1;
const ViewportFlags kViewportFlagNoFocusOnAppearing = 1 << 2;
const ViewportFlags kViewportFlagNoFocusOnClick = 1 << 3;
const ViewportFlags kViewportFlagNoInputs = 1 << 4;
const ViewportFlags kViewportFlagNoRendererClear = 1 << 5;
const ViewportFlags kViewportFlagTopMost = 1 << 6;

struct Viewport
{
    uint32_t id;
    ViewportFlags flags;
    Float2 pos;
    Float2 size;
    Float2 workOffsetMin;
    Float2 workOffsetMax;
    float dpiScale;
    DrawData* drawData;
    uint32_t parentViewportId;

    void* rendererUserData;
    void* platformUserData;
    void* platformHandle;
    void* platformHandleRaw;
    bool platformRequestMove;
    bool platformRequestResize;
    bool platformRequestClose;

    Viewport()
    {
        id = 0;
        flags = 0;
        dpiScale = 0.0f;
        drawData = NULL;
        parentViewportId = 0;
        rendererUserData = platformUserData = platformHandle = platformHandleRaw = nullptr;
        platformRequestMove = platformRequestResize = platformRequestClose = false;
    }
    ~Viewport()
    {
        CARB_ASSERT(platformUserData == nullptr && rendererUserData == nullptr);
    }
};

struct WindowClass
{
    uint32_t classId;
    uint32_t parentViewportId;
    ViewportFlags viewportFlagsOverrideSet;
    ViewportFlags viewportFlagsOverrideClear;
    DockNodeFlags dockNodeFlagsOverrideSet;
    DockNodeFlags dockNodeFlagsOverrideClear;
    bool dockingAlwaysTabBar;
    bool dockingAllowUnclassed;

    WindowClass()
    {
        classId = 0;
        parentViewportId = 0;
        viewportFlagsOverrideSet = viewportFlagsOverrideClear = 0x00;
        dockNodeFlagsOverrideSet = dockNodeFlagsOverrideClear = 0x00;
        dockingAlwaysTabBar = false;
        dockingAllowUnclassed = true;
    }
};

struct ListClipper
{
    float startPosY;
    float itemsHeight;
    int32_t itemsCount;
    int32_t stepNo;
    int32_t displayStart;
    int32_t displayEnd;
};
} // namespace simplegui
} // namespace carb