Mana
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
TextField Class Reference

A text field. More...

#include <textfield.h>

Inheritance diagram for TextField:
ChatInput IntTextField PasswordField

Public Member Functions

 TextField (const std::string &text=std::string(), bool loseFocusOnTab=true)
 Constructor, initializes the text field with the given string.
 
void draw (gcn::Graphics *graphics) override
 Draws the text field.
 
void drawFrame (gcn::Graphics *graphics) override
 Draws the background and border.
 
void setNumeric (bool numeric)
 Determine whether the field should be numeric or not.
 
void setRange (int min, int max)
 Set the range on the field if it is numeric.
 
void keyPressed (gcn::KeyEvent &keyEvent) override
 Processes one keypress.
 
void textInput (const TextInput &textInput)
 Handle text input (should possibly be new event in Guichan).
 
void setMinimum (int min)
 Set the minimum value for a range.
 
void setMaximum (int max)
 Set the maximum value for a range.
 
int getValue () const
 Return the value for a numeric field.
 
void setAutoComplete (AutoCompleteLister *lister)
 Sets the TextField's source of autocomplete.
 
AutoCompleteListergetAutoComplete () const
 Returns the TextField's source of autocomplete.
 
void setHistory (TextHistory *history)
 Sets the TextField's source of input history.
 
TextHistorygetHistory () const
 Returns the TextField's source of input history.
 

Protected Member Functions

void drawCaret (gcn::Graphics *graphics, int x) override
 

Private Member Functions

void autoComplete ()
 
void handlePaste ()
 

Private Attributes

bool mNumeric = false
 
int mMinimum = 0
 
int mMaximum = 0
 
bool mLoseFocusOnTab
 
int mPadding = 1
 
AutoCompleteListermAutoComplete = nullptr
 
TextHistorymHistory = nullptr
 Text history.
 

Detailed Description

A text field.

Definition at line 71 of file textfield.h.

Constructor & Destructor Documentation

◆ TextField()

TextField::TextField ( const std::string &  text = std::string(),
bool  loseFocusOnTab = true 
)

Constructor, initializes the text field with the given string.

Definition at line 38 of file textfield.cpp.

Member Function Documentation

◆ autoComplete()

void TextField::autoComplete ( )
private

Definition at line 253 of file textfield.cpp.

◆ draw()

void TextField::draw ( gcn::Graphics *  graphics)
override

Draws the text field.

Definition at line 51 of file textfield.cpp.

◆ drawCaret()

void TextField::drawCaret ( gcn::Graphics *  graphics,
int  x 
)
overrideprotected

Definition at line 115 of file textfield.cpp.

◆ drawFrame()

void TextField::drawFrame ( gcn::Graphics *  graphics)
override

Draws the background and border.

Definition at line 72 of file textfield.cpp.

◆ getAutoComplete()

AutoCompleteLister * TextField::getAutoComplete ( ) const
inline

Returns the TextField's source of autocomplete.

Definition at line 139 of file textfield.h.

◆ getHistory()

TextHistory * TextField::getHistory ( ) const
inline

Returns the TextField's source of input history.

Definition at line 151 of file textfield.h.

◆ getValue()

int TextField::getValue ( ) const

Return the value for a numeric field.

Definition at line 100 of file textfield.cpp.

◆ handlePaste()

void TextField::handlePaste ( )
private

Definition at line 320 of file textfield.cpp.

◆ keyPressed()

void TextField::keyPressed ( gcn::KeyEvent &  keyEvent)
override

Processes one keypress.

Definition at line 121 of file textfield.cpp.

◆ setAutoComplete()

void TextField::setAutoComplete ( AutoCompleteLister lister)
inline

Sets the TextField's source of autocomplete.

Passing null will disable autocomplete.

Definition at line 133 of file textfield.h.

◆ setHistory()

void TextField::setHistory ( TextHistory history)
inline

Sets the TextField's source of input history.

Definition at line 145 of file textfield.h.

◆ setMaximum()

void TextField::setMaximum ( int  max)
inline

Set the maximum value for a range.

Definition at line 122 of file textfield.h.

◆ setMinimum()

void TextField::setMinimum ( int  min)
inline

Set the minimum value for a range.

Definition at line 117 of file textfield.h.

◆ setNumeric()

void TextField::setNumeric ( bool  numeric)

Determine whether the field should be numeric or not.

Definition at line 83 of file textfield.cpp.

◆ setRange()

void TextField::setRange ( int  min,
int  max 
)
inline

Set the range on the field if it is numeric.

Definition at line 98 of file textfield.h.

◆ textInput()

void TextField::textInput ( const TextInput textInput)

Handle text input (should possibly be new event in Guichan).

Definition at line 247 of file textfield.cpp.

Member Data Documentation

◆ mAutoComplete

AutoCompleteLister* TextField::mAutoComplete = nullptr
private

Definition at line 167 of file textfield.h.

◆ mHistory

TextHistory* TextField::mHistory = nullptr
private

Text history.

Definition at line 169 of file textfield.h.

◆ mLoseFocusOnTab

bool TextField::mLoseFocusOnTab
private

Definition at line 164 of file textfield.h.

◆ mMaximum

int TextField::mMaximum = 0
private

Definition at line 163 of file textfield.h.

◆ mMinimum

int TextField::mMinimum = 0
private

Definition at line 162 of file textfield.h.

◆ mNumeric

bool TextField::mNumeric = false
private

Definition at line 161 of file textfield.h.

◆ mPadding

int TextField::mPadding = 1
private

Definition at line 165 of file textfield.h.


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