- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::GUI::Controls::CTextEdit Class Reference

Inheritance diagram for Exponent::GUI::Controls::CTextEdit:

List of all members.

## Detailed Description

Displays text in a box area and allows the user to edit it.

Date:
  13/04/2005

Author:
  Paul Chana

Version:
  1.0.0 Initial version

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CTextEdit.hpp,v 1.7 2007/02/08 21:07:54 paul Exp

Definition at line 46 of file CTextEdit.hpp.

## Public Types

- enum ETextEditAlignment {
  e_center = 0,
  e_left,
  e_right
  }
    Alignment of the text edit. More...

## Public Member Functions

- virtual void cancelCall (const bool cancel)
- CTextEdit (IControlRoot *root, const long uniqueId, const CRect &area, const CString &text, IActionListener *listener=NULL)
- virtual void drawControl (CGraphics &graphics)
- virtual const CString & getString () const
- virtual TXNObject getTxnHandle () const
- virtual void handleActionEvent (const CActionEvent &event)
- virtual void handleDoubleClick (CMouseEvent &event)
- virtual void handleLeftButtonDown (CMouseEvent &event)
- virtual void limitText (const bool limitText=false, const long textLimit=256)
- virtual void setAlignment (const ETextEditAlignment alignment)
- virtual void setEditable (const bool editable=true)
- LRESULT setEditWindowDrawConditions (HDC drawContext)
- virtual void setSingleClickEditable (const bool editable=true)
- virtual ~CTextEdit ()

## Protected Member Functions

- void launchEdit (CMouseEvent &event)

## Static Protected Member Functions

- static pascal OSStatus windowProcTextEdit (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData)
- static LONG WINAPI windowProcTextEdit (HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam)

## Protected Attributes

- ETextEditAlignment m_alignment
- CBrush m_brush
- bool m_cancel
- HWND m_editWindowHandle
- bool m_isEditable
- bool m_limitText
- IControl * m_previouslyLockedControl
- bool m_singleClickEdit
- EventHandlerRef m_textEditEventHandler
- long m_textLimit
- TXNObject m_txnHandle

## Static Protected Attributes

- static WNDPROC m_lastWinProc

## Member Enumeration Documentation

enum Exponent::GUI::Controls::CTextEdit::ETextEditAlignment

Alignment of the text edit.

Enumerator:

  e_center | Center align text
  e_left | Left align text
  e_right |

Definition at line 62 of file CTextEdit.hpp.

## Constructor & Destructor Documentation

Exponent::GUI::Controls::CTextEdit::CTextEdit | ( | IControlRoot * | root,
|  | const long | uniqueId,
|  | const CRect & | area,
|  | const CString & | text,
|  | IActionListener * | listener = `NULL` |
| ) |  |  |

Construction

Parameters:

  | root | The root control that this control is being added to
  | uniqueId | The unique Identifier of this control or CCONTROL_NO_ID_REQUIRED if no id is required
  | area | The area of this control relative to the root controls top left
  | text | The text to display
  | listener | The action listener

virtual Exponent::GUI::Controls::CTextEdit::~CTextEdit | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

virtual void Exponent::GUI::Controls::CTextEdit::cancelCall | ( | const bool | cancel | ) | `[inline, virtual]`

Is this a cancel call to handleActionEvent?

Parameters:

  | cancel | True if is a cancel call

Note:
  Internal use only, do not call this function

Definition at line 174 of file CTextEdit.hpp.

References m_cancel.

virtual void Exponent::GUI::Controls::CTextEdit::drawControl | ( | CGraphics & | graphics | ) | `[virtual]`

Draw the controls

Parameters:

  | graphics | The graphics context

Reimplemented from Exponent::GUI::Controls::CTextLabel.

virtual const CString& Exponent::GUI::Controls::CTextEdit::getString | ( |  | ) | const`[inline, virtual]`

Get the string

Return values:

  | const | CString & The text

Definition at line 146 of file CTextEdit.hpp.

References Exponent::GUI::Controls::CTextLabel::m_text.

virtual TXNObject Exponent::GUI::Controls::CTextEdit::getTxnHandle | ( |  | ) | const`[inline, virtual]`

Get the TXNObject associated with the edit

Return values:

  | TXNObject | The editor handle

Definition at line 167 of file CTextEdit.hpp.

References m_txnHandle.

virtual void Exponent::GUI::Controls::CTextEdit::handleActionEvent | ( | const CActionEvent & | event | ) | `[virtual]`

Handle events - NOT INTENDED FOR PUBLIC USE!!

Parameters:

  | event | The event to handle

virtual void Exponent::GUI::Controls::CTextEdit::handleDoubleClick | ( | CMouseEvent & | event | ) | `[virtual]`

Handle a double click on the left button

Parameters:

  | event | The event to handle

Reimplemented from Exponent::GUI::Controls::CControl.

virtual void Exponent::GUI::Controls::CTextEdit::handleLeftButtonDown | ( | CMouseEvent & | event | ) | `[virtual]`

Handle left button being clicked

Parameters:

  | event | The event to handle

Reimplemented from Exponent::GUI::Controls::CControl.

void Exponent::GUI::Controls::CTextEdit::launchEdit | ( | CMouseEvent & | event | ) | `[protected]`

Launch the edit

Parameters:

  | event | The mouse event that triggered

virtual void Exponent::GUI::Controls::CTextEdit::limitText | ( | const bool | limitText = `false`,
|  | const long | textLimit = `256` |
| ) |  |  | `[virtual]`

Should we limit the text

Parameters:

  | limitText | If true text is limited to to textLimit numberof characters. If false then text is not limited
  | textLimit | If limitText is true, this parameter defines the number of limited characters

virtual void Exponent::GUI::Controls::CTextEdit::setAlignment | ( | const ETextEditAlignment | alignment | ) | `[inline, virtual]`

Set text alignment

Parameters:

  | alignment | The alignment to draw the text with

Definition at line 127 of file CTextEdit.hpp.

References m_alignment.

virtual void Exponent::GUI::Controls::CTextEdit::setEditable | ( | const bool | editable = `true` | ) | `[inline, virtual]`

Are we editable?

Parameters:

  | editable | If true the text is editable, if false this becomesa CTextLabel

See also:
  CTextLabel

Definition at line 134 of file CTextEdit.hpp.

References m_isEditable.

LRESULT Exponent::GUI::Controls::CTextEdit::setEditWindowDrawConditions | ( | HDC | drawContext | ) |

Dirty little hack in to the edit window, so that we can correctly set the background colour fo the box.

Parameters:

  | drawContext | The drawing context for the edit box

Return values:

  | LRESULT | Handle to the brush

virtual void Exponent::GUI::Controls::CTextEdit::setSingleClickEditable | ( | const bool | editable = `true` | ) | `[inline, virtual]`

Set single click editable

Parameters:

  | editable | If true then a single click will trigger an edit event. A double click will not be handlded in this case

Definition at line 140 of file CTextEdit.hpp.

References m_singleClickEdit.

static pascal OSStatus Exponent::GUI::Controls::CTextEdit::windowProcTextEdit | ( | EventHandlerCallRef | inHandlerCallRef,
|  | EventRef | inEvent,
|  | void * | inUserData |
| ) |  |  | `[static, protected]`

Call back function for the window

Parameters:

  | inHandlerCallRef | Event handler reference
  | inEvent | The event to handle
  | inUserData | A reference to the CTextEdit that created the window

Return values:

  | pascal | OSStatus The status of the event

See also:
  TXNObject

static LONG WINAPI Exponent::GUI::Controls::CTextEdit::windowProcTextEdit | ( | HWND | windowHandle,
|  | UINT | message,
|  | WPARAM | wParam,
|  | LPARAM | lParam |
| ) |  |  | `[static, protected]`

Call back function for the window

Parameters:

  | windowHandle | Handle to the edit window
  | message | The event to handle
  | wParam | The event high bits
  | lParam | The event low bits

Return values:

  | LONG | The window handler result

See also:
  WindowProc

## Member Data Documentation

ETextEditAlignment Exponent::GUI::Controls::CTextEdit::m_alignment`[protected]`

The alignment

Definition at line 247 of file CTextEdit.hpp.

Referenced by setAlignment().

CBrush Exponent::GUI::Controls::CTextEdit::m_brush`[protected]`

The brush

Definition at line 234 of file CTextEdit.hpp.

bool Exponent::GUI::Controls::CTextEdit::m_cancel`[protected]`

Is this cancel call?

Definition at line 240 of file CTextEdit.hpp.

Referenced by cancelCall().

HWND Exponent::GUI::Controls::CTextEdit::m_editWindowHandle`[protected]`

handle to the edit window

Definition at line 231 of file CTextEdit.hpp.

bool Exponent::GUI::Controls::CTextEdit::m_isEditable`[protected]`

Can we be edited?

Definition at line 248 of file CTextEdit.hpp.

Referenced by setEditable().

WNDPROC Exponent::GUI::Controls::CTextEdit::m_lastWinProc`[static, protected]`

The main window proc

Definition at line 232 of file CTextEdit.hpp.

bool Exponent::GUI::Controls::CTextEdit::m_limitText`[protected]`

Should the text be limited

Definition at line 245 of file CTextEdit.hpp.

IControl* Exponent::GUI::Controls::CTextEdit::m_previouslyLockedControl`[protected]`

The last locked control

Definition at line 233 of file CTextEdit.hpp.

bool Exponent::GUI::Controls::CTextEdit::m_singleClickEdit`[protected]`

Can we be edited by a single click

Definition at line 249 of file CTextEdit.hpp.

Referenced by setSingleClickEditable().

EventHandlerRef Exponent::GUI::Controls::CTextEdit::m_textEditEventHandler`[protected]`

Event handler

Definition at line 239 of file CTextEdit.hpp.

long Exponent::GUI::Controls::CTextEdit::m_textLimit`[protected]`

If so what is the character limit

Definition at line 246 of file CTextEdit.hpp.

TXNObject Exponent::GUI::Controls::CTextEdit::m_txnHandle`[protected]`

Handle to the edit window

Definition at line 238 of file CTextEdit.hpp.

Referenced by getTxnHandle().