wGui::CEditBox Class Reference

The CEditBox will generate CTRL_VALUECHANGE messages every time the text changes. More...

#include <wg_editbox.h>

Inheritance diagram for wGui::CEditBox:

wGui::CWindow wGui::CMessageClient

Public Member Functions

Protected Member Functions

Protected Attributes


Detailed Description

The CEditBox will generate CTRL_VALUECHANGE messages every time the text changes.

Definition at line 43 of file wg_editbox.h.


Constructor & Destructor Documentation

wGui::CEditBox::CEditBox ( const CRect WindowRect,
CWindow pParent,
CFontEngine pFontEngine = 0 
)

Construct a new Edit control

Parameters:
WindowRect A CRect that defines the outer limits of the control
pParent A pointer to the parent window
pFontEngine A pointer to the font engine to use when drawing the control If this is left out (or set to 0) it will use the default font engine specified by the CApplication (which must be set before instantiating this object)

Definition at line 39 of file wg_editbox.cpp.

References wGui::COLOR_WHITE, wGui::CMessage::CTRL_DOUBLELCLICK, wGui::CMessage::CTRL_GAININGKEYFOCUS, wGui::CMessage::CTRL_LOSINGKEYFOCUS, wGui::CMessage::CTRL_TIMER, Draw(), wGui::CApplication::GetDefaultFontEngine(), wGui::CRect::Grow(), wGui::CRenderedString::HALIGN_LEFT, wGui::CMessageServer::Instance(), wGui::CApplication::Instance(), wGui::CMessage::KEYBOARD_KEYDOWN, wGui::CWindow::m_BackgroundColor, wGui::CWindow::m_ClientRect, m_pFontEngine, m_pRenderedString, wGui::CMessage::MOUSE_BUTTONUP, wGui::CMessage::MOUSE_MOVE, wGui::CMessageServer::RegisterMessageClient(), and wGui::CRenderedString::VALIGN_NORMAL.


Member Function Documentation

void wGui::CEditBox::SetUsePasswordMask ( bool  bUseMask  )  [inline]

Set the Password mask state of the control

Parameters:
bUseMask If set to true, the control will act as a password mask box

Definition at line 58 of file wg_editbox.h.

References m_bUseMask.

bool wGui::CEditBox::UsingPasswordMask ( void   )  const [inline]

Indicates if the edit box is using a password mask

Returns:
true if the control is a password box

Definition at line 62 of file wg_editbox.h.

References m_bUseMask.

void wGui::CEditBox::SetReadOnly ( bool  bReadOnly  ) 

Set the Read-only state of the control

Parameters:
bReadOnly If set to true, the control will not take any keyboard input

Definition at line 84 of file wg_editbox.cpp.

References wGui::COLOR_LIGHTGRAY, wGui::COLOR_WHITE, Draw(), wGui::CWindow::m_BackgroundColor, and m_bReadOnly.

Referenced by wGui::CDropDown::CDropDown().

bool wGui::CEditBox::IsReadOnly ( void   )  const [inline]

Indicates if the edit box is operating in read-only mode

Returns:
true if the control is read-only

Definition at line 70 of file wg_editbox.h.

References m_bReadOnly.

std::wstring wGui::CEditBox::GetSelText ( void   )  const

Gets the currently selected text

Returns:
The currently selected text in the edit box, if the edit box is in Password Mask mode, this will always return an empty string

Definition at line 92 of file wg_editbox.cpp.

References m_bUseMask, m_SelLength, m_SelStart, and wGui::CWindow::m_sWindowText.

void wGui::CEditBox::SetSelection ( std::wstring::size_type  iSelStart,
int  iSelLength 
)

Set the selection

Parameters:
iSelStart The index of the start of the selection
iSelLength The number of characters selected

Definition at line 115 of file wg_editbox.cpp.

References m_SelLength, m_SelStart, and wGui::CWindow::m_sWindowText.

virtual std::wstring::size_type wGui::CEditBox::GetSelectionStart ( void   )  const [inline, virtual]

Gets the starting index of the selection

Returns:
The index of the start of the selection

Definition at line 83 of file wg_editbox.h.

References m_SelStart.

virtual int wGui::CEditBox::GetSelectionLength ( void   )  const [inline, virtual]

Gets the length of the selection

Returns:
The length of the selection

Definition at line 87 of file wg_editbox.h.

References m_SelLength.

std::wstring::size_type wGui::CEditBox::GetIndexFromPoint ( const CPoint Point  )  const [virtual]

Gets a character index from a point

Parameters:
Point The point (in window coordinates)
Returns:
The index (in characters) of the point in the string

Definition at line 133 of file wg_editbox.cpp.

References wGui::CPoint::SetX(), and wGui::CPoint::XPos().

Referenced by HandleMessage(), and OnMouseButtonDown().

void wGui::CEditBox::SetWindowText ( const std::wstring &  sText  )  [virtual]

Set the WindowText of the control

Parameters:
sText The text to assign to the window

Reimplemented from wGui::CWindow.

Definition at line 283 of file wg_editbox.cpp.

References wGui::CRenderedString::HALIGN_LEFT, m_pFontEngine, m_pRenderedString, m_SelLength, m_SelStart, wGui::CWindow::SetWindowText(), and wGui::CRenderedString::VALIGN_NORMAL.

Referenced by wGui::CDropDown::SetWindowText().

bool wGui::CEditBox::OnMouseButtonDown ( CPoint  Point,
unsigned int  Button 
) [virtual]

This is called whenever the editbox is clicked on by the mouse Only the topmost window that bounds the point will be called by the system

Parameters:
Point The point where the mouse clicked
Button A bitfield indicating which button the window was clicked with
Returns:
True if it's in the bounds of the editbox

Reimplemented from wGui::CWindow.

Definition at line 294 of file wg_editbox.cpp.

References wGui::CMessage::CTRL_DOUBLELCLICK, Draw(), GetIndexFromPoint(), wGui::CRect::HitTest(), wGui::CApplication::Instance(), wGui::CMessageServer::Instance(), wGui::CTimer::IsRunning(), wGui::CMouseMessage::LEFT, m_bMouseDown, m_bReadOnly, wGui::CWindow::m_bVisible, wGui::CWindow::m_ClientRect, m_DragStart, m_SelLength, m_SelStart, wGui::CWindow::OnMouseButtonDown(), wGui::CMessageServer::QueueMessage(), wGui::CRect::RELPOS_INSIDE, wGui::CApplication::SetKeyFocus(), wGui::CTimer::StartTimer(), wGui::CTimer::StopTimer(), and wGui::CWindow::ViewToWindow().

bool wGui::CEditBox::HandleMessage ( CMessage pMessage  )  [virtual]

CEditBox will handle MOUSE_BUTTONDOWN and KEYBOARD_KEYDOWN messages

Parameters:
pMessage A pointer to the message that needs to be handled

Reimplemented from wGui::CWindow.

Definition at line 335 of file wg_editbox.cpp.

References wGui::CMessage::CTRL_DOUBLELCLICK, wGui::CMessage::CTRL_GAININGKEYFOCUS, wGui::CMessage::CTRL_LOSINGKEYFOCUS, wGui::CMessage::CTRL_TIMER, wGui::CMessage::CTRL_VALUECHANGE, wGui::CMessage::Destination(), Draw(), wGui::CView::GetFloatingWindow(), GetIndexFromPoint(), wGui::CWindow::GetView(), wGui::CRect::Grow(), wGui::CRenderedString::HALIGN_LEFT, wGui::CWindow::HandleMessage(), wGui::CRect::HitTest(), wGui::CWindow::HitTest(), wGui::CMessageServer::Instance(), wGui::CApplication::Instance(), wGui::CKeyboardMessage::Key, wGui::CMessage::KEYBOARD_KEYDOWN, m_bLastMouseMoveInside, m_bMouseDown, m_bReadOnly, wGui::CWindow::m_bVisible, wGui::CWindow::m_ClientRect, m_DragStart, m_pFontEngine, wGui::CWindow::m_pParentWindow, m_pRenderedString, m_SelLength, m_SelStart, wGui::CWindow::m_sWindowText, wGui::CWindow::m_WindowRect, wGui::CMessage::MessageType(), wGui::CKeyboardMessage::Modifiers, wGui::CMessage::MOUSE_BUTTONUP, wGui::CMessage::MOUSE_MOVE, wGui::CMouseMessage::Point, wGui::CMessageServer::QueueMessage(), wGui::CRect::RELPOS_INSIDE, SelDelete(), wGui::CApplication::SetMouseCursor(), wGui::CWindow::SetWindowText(), wGui::CMessage::Source(), wGui::CTimer::StartTimer(), wGui::CTimer::StopTimer(), wGui::CKeyboardMessage::Unicode, wGui::CRenderedString::VALIGN_NORMAL, and wGui::CWindow::ViewToWindow().

void wGui::CEditBox::SelDelete ( std::wstring *  psString  )  [protected]

Deletes the selected portion of the string

Definition at line 639 of file wg_editbox.cpp.

References m_SelLength, and m_SelStart.

Referenced by HandleMessage().


The documentation for this class was generated from the following files:
Generated on Wed May 16 23:11:27 2007 for wGui by  doxygen 1.5.1