Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::Win32Edit Class Reference

#include <Win32Edit.h>

Inheritance diagram for VCF::Win32Edit:

VCF::AbstractWin32Component VCF::TextEditPeer VCF::Win32TextPeer VCF::Win32Object VCF::ControlPeer VCF::TextPeer VCF::TextPeer VCF::ObjectWithCallbacks VCF::Interface VCF::Interface VCF::Interface VCF::Object List of all members.

Public Types

enum  EditState {
  esMultiLined = 0x0001, esStyleChanging = 0x0010, esPeerTextChanging = 0x0100, esModelTextChanging = 0x0200,
  esExternalTextChanging = 0x0400, esKeyEvent = 0x1000
}

Public Member Functions

 Win32Edit (TextControl *component, const bool &isMultiLineControl)
virtual ~Win32Edit ()
virtual void create (Control *owningControl)
 This is called to actually create any neccessary windowing system resources specific to a new control (or widget/window/etc) instance for the platform.
virtual void setText (const VCF::String &text)
 sets the text for the widget
virtual VCF::String getText ()
 returns a text associated with the component.
virtual CreateParams createParams ()
 called before the create window is called.
virtual bool handleEventMessages (UINT message, WPARAM wParam, LPARAM lParam, LRESULT &wndProcResult, WNDPROC defaultWndProc=NULL)
 returns true if no further handling is required, otherwise returns false, which means the rest of the handling needs to be done by the default wnd proc.
virtual void repaint (Rect *repaintRect=NULL)
virtual bool acceptsWMCommandMessages ()
virtual OSHandleID getTextObjectHandle ()
 Return the native text object handle.
virtual void insertText (unsigned int start, const String &text)
virtual void deleteText (unsigned int start, unsigned int length)
virtual unsigned int getTextLength ()
virtual String getText (unsigned int start, unsigned int length)
virtual void paint (GraphicsContext *context, const Rect &paintRect)
virtual void setRightMargin (const double &rightMargin)
virtual void setLeftMargin (const double &leftMargin)
virtual void setTopMargin (const double &topMargin)
virtual void setBottomMargin (const double &bottomMargin)
virtual double getLeftMargin ()
virtual double getRightMargin ()
virtual double getTopMargin ()
virtual double getBottomMargin ()
virtual uint32 getLineCount ()
virtual Rect getContentBoundsForWidth (const double &width)
virtual void setStyle (unsigned int start, unsigned int length, Dictionary &styles)
 This sets the style for the text.
virtual void getStyle (unsigned int start, unsigned int length, Dictionary &styles)
 gets the current style of the text.
virtual void setDefaultStyle (Dictionary &styles)
 call this to set the defaults for the text peer.
virtual PointgetPositionFromCharIndex (const uint32 &index)
virtual uint32 getCharIndexFromPosition (Point *point)
virtual uint32 getCaretPosition ()
 returns the current caret position with in the text control this is specified by a zero based number representing the insertion point with the text control's text (stored in the text control's Model).
virtual void setCaretPosition (const uint32 &caretPos)
virtual uint32 getCurrentLinePosition ()
virtual uint32 getSelectionStart ()
 returns the zero based index that indicates where the current selection begins may be the same index that getCaretPosition() returns
virtual uint32 getSelectionCount ()
 returns the number of characters selected
virtual void setSelectionMark (const uint32 &start, const uint32 &count)
virtual void clearSelection ()
virtual void scrollToLine (const uint32 &lineIndex)
virtual void scrollToSelection (const bool &_showEndSel=false)
virtual void setReadOnly (const bool &readonly)
virtual void print (PrintContext *context, const int32 &page)
 This attempts to print a single page and render in to the printer context that's passed in.
virtual void finishPrinting ()
virtual uint32 getTotalPrintablePageCount (PrintContext *context)
virtual void cut ()
 Cuts the selection and places it in the clipboard.
virtual void copy ()
 Copies the selection and places it in the clipboard.
virtual void paste ()
 Pastes the contents of the clipboard into the text control.
virtual bool canUndo ()
 Returns a bool to indicate whether or not an undo operation can be performed.
virtual bool canRedo ()
 Returns a bool to indicate whether or not a redo operation can be performed.
virtual void undo ()
 Undoes the last operation.
virtual void redo ()
 Redoes the last operation.
virtual void setTextWrapping (const bool &val)
virtual bool getTextWrapping ()

Protected Member Functions

bool stateAllowsModelChange ()
void onTextModelTextChanged (ModelEvent *event)
int getCRCount (const uint32 &begin, const uint32 &end, const bool &limitCountsAreExact)
 this is a fix from Marcello to work around an apparent bug in Win32's handling of crlf's
void getSelectionMark (long &start, long &end)
void onControlModelChanged (Event *e)

Protected Attributes

VCF::Point posAtChar_
HBRUSH backgroundBrush_
int currentSelLength_
int currentSelStart_
TextControltextControl_
int editState_
std::map< uint32, uint32printPageMap_
bool textWrapping_
Win32RichEditOleCallback * richEditCallback_

Member Enumeration Documentation

enum VCF::Win32Edit::EditState
 

Enumerator:
esMultiLined 
esStyleChanging 
esPeerTextChanging 
esModelTextChanging 
esExternalTextChanging 
esKeyEvent 


Constructor & Destructor Documentation

VCF::Win32Edit::Win32Edit TextControl component,
const bool &  isMultiLineControl
 

virtual VCF::Win32Edit::~Win32Edit  )  [virtual]
 


Member Function Documentation

virtual bool VCF::Win32Edit::acceptsWMCommandMessages  )  [inline, virtual]
 

Reimplemented from VCF::Win32Object.

virtual bool VCF::Win32Edit::canRedo  )  [virtual]
 

Returns a bool to indicate whether or not a redo operation can be performed.

Returns:
bool true if an a redo operation can be performed. This indicates that a call to redo() will succeed. Returns false to indicate no redo is possible and any calls to redo() will be no-ops.

Implements VCF::TextEditPeer.

virtual bool VCF::Win32Edit::canUndo  )  [virtual]
 

Returns a bool to indicate whether or not an undo operation can be performed.

Returns:
bool true if an an undo operation can be performed. This indicates that a call to undo() will succeed. Returns false to indicate no undo is possible and any calls to undo() will be no-ops.

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::clearSelection  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::copy  )  [virtual]
 

Copies the selection and places it in the clipboard.

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::create Control owningControl  )  [virtual]
 

This is called to actually create any neccessary windowing system resources specific to a new control (or widget/window/etc) instance for the platform.

create() must be called by the containing VCF::Control subclass, typically in the classes constructor, after retreiving the new peer instance from the appropriate UIToolkit::createXXX() call.

Reimplemented from VCF::AbstractWin32Component.

virtual CreateParams VCF::Win32Edit::createParams  )  [virtual]
 

called before the create window is called.

Overide this to change the style and style ex parameters. Returns a pair, the pair.first is the style parameter, the pair.second is the style ex paramater.

Reimplemented from VCF::Win32Object.

virtual void VCF::Win32Edit::cut  )  [virtual]
 

Cuts the selection and places it in the clipboard.

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::deleteText unsigned int  start,
unsigned int  length
[virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual void VCF::Win32Edit::finishPrinting  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual double VCF::Win32Edit::getBottomMargin  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual uint32 VCF::Win32Edit::getCaretPosition  )  [virtual]
 

returns the current caret position with in the text control this is specified by a zero based number representing the insertion point with the text control's text (stored in the text control's Model).

Returns:
uint32 the index of the current insertion point in the Model's text

Implements VCF::TextEditPeer.

virtual uint32 VCF::Win32Edit::getCharIndexFromPosition Point point  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual Rect VCF::Win32Edit::getContentBoundsForWidth const double &  width  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

int VCF::Win32Edit::getCRCount const uint32 begin,
const uint32 end,
const bool &  limitCountsAreExact
[protected]
 

this is a fix from Marcello to work around an apparent bug in Win32's handling of crlf's

virtual uint32 VCF::Win32Edit::getCurrentLinePosition  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual double VCF::Win32Edit::getLeftMargin  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual uint32 VCF::Win32Edit::getLineCount  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual Point* VCF::Win32Edit::getPositionFromCharIndex const uint32 index  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual double VCF::Win32Edit::getRightMargin  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual uint32 VCF::Win32Edit::getSelectionCount  )  [virtual]
 

returns the number of characters selected

Returns:
uint32 the number of characters selected, a return value of 0 indicates that no characters are currently selected

Implements VCF::TextEditPeer.

void VCF::Win32Edit::getSelectionMark long &  start,
long &  end
[protected]
 

virtual uint32 VCF::Win32Edit::getSelectionStart  )  [virtual]
 

returns the zero based index that indicates where the current selection begins may be the same index that getCaretPosition() returns

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::getStyle unsigned int  start,
unsigned int  length,
Dictionary styles
[virtual]
 

gets the current style of the text.

Parameters:
unsigned int start the beginning of the location of which we are getting the style.
unsigned int length the length of the location of which we are getting the style.
Dictionary& styles the dictionary storing the values for each style attribute.

Reimplemented from VCF::Win32TextPeer.

virtual String VCF::Win32Edit::getText unsigned int  start,
unsigned int  length
[virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual VCF::String VCF::Win32Edit::getText  )  [virtual]
 

returns a text associated with the component.

This usually gets used in the Control::getCaption() method.

Reimplemented from VCF::AbstractWin32Component.

virtual unsigned int VCF::Win32Edit::getTextLength  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual OSHandleID VCF::Win32Edit::getTextObjectHandle  )  [virtual]
 

Return the native text object handle.

For Win32 systems this will be an IUnknown interface that may be queried for either ITextServices or ITextDocument. For OSX this will be a TXNObject instance.

Reimplemented from VCF::Win32TextPeer.

virtual bool VCF::Win32Edit::getTextWrapping  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual double VCF::Win32Edit::getTopMargin  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual uint32 VCF::Win32Edit::getTotalPrintablePageCount PrintContext context  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual bool VCF::Win32Edit::handleEventMessages UINT  message,
WPARAM  wParam,
LPARAM  lParam,
LRESULT &  wndProcResult,
WNDPROC  defaultWndProc = NULL
[virtual]
 

returns true if no further handling is required, otherwise returns false, which means the rest of the handling needs to be done by the default wnd proc.

Reimplemented from VCF::AbstractWin32Component.

virtual void VCF::Win32Edit::insertText unsigned int  start,
const String text
[virtual]
 

Reimplemented from VCF::Win32TextPeer.

void VCF::Win32Edit::onControlModelChanged Event e  )  [protected]
 

void VCF::Win32Edit::onTextModelTextChanged ModelEvent event  )  [protected]
 

virtual void VCF::Win32Edit::paint GraphicsContext context,
const Rect paintRect
[virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual void VCF::Win32Edit::paste  )  [virtual]
 

Pastes the contents of the clipboard into the text control.

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::print PrintContext context,
const int32 page
[virtual]
 

This attempts to print a single page and render in to the printer context that's passed in.

Note that some platforms may not support this, as printing support varies widely. It will work on Win32, and should work on Mac OS X as well.

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::redo  )  [virtual]
 

Redoes the last operation.

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::repaint Rect repaintRect = NULL  )  [virtual]
 

virtual void VCF::Win32Edit::scrollToLine const uint32 lineIndex  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::scrollToSelection const bool &  _showEndSel = false  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::setBottomMargin const double &  bottomMargin  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual void VCF::Win32Edit::setCaretPosition const uint32 caretPos  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::setDefaultStyle Dictionary styles  )  [virtual]
 

call this to set the defaults for the text peer.

If this is not called, then the default font is that used for label controls and the defaul paragraph alignment is left aligned.

Reimplemented from VCF::Win32TextPeer.

virtual void VCF::Win32Edit::setLeftMargin const double &  leftMargin  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual void VCF::Win32Edit::setReadOnly const bool &  readonly  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::setRightMargin const double &  rightMargin  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

virtual void VCF::Win32Edit::setSelectionMark const uint32 start,
const uint32 count
[virtual]
 

Parameters:
uint32 the starting point. The index is zero based.
uint32 the number of characters selected.

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::setStyle unsigned int  start,
unsigned int  length,
Dictionary styles
[virtual]
 

This sets the style for the text.

Pass in a Dictionary with a set of values for each style attribute. Example:

TextPeer* textPeer = ....

Dictionary styles; style [Text::fsFontName] = "Arial"; style [Text::fsPointSize] = 15.0; style [Text::fsBold] = true;

textPeer->setStyle( 5, 10, styles );

this changes the font at position 5, for a length of 10, to be "arial", bold and a point size of 15.

Reimplemented from VCF::Win32TextPeer.

virtual void VCF::Win32Edit::setText const VCF::String text  )  [virtual]
 

sets the text for the widget

Reimplemented from VCF::AbstractWin32Component.

virtual void VCF::Win32Edit::setTextWrapping const bool &  val  )  [virtual]
 

Implements VCF::TextEditPeer.

virtual void VCF::Win32Edit::setTopMargin const double &  topMargin  )  [virtual]
 

Reimplemented from VCF::Win32TextPeer.

bool VCF::Win32Edit::stateAllowsModelChange  )  [protected]
 

virtual void VCF::Win32Edit::undo  )  [virtual]
 

Undoes the last operation.

Implements VCF::TextEditPeer.


Member Data Documentation

HBRUSH VCF::Win32Edit::backgroundBrush_ [protected]
 

int VCF::Win32Edit::currentSelLength_ [protected]
 

int VCF::Win32Edit::currentSelStart_ [protected]
 

int VCF::Win32Edit::editState_ [protected]
 

VCF::Point VCF::Win32Edit::posAtChar_ [protected]
 

std::map<uint32,uint32> VCF::Win32Edit::printPageMap_ [protected]
 

Win32RichEditOleCallback* VCF::Win32Edit::richEditCallback_ [protected]
 

TextControl* VCF::Win32Edit::textControl_ [protected]
 

bool VCF::Win32Edit::textWrapping_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information