Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CInput Class Reference

Text field where you can input and edit the text. More...

#include <CInput.h>

Inheritance diagram for CInput:
IGUIScrollBarOwner IGUIObject

Classes

struct  SRow
 

Public Member Functions

 CInput ()
 
virtual ~CInput ()
 
virtual void ResetStates ()
 
int GetMouseHoveringTextPosition ()
 
int GetXTextPosition (const std::list< SRow >::iterator &c, const float &x, float &wanted)
 
- Public Member Functions inherited from IGUIScrollBarOwner
 IGUIScrollBarOwner ()
 
virtual ~IGUIScrollBarOwner ()
 
virtual const SGUIScrollBarStyleGetScrollBarStyle (const CStr &style) const
 Interface for the m_ScrollBar to use. More...
 
virtual void AddScrollBar (IGUIScrollBar *scrollbar)
 Add a scroll-bar. More...
 
virtual IGUIScrollBarGetScrollBar (const int &index)
 Get Scroll Bar reference (it should be transparent it's actually pointers). More...
 
- Public Member Functions inherited from IGUIObject
 IGUIObject ()
 
virtual ~IGUIObject ()
 
virtual bool MouseOver ()
 Checks if mouse is hovering this object. More...
 
virtual bool MouseOverIcon ()
 Test if mouse position is over an icon. More...
 
const CStr & GetName () const
 Get object name, name is unique. More...
 
void SetName (const CStr &Name)
 Get object name. More...
 
CStr GetPresentableName () const
 
void AddToPointersMap (map_pObjects &ObjectMap)
 Adds object and its children to the map, it's name being the first part, and the second being itself. More...
 
void AddChild (IGUIObject *pChild)
 Notice nothing will be returned or thrown if the child hasn't been inputted into the GUI yet. More...
 
vector_pObjects::iterator ChildrenItBegin ()
 
vector_pObjects::iterator ChildrenItEnd ()
 
bool SettingExists (const CStr &Setting) const
 Checks if settings exists, only available for derived classes that has this set up, that's why the base class just returns false. More...
 
PSRETURN SetSetting (const CStr &Setting, const CStrW &Value, const bool &SkipMessage=false)
 Set a setting by string, regardless of what type it is. More...
 
PSRETURN GetSettingType (const CStr &Setting, EGUISettingType &Type) const
 Retrieves the type of a named setting. More...
 
void RegisterScriptHandler (const CStr &Action, const CStr &Code, CGUI *pGUI)
 Set the script handler for a particular object-specific action. More...
 
JSObject * GetJSObject ()
 Retrieves the JSObject representing this GUI object. More...
 
CGUIGetGUI ()
 
const CGUIGetGUI () const
 
void SetFocus ()
 Take focus! More...
 

Protected Member Functions

virtual void HandleMessage (SGUIMessage &Message)
 
virtual InReaction ManuallyHandleEvent (const SDL_Event_ *ev)
 Handle events manually to catch keyboard inputting. More...
 
virtual InReaction ManuallyHandleHotkeyEvent (const SDL_Event_ *ev)
 Handle hotkey events (called by ManuallyHandleEvent) More...
 
virtual void UpdateCachedSize ()
 
virtual void Draw ()
 Draws the Text. More...
 
void UpdateText (int from=0, int to_before=-1, int to_after=-1)
 
void DeleteCurSelection ()
 
bool SelectingText () const
 
float GetTextAreaWidth ()
 
void UpdateAutoScroll ()
 
- Protected Member Functions inherited from IGUIObject
void AddSetting (const EGUISettingType &Type, const CStr &Name)
 Add a setting to m_Settings. More...
 
virtual void Destroy ()
 Calls Destroy on all children, and deallocates all memory. More...
 
void LoadStyle (CGUI &GUIinstance, const CStr &StyleName)
 Loads a style. More...
 
void LoadStyle (const SGUIStyle &Style)
 Loads a style. More...
 
virtual float GetBufferedZ () const
 Returns not the Z value, but the actual buffered Z value, i.e. More...
 
void SetGUI (CGUI *const &pGUI)
 
void SetParent (IGUIObject *pParent)
 Set parent of this object. More...
 
bool IsFocused () const
 Check if object is focused. More...
 
IGUIObjectGetParent () const
 NOTE! This will not just return m_pParent, when that is need use it! There is one exception to it, when the parent is the top-node (the object that isn't a real object), this will return NULL, so that the top-node's children are seemingly parentless. More...
 
CPos GetMousePos () const
 Get Mouse from CGUI. More...
 
virtual bool HandleAdditionalChildren (const XMBElement &child, CXeromyces *pFile)
 Handle additional children to the <object>-tag. More...
 
InReaction SendEvent (EGUIMessageType type, const CStr &EventName)
 Send event to this GUI object (HandleMessage and ScriptEvent) More...
 
void ScriptEvent (const CStr &Action)
 Execute the script for a particular action. More...
 
void ScriptEvent (const CStr &Action, const CScriptValRooted &Argument)
 Execute the script for a particular action. More...
 
void SetScriptHandler (const CStr &Action, JSObject *Function)
 
void UpdateMouseOver (IGUIObject *const &pMouseOver)
 Inputes the object that is currently hovered, this function updates this object accordingly (i.e. More...
 

Protected Attributes

int m_iBufferPos
 
int m_iBufferPos_Tail
 
std::list< SRowm_CharacterPositions
 
float m_WantedX
 
bool m_SelectingText
 
float m_HorizontalScroll
 
double m_PrevTime
 
double m_CursorBlinkRate
 
bool m_CursorVisState
 
- Protected Attributes inherited from IGUIScrollBarOwner
std::vector< IGUIScrollBar * > m_ScrollBars
 Predominately you will only have one, but you can have as many as you like. More...
 
- Protected Attributes inherited from IGUIObject
CRect m_CachedActualSize
 Cached size, real size m_Size is actually dependent on resolution and can have different real outcomes, this is the real outcome cached to avoid slow calculations in real time. More...
 
CStr m_Name
 
vector_pObjects m_Children
 
IGUIObjectm_pParent
 
double m_LastClickTime [6]
 
bool m_MouseHovering
 This is an array of true or false, each element is associated with a string representing a setting. More...
 

Detailed Description

Text field where you can input and edit the text.

It doesn't use IGUITextOwner, because we don't need any other features than word-wrapping, and we need to be able to rapidly change the string.

See Also
IGUIObject

Definition at line 63 of file CInput.h.

Constructor & Destructor Documentation

CInput::CInput ( )

Definition at line 46 of file CInput.cpp.

CInput::~CInput ( )
virtual

Definition at line 74 of file CInput.cpp.

Member Function Documentation

void CInput::DeleteCurSelection ( )
protected

Definition at line 1863 of file CInput.cpp.

void CInput::Draw ( )
protectedvirtual

Draws the Text.

Reimplemented from IGUIScrollBarOwner.

Definition at line 997 of file CInput.cpp.

int CInput::GetMouseHoveringTextPosition ( )

Definition at line 1749 of file CInput.cpp.

float CInput::GetTextAreaWidth ( )
protected

Definition at line 1897 of file CInput.cpp.

int CInput::GetXTextPosition ( const std::list< SRow >::iterator &  c,
const float &  x,
float &  wanted 
)

Definition at line 1830 of file CInput.cpp.

void CInput::HandleMessage ( SGUIMessage Message)
protectedvirtual
See Also
IGUIObject::HandleMessage()

Reimplemented from IGUIScrollBarOwner.

Definition at line 697 of file CInput.cpp.

InReaction CInput::ManuallyHandleEvent ( const SDL_Event_ ev)
protectedvirtual

Handle events manually to catch keyboard inputting.

Conventions for Left/Right when text is selected:

References:

Visual Studio Visual Studio has the 'newer' approach, used by newer versions of things, and in newer applications. A left press will always place the pointer on the left edge of the selection, and then of course remove the selection. Right will do the exakt same thing. If you have the pointer on the right edge and press right, it will in other words just remove the selection.

Windows (eg. Notepad) A left press always takes the pointer a step to the left and removes the selection as if it were never there in the first place. Right of course does the same thing but to the right.

I chose the Visual Studio convention. Used also in Word, gtk 2.0, MSN Messenger.

Conventions for Up/Down when text is selected:

References:

Visual Studio Visual Studio has a very strange approach, down takes you below the selection to the next row, and up to the one prior to the whole selection. The weird part is that it is always aligned as the 'pointer'. I decided this is to much work for something that is a bit arbitrary

Windows (eg. Notepad) Just like with left/right, the selection is destroyed and it moves just as if there never were a selection.

I chose the Notepad convention even though I use the VS convention with left/right.

Reimplemented from IGUIObject.

Definition at line 78 of file CInput.cpp.

InReaction CInput::ManuallyHandleHotkeyEvent ( const SDL_Event_ ev)
protectedvirtual

Handle hotkey events (called by ManuallyHandleEvent)

Definition at line 448 of file CInput.cpp.

virtual void CInput::ResetStates ( )
inlinevirtual
See Also
IGUIObject::ResetStates()

Reimplemented from IGUIScrollBarOwner.

Definition at line 77 of file CInput.h.

bool CInput::SelectingText ( ) const
protected

Definition at line 1891 of file CInput.cpp.

void CInput::UpdateAutoScroll ( )
protected

Definition at line 1910 of file CInput.cpp.

void CInput::UpdateCachedSize ( )
protectedvirtual
See Also
IGUIObject::UpdateCachedSize()

Reimplemented from IGUIObject.

Definition at line 979 of file CInput.cpp.

void CInput::UpdateText ( int  from = 0,
int  to_before = -1,
int  to_after = -1 
)
protected

Definition at line 1378 of file CInput.cpp.

Member Data Documentation

std::list< SRow > CInput::m_CharacterPositions
protected

Definition at line 167 of file CInput.h.

double CInput::m_CursorBlinkRate
protected

Definition at line 190 of file CInput.h.

bool CInput::m_CursorVisState
protected

Definition at line 193 of file CInput.h.

float CInput::m_HorizontalScroll
protected

Definition at line 184 of file CInput.h.

int CInput::m_iBufferPos
protected

Definition at line 150 of file CInput.h.

int CInput::m_iBufferPos_Tail
protected

Definition at line 150 of file CInput.h.

double CInput::m_PrevTime
protected

Definition at line 187 of file CInput.h.

bool CInput::m_SelectingText
protected

Definition at line 181 of file CInput.h.

float CInput::m_WantedX
protected

Definition at line 177 of file CInput.h.


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