GlistEngine
Loading...
Searching...
No Matches
gGUITextbox Class Reference

#include <gGUITextbox.h>

Inheritance diagram for gGUITextbox:
Collaboration diagram for gGUITextbox:

Public Member Functions

 gGUITextbox ()
virtual ~gGUITextbox ()
void set (gBaseApp *root, gBaseGUIObject *topParentGUIObject, gBaseGUIObject *parentGUIObject, int parentSlotLineNo, int parentSlotColumnNo, int x, int y, int w, int h) override
void setText (const std::string &text)
std::string getText ()
void setSelection (int startChar, int endChar)
void selectAll ()
std::string getSelectedText ()
void copyText ()
void cutText ()
void pasteText ()
void showAndroidSelectionMenu ()
void hideAndroidSelectionMenu ()
void longPressed (int x, int y)
void setEditable (bool isEditable)
bool isEditable ()
void setLineCount (int linecount)
int getLineCount ()
int getCursor (int x, int y) override
void setSize (int width, int height)
void setNumeric (bool isNumeric)
bool isNumeric ()
void addLeftMargin (int left)
void addTopMargin (int top)
void setLineTopMargin (int linetopmargin)
void setPassword (bool isPassword)
bool isPassword ()
void enableBackground (bool isEnabled)
void enableVerticalMargin (bool isAligned)
bool isBackgroundEnabled ()
void update () override
void draw () override
void keyPressed (int key) override
void keyReleased (int key) override
void charPressed (unsigned int codepoint) override
void mousePressed (int x, int y, int button) override
void mouseReleased (int x, int y, int button) override
void mouseDragged (int x, int y, int button) override
void unfocus () override
int getTextboxh ()
void cleanText ()
void setFirstX (int firstx)
void setFirstY (int firsty)
int getInitX ()
void setTextFont (gFont *textFont)
void setFont (gFont *font)
void setTextAlignment (int textAlignment, float cellW, int initX)
void setTextColor (gColor *textColor)
int getCursorPosX ()
void setCursorPosX (int cursorPosX, int length)
int getCursorPosChar ()
int getCursorPosUTF ()
int getCursorPreviousPosUTF ()
void setDisabled (bool isDisabled)
void setEditMode (bool editMode)
int calculateContentHeight () override
void setHintText (const std::string &hintText)
gGUIText * getHintText ()
void setHintTextColor (const gColor &color)
gGUIText * getHintTextObject ()
void enableBBCode (bool isEnabled=true)
bool isBBCodeEnabled () const
std::string getPlainText ()
void setBBCodeBoldFont (gFont *font)
void setBBCodeItalicFont (gFont *font)
void setBBCodeBoldItalicFont (gFont *font)
void setBBCodeCodeFont (gFont *font)
void setBBCodeCodeBackgroundColor (const gColor &color)
void setBBCodeCodeTextColor (const gColor &color)
Public Member Functions inherited from gGUIControl
 gGUIControl ()
virtual ~gGUIControl () override
virtual bool countAsSpace ()
void setCountAsSpace (bool isSpace)
void setFont (gFont *font)
gFont * getFont ()
Public Member Functions inherited from gBaseGUIObject
 gBaseGUIObject ()
virtual ~gBaseGUIObject ()
int getId ()
int getType ()
void setEnabled (bool isEnabled)
bool isEnabled ()
void setVisible (bool isVisible)
bool isVisible ()
void setTitleOn (bool isTitleOn)
bool isTitleOn ()
virtual void setTopParent (gBaseGUIObject *parentGUIObject)
gBaseGUIObject * getTopParent ()
virtual void setParent (gBaseGUIObject *parentGUIObject)
gBaseGUIObject * getParent ()
void setParentSlotNo (int parentSlotLineNo, int parentSlotColumnNo)
int getParentSlotLineNo ()
int getParentSlotColumnNo ()
void setTitle (std::string title)
std::string getTitle ()
virtual void mouseMoved (int x, int y)
virtual void mouseScrolled (int x, int y)
virtual void mouseEntered ()
virtual void mouseExited ()
virtual void windowResized (int w, int h)
virtual void onGUIEvent (int guiObjectId, int eventType, int sourceEventType, std::string value1="", std::string value2="")
void setRootApp (gBaseApp *root)
virtual void setCursorOn (bool isOn)
Public Member Functions inherited from gRenderObject
 gRenderObject ()
int getScreenWidth ()
int getScreenHeight ()
void pushMatrix ()
void popMatrix ()
Public Member Functions inherited from gObject
 gObject ()
void logi (std::string message)
void logd (std::string message)
void logw (std::string message)
void loge (std::string message)
void logi (std::string tag, std::string message)
void logd (std::string tag, std::string message)
void logw (std::string tag, std::string message)
void loge (std::string tag, std::string message)

Static Public Attributes

static gGUITextbox * focusedtextbox
Static Public Attributes inherited from gBaseGUIObject
static const int GUIEVENT_FOCUSED = -1
static const int GUIEVENT_UNFOCUSED = -2
static const int CURSOR_ARROW = 0
static const int CURSOR_IBEAM = 1
static const int CURSOR_CROSSHAIR = 2
static const int CURSOR_HAND = 3
static const int CURSOR_HRESIZE = 4
static const int CURSOR_VRESIZE = 5
static int focusid
static int previousfocusid
Static Public Attributes inherited from gObject
static const int LOGLEVEL_SILENT
static const int LOGLEVEL_DEBUG
static const int LOGLEVEL_INFO
static const int LOGLEVEL_WARNING
static const int LOGLEVEL_ERROR

Additional Inherited Members

Public Types inherited from gBaseGUIObject
enum  { TEXTALIGNMENT_LEFT , TEXTALIGNMENT_MIDDLE , TEXTALIGNMENT_RIGHT }
Static Public Member Functions inherited from gBaseGUIObject
static void setBackgroundColor (gColor *backgroundColor)
static gColor * getBackgroundColor ()
static void setMiddlegroundColor (gColor *middlegroundColor)
static gColor * getMiddlegroundColor ()
static void setForegroundColor (gColor *foregroundColor)
static gColor * getForegroundColor ()
static void setTextBackgroundColor (gColor *textBackgroundColor)
static gColor * getTextBackgroundColor ()
static void setNavigationBackgroundColor (gColor *navigationBackgroundColor)
static gColor * getNavigationBackgroundColor ()
static void setFont (gFont *font)
static gFont * getFont ()
static void setFontColor (gColor *fontColor)
static gColor * getFontColor ()
static void setNavigationFontColor (gColor *navigationFontColor)
static gColor * getNavigationFontColor ()
static void setButtonColor (gColor *color)
static gColor * getButtonColor ()
static void setPressedButtonColor (gColor *color)
static gColor * getPressedButtonColor ()
static void setDisabledButtonColor (gColor *color)
static gColor * getDisabledButtonColor ()
static void setButtonFontColor (gColor *color)
static gColor * getButtonFontColor ()
static void setPressedButtonFontColor (gColor *color)
static gColor * getPressedButtonFontColor ()
static void setDisabledButtonFontColor (gColor *color)
static gColor * getDisabledButtonFontColor ()
Static Public Member Functions inherited from gRenderObject
static void setScreenSize (int screenWidth, int screenHeight)
static void setUnitScreenSize (int unitWidth, int unitHeight)
static void setScreenScaling (int screenScaling)
static void enableShadowMapping ()
static void disableShadowMapping ()
static bool isShadowMappingEnabled ()
static void enableExtraShaders (bool isEnabled=true)
static void disableExtraShaders ()
static bool isExtraShadersEnabled ()
static gRenderer * getRenderer ()
static void destroyRenderer ()
static void createRenderer (int renderEngine=G_RENDERER_GL)
Static Public Member Functions inherited from gObject
static std::string gGetAppDir ()
static std::string gGetAssetsDir ()
static void gSetAssetsDir (std::string assetsDir)
static std::string gGetFilesDir ()
static std::string gGetImagesDir ()
static std::string gGetFontsDir ()
static std::string gGetModelsDir ()
static std::string gGetTexturesDir ()
static std::string gGetShadersDir ()
static std::string gGetSoundsDir ()
static std::string gGetDatabasesDir ()
static std::string gGetVideosDir ()
static void setCurrentResolution (int scalingNo, int currentResolutionNo)
Public Attributes inherited from gBaseGUIObject
int id
int type
int left
int top
int right
int bottom
int width
int height
int titlex
int titley
int titleheight
bool isfocused
bool iscursoron
bool issizer
bool iscontainer
bool isresizable
Protected Attributes inherited from gGUIControl
bool countasspace
int oldwidth
int oldheight
gFont * localfont
Protected Attributes inherited from gBaseGUIObject
std::string title
gBaseApp * root
gBaseGUIObject * topparent
gBaseGUIObject * parent
bool isenabled
bool isvisible
bool istitleon
int parentslotlineno
int parentslotcolumnno
Static Protected Attributes inherited from gBaseGUIObject
static gColor * backgroundcolor
static gColor * middlegroundcolor
static gColor * foregroundcolor
static gColor * textbackgroundcolor
static gColor * navigationbackgroundcolor
static gFont * font
static gColor * fontcolor
static gColor * navigationfontcolor
static gColor * buttoncolor
static gColor * pressedbuttoncolor
static gColor * disabledbuttoncolor
static gColor * buttonfontcolor
static gColor * pressedbuttonfontcolor
static gColor * disabledbuttonfontcolor
static gGUIActionManager actionmanager
static gGUIResources res
Static Protected Attributes inherited from gRenderObject
static bool isshadowmappingenabled
static bool isextrashadersenabled
Static Protected Attributes inherited from gObject
static int renderpassnum
static int renderpassno
static int releasescaling
static int releaseresolution

Constructor & Destructor Documentation

◆ gGUITextbox()

gGUITextbox::gGUITextbox ( )

◆ ~gGUITextbox()

virtual gGUITextbox::~gGUITextbox ( )
virtual

Member Function Documentation

◆ addLeftMargin()

void gGUITextbox::addLeftMargin ( int left)

Shifts the left and right coordinates of the textbox by given value. Makes sure that both left and right coordinates are within the limits of the panel.

Parameters
leftDesired shift value for the left coordinate of the textbox. It can be a negative integer value.

◆ addTopMargin()

void gGUITextbox::addTopMargin ( int top)

Shifts the top and bottom coordinates of the textbox by given value. Makes sure that both top and bottom coordinates are within the limits of the panel.

Parameters
topDesired shift value for the top coordinate of the textbox. It can be a negative integer value.

◆ calculateContentHeight()

int gGUITextbox::calculateContentHeight ( )
overridevirtual

Reimplemented from gGUIControl.

◆ charPressed()

void gGUITextbox::charPressed ( unsigned int codepoint)
overridevirtual

Reimplemented from gBaseGUIObject.

◆ cleanText()

void gGUITextbox::cleanText ( )

◆ copyText()

void gGUITextbox::copyText ( )

◆ cutText()

void gGUITextbox::cutText ( )

◆ draw()

void gGUITextbox::draw ( )
overridevirtual

Reimplemented from gGUIControl.

◆ enableBackground()

void gGUITextbox::enableBackground ( bool isEnabled)

Enables/disable drawing a background for textbox.

Parameters
isEnabledBoolean value to enable/disable drawing a background.

◆ enableBBCode()

void gGUITextbox::enableBBCode ( bool isEnabled = true)

Enables or disables BBCode rich-text rendering for this textbox. Disabled by default to preserve 100% plain-text backward compatibility.

When enabled:

  • Read-only mode (setEditable(false)): always renders formatted BBCode with plain-text selection and clipboard copy support.
  • Editable mode (setEditable(true)): renders formatted BBCode while unfocused, and switches to raw BBCode source editing while focused/editing.
Parameters
isEnabledTrue to enable BBCode mode, false for plain-text mode.

◆ enableVerticalMargin()

void gGUITextbox::enableVerticalMargin ( bool isAligned)

◆ getCursor()

int gGUITextbox::getCursor ( int x,
int y )
overridevirtual

Returns the current position of the cursor.

Reimplemented from gGUIControl.

◆ getCursorPosChar()

int gGUITextbox::getCursorPosChar ( )

◆ getCursorPosUTF()

int gGUITextbox::getCursorPosUTF ( )

◆ getCursorPosX()

int gGUITextbox::getCursorPosX ( )

◆ getCursorPreviousPosUTF()

int gGUITextbox::getCursorPreviousPosUTF ( )

◆ getHintText()

gGUIText * gGUITextbox::getHintText ( )

Returns a pointer to the internal gGUIText hint text object.

Returns
Pointer to gGUIText hinttext.

◆ getHintTextObject()

gGUIText * gGUITextbox::getHintTextObject ( )

Returns a pointer to the internal gGUIText hint text object.

Returns
gGUIText pointer.

◆ getInitX()

int gGUITextbox::getInitX ( )

◆ getLineCount()

int gGUITextbox::getLineCount ( )

Returns the line count of the textbox.

Returns
Line count of the textbox.

◆ getPlainText()

std::string gGUITextbox::getPlainText ( )

Returns visible plain text (BBCode tags stripped when BBCode is enabled, or raw text when BBCode is disabled).

Returns
Plain visible text string.

◆ getSelectedText()

std::string gGUITextbox::getSelectedText ( )

Returns the currently selected text.

Returns
Selected text substring, or empty string if nothing is selected.

◆ getText()

std::string gGUITextbox::getText ( )

Returns the text that is currently inside the textbox.

Returns
Text inside the textbox.

◆ getTextboxh()

int gGUITextbox::getTextboxh ( )

◆ hideAndroidSelectionMenu()

void gGUITextbox::hideAndroidSelectionMenu ( )

◆ isBackgroundEnabled()

bool gGUITextbox::isBackgroundEnabled ( )

◆ isBBCodeEnabled()

bool gGUITextbox::isBBCodeEnabled ( ) const

Returns whether BBCode mode is enabled.

Returns
True if BBCode mode is enabled, false otherwise.

◆ isEditable()

bool gGUITextbox::isEditable ( )

Returns the bool value that indicates if textbox is editable or not.

Returns
Bool value that indicates if textbox is editable or not.

◆ isNumeric()

bool gGUITextbox::isNumeric ( )

Check if the textbox only allows numeric value entry.

Returns
Bool value that indicates if textbox allows only numbers to be input into the textbox.

◆ isPassword()

bool gGUITextbox::isPassword ( )

Check if the textbox is a password box.

Returns
Bool value that indicates if textbox is a password box

◆ keyPressed()

void gGUITextbox::keyPressed ( int key)
overridevirtual

Reimplemented from gBaseGUIObject.

◆ keyReleased()

void gGUITextbox::keyReleased ( int key)
overridevirtual

Reimplemented from gBaseGUIObject.

◆ longPressed()

void gGUITextbox::longPressed ( int x,
int y )

◆ mouseDragged()

void gGUITextbox::mouseDragged ( int x,
int y,
int button )
overridevirtual

Reimplemented from gBaseGUIObject.

◆ mousePressed()

void gGUITextbox::mousePressed ( int x,
int y,
int button )
overridevirtual

Reimplemented from gBaseGUIObject.

◆ mouseReleased()

void gGUITextbox::mouseReleased ( int x,
int y,
int button )
overridevirtual

Reimplemented from gBaseGUIObject.

◆ pasteText()

void gGUITextbox::pasteText ( )

◆ selectAll()

void gGUITextbox::selectAll ( )

Selects all text in the textbox.

◆ set()

void gGUITextbox::set ( gBaseApp * root,
gBaseGUIObject * topParentGUIObject,
gBaseGUIObject * parentGUIObject,
int parentSlotLineNo,
int parentSlotColumnNo,
int x,
int y,
int w,
int h )
overridevirtual

Reimplemented from gGUIControl.

◆ setBBCodeBoldFont()

void gGUITextbox::setBBCodeBoldFont ( gFont * font)

◆ setBBCodeBoldItalicFont()

void gGUITextbox::setBBCodeBoldItalicFont ( gFont * font)

◆ setBBCodeCodeBackgroundColor()

void gGUITextbox::setBBCodeCodeBackgroundColor ( const gColor & color)

◆ setBBCodeCodeFont()

void gGUITextbox::setBBCodeCodeFont ( gFont * font)

◆ setBBCodeCodeTextColor()

void gGUITextbox::setBBCodeCodeTextColor ( const gColor & color)

◆ setBBCodeItalicFont()

void gGUITextbox::setBBCodeItalicFont ( gFont * font)

◆ setCursorPosX()

void gGUITextbox::setCursorPosX ( int cursorPosX,
int length )

◆ setDisabled()

void gGUITextbox::setDisabled ( bool isDisabled)

◆ setEditable()

void gGUITextbox::setEditable ( bool isEditable)

Enables/disables the textbox for editing.

Parameters
isEditableBoolean value to enable/disable the textbox for editing. If it is 'true', textbox becomes editable. If it is 'false', textbox becomes static.

◆ setEditMode()

void gGUITextbox::setEditMode ( bool editMode)

◆ setFirstX()

void gGUITextbox::setFirstX ( int firstx)

◆ setFirstY()

void gGUITextbox::setFirstY ( int firsty)

◆ setFont()

void gGUITextbox::setFont ( gFont * font)

◆ setHintText()

void gGUITextbox::setHintText ( const std::string & hintText)

Sets the hint text (placeholder) displayed when the textbox is empty.

Parameters
hintTextPlaceholder text to display.

◆ setHintTextColor()

void gGUITextbox::setHintTextColor ( const gColor & color)

Sets the color of the hint text.

Parameters
colorgColor for the hint text.

◆ setLineCount()

void gGUITextbox::setLineCount ( int linecount)

Sets the line count of the textbox.

NOTE: Currently if line count is set to a higher value than 1, editing is not functioning properly. So, if you want to use multilines in your textbox, use the setText() function.

Parameters
linecountLine count of the textbox. By default it is set to 1. It must be an integer value bigger than 1.

◆ setLineTopMargin()

void gGUITextbox::setLineTopMargin ( int linetopmargin)

Changes the top margin between lines.

Parameters
linetopmarginDesired margin value between lines.

◆ setNumeric()

void gGUITextbox::setNumeric ( bool isNumeric)

Enables/disables the numeric value only mode of the textbox.

Parameters
isNumericBoolean value to enable/disable entering numeric values only. If it is 'true', you can only input numeric values into the textbox, if it is 'false', it works normally.

◆ setPassword()

void gGUITextbox::setPassword ( bool isPassword)

Converts textbox into a password box or converts password box back into a textbox.

Parameters
isPasswordBoolean value to select between password box and textbox. If it is true, password box is active. If it is false, textbox is active.

◆ setSelection()

void gGUITextbox::setSelection ( int startChar,
int endChar )

Selects a range of characters in the textbox.

Parameters
startCharThe starting character index (0-based).
endCharThe ending character index (0-based).

◆ setSize()

void gGUITextbox::setSize ( int width,
int height )

Changes the textbox's measurements. Makes sure that textbox's size is within the panel's limits.

Parameters
widthWidth of the textbox.
heightHeight of the textbox.

◆ setText()

void gGUITextbox::setText ( const std::string & text)

Changes the text displayed in the textbox.

Parameters
textText you want to put in the textbox.

◆ setTextAlignment()

void gGUITextbox::setTextAlignment ( int textAlignment,
float cellW,
int initX )

◆ setTextColor()

void gGUITextbox::setTextColor ( gColor * textColor)

◆ setTextFont()

void gGUITextbox::setTextFont ( gFont * textFont)

◆ showAndroidSelectionMenu()

void gGUITextbox::showAndroidSelectionMenu ( )

◆ unfocus()

void gGUITextbox::unfocus ( )
overridevirtual

Reimplemented from gBaseGUIObject.

◆ update()

void gGUITextbox::update ( )
overridevirtual

Reimplemented from gGUIControl.

Member Data Documentation

◆ focusedtextbox

gGUITextbox* gGUITextbox::focusedtextbox
static

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