wGui::CTextBox Class Reference

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

#include <wg_textbox.h>

Inheritance diagram for wGui::CTextBox:

wGui::CWindow wGui::CMessageClient

Public Types

Public Member Functions

Protected Member Functions

Protected Attributes


Detailed Description

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

Definition at line 44 of file wg_textbox.h.


Member Enumeration Documentation

enum wGui::CTextBox::EScrollBarVisibility

The various states for the scrollbars.

Enumerator:
SCROLLBAR_VIS_AUTO  Display the scrollbar if the text extends beyond the right border of the client area.
SCROLLBAR_VIS_NEVER  Never display the scrollbar.
SCROLLBAR_VIS_ALWAYS  Always show the scrollbar.

Definition at line 83 of file wg_textbox.h.


Constructor & Destructor Documentation

wGui::CTextBox::CTextBox ( 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 38 of file wg_textbox.cpp.

References wGui::COLOR_WHITE, wGui::CMessage::CTRL_DOUBLELCLICK, wGui::CMessage::CTRL_GAININGKEYFOCUS, wGui::CMessage::CTRL_LOSINGKEYFOCUS, wGui::CMessage::CTRL_TIMER, wGui::CMessage::CTRL_VALUECHANGE, wGui::CMessage::CTRL_VALUECHANGING, Draw(), wGui::CApplication::GetDefaultFontEngine(), wGui::CRect::Grow(), wGui::CRect::Height(), wGui::CScrollBar::HORIZONTAL, wGui::CMessageServer::Instance(), wGui::CApplication::Instance(), wGui::CMessage::KEYBOARD_KEYDOWN, wGui::CWindow::m_BackgroundColor, wGui::CWindow::m_ClientRect, m_pFontEngine, m_pHorizontalScrollBar, m_pVerticalScrollBar, m_ScrollBarVisibilityMap, wGui::CWindow::m_WindowRect, wGui::CMessage::MOUSE_BUTTONUP, wGui::CMessage::MOUSE_MOVE, PrepareWindowText(), wGui::CMessageServer::RegisterMessageClient(), SCROLLBAR_VIS_AUTO, wGui::CRect::TopLeft(), wGui::CScrollBar::VERTICAL, and wGui::CRect::Width().


Member Function Documentation

void wGui::CTextBox::SetReadOnly ( bool  bReadOnly  )  [virtual]

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 100 of file wg_textbox.cpp.

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

virtual bool wGui::CTextBox::IsReadOnly ( void   )  const [inline, virtual]

Indicates if the text box is in read-only mode

Returns:
true if the control is read-only

Definition at line 63 of file wg_textbox.h.

References m_bReadOnly.

std::wstring wGui::CTextBox::GetSelText ( void   )  const [virtual]

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 108 of file wg_textbox.cpp.

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

void wGui::CTextBox::SetSelection ( std::wstring::size_type  iSelStart,
int  iSelLength 
) [virtual]

Set the selection

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

Definition at line 130 of file wg_textbox.cpp.

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

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

Gets the start of the selection

Returns:
The index of the start of the selection

Definition at line 76 of file wg_textbox.h.

References m_SelStart.

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

Gets the selection length

Returns:
The length of the selection

Definition at line 80 of file wg_textbox.h.

References m_SelLength.

void wGui::CTextBox::SetScrollBarVisibility ( CScrollBar::EScrollBarType  ScrollBarType,
EScrollBarVisibility  Visibility 
) [virtual]

Set the visibility mode for the scrollbars

Parameters:
ScrollBarType Indicates the vertical or the horizontal scrollbar
Visibility The visibility mode to set the scrollbar to

Definition at line 148 of file wg_textbox.cpp.

References m_ScrollBarVisibilityMap, and UpdateScrollBars().

virtual EScrollBarVisibility wGui::CTextBox::GetScrollBarVisibility ( CScrollBar::EScrollBarType  ScrollBarType  )  const [inline, virtual]

Gets the visibility mode for the indicated scrollbar

Parameters:
ScrollBarType Indicates the vertical or the horizontal scrollbar
Returns:
An EScrollBarVisibility value indicating the mode for the bar

Definition at line 98 of file wg_textbox.h.

References m_ScrollBarVisibilityMap.

void wGui::CTextBox::SetWindowRect ( const CRect WindowRect  )  [virtual]

Giving a control a new WindowRect will move and resize the control

Parameters:
WindowRect A CRect that defines the outer limits of the control

Reimplemented from wGui::CWindow.

Definition at line 279 of file wg_textbox.cpp.

References wGui::CRect::Grow(), wGui::CWindow::m_ClientRect, wGui::CWindow::m_WindowRect, wGui::CWindow::SetWindowRect(), wGui::CRect::SizeRect(), and UpdateScrollBars().

void wGui::CTextBox::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 270 of file wg_textbox.cpp.

References m_SelLength, m_SelStart, PrepareWindowText(), and wGui::CWindow::SetWindowText().

bool wGui::CTextBox::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 288 of file wg_textbox.cpp.

References wGui::CMessage::CTRL_DOUBLELCLICK, Draw(), wGui::CRangeControl< T >::GetValue(), wGui::CRect::HitTest(), wGui::CApplication::Instance(), wGui::CMessageServer::Instance(), wGui::CTimer::IsRunning(), wGui::CRect::Left(), wGui::CMouseMessage::LEFT, m_bMouseDown, m_bReadOnly, wGui::CWindow::m_bVisible, wGui::CWindow::m_ClientRect, m_DragStart, m_iLineCount, m_iRowHeight, m_pHorizontalScrollBar, m_pVerticalScrollBar, m_SelLength, m_SelStart, m_vpRenderedString, wGui::CWindow::OnMouseButtonDown(), wGui::CMessageServer::QueueMessage(), wGui::CRect::RELPOS_INSIDE, wGui::CApplication::SetKeyFocus(), wGui::CScrollBar::SetValue(), wGui::CTimer::StartTimer(), wGui::CRect::Top(), wGui::CWindow::ViewToWindow(), wGui::CMouseMessage::WHEELDOWN, wGui::CMouseMessage::WHEELUP, wGui::CPoint::XPos(), and wGui::CPoint::YPos().

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

CTextBox 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 378 of file wg_textbox.cpp.

References wGui::CMessage::CTRL_DOUBLELCLICK, wGui::CMessage::CTRL_GAININGKEYFOCUS, wGui::CMessage::CTRL_LOSINGKEYFOCUS, wGui::CMessage::CTRL_TIMER, wGui::CMessage::CTRL_VALUECHANGE, wGui::CMessage::CTRL_VALUECHANGING, wGui::CMessage::Destination(), Draw(), wGui::CView::GetFloatingWindow(), wGui::CRangeControl< T >::GetValue(), wGui::CWindow::GetView(), wGui::CWindow::HandleMessage(), wGui::CRect::HitTest(), wGui::CWindow::HitTest(), IndexFromRowCol(), wGui::CMessageServer::Instance(), wGui::CApplication::Instance(), wGui::CKeyboardMessage::Key, wGui::CMessage::KEYBOARD_KEYDOWN, wGui::CRect::Left(), m_bLastMouseMoveInside, m_bMouseDown, m_bReadOnly, wGui::CWindow::m_bVisible, wGui::CWindow::m_ClientRect, m_DragStart, m_iLineCount, m_iRowHeight, m_pHorizontalScrollBar, wGui::CWindow::m_pParentWindow, m_pVerticalScrollBar, m_SelLength, m_SelStart, wGui::CWindow::m_sWindowText, m_vpRenderedString, wGui::CMessage::MessageType(), wGui::CKeyboardMessage::Modifiers, wGui::CMessage::MOUSE_BUTTONUP, wGui::CMessage::MOUSE_MOVE, wGui::CMouseMessage::Point, PrepareWindowText(), wGui::CMessageServer::QueueMessage(), wGui::CRect::RELPOS_BELOW, wGui::CRect::RELPOS_INSIDE, RowColFromIndex(), SelDelete(), wGui::CApplication::SetMouseCursor(), wGui::CMessage::Source(), wGui::CTimer::StartTimer(), wGui::CTimer::StopTimer(), wGui::CRect::Top(), wGui::CKeyboardMessage::Unicode, wGui::CWindow::ViewToWindow(), wGui::CPoint::XPos(), and wGui::CPoint::YPos().

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

Deletes the selected portion of the string

Definition at line 836 of file wg_textbox.cpp.

References m_SelLength, and m_SelStart.

Referenced by HandleMessage().

void wGui::CTextBox::PrepareWindowText ( const std::wstring &  sText  )  [protected]

Creates the rendered string objects and calculates some cached values for the string

Parameters:
sText The text to assign to the window

Definition at line 859 of file wg_textbox.cpp.

References wGui::CRenderedString::HALIGN_LEFT, m_iLineCount, m_iMaxWidth, m_iRowHeight, m_pFontEngine, m_vpRenderedString, UpdateScrollBars(), wGui::CRenderedString::VALIGN_TOP, and wGui::CPoint::XPos().

Referenced by CTextBox(), HandleMessage(), and SetWindowText().

CPoint wGui::CTextBox::RowColFromIndex ( std::wstring::size_type  Index  )  const [protected]

Convert an index to a row, column pair (in a CPoint object)

Parameters:
Index The index into the string
Returns:
A CPoint object with the row as YPos and the column as XPos

Definition at line 933 of file wg_textbox.cpp.

References wGui::CWindow::m_sWindowText.

Referenced by Draw(), and HandleMessage().

std::wstring::size_type wGui::CTextBox::IndexFromRowCol ( std::wstring::size_type  Row,
std::wstring::size_type  Col 
) const [protected]

Convert a row, column pair to an index

Parameters:
Row The row of the position to be converted
Col The column of the position to be converted
Returns:
The index into the string of the specified position

Definition at line 950 of file wg_textbox.cpp.

References m_vpRenderedString.

Referenced by HandleMessage().


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