Vaca::Edit Class Reference

#include <Edit.h>

Inheritance diagram for Vaca::Edit:

Vaca::Widget Vaca::Component Vaca::Referenceable Vaca::NonCopyable Vaca::MultilineEdit Vaca::PasswordEdit

List of all members.


Detailed Description

Widget to edit a line of text.

See also:
TN008: Unicode support

Public Member Functions

 Edit (const String &text, Widget *parent, Style style=EditStyle)
virtual ~Edit ()
int getTextLength ()
int getTextLimit ()
 Returns the current text limit (EM_GETLIMITTEXT).
void setTextLimit (int textLimit)
 Sets the text limit (EM_SETLIMITTEXT).
bool isReadOnly ()
 Returns true if this Edit widget has read-only mode activated.
void setReadOnly (bool readOnly)
 Changes the read-only mode to readOnly.
bool canUndo ()
 Returns true if the user can undo the last operation (EM_CANUNDO).
void undo ()
 Undoes the last user's operation in the Edit widget.
void cut ()
void copy ()
void paste ()
void selectAll ()
 Selects all the text in the Edit widget.
void selectRange (int start, int end)
 Selects a range of text.
void deselect ()
 Removes the text's selection.
void getSelection (int &start, int &end)
 Returns the current selected range in the text-box.

Public Attributes

Signal1< void, Event & > Change

Protected Member Functions

virtual void onPreferredSize (Size &sz)
 It should calculates the preferred size for this widget.
virtual void onChange (Event &ev)
virtual bool onReflectedCommand (int id, int code, LRESULT &lResult)
 Converts the EN_CHANGE in onChange.

Constructor & Destructor Documentation

Edit::Edit ( const String text,
Widget parent,
Style  style = EditStyle 
)

Edit::~Edit (  )  [virtual]


Member Function Documentation

int Vaca::Edit::getTextLength (  ) 

int Edit::getTextLimit (  ) 

Returns the current text limit (EM_GETLIMITTEXT).

void Edit::setTextLimit ( int  textLimit  ) 

Sets the text limit (EM_SETLIMITTEXT).

The user can't write more of textLimit characters inside the Edit widget.

bool Edit::isReadOnly (  ) 

Returns true if this Edit widget has read-only mode activated.

void Edit::setReadOnly ( bool  readOnly  ) 

Changes the read-only mode to readOnly.

A read-only Edit widget can't be modified. It's a wrapper for the EM_SETREADONLY message.

bool Edit::canUndo (  ) 

Returns true if the user can undo the last operation (EM_CANUNDO).

void Edit::undo (  ) 

Undoes the last user's operation in the Edit widget.

void Edit::cut (  ) 

void Edit::copy (  ) 

void Edit::paste (  ) 

void Edit::selectAll (  ) 

Selects all the text in the Edit widget.

void Edit::selectRange ( int  startIndex,
int  endIndex 
)

Selects a range of text.

The range is specified by the indexes startIndex and endIndex.

void Edit::deselect (  ) 

Removes the text's selection.

void Edit::getSelection ( int &  start,
int &  end 
)

Returns the current selected range in the text-box.

void Edit::onPreferredSize ( Size sz  )  [protected, virtual]

It should calculates the preferred size for this widget.

Parameters:
sz It's for input and output. You should put the preferred size in this value, but also you should read the input value to know if you must to fit the widget in some size. The possible values for sz are:
  • sz = Size(0, 0) to calculate the preferred size without restrictions.
  • sz = Size(width, 0) to calculate the preferred size with restricted <= width.
  • sz = Size(0, height) to calculate the preferred size with restricted <= height.

Reimplemented from Vaca::Widget.

void Edit::onChange ( Event ev  )  [protected, virtual]

bool Edit::onReflectedCommand ( int  id,
int  code,
LRESULT &  lResult 
) [protected, virtual]

Converts the EN_CHANGE in onChange.

Reimplemented from Vaca::Widget.


Member Data Documentation

See also:
onChange