GTextView3 Class Reference

Unicode text editor control. More...

#include <GTextView3.h>

Inheritance diagram for GTextView3:

GDocView GDragDropTarget GLayout GView

List of all members.

Public Member Functions

char * GetClass ()
char * Name ()
 Returns the utf-8 text associated with this view.
bool Name (char *s)
 Sets the utf-8 text associated with this view.
char16NameW ()
 Returns the wide char text associated with this view.
bool NameW (char16 *s)
 Sets the wide char text associated with this view.
int64 Value ()
 Gets the integer representation of the view's contents.
void Value (int64 i)
 Sets the integer representation of the view's contents.
GFontGetFont ()
 Gets the font this control should draw with.
void SetFont (GFont *f, bool OwnIt=false)
 Sets the font for this control.
void SetWrapType (uint8 i)
 Sets the wrapping on the control, use TEXTED_WRAP_NONE or TEXTED_WRAP_REFLOW.
void SetCursor (int i, bool Select, bool ForceFullUpdate=false)
int IndexAt (int x, int y)
 Returns the character index at the x,y location.
bool IsDirty ()
 True if the document has changed.
bool HasSelection ()
 True if there is a selection.
void UnSelectAll ()
 Unselect all the text.
void SelectWord (int From)
 Select the word from index 'From'.
void SelectAll ()
 Select all the text in the control.
int GetCursor (bool Cursor=true)
void PositionAt (int &x, int &y, int Index=-1)
 Index=-1 returns the x,y of the cursor, Index >=0 returns the specified x,y.
int GetLines ()
 Gets the number of lines of text.
void GetTextExtent (int &x, int &y)
 Gets the pixels required to display all the text.
char * GetSelection ()
 Get the selection as a dynamicially allocated utf-8 string.
bool Open (char *Name, char *Cs=0)
 Open a file handler.
bool Save (char *Name, char *Cs=0)
 Save a file handler.
bool Cut ()
 Cuts the selection from the document and puts it on the clipboard.
bool Copy ()
 Copies the selection from the document to the clipboard.
bool Paste ()
 Pastes the current contents of the clipboard into the document.
virtual bool DoFind ()
 Find window handler.
virtual bool DoReplace ()
 Replace window handler.
void OnPosChange ()
 Called when the view position changes.
void OnCreate ()
 The view is attached.
void OnEscape (GKey &K)
 Called when the user hits the escape key.
void OnMouseWheel (double Lines)
 The mouse wheel was scrolled.
void OnFocus (bool f)
 The view gains or loses the keyboard focus.
void OnMouseClick (GMouse &m)
 The mouse was clicked over this view.
void OnMouseMove (GMouse &m)
 The mouse moves over the control.
bool OnKey (GKey &k)
 A key was pressed while this view has focus.
void OnPaint (GSurface *pDC)
 Called to paint the onscreen representation of the view.
int OnEvent (GMessage *Msg)
 Handles the incoming events.
int OnNotify (GViewI *Ctrl, int Flags)
 Called when a child view or view with it's SetNotify() set to this window changes.
void OnPulse ()
 Called every so often by the timer system.
int OnHitTest (int x, int y)
bool OnLayout (GViewLayoutInfo &Inf)
 Called to get layout information for the control.
int WillAccept (List< char > &Formats, GdcPt2 Pt, int KeyState)
int OnDrop (char *Format, GVariant *Data, GdcPt2 Pt, int KeyState)
virtual void OnEnter (GKey &k)
 Called when the user hits the enter key.
virtual void OnUrl (char *Url)
 Called when the user clicks a URL.


Detailed Description

Unicode text editor control.

Member Function Documentation

char* GTextView3::GetClass (  )  [inline]

The class' name. Should be overriden in child classes to return the right class name. Mostly used for debugging, but in the win32 port it is also the default WIN32 class name passed to RegisterClass() in GView::CreateClass().

Returns:
the Class' name for debugging

Reimplemented from GDocView.

int GTextView3::GetCursor ( bool  Cursor = true  )  [virtual]

Cursor=false means the other end of the selection if any. The cursor is alwasy at one end of the selection.

Reimplemented from GDocView.

GFont * GTextView3::GetFont (  )  [virtual]

Gets the font this control should draw with.

The default font is the system font, owned by the GApp object.

Reimplemented from GView.

bool GTextView3::Name ( char *  n  ) 

Sets the utf-8 text associated with this view.

Name and NameW are interchangable. Using them in any order will convert the text between utf-8 and wide to satify any requirement. Generally once the opposing version of the string is required both the utf-8 and wide copies of the string remain cached in RAM until the Name is changed.

Reimplemented from GView.

References GView::Invalidate().

char16 * GTextView3::NameW (  )  [virtual]

Returns the wide char text associated with this view.

On Win32 the wide characters are 16 bits, on unix systems they are 32-bit characters.

Reimplemented from GView.

Referenced by OnEvent().

int GTextView3::OnDrop ( char *  Format,
GVariant Data,
GdcPt2  Pt,
int  KeyState 
) [virtual]

'OnDrop' is called when the user releases the data over your window. The data is going to be a binary GVariant in the format you accepted earlier.

Returns:
DROPEFFECT_NONE for failure or DROPEFFECT_COPY, DROPEFFECT_MOVE, DROPEFFECT_LINK

Reimplemented from GDragDropTarget.

References GVariant::Binary, GView::Invalidate(), GVariant::IsBinary(), and GVariant::Value.

int GTextView3::OnHitTest ( int  x,
int  y 
)

Return the type of cursor that should be visible when the mouse is at x,y e.g. LCUR_Normal

Reimplemented from GView.

References GLayout::GetClient().

int GTextView3::OnNotify ( GViewI *  Ctrl,
int  Flags 
)

Called when a child view or view with it's SetNotify() set to this window changes.

The event by default will bubble up to the GWindow at the top of the window heirarchy visiting each GView on the way. If it reaches a GView that processes it then the event stops propergating up the heirarchy.

Reimplemented from GLayout.

References IDC_VSCROLL, GView::Invalidate(), and GLayout::VScroll.

void GTextView3::OnPulse (  ) 

Called every so often by the timer system.

See also:
SetPulse()

Reimplemented from GView.

References GView::Invalidate(), and GRect::Offset().

void GTextView3::SetCursor ( int  i,
bool  Select,
bool  ForceFullUpdate = false 
) [virtual]

Set the cursor position, to select an area, move the cursor with Select=false then set the other end of the region with Select=true.

Reimplemented from GDocView.

References GLayout::GetClient(), GTVN_CURSOR_CHANGED, GView::Invalidate(), GRect::Offset(), GView::SendNotify(), GRect::Set(), GRect::Union(), GScrollBar::Value(), Value(), GLayout::VScroll, GView::X(), GRect::X(), GRect::x1, GRect::x2, and GRect::Y().

Referenced by OnEnter(), OnKey(), OnMouseClick(), OnMouseMove(), Open(), and Paste().

void GTextView3::SetFont ( GFont Fnt,
bool  OwnIt = false 
) [virtual]

Sets the font for this control.

The lifetime of the font passed in is the responsibility of the caller. The GView object assumes the pointer will be valid at all times.

Reimplemented from GView.

References GTypeFace::Fore(), and GTypeFace::Underline().

int GTextView3::WillAccept ( List< char > &  Formats,
GdcPt2  Pt,
int  KeyState 
) [virtual]

'WillAccept' is called to see whether this target can cope with any of the data types being passed to it. Once you have decided what format you want the data in clear all the other formats from the list. The first format left in the list will be passed to the 'OnDrop' function.

Returns:
DROPEFFECT_NONE for failure or DROPEFFECT_COPY, DROPEFFECT_MOVE, DROPEFFECT_LINK

Reimplemented from GDragDropTarget.

References List< Type >::Current(), List< Type >::Delete(), List< Type >::First(), and List< Type >::Next().


The documentation for this class was generated from the following files:

Generated on Wed Dec 1 15:41:04 2010 for Lgi by  doxygen 1.5.7.1