@startuml
namespace HelloImGui {

class _ <free functions> {
    ----
    + void Run(RunnerParams &)
    + void Run(SimpleRunnerParams &)
    + Run(
        guiFunction,
        windowTitle,
        windowSizeAuto=false,
        restoreLastWindowGeometry=false,
        windowSize=(800,600),
        fpsIdle=10)
}

_ --> SimpleRunnerParams: uses
_ --> RunnerParams: or uses


class FpsIdling<struct> {
    float fpsIdle = 9
    bool  enableIdling = true
    bool  isIdling = false
}


class RunnerParams <struct> {
    + RunnerCallbacks callbacks
    + AppWindowParams appWindowParams
    + ImGuiWindowParams imGuiWindowParams
    ---
    + DockingParams dockingParams
    + vector<DockingParams> alternativeDockingLayouts
    ---
    + BackendPointers backendPointers
    + RendererBackendOptions rendererBackendOptions
    + PlatformBackendType platformBackendType
    + RendererBackendType rendererBackendType
    ---
    + FpsIdling fpsIdling
    + DpiAwareParams dpiAwareParams
    ---
    + iniFolderType
    + iniFilename = ""
    + bool iniFilename_useAppWindowTitle = true
    ---
    ---
    + bool appShallExit = false
}

class SimpleRunnerParams <struct> {
    + VoidFunction guiFunction
    + string windowTitle = "";
    ---
    + ScreenSize windowSize = {800, 600}
    + bool windowSizeAuto = false
    + bool windowRestorePreviousGeometry = false
    ---
    + float fpsIdle = 9
    + bool enableIdling = true
    ---
    + RunnerParams ToRunnerParams()
}

SimpleRunnerParams ..> RunnerParams: ToRunnerParams()

class RunnerCallbacks <struct> {
    ---
    + VoidFunction ShowGui = {}
    + VoidFunction ShowMenus = {}
    + VoidFunction ShowAppMenuItems = {}
    + VoidFunction ShowStatus = {}
    + VoidFunction PostInit = {}
    + VoidFunction BeforeExit = {}
    + VoidFunction PreNewFrame = {}

    + AnyBackendEventCallback = {}
    //Handle any backend event (e.g.SDL_Event)

    + VoidFunction LoadAdditionalFonts =
       LoadDefaultFont_WithFontAwesomeIcons

    + VoidFunction SetupImGuiConfig =
      SetupDefaultImGuiConfig

    + VoidFunction SetupImGuiStyle =
      SetupDefaultImGuiStyle

    + mobileCallbacks
}

class MobileCallbacks <struct>{
    ---
    Only available on mobile devices
    ---
    + VoidFunction OnDestroy = {}
    + VoidFunction OnLowMemory = {}
    + VoidFunction OnPause = {}
    + VoidFunction OnResume = {}
}
RunnerCallbacks *-- MobileCallbacks

enum PlatformBackendType {
    FirstAvailable,
    Glfw,
    Sdl,
}

RunnerParams +-- PlatformBackendType

enum RendererBackendType {
    FirstAvailable,
    OpenGL3,
    Metal,
    Vulkan,
    DirectX11,
    DirectX12,
}

RunnerParams +-- RendererBackendType


class DpiAwareParams {
    + float dpiWindowSizeFactor = 0.0f;
    + float fontRenderingScale = 0.0f;
    + float DpiFontLoadingFactor()
}

RunnerParams +-- DpiAwareParams


enum FullScreenMode <enum>{
    + NoFullScreen
    + FullScreen
    // Full screen with specified resolution
    + FullScreenDesktopResolution
    // Full screen with current resolution
    + FullMonitorWorkArea
    // Fake full screen, maximized window
    // on the selected monitor
}

enum WindowSizeState <enum>{
    + Standard,
    + Minimized,
    + Maximized
}



enum WindowPositionMode <enum>{
    + OsDefault,
    + MonitorCenter,
    + FromCoords,
}



class WindowGeometry <struct>{
    + size = ScreenSize{100, 100}
    // used if fullScreenMode==NoFullScreen
    // and sizeAuto==false

    + bool sizeAuto = false
    // If true, adapt the app window size
    // to the presented widgets

    + fullScreenMode = NoFullScreen

    + WindowPositionMode positionMode

    + position = ScreenPosition{0, 0}
    // used if windowPositionMode==FromCoords

    + int monitorIdx = 0
    // used if full screen,
    // or if positionMode==MonitorCenter

    + resizeAppWindowAtNextFrame = false
}

WindowGeometry *-- FullScreenMode
WindowGeometry *-- WindowPositionMode


class AppWindowParams <struct>{
    + windowTitle
    ---
    + windowGeometry
    + bool restorePreviousGeometry
    // if true, then save & restore from last run
    ---
    + bool borderless = false
    + bool resizable = false
    + windowSizeState = Standard
}

AppWindowParams *-- WindowGeometry
AppWindowParams *-- WindowSizeState


class ImGuiWindowParams <struct> {
    + defaultImGuiWindowType = ProvideFullScreenWindow

    + ImVec4 backgroundColor

    + bool showMenuBar = false
    + bool showMenu_App = true
    + string menuAppTitle = ""
    + bool showMenu_View = true

    + bool showStatusBar = false
    + bool showStatus_Fps = true

    + bool configWindowsMoveFromTitleBarOnly = true

    + bool enableViewports = false

    + ImGuiTweakedTheme tweakedTheme
}

class BackendPointers <struct> {
  ---
  Output structure: filled by HelloImGui
  ---
  + void* glfwWindow
  + void* sdlWindow
  + void* sdlGlContext
}

enum DockingLayoutCondition {
    FirstUseEver,
    ApplicationStart,
    Never
}

class DockingParams <struct> {
    + vector<DockingSplit> dockingSplits

    + vector<DockableWindow> dockableWindows

    + layoutCondition = DockingLayoutCondition::FirstUseEver
    + bool layoutReset = false
}

class DockableWindow <struct> {
    + string label
    + DockSpaceName dockSpaceName
    + VoidFunction GuiFunction = {}
    + bool isVisible = true
    + bool canBeClosed = true
}

class DockingSplit <struct> {
    + DockSpaceName initialDock
    + DockSpaceName newDock
    + ImGuiDir_ direction
    + float ratio = 0.25f
}

RunnerParams *-- FpsIdling
RunnerParams *-- RunnerCallbacks
RunnerParams *-- AppWindowParams
RunnerParams *-- ImGuiWindowParams
RunnerParams *-- BackendPointers
RunnerParams *-- DockingParams
DockingParams *-- DockingLayoutCondition
DockingParams *-- DockableWindow : vector
DockingParams *-- DockingSplit : vector

}
@enduml