DDraceNetwork Docs
CLineInput Class Reference

#include <lineinput.h>

Inheritance diagram for CLineInput:
[legend]
Collaboration diagram for CLineInput:
[legend]

Classes

struct  SMouseSelection
 

Public Types

typedef std::function< void(const char *pLine)> FClipboardLineCallback
 
typedef std::function< const char *(char *pCurrentText, size_t NumChars)> FDisplayTextCallback
 
typedef std::function< bool()> FCalculateOffsetCallback
 

Public Member Functions

 CLineInput ()
 
 CLineInput (char *pStr, size_t MaxSize)
 
 CLineInput (char *pStr, size_t MaxSize, size_t MaxChars)
 
void SetBuffer (char *pStr, size_t MaxSize)
 
void SetBuffer (char *pStr, size_t MaxSize, size_t MaxChars)
 
void Clear ()
 
void Set (const char *pString)
 
void SetRange (const char *pString, size_t Begin, size_t End)
 
void Insert (const char *pString, size_t Begin)
 
void Append (const char *pString)
 
const char * GetString () const
 
const char * GetDisplayedString ()
 
size_t GetMaxSize () const
 
size_t GetMaxChars () const
 
size_t GetLength () const
 
size_t GetNumChars () const
 
bool IsEmpty () const
 
size_t GetCursorOffset () const
 
void SetCursorOffset (size_t Offset)
 
size_t GetSelectionStart () const
 
size_t GetSelectionEnd () const
 
size_t GetSelectionLength () const
 
bool HasSelection () const
 
void SetSelection (size_t Start, size_t End)
 
void SelectNothing ()
 
void SelectAll ()
 
size_t OffsetFromActualToDisplay (size_t ActualOffset)
 
size_t OffsetFromDisplayToActual (size_t DisplayOffset)
 
float GetScrollOffset () const
 
void SetScrollOffset (float ScrollOffset)
 
float GetScrollOffsetChange () const
 
void SetScrollOffsetChange (float ScrollOffsetChange)
 
vec2 GetCaretPosition () const
 
bool IsHidden () const
 
void SetHidden (bool Hidden)
 
const char * GetEmptyText () const
 
void SetEmptyText (const char *pText)
 
void SetClipboardLineCallback (FClipboardLineCallback pfnClipboardLineCallback)
 
void SetDisplayTextCallback (FDisplayTextCallback pfnDisplayTextCallback)
 
void SetCalculateOffsetCallback (FCalculateOffsetCallback pfnCalculateOffsetCallback)
 
bool ProcessInput (const IInput::CEvent &Event)
 
bool WasChanged ()
 
bool WasCursorChanged ()
 
STextBoundingBox Render (const CUIRect *pRect, float FontSize, int Align, bool Changed, float LineWidth, float LineSpacing, const std::vector< STextColorSplit > &vColorSplits={})
 
SMouseSelectionGetMouseSelection ()
 
const void * GetClearButtonId () const
 
bool IsActive () const
 
void Activate (EInputPriority Priority)
 
void Deactivate () const
 

Static Public Member Functions

static void Init (IClient *pClient, IGraphics *pGraphics, IInput *pInput, ITextRender *pTextRender)
 
static void RenderCandidates ()
 
static CLineInputGetActiveInput ()
 

Private Types

enum  EMoveDirection { FORWARD , REWIND }
 

Private Member Functions

void UpdateStrData ()
 
void OnActivate ()
 
void OnDeactivate ()
 

Static Private Member Functions

static IClientClient ()
 
static IGraphicsGraphics ()
 
static IInputInput ()
 
static ITextRenderTextRender ()
 
static void MoveCursor (EMoveDirection Direction, bool MoveWord, const char *pStr, size_t MaxSize, size_t *pCursorPos)
 
static void SetCompositionWindowPosition (vec2 Anchor, float LineHeight)
 

Private Attributes

char * m_pStr = nullptr
 
size_t m_MaxSize
 
size_t m_MaxChars
 
size_t m_Len
 
size_t m_NumChars
 
size_t m_CursorPos
 
size_t m_SelectionStart
 
size_t m_SelectionEnd
 
float m_ScrollOffset
 
float m_ScrollOffsetChange
 
vec2 m_CaretPosition
 
SMouseSelection m_MouseSelection
 
size_t m_LastCompositionCursorPos
 
bool m_Hidden
 
const char * m_pEmptyText
 
FClipboardLineCallback m_pfnClipboardLineCallback
 
FDisplayTextCallback m_pfnDisplayTextCallback
 
FCalculateOffsetCallback m_pfnCalculateOffsetCallback
 
bool m_WasChanged
 
bool m_WasCursorChanged
 
bool m_WasRendered
 
char m_ClearButtonId
 

Static Private Attributes

static IClientms_pClient = nullptr
 
static IGraphicsms_pGraphics = nullptr
 
static IInputms_pInput = nullptr
 
static ITextRenderms_pTextRender = nullptr
 
static CLineInputms_pActiveInput = nullptr
 
static EInputPriority ms_ActiveInputPriority = EInputPriority::NONE
 
static vec2 ms_CompositionWindowPosition = vec2(0.0f, 0.0f)
 
static float ms_CompositionLineHeight = 0.0f
 
static char ms_aStars [128] = {'\0'}
 

Member Typedef Documentation

◆ FCalculateOffsetCallback

typedef std::function<bool()> CLineInput::FCalculateOffsetCallback

◆ FClipboardLineCallback

typedef std::function<void(const char *pLine)> CLineInput::FClipboardLineCallback

◆ FDisplayTextCallback

typedef std::function<const char *(char *pCurrentText, size_t NumChars)> CLineInput::FDisplayTextCallback

Member Enumeration Documentation

◆ EMoveDirection

Enumerator
FORWARD 
REWIND 

Constructor & Destructor Documentation

◆ CLineInput() [1/3]

CLineInput::CLineInput ( )
inline

◆ CLineInput() [2/3]

CLineInput::CLineInput ( char *  pStr,
size_t  MaxSize 
)
inline

◆ CLineInput() [3/3]

CLineInput::CLineInput ( char *  pStr,
size_t  MaxSize,
size_t  MaxChars 
)
inline

Member Function Documentation

◆ Activate()

void CLineInput::Activate ( EInputPriority  Priority)

◆ Append()

void CLineInput::Append ( const char *  pString)

◆ Clear()

void CLineInput::Clear ( )

◆ Client()

static IClient * CLineInput::Client ( )
inlinestaticprivate

◆ Deactivate()

void CLineInput::Deactivate ( ) const

◆ GetActiveInput()

static CLineInput * CLineInput::GetActiveInput ( )
inlinestatic

◆ GetCaretPosition()

vec2 CLineInput::GetCaretPosition ( ) const
inline

◆ GetClearButtonId()

const void * CLineInput::GetClearButtonId ( ) const
inline

◆ GetCursorOffset()

size_t CLineInput::GetCursorOffset ( ) const
inline

◆ GetDisplayedString()

const char * CLineInput::GetDisplayedString ( )

◆ GetEmptyText()

const char * CLineInput::GetEmptyText ( ) const
inline

◆ GetLength()

size_t CLineInput::GetLength ( ) const
inline

◆ GetMaxChars()

size_t CLineInput::GetMaxChars ( ) const
inline

◆ GetMaxSize()

size_t CLineInput::GetMaxSize ( ) const
inline

◆ GetMouseSelection()

SMouseSelection * CLineInput::GetMouseSelection ( )
inline

◆ GetNumChars()

size_t CLineInput::GetNumChars ( ) const
inline

◆ GetScrollOffset()

float CLineInput::GetScrollOffset ( ) const
inline

◆ GetScrollOffsetChange()

float CLineInput::GetScrollOffsetChange ( ) const
inline

◆ GetSelectionEnd()

size_t CLineInput::GetSelectionEnd ( ) const
inline

◆ GetSelectionLength()

size_t CLineInput::GetSelectionLength ( ) const
inline

◆ GetSelectionStart()

size_t CLineInput::GetSelectionStart ( ) const
inline

◆ GetString()

const char * CLineInput::GetString ( ) const
inline

◆ Graphics()

static IGraphics * CLineInput::Graphics ( )
inlinestaticprivate

◆ HasSelection()

bool CLineInput::HasSelection ( ) const
inline

◆ Init()

static void CLineInput::Init ( IClient pClient,
IGraphics pGraphics,
IInput pInput,
ITextRender pTextRender 
)
inlinestatic

◆ Input()

static IInput * CLineInput::Input ( )
inlinestaticprivate

◆ Insert()

void CLineInput::Insert ( const char *  pString,
size_t  Begin 
)

◆ IsActive()

bool CLineInput::IsActive ( ) const
inline

◆ IsEmpty()

bool CLineInput::IsEmpty ( ) const
inline

◆ IsHidden()

bool CLineInput::IsHidden ( ) const
inline

◆ MoveCursor()

void CLineInput::MoveCursor ( EMoveDirection  Direction,
bool  MoveWord,
const char *  pStr,
size_t  MaxSize,
size_t *  pCursorPos 
)
staticprivate

◆ OffsetFromActualToDisplay()

size_t CLineInput::OffsetFromActualToDisplay ( size_t  ActualOffset)

◆ OffsetFromDisplayToActual()

size_t CLineInput::OffsetFromDisplayToActual ( size_t  DisplayOffset)

◆ OnActivate()

void CLineInput::OnActivate ( )
private

◆ OnDeactivate()

void CLineInput::OnDeactivate ( )
private

◆ ProcessInput()

bool CLineInput::ProcessInput ( const IInput::CEvent Event)

◆ Render()

STextBoundingBox CLineInput::Render ( const CUIRect pRect,
float  FontSize,
int  Align,
bool  Changed,
float  LineWidth,
float  LineSpacing,
const std::vector< STextColorSplit > &  vColorSplits = {} 
)

◆ RenderCandidates()

void CLineInput::RenderCandidates ( )
static

◆ SelectAll()

void CLineInput::SelectAll ( )
inline

◆ SelectNothing()

void CLineInput::SelectNothing ( )
inline

◆ Set()

void CLineInput::Set ( const char *  pString)

◆ SetBuffer() [1/2]

void CLineInput::SetBuffer ( char *  pStr,
size_t  MaxSize 
)
inline

◆ SetBuffer() [2/2]

void CLineInput::SetBuffer ( char *  pStr,
size_t  MaxSize,
size_t  MaxChars 
)

◆ SetCalculateOffsetCallback()

void CLineInput::SetCalculateOffsetCallback ( FCalculateOffsetCallback  pfnCalculateOffsetCallback)
inline

◆ SetClipboardLineCallback()

void CLineInput::SetClipboardLineCallback ( FClipboardLineCallback  pfnClipboardLineCallback)
inline

◆ SetCompositionWindowPosition()

void CLineInput::SetCompositionWindowPosition ( vec2  Anchor,
float  LineHeight 
)
staticprivate

◆ SetCursorOffset()

void CLineInput::SetCursorOffset ( size_t  Offset)

◆ SetDisplayTextCallback()

void CLineInput::SetDisplayTextCallback ( FDisplayTextCallback  pfnDisplayTextCallback)
inline

◆ SetEmptyText()

void CLineInput::SetEmptyText ( const char *  pText)
inline

◆ SetHidden()

void CLineInput::SetHidden ( bool  Hidden)
inline

◆ SetRange()

void CLineInput::SetRange ( const char *  pString,
size_t  Begin,
size_t  End 
)

◆ SetScrollOffset()

void CLineInput::SetScrollOffset ( float  ScrollOffset)
inline

◆ SetScrollOffsetChange()

void CLineInput::SetScrollOffsetChange ( float  ScrollOffsetChange)
inline

◆ SetSelection()

void CLineInput::SetSelection ( size_t  Start,
size_t  End 
)

◆ TextRender()

static ITextRender * CLineInput::TextRender ( )
inlinestaticprivate

◆ UpdateStrData()

void CLineInput::UpdateStrData ( )
private

◆ WasChanged()

bool CLineInput::WasChanged ( )
inline

◆ WasCursorChanged()

bool CLineInput::WasCursorChanged ( )
inline

Member Data Documentation

◆ m_CaretPosition

vec2 CLineInput::m_CaretPosition
private

◆ m_ClearButtonId

char CLineInput::m_ClearButtonId
private

◆ m_CursorPos

size_t CLineInput::m_CursorPos
private

◆ m_Hidden

bool CLineInput::m_Hidden
private

◆ m_LastCompositionCursorPos

size_t CLineInput::m_LastCompositionCursorPos
private

◆ m_Len

size_t CLineInput::m_Len
private

◆ m_MaxChars

size_t CLineInput::m_MaxChars
private

◆ m_MaxSize

size_t CLineInput::m_MaxSize
private

◆ m_MouseSelection

SMouseSelection CLineInput::m_MouseSelection
private

◆ m_NumChars

size_t CLineInput::m_NumChars
private

◆ m_pEmptyText

const char* CLineInput::m_pEmptyText
private

◆ m_pfnCalculateOffsetCallback

FCalculateOffsetCallback CLineInput::m_pfnCalculateOffsetCallback
private

◆ m_pfnClipboardLineCallback

FClipboardLineCallback CLineInput::m_pfnClipboardLineCallback
private

◆ m_pfnDisplayTextCallback

FDisplayTextCallback CLineInput::m_pfnDisplayTextCallback
private

◆ m_pStr

char* CLineInput::m_pStr = nullptr
private

◆ m_ScrollOffset

float CLineInput::m_ScrollOffset
private

◆ m_ScrollOffsetChange

float CLineInput::m_ScrollOffsetChange
private

◆ m_SelectionEnd

size_t CLineInput::m_SelectionEnd
private

◆ m_SelectionStart

size_t CLineInput::m_SelectionStart
private

◆ m_WasChanged

bool CLineInput::m_WasChanged
private

◆ m_WasCursorChanged

bool CLineInput::m_WasCursorChanged
private

◆ m_WasRendered

bool CLineInput::m_WasRendered
private

◆ ms_ActiveInputPriority

EInputPriority CLineInput::ms_ActiveInputPriority = EInputPriority::NONE
staticprivate

◆ ms_aStars

char CLineInput::ms_aStars = {'\0'}
staticprivate

◆ ms_CompositionLineHeight

float CLineInput::ms_CompositionLineHeight = 0.0f
staticprivate

◆ ms_CompositionWindowPosition

vec2 CLineInput::ms_CompositionWindowPosition = vec2(0.0f, 0.0f)
staticprivate

◆ ms_pActiveInput

CLineInput * CLineInput::ms_pActiveInput = nullptr
staticprivate

◆ ms_pClient

IClient * CLineInput::ms_pClient = nullptr
staticprivate

◆ ms_pGraphics

IGraphics * CLineInput::ms_pGraphics = nullptr
staticprivate

◆ ms_pInput

IInput * CLineInput::ms_pInput = nullptr
staticprivate

◆ ms_pTextRender

ITextRender * CLineInput::ms_pTextRender = nullptr
staticprivate

The documentation for this class was generated from the following files: