![]() |
DDraceNetwork Documentation
|
#include <ui.h>
Classes | |
| class | CTouchState |
| class | CDoubleClickState |
| class | CValueSelectorState |
| struct | SPopupMenu |
| struct | SMessagePopupContext |
| struct | SConfirmPopupContext |
| struct | SSelectionPopupContext |
| struct | SColorPickerPopupContext |
| struct | SDropDownState |
Public Types | |
| enum | EPopupMenuFunctionResult { POPUP_KEEP_OPEN = 0 , POPUP_CLOSE_CURRENT = 1 , POPUP_CLOSE_CURRENT_AND_DESCENDANTS = 2 } |
| enum | EHotkey : unsigned { HOTKEY_ENTER = 1 << 0 , HOTKEY_ESCAPE = 1 << 1 , HOTKEY_UP = 1 << 2 , HOTKEY_DOWN = 1 << 3 , HOTKEY_LEFT = 1 << 4 , HOTKEY_RIGHT = 1 << 5 , HOTKEY_DELETE = 1 << 6 , HOTKEY_TAB = 1 << 7 , HOTKEY_SCROLL_UP = 1 << 8 , HOTKEY_SCROLL_DOWN = 1 << 9 , HOTKEY_PAGE_UP = 1 << 10 , HOTKEY_PAGE_DOWN = 1 << 11 , HOTKEY_HOME = 1 << 12 , HOTKEY_END = 1 << 13 } |
| enum | { SCROLLBAR_OPTION_INFINITE = 1 << 0 , SCROLLBAR_OPTION_NOCLAMPVALUE = 1 << 1 , SCROLLBAR_OPTION_MULTILINE = 1 << 2 , SCROLLBAR_OPTION_DELAYUPDATE = 1 << 3 } |
| typedef EPopupMenuFunctionResult(* | FPopupMenuFunction) (void *pContext, CUIRect View, bool Active) |
| typedef std::function< void()> | FPopupMenuClosedCallback |
Public Member Functions | |
| void | Init (IKernel *pKernel) |
| IClient * | Client () const |
| IGraphics * | Graphics () const |
| IInput * | Input () const |
| ITextRender * | TextRender () const |
| CUi () | |
| ~CUi () | |
| void | ResetUIElement (CUIElement &UIElement) const |
| CUIElement * | GetNewUIElement (int RequestedRectCount) |
| void | AddUIElement (CUIElement *pElement) |
| void | OnElementsReset () |
| void | OnWindowResize () |
| void | OnCursorMove (float X, float Y) |
| void | SetEnabled (bool Enabled) |
| bool | Enabled () const |
| void | Update (vec2 MouseWorldPos=vec2(-1.0f, -1.0f)) |
| void | DebugRender (float X, float Y) |
| vec2 | MousePos () const |
| float | MouseX () const |
| float | MouseY () const |
| vec2 | MouseDelta () const |
| float | MouseDeltaX () const |
| float | MouseDeltaY () const |
| vec2 | MouseWorldPos () const |
| float | MouseWorldX () const |
| float | MouseWorldY () const |
| vec2 | UpdatedMousePos () const |
| vec2 | UpdatedMouseDelta () const |
| int | MouseButton (int Index) const |
| int | MouseButtonClicked (int Index) const |
| bool | CheckMouseLock () |
| void | EnableMouseLock (const void *pId) |
| void | DisableMouseLock () |
| void | SetHotItem (const void *pId) |
| void | SetActiveItem (const void *pId) |
| bool | CheckActiveItem (const void *pId) |
| void | SetHotScrollRegion (CScrollRegion *pId) |
| const void * | HotItem () const |
| const void * | NextHotItem () const |
| const void * | ActiveItem () const |
| const CScrollRegion * | HotScrollRegion () const |
| void | StartCheck () |
| void | FinishCheck () |
| bool | MouseInside (const CUIRect *pRect) const |
| bool | MouseInsideClip () const |
| bool | MouseHovered (const CUIRect *pRect) const |
| void | ConvertMouseMove (float *pX, float *pY, IInput::ECursorType CursorType) const |
| void | UpdateTouchState (CTouchState &State) const |
| void | ResetMouseSlow () |
| bool | ConsumeHotkey (EHotkey Hotkey) |
| void | ClearHotkeys () |
| bool | OnInput (const IInput::CEvent &Event) |
| constexpr float | ButtonColorMulActive () const |
| constexpr float | ButtonColorMulHot () const |
| constexpr float | ButtonColorMulDefault () const |
| float | ButtonColorMul (const void *pId) |
| const CUIRect * | Screen () |
| void | MapScreen () |
| float | PixelSize () |
| void | ClipEnable (const CUIRect *pRect) |
| void | ClipDisable () |
| const CUIRect * | ClipArea () const |
| bool | IsClipped () const |
| int | DoButtonLogic (const void *pId, int Checked, const CUIRect *pRect, unsigned Flags) |
| int | DoDraggableButtonLogic (const void *pId, int Checked, const CUIRect *pRect, bool *pClicked, bool *pAbrupted) |
| bool | DoDoubleClickLogic (const void *pId) |
| EEditState | DoPickerLogic (const void *pId, const CUIRect *pRect, float *pX, float *pY) |
| void | DoSmoothScrollLogic (float *pScrollOffset, float *pScrollOffsetChange, float ViewPortSize, float TotalSize, bool SmoothClamp=false, float ScrollSpeed=10.0f) const |
| CLabelResult | DoLabel (const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps={}) const |
| CLabelResult | DoLabel_AutoLineSize (const char *pText, float FontSize, int Align, CUIRect *pRect, float LineSize, const SLabelProperties &LabelProps={}) const |
| void | DoLabel (CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps={}, int StrLen=-1, const CTextCursor *pReadCursor=nullptr) const |
| void | DoLabelStreamed (CUIElement::SUIElementRect &RectEl, const CUIRect *pRect, const char *pText, float Size, int Align, const SLabelProperties &LabelProps={}, int StrLen=-1, const CTextCursor *pReadCursor=nullptr) const |
| bool | DoEditBox (CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners=IGraphics::CORNER_ALL, const std::vector< STextColorSplit > &vColorSplits={}) |
| bool | DoClearableEditBox (CLineInput *pLineInput, const CUIRect *pRect, float FontSize, int Corners=IGraphics::CORNER_ALL, const std::vector< STextColorSplit > &vColorSplits={}) |
| bool | DoEditBox_Search (CLineInput *pLineInput, const CUIRect *pRect, float FontSize, bool HotkeyEnabled) |
| int | DoButton_Menu (CUIElement &UIElement, const CButtonContainer *pId, const std::function< const char *()> &GetTextLambda, const CUIRect *pRect, const SMenuButtonProperties &Props={}) |
| int | DoButton_FontIcon (CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, unsigned Flags, int Corners=IGraphics::CORNER_ALL, bool Enabled=true, std::optional< ColorRGBA > ButtonColor=std::nullopt) |
| int | DoButton_PopupMenu (CButtonContainer *pButtonContainer, const char *pText, const CUIRect *pRect, float Size, int Align, float Padding=0.0f, bool TransparentInactive=false, bool Enabled=true, std::optional< ColorRGBA > ButtonColor=std::nullopt) |
| SEditResult< int64_t > | DoValueSelectorWithState (const void *pId, const CUIRect *pRect, const char *pLabel, int64_t Current, int64_t Min, int64_t Max, const SValueSelectorProperties &Props={}) |
| int64_t | DoValueSelector (const void *pId, const CUIRect *pRect, const char *pLabel, int64_t Current, int64_t Min, int64_t Max, const SValueSelectorProperties &Props={}) |
| float | DoScrollbarV (const void *pId, const CUIRect *pRect, float Current) |
| float | DoScrollbarH (const void *pId, const CUIRect *pRect, float Current, const ColorRGBA *pColorInner=nullptr) |
| bool | DoScrollbarOption (const void *pId, int *pOption, const CUIRect *pRect, const char *pStr, int Min, int Max, const IScrollbarScale *pScale=&ms_LinearScrollbarScale, unsigned Flags=0u, const char *pSuffix="") |
| void | RenderProgressBar (CUIRect ProgressBar, float Progress) |
| void | RenderProgressSpinner (vec2 Center, float OuterRadius, const SProgressSpinnerProperties &Props={}) const |
| void | DoPopupMenu (const SPopupMenuId *pId, float X, float Y, float Width, float Height, void *pContext, FPopupMenuFunction pfnFunc, const SPopupMenuProperties &Props={}) |
| void | RenderPopupMenus () |
| void | ClosePopupMenu (const SPopupMenuId *pId, bool IncludeDescendants=false) |
| void | ClosePopupMenus () |
| bool | IsPopupOpen () const |
| bool | IsPopupOpen (const SPopupMenuId *pId) const |
| bool | IsPopupHovered () const |
| void | SetPopupMenuClosedCallback (FPopupMenuClosedCallback pfnCallback) |
| void | ShowPopupMessage (float X, float Y, SMessagePopupContext *pContext) |
| void | ShowPopupConfirm (float X, float Y, SConfirmPopupContext *pContext) |
| void | ShowPopupSelection (float X, float Y, SSelectionPopupContext *pContext) |
| void | ShowPopupColorPicker (float X, float Y, SColorPickerPopupContext *pContext) |
| int | DoDropDown (CUIRect *pRect, int CurSelection, const char **pStrs, int Num, SDropDownState &State) |
Static Public Member Functions | |
| static vec2 | CalcAlignedCursorPos (const CUIRect *pRect, vec2 TextSize, int Align, const float *pBiggestCharHeight=nullptr) |
Static Public Attributes | |
| static const CLinearScrollbarScale | ms_LinearScrollbarScale |
| static const CLogarithmicScrollbarScale | ms_LogarithmicScrollbarScale |
| static const CDarkButtonColorFunction | ms_DarkButtonColorFunction |
| static const CLightButtonColorFunction | ms_LightButtonColorFunction |
| static const CScrollBarColorFunction | ms_ScrollBarColorFunction |
| static const float | ms_FontmodHeight = 0.8f |
Private Member Functions | |
| void | UpdateClipping () |
Static Private Member Functions | |
| static CUi::EPopupMenuFunctionResult | PopupMessage (void *pContext, CUIRect View, bool Active) |
| static CUi::EPopupMenuFunctionResult | PopupConfirm (void *pContext, CUIRect View, bool Active) |
| static CUi::EPopupMenuFunctionResult | PopupSelection (void *pContext, CUIRect View, bool Active) |
| static CUi::EPopupMenuFunctionResult | PopupColorPicker (void *pContext, CUIRect View, bool Active) |
| typedef std::function<void()> CUi::FPopupMenuClosedCallback |
Callback that is called when one or more popups are closed.
| typedef EPopupMenuFunctionResult(* CUi::FPopupMenuFunction) (void *pContext, CUIRect View, bool Active) |
Callback that draws a popup menu.
| pContext | The context object of the popup menu. |
| View | The UI rect where the popup menu's contents should be drawn. |
| Active | Whether this popup is active (the top-most popup). Only the active popup should handle key and mouse events. |
| anonymous enum |
| enum CUi::EHotkey : unsigned |
These enum values are returned by popup menu functions to specify the behavior.
| CUi::CUi | ( | ) |
| CUi::~CUi | ( | ) |
|
inline |
| void CUi::AddUIElement | ( | CUIElement * | pElement | ) |
| float CUi::ButtonColorMul | ( | const void * | pId | ) |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
static |
|
inline |
|
inline |
|
inline |
|
inline |
| const CUIRect * CUi::ClipArea | ( | ) | const |
| void CUi::ClipDisable | ( | ) |
| void CUi::ClipEnable | ( | const CUIRect * | pRect | ) |
| void CUi::ClosePopupMenu | ( | const SPopupMenuId * | pId, |
| bool | IncludeDescendants = false ) |
| void CUi::ClosePopupMenus | ( | ) |
| bool CUi::ConsumeHotkey | ( | EHotkey | Hotkey | ) |
| void CUi::ConvertMouseMove | ( | float * | pX, |
| float * | pY, | ||
| IInput::ECursorType | CursorType ) const |
| void CUi::DebugRender | ( | float | X, |
| float | Y ) |
|
inline |
| int CUi::DoButton_FontIcon | ( | CButtonContainer * | pButtonContainer, |
| const char * | pText, | ||
| int | Checked, | ||
| const CUIRect * | pRect, | ||
| unsigned | Flags, | ||
| int | Corners = IGraphics::CORNER_ALL, | ||
| bool | Enabled = true, | ||
| std::optional< ColorRGBA > | ButtonColor = std::nullopt ) |
| int CUi::DoButton_Menu | ( | CUIElement & | UIElement, |
| const CButtonContainer * | pId, | ||
| const std::function< const char *()> & | GetTextLambda, | ||
| const CUIRect * | pRect, | ||
| const SMenuButtonProperties & | Props = {} ) |
| int CUi::DoButton_PopupMenu | ( | CButtonContainer * | pButtonContainer, |
| const char * | pText, | ||
| const CUIRect * | pRect, | ||
| float | Size, | ||
| int | Align, | ||
| float | Padding = 0.0f, | ||
| bool | TransparentInactive = false, | ||
| bool | Enabled = true, | ||
| std::optional< ColorRGBA > | ButtonColor = std::nullopt ) |
| int CUi::DoButtonLogic | ( | const void * | pId, |
| int | Checked, | ||
| const CUIRect * | pRect, | ||
| unsigned | Flags ) |
| bool CUi::DoClearableEditBox | ( | CLineInput * | pLineInput, |
| const CUIRect * | pRect, | ||
| float | FontSize, | ||
| int | Corners = IGraphics::CORNER_ALL, | ||
| const std::vector< STextColorSplit > & | vColorSplits = {} ) |
Creates an input field with a clear [x] button attached to it.
| pLineInput | This pointer will be stored and written to on next user input. So you can not pass in a pointer that goes out of scope such as a local variable. Pass in either a member variable of the current class or a static variable. For example static CLineInputBuffered<IO_MAX_PATH_LENGTH> s_MyInput; |
| pRect | the UI rect it will attach to |
| FontSize | Size of the font (10.0f, 12.0f and 14.0f are commonly used here) |
| Corners | Number of corners (default: IGraphics::CORNER_ALL) |
| vColorSplits | Sets color splits of the CTextCursor to allow multicolored text |
| bool CUi::DoDoubleClickLogic | ( | const void * | pId | ) |
| int CUi::DoDraggableButtonLogic | ( | const void * | pId, |
| int | Checked, | ||
| const CUIRect * | pRect, | ||
| bool * | pClicked, | ||
| bool * | pAbrupted ) |
| int CUi::DoDropDown | ( | CUIRect * | pRect, |
| int | CurSelection, | ||
| const char ** | pStrs, | ||
| int | Num, | ||
| SDropDownState & | State ) |
| bool CUi::DoEditBox | ( | CLineInput * | pLineInput, |
| const CUIRect * | pRect, | ||
| float | FontSize, | ||
| int | Corners = IGraphics::CORNER_ALL, | ||
| const std::vector< STextColorSplit > & | vColorSplits = {} ) |
Creates an input field.
| pLineInput | This pointer will be stored and written to on next user input. So you can not pass in a pointer that goes out of scope such as a local variable. Pass in either a member variable of the current class or a static variable. For example static CLineInputBuffered<IO_MAX_PATH_LENGTH> s_MyInput; |
| pRect | the UI rect it will attach to with a 2.0f margin |
| FontSize | Size of the font (10.0f, 12.0f and 14.0f are commonly used here) |
| Corners | Number of corners (default: IGraphics::CORNER_ALL) |
| vColorSplits | Sets color splits of the CTextCursor to allow multicolored text |
| bool CUi::DoEditBox_Search | ( | CLineInput * | pLineInput, |
| const CUIRect * | pRect, | ||
| float | FontSize, | ||
| bool | HotkeyEnabled ) |
Creates an input field with a search icon and a clear [x] button attached to it. The input will have default text "Search" and the hotkey Ctrl+F can be used to activate the input.
| pLineInput | This pointer will be stored and written to on next user input. So you can not pass in a pointer that goes out of scope such as a local variable. Pass in either a member variable of the current class or a static variable. For example static CLineInputBuffered<IO_MAX_PATH_LENGTH> s_MyInput; |
| pRect | the UI rect it will attach to |
| FontSize | Size of the font (10.0f, 12.0f and 14.0f are commonly used here) |
| HotkeyEnabled | Whether the hotkey to enable this editbox is currently enabled. |
| CLabelResult CUi::DoLabel | ( | const CUIRect * | pRect, |
| const char * | pText, | ||
| float | Size, | ||
| int | Align, | ||
| const SLabelProperties & | LabelProps = {} ) const |
| void CUi::DoLabel | ( | CUIElement::SUIElementRect & | RectEl, |
| const CUIRect * | pRect, | ||
| const char * | pText, | ||
| float | Size, | ||
| int | Align, | ||
| const SLabelProperties & | LabelProps = {}, | ||
| int | StrLen = -1, | ||
| const CTextCursor * | pReadCursor = nullptr ) const |
| CLabelResult CUi::DoLabel_AutoLineSize | ( | const char * | pText, |
| float | FontSize, | ||
| int | Align, | ||
| CUIRect * | pRect, | ||
| float | LineSize, | ||
| const SLabelProperties & | LabelProps = {} ) const |
| void CUi::DoLabelStreamed | ( | CUIElement::SUIElementRect & | RectEl, |
| const CUIRect * | pRect, | ||
| const char * | pText, | ||
| float | Size, | ||
| int | Align, | ||
| const SLabelProperties & | LabelProps = {}, | ||
| int | StrLen = -1, | ||
| const CTextCursor * | pReadCursor = nullptr ) const |
| EEditState CUi::DoPickerLogic | ( | const void * | pId, |
| const CUIRect * | pRect, | ||
| float * | pX, | ||
| float * | pY ) |
| void CUi::DoPopupMenu | ( | const SPopupMenuId * | pId, |
| float | X, | ||
| float | Y, | ||
| float | Width, | ||
| float | Height, | ||
| void * | pContext, | ||
| FPopupMenuFunction | pfnFunc, | ||
| const SPopupMenuProperties & | Props = {} ) |
| float CUi::DoScrollbarH | ( | const void * | pId, |
| const CUIRect * | pRect, | ||
| float | Current, | ||
| const ColorRGBA * | pColorInner = nullptr ) |
| bool CUi::DoScrollbarOption | ( | const void * | pId, |
| int * | pOption, | ||
| const CUIRect * | pRect, | ||
| const char * | pStr, | ||
| int | Min, | ||
| int | Max, | ||
| const IScrollbarScale * | pScale = &ms_LinearScrollbarScale, | ||
| unsigned | Flags = 0u, | ||
| const char * | pSuffix = "" ) |
| float CUi::DoScrollbarV | ( | const void * | pId, |
| const CUIRect * | pRect, | ||
| float | Current ) |
| void CUi::DoSmoothScrollLogic | ( | float * | pScrollOffset, |
| float * | pScrollOffsetChange, | ||
| float | ViewPortSize, | ||
| float | TotalSize, | ||
| bool | SmoothClamp = false, | ||
| float | ScrollSpeed = 10.0f ) const |
| int64_t CUi::DoValueSelector | ( | const void * | pId, |
| const CUIRect * | pRect, | ||
| const char * | pLabel, | ||
| int64_t | Current, | ||
| int64_t | Min, | ||
| int64_t | Max, | ||
| const SValueSelectorProperties & | Props = {} ) |
| SEditResult< int64_t > CUi::DoValueSelectorWithState | ( | const void * | pId, |
| const CUIRect * | pRect, | ||
| const char * | pLabel, | ||
| int64_t | Current, | ||
| int64_t | Min, | ||
| int64_t | Max, | ||
| const SValueSelectorProperties & | Props = {} ) |
|
inline |
|
inline |
|
inline |
| CUIElement * CUi::GetNewUIElement | ( | int | RequestedRectCount | ) |
|
inline |
|
inline |
|
inline |
| void CUi::Init | ( | IKernel * | pKernel | ) |
|
inline |
|
inline |
| bool CUi::IsPopupHovered | ( | ) | const |
| bool CUi::IsPopupOpen | ( | ) | const |
| bool CUi::IsPopupOpen | ( | const SPopupMenuId * | pId | ) | const |
| void CUi::MapScreen | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| bool CUi::MouseInside | ( | const CUIRect * | pRect | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void CUi::OnCursorMove | ( | float | X, |
| float | Y ) |
| void CUi::OnElementsReset | ( | ) |
| bool CUi::OnInput | ( | const IInput::CEvent & | Event | ) |
| void CUi::OnWindowResize | ( | ) |
| float CUi::PixelSize | ( | ) |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
| void CUi::RenderPopupMenus | ( | ) |
| void CUi::RenderProgressBar | ( | CUIRect | ProgressBar, |
| float | Progress ) |
| void CUi::RenderProgressSpinner | ( | vec2 | Center, |
| float | OuterRadius, | ||
| const SProgressSpinnerProperties & | Props = {} ) const |
|
inline |
| void CUi::ResetUIElement | ( | CUIElement & | UIElement | ) | const |
| const CUIRect * CUi::Screen | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
| void CUi::SetPopupMenuClosedCallback | ( | FPopupMenuClosedCallback | pfnCallback | ) |
| void CUi::ShowPopupColorPicker | ( | float | X, |
| float | Y, | ||
| SColorPickerPopupContext * | pContext ) |
| void CUi::ShowPopupConfirm | ( | float | X, |
| float | Y, | ||
| SConfirmPopupContext * | pContext ) |
| void CUi::ShowPopupMessage | ( | float | X, |
| float | Y, | ||
| SMessagePopupContext * | pContext ) |
| void CUi::ShowPopupSelection | ( | float | X, |
| float | Y, | ||
| SSelectionPopupContext * | pContext ) |
|
inline |
|
inline |
|
private |
|
inline |
|
inline |
| void CUi::UpdateTouchState | ( | CTouchState & | State | ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |