Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

PG_LineEdit Class Reference

An editable text box. More...

#include <pglineedit.h>

Inheritance diagram for PG_LineEdit:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 PG_LineEdit (PG_Widget *parent, const PG_Rect &r=PG_Rect::null, const std::string &style="LineEdit", int maximumLength=1000000)
 ~PG_LineEdit ()
void LoadThemeStyle (const std::string &widgettype)
 Load a specific themestyle.
void LoadThemeStyle (const std::string &widgettype, const std::string &objectname)
 Load a style from the theme definition.
void EditBegin ()
 start edit
void EditEnd ()
virtual void SetCursorPos (int p)
int GetCursorPos ()
virtual void SetText (const std::string &new_text)
 Set the current text string.
bool IsCursorVisible ()
void SendChar (PG_Char c)
 Send a char into the LineEdit widget.
void SendDel ()
 Send a 'del' keystroke into the LineEdit widget.
void SendBackspace ()
 Send a 'BKSPC' keystroke into the LineEdit widget.
void SetValidKeys (const std::string &keys)
 Define a set of valid keys.
void SetEditable (bool edit)
 Set if the widget is editable by the user.
bool GetEditable ()
 Check if the widget is editable by the user.
void SetPassHidden (const PG_Char &passchar)
 Set password character (witch will be displayed in place of letter).
char GetPassHidden ()
 Return setted passchar.
bool Action (KeyAction action)

Static Public Member Functions

static void SetBlinkingTime (int msec)
 sets the blinking interval of the cursor Only PG_LineEdits created after setting this to a non-zero value will have a blinking cursor

Public Attributes

SignalEditBegin sigEditBegin
SignalEditEnd sigEditEnd
SignalEditReturn sigEditReturn
SignalEditUpdate sigEditUpdate

Protected Member Functions

virtual void InsertChar (const PG_Char &c)
virtual void DeleteChar (Uint16 pos)
void CopyText (bool del=false)
void PasteText (Uint16 pos)
void StartMark (Uint16 pos)
void EndMark (Uint16 pos)
virtual bool eventFilterKey (const SDL_KeyboardEvent *key)
virtual void eventEditBegin (int id, PG_Widget *widget, unsigned long data, void *clientdata)
virtual void eventEditEnd (int id, PG_Widget *widget, unsigned long data, void *clientdata)
void eventBlit (SDL_Surface *surface, const PG_Rect &src, const PG_Rect &dst)
 overridable eventhandler to blit the widget contents to the screen
bool eventKeyDown (const SDL_KeyboardEvent *key)
 Overridable Eventhandler for a SDL_KeyboardEvent message.
bool eventMouseButtonUp (const SDL_MouseButtonEvent *button)
 Overridable Eventhandler for a SDL_MouseButtonEvent message.
void eventInputFocusLost (PG_MessageObject *newfocus)
void eventHide ()
 overridable eventhandler called whenever the widget gets hidden.

Protected Attributes

int my_cursorPosition
SDL_Surface * my_srfTextCursor

Classes

class  SignalEditBegin
 Signal type declaration. More...
class  SignalEditEnd
class  SignalEditReturn
class  SignalEditUpdate

Detailed Description

An editable text box.

Author:
Alexander Pipelka
This really should be renamed to PG_TextBox or something similar, because PG_LineEdit really makes no sense :). Also the 'Edit' part implies that it will always be modifiable, but having a modifyable attribute would probably be better than creating a whole new widget for an unmodifiable text box.

Definition at line 52 of file pglineedit.h.


Constructor & Destructor Documentation

PG_LineEdit::PG_LineEdit PG_Widget parent,
const PG_Rect r = PG_Rect::null,
const std::string &  style = "LineEdit",
int  maximumLength = 1000000
 

Definition at line 33 of file pglineedit.cpp.

References PG_Application::GetApp(), LoadThemeStyle(), my_cursorPosition, and my_srfTextCursor.

PG_LineEdit::~PG_LineEdit  ) 
 

Definition at line 53 of file pglineedit.cpp.


Member Function Documentation

bool PG_LineEdit::Action KeyAction  action  )  [virtual]
 

Reimplemented from PG_Widget.

Definition at line 575 of file pglineedit.cpp.

References PG_Widget::ACT_CANCEL, PG_Widget::ACT_OK, PG_Widget::Action(), EditBegin(), and EditEnd().

void PG_LineEdit::CopyText bool  del = false  )  [protected]
 

Definition at line 446 of file pglineedit.cpp.

References my_cursorPosition, PG_Widget::my_text, SetCursorPos(), and PG_Widget::Update().

Referenced by eventKeyDown().

void PG_LineEdit::DeleteChar Uint16  pos  )  [protected, virtual]
 

Reimplemented in PG_MaskEdit, and PG_MultiLineEdit.

Definition at line 429 of file pglineedit.cpp.

References PG_Widget::my_text, and sigEditUpdate.

Referenced by PG_MultiLineEdit::DeleteChar(), SendBackspace(), and SendDel().

void PG_LineEdit::EditBegin  ) 
 

start edit

Definition at line 163 of file pglineedit.cpp.

References eventEditBegin(), PG_Widget::GetID(), PG_MessageObject::SetInputFocus(), sigEditBegin, and PG_Widget::Update().

Referenced by Action(), PG_MultiLineEdit::eventMouseButtonDown(), eventMouseButtonUp(), NonEditableLineEdit::NonEditableLineEdit(), GotoPosition::RunModal(), PasswordDialog::RunModal(), and FileFindDialog::RunModal().

void PG_LineEdit::EditEnd  ) 
 

Definition at line 172 of file pglineedit.cpp.

References eventEditEnd(), PG_Widget::GetID(), my_cursorPosition, PG_MessageObject::ReleaseInputFocus(), sigEditEnd, and PG_Widget::Update().

Referenced by Action(), eventHide(), eventInputFocusLost(), eventKeyDown(), and SetEditable().

void PG_LineEdit::EndMark Uint16  pos  )  [protected]
 

Definition at line 441 of file pglineedit.cpp.

Referenced by eventKeyDown().

void PG_LineEdit::eventBlit SDL_Surface *  surface,
const PG_Rect src,
const PG_Rect dst
[protected, virtual]
 

overridable eventhandler to blit the widget contents to the screen

Parameters:
surface pointer to SDL_Surface to be blitted
src source rectangle (client coordinates)
dst destination rectangle (screen coordinates) Override this eventhandler to perform custom blitting behaviour (without drawing onto the widget surface).

Reimplemented from PG_ThemeWidget.

Reimplemented in PG_MultiLineEdit.

Definition at line 55 of file pglineedit.cpp.

References PG_ThemeWidget::eventBlit().

void PG_LineEdit::eventEditBegin int  id,
PG_Widget widget,
unsigned long  data,
void *  clientdata
[protected, virtual]
 

Definition at line 489 of file pglineedit.cpp.

Referenced by EditBegin().

void PG_LineEdit::eventEditEnd int  id,
PG_Widget widget,
unsigned long  data,
void *  clientdata
[protected, virtual]
 

Definition at line 491 of file pglineedit.cpp.

Referenced by EditEnd().

bool PG_LineEdit::eventFilterKey const SDL_KeyboardEvent *  key  )  [protected, virtual]
 

Reimplemented in NonEditableLineEdit.

Definition at line 497 of file pglineedit.cpp.

Referenced by eventKeyDown().

void PG_LineEdit::eventHide  )  [protected, virtual]
 

overridable eventhandler called whenever the widget gets hidden.

Reimplemented from PG_Widget.

Definition at line 559 of file pglineedit.cpp.

References EditEnd().

void PG_LineEdit::eventInputFocusLost PG_MessageObject newfocus  )  [protected, virtual]
 

Reimplemented from PG_MessageObject.

Definition at line 367 of file pglineedit.cpp.

References EditEnd().

bool PG_LineEdit::eventKeyDown const SDL_KeyboardEvent *  key  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_KeyboardEvent message.

This handler is called when a key changed it's state from unpressed to pressed. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
key SDL_KeyboardEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Reimplemented in NonEditableLineEdit, and PG_MultiLineEdit.

Definition at line 183 of file pglineedit.cpp.

References CopyText(), EditEnd(), EndMark(), eventFilterKey(), InsertChar(), my_cursorPosition, PG_Widget::my_text, PasteText(), PG_Char, SendBackspace(), SendDel(), SetCursorPos(), sigEditReturn, StartMark(), and PG_Application::TranslateNumpadKeys().

Referenced by PG_MultiLineEdit::eventKeyDown().

bool PG_LineEdit::eventMouseButtonUp const SDL_MouseButtonEvent *  button  )  [protected, virtual]
 

Overridable Eventhandler for a SDL_MouseButtonEvent message.

This handler is called when a mouse button is released. The default implementation returns 'false' which indicates that this message is not processed by this object.

Parameters:
button SDL_MouseButtonEvent message
Returns:
Notifies the message pump if this message is processed by this object or it should be routed to the next message receiver.

Reimplemented from PG_MessageObject.

Reimplemented in PG_MultiLineEdit.

Definition at line 398 of file pglineedit.cpp.

References EditBegin(), and SetCursorPos().

int PG_LineEdit::GetCursorPos  ) 
 

Definition at line 394 of file pglineedit.cpp.

References my_cursorPosition.

Referenced by PG_MultiLineEdit::eventKeyDown().

bool PG_LineEdit::GetEditable  ) 
 

Check if the widget is editable by the user.

Returns:
true - widget is editable / false - widget is read only

Definition at line 571 of file pglineedit.cpp.

Referenced by PG_MultiLineEdit::eventMouseButtonDown(), and PG_DropDown::GetEditable().

char PG_LineEdit::GetPassHidden  ) 
 

Return setted passchar.

Returns:
Returns character, witch is displayed in place on letters

Definition at line 595 of file pglineedit.cpp.

void PG_LineEdit::InsertChar const PG_Char &  c  )  [protected, virtual]
 

Reimplemented in PG_MaskEdit, and PG_MultiLineEdit.

Definition at line 412 of file pglineedit.cpp.

References my_cursorPosition, PG_Widget::my_text, SetCursorPos(), and sigEditUpdate.

Referenced by eventKeyDown(), PG_MultiLineEdit::InsertText(), and SendChar().

bool PG_LineEdit::IsCursorVisible  ) 
 

Definition at line 493 of file pglineedit.cpp.

Referenced by PG_MultiLineEdit::eventKeyDown(), and PG_MultiLineEdit::eventMouseButtonDown().

void PG_LineEdit::LoadThemeStyle const std::string &  widgettype,
const std::string &  objectname
[virtual]
 

Load a style from the theme definition.

Parameters:
widgettype name of the widgettype
objectname name of the object
Loads the defined style of a given widgettype and objectname.

Reimplemented from PG_ThemeWidget.

Definition at line 512 of file pglineedit.cpp.

References PG_Theme::FindString(), PG_Theme::FindSurface(), PG_Application::GetTheme(), my_srfTextCursor, and SetValidKeys().

void PG_LineEdit::LoadThemeStyle const std::string &  widgettype  ) 
 

Load a specific themestyle.

Parameters:
widgettype name of widget type to load

Reimplemented from PG_ThemeWidget.

Definition at line 501 of file pglineedit.cpp.

References PG_ThemeWidget::LoadThemeStyle().

Referenced by PG_DropDown::LoadThemeStyle(), and PG_LineEdit().

void PG_LineEdit::PasteText Uint16  pos  )  [protected]
 

Definition at line 473 of file pglineedit.cpp.

References my_cursorPosition, PG_Widget::my_text, and PG_Widget::Update().

Referenced by eventKeyDown().

void PG_LineEdit::SendBackspace  ) 
 

Send a 'BKSPC' keystroke into the LineEdit widget.

Definition at line 537 of file pglineedit.cpp.

References DeleteChar(), PG_Application::BulkModeActivator::disable(), my_cursorPosition, SetCursorPos(), and PG_Widget::Update().

Referenced by ItemSelectorWidget::eventKeyDown(), and eventKeyDown().

void PG_LineEdit::SendChar PG_Char  c  ) 
 

Send a char into the LineEdit widget.

Parameters:
c the character to insert

Definition at line 524 of file pglineedit.cpp.

References InsertChar().

Referenced by ItemSelectorWidget::eventKeyDown().

void PG_LineEdit::SendDel  ) 
 

Send a 'del' keystroke into the LineEdit widget.

Definition at line 532 of file pglineedit.cpp.

References DeleteChar(), my_cursorPosition, and SetCursorPos().

Referenced by eventKeyDown().

void PG_LineEdit::SetBlinkingTime int  msec  )  [static]
 

sets the blinking interval of the cursor Only PG_LineEdits created after setting this to a non-zero value will have a blinking cursor

Definition at line 602 of file pglineedit.cpp.

Referenced by ASC_PG_App::ASC_PG_App().

void PG_LineEdit::SetCursorPos int  p  )  [virtual]
 

Reimplemented in PG_MultiLineEdit.

Definition at line 371 of file pglineedit.cpp.

References my_cursorPosition, PG_Widget::my_text, and PG_Widget::Update().

Referenced by CopyText(), PG_MultiLineEdit::eventKeyDown(), eventKeyDown(), PG_MaskEdit::eventMouseButtonDown(), eventMouseButtonUp(), PG_MaskEdit::InsertChar(), InsertChar(), SendBackspace(), SendDel(), PG_MultiLineEdit::SetCursorPos(), and PG_MaskEdit::SetText().

void PG_LineEdit::SetEditable bool  edit  ) 
 

Set if the widget is editable by the user.

Parameters:
edit true - widget is editable / false - widget is read only

Definition at line 565 of file pglineedit.cpp.

References EditEnd().

Referenced by AdminGameWindow::AdminGameWindow(), ChooseTech::ChooseTech(), PlayerSetupWidget::PlayerSetupWidget(), ResourcePlacementDialog::ResourcePlacementDialog(), PG_DropDown::SetEditable(), SetLineEditAtts(), and PG_ToolTipHelp::ShowHelp().

void PG_LineEdit::SetPassHidden const PG_Char &  passchar  ) 
 

Set password character (witch will be displayed in place of letter).

Parameters:
passchar character (if = 0 do not any replacement)

Definition at line 591 of file pglineedit.cpp.

Referenced by PasswordDialog::PasswordDialog(), SetLineEditAtts(), PG_PropertyField_String< StringType >::SetPassHidden(), and StartMultiplayerGame::StartMultiplayerGame().

void PG_LineEdit::SetText const std::string &  new_text  )  [virtual]
 

Set the current text string.

Parameters:
new_text pointer to text string

Reimplemented from PG_Widget.

Reimplemented in PG_MaskEdit, and PG_MultiLineEdit.

Definition at line 483 of file pglineedit.cpp.

References my_cursorPosition, and PG_Widget::SetText().

Referenced by ChanceSettingsDialog::buildUpForm(), ChangePasswordDialog::ChangePasswordDialog(), CopyMap::CopyMap(), EventEditor::EventEditor(), ImportBI3MapDialog::ImportBI3MapDialog(), MailOptionsDialog::MailOptionsDialog(), ASCGUI_Window::parsePanelASCTXT(), PG_PropertyField_String< StringType >::PG_PropertyField_String(), PlayerSetupWidget::PlayerSetupWidget(), PG_PropertyField_String< StringType >::Reload(), ReplayRecorderDialog::ReplayRecorderDialog(), ItemSelectorWidget::resetNamesearch(), ResourcePlacementDialog::ResourcePlacementDialog(), ResourcePlacementDialog::scrollTrackEventFuel(), ResourcePlacementDialog::scrollTrackEventFuelFreeRatio(), ResourcePlacementDialog::scrollTrackEventMaterial(), ResourcePlacementDialog::scrollTrackEventMaterialFreeRatio(), PG_PropertyField_Integer< IntegerType >::set(), PG_MaskEdit::SetMask(), PG_MultiLineEdit::SetText(), PG_MaskEdit::SetText(), PG_DropDown::SetText(), PG_ToolTipHelp::ShowHelp(), StringEditor::StringEditor(), and WeatherDialog::WeatherDialog().

void PG_LineEdit::SetValidKeys const std::string &  keys  ) 
 

Define a set of valid keys.

Parameters:
keys a string which contains all valid chars

Definition at line 547 of file pglineedit.cpp.

Referenced by AddWeatherAreaDialog::AddWeatherAreaDialog(), AddWindChangeDialog::AddWindChangeDialog(), LoadThemeStyle(), PG_SpinnerBox::PG_SpinnerBox(), ResourcePlacementDialog::ResourcePlacementDialog(), and SetLineEditAtts().

void PG_LineEdit::StartMark Uint16  pos  )  [protected]
 

Definition at line 435 of file pglineedit.cpp.

Referenced by eventKeyDown().


Member Data Documentation

int PG_LineEdit::my_cursorPosition [protected]
 

Definition at line 208 of file pglineedit.h.

Referenced by CopyText(), PG_MultiLineEdit::DeleteChar(), EditEnd(), PG_MultiLineEdit::eventKeyDown(), eventKeyDown(), PG_MultiLineEdit::eventMouseButtonDown(), PG_MaskEdit::eventMouseButtonDown(), GetCursorPos(), PG_MaskEdit::InsertChar(), InsertChar(), PG_MultiLineEdit::InsertText(), PasteText(), PG_LineEdit(), SendBackspace(), SendDel(), SetCursorPos(), and SetText().

SDL_Surface* PG_LineEdit::my_srfTextCursor [protected]
 

Definition at line 210 of file pglineedit.h.

Referenced by LoadThemeStyle(), and PG_LineEdit().

SignalEditBegin PG_LineEdit::sigEditBegin
 

Definition at line 153 of file pglineedit.h.

Referenced by EditBegin(), and PG_DropDown::PG_DropDown().

SignalEditEnd PG_LineEdit::sigEditEnd
 

Definition at line 154 of file pglineedit.h.

Referenced by AdminGameWindow::AdminGameWindow(), EditEnd(), FileFindDialog::FileFindDialog(), PG_DropDown::PG_DropDown(), and PG_SpinnerBox::PG_SpinnerBox().

SignalEditReturn PG_LineEdit::sigEditReturn
 

Definition at line 155 of file pglineedit.h.

Referenced by AdminGameWindow::AdminGameWindow(), eventKeyDown(), GotoPosition::GotoPosition(), PasswordDialog::PasswordDialog(), and PG_DropDown::PG_DropDown().

SignalEditUpdate PG_LineEdit::sigEditUpdate
 

Definition at line 156 of file pglineedit.h.

Referenced by DeleteChar(), and InsertChar().


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 02:18:56 2008 for Advanced Strategic Command by  doxygen 1.4.2