SkyGI::TextView Class Reference

Inheritance diagram for SkyGI::TextView:
[legend]
Collaboration diagram for SkyGI::TextView:
[legend]
List of all members.

Public Member Functions

 TextView (Window *pParent, const Rect rFrame, unsigned int nWindowLayoutFlags, unsigned int uiTextViewFlags=0)
 TextView (Window *pParent, const Point pPos, unsigned int nWindowLayoutFlags, unsigned int uiTextViewFlags=TEXTVIEW_FLAG_SINGLE_LINE)
 ~TextView ()
void Paint (const Rect &rDirty)
void SetTextFlags (TextFlags nTextFlags)
TextFlags GetTextFlags ()
Point GetSizeHint (enumSizeHint nSizeHint)
void HandleMessage (const Message *pMessage)
void ScrollToLine (int iTopLine)
void KeyDown (const InputEvent &nInputEvent)
void OnTimer (int iTimerID, void *vpCookie)
bool FocusGet ()
bool FocusLost ()
void MouseDown (const InputEvent &nInputEvent)
void MouseWheel (const InputEvent &nInputEvent)
void Sized (const Point &pDelta)
DocumentGetDocument ()
DocumentBufferGetBuffer ()
int GetLines ()
void Set (const String &pString)
void Insert (const String &pString, const Point &cPos, bool bUndoAble=false, Rect *rUpdateRect=NULL, Point *pNewPos=NULL)
void Append (const String &pString, bool bAsNewLine=false, bool bUndoAble=false)
void Remove (const Point &cPos, bool bUndoAble=false, Rect *rUpdateRect=NULL, Point *pNewPos=NULL)
void Remove (const Point &cTL, const Point &cBR, bool bUndoAble=false)
void Clear ()
bool LoseFocus ()
void Enable (bool bEnable=true)
void SetPasswordMode (bool bEnable)
bool GetPasswordMode ()
void SetLeadingImage (Image *pImage, int iLeadingSpacing)
virtual void OnChanged ()
virtual void OnConfirm ()
virtual void SetCursor (unsigned int uiCursorPositionFlag)
virtual void SetDocumentParser (DocumentParser *pDocumentParser)
DocumentParserGetDocumentParser ()
void MouseMove (const InputEvent &nInputEvent)
void MouseUp (const InputEvent &nInputEvent)
bool LoadDocument (const String &szFilePath)
bool SaveDocument (const String &szFilePath)
bool SetFont (Font *pFont)
void SetSelection (const Point &cTopLeft, const Point &cBottomRight)
void ClearSelection (bool bRemoveSelectedText)
bool GetSelectionRectangle (Point &pRectTopLeft, Point &pRectBottomRight)
void MoveCursorHorizontal (int iDelta, bool bSelect=false)
void MoveCursorVertical (int iDelta, bool bSelect=false)
bool GetSelectedText (String *pText)
bool GetText (String *pText, int iLeft, int iTop, int iRight, int iBottom)
void Copy ()
void Paste ()
void Delete ()
void Cut ()
void SelectAll ()
bool PointInsideSelection (const Point &pPoint)
void AddUndoNode (const String &szText, int enumAction, const Point &pPos)
void Undo ()
void Redo ()
void ClearUndoNodes ()
int UndoCount ()
int RedoCount ()
bool IsDirty ()
void SetDirty (bool bDirty)
void ScrollToEnd ()
void ScrollToBegin ()
bool ScrollUp (int iLines=1)
bool ScrollDown (int iLines=1)
void SwitchFocusOnEnter (bool bSwitch)
virtual void OnContextMenu (const InputEvent &nInputEvent)
virtual void OnCursorPositionChanged (const Point &pPosition)
Point GetCursorPosition ()
void EnableFindBar (bool bEnable)
bool FindBarEnabled ()
void ShowFindBar ()
void OnVerticalScroll (int iValue, int iOldValue)
DocumentLineGetLine (int iLine)
String GetWordAt (const Point &cPos)
String GetWordAt (const Point &cPos, Rect &rRect)
bool IsTextSelected ()

Public Attributes

signal0 Changed
signal0 Confirm
signal1< const InputEvent & > ContextMenu
signal1< const Point & > CursorPositionChanged
signal0 Dirty

Protected Member Functions

void SetCursorPosition (const Point &nNewPos, bool bUpdateLayer, bool bShift, bool bRemoveSelection, bool bClearSelection=true)
void InvalidateLine (int iLine, int iNumLines=1)
void InvalidateUpdateRect (const Rect &rUpdateRect)

Detailed Description

TextView

Description:
This class implementes a full featured TextView using the Document class as backend editor.
Properties:
Examples:

clipboard.cpp, diskdevice.cpp, eventthread.cpp, layoutview.cpp, listview.cpp, localization.cpp, messagebox.cpp, networkinterface.cpp, progressbar.cpp, splitter.cpp, tabview.cpp, textview.cpp, and thread.cpp.


Constructor & Destructor Documentation

TextView::TextView ( Window pParent,
const Rect  rFrame,
unsigned int  nWindowLayoutFlags,
unsigned int  uiTextViewFlags = 0 
)

TextView Constructor

Description:
Create a new TextView.
Parameters:
pParent Passed to the Window constructor
rFrame Passed to the Window constructor
nWindowLayoutFlags Passed to the Window constructor
uiTextViewFlags TextView specific flags
See also:
Window, WindowLayoutFlags, TextViewFlags

TextView::TextView ( Window pParent,
const Point  pPos,
unsigned int  nWindowLayoutFlags,
unsigned int  uiTextViewFlags = TEXTVIEW_FLAG_SINGLE_LINE 
)

TextView::~TextView (  ) 


Member Function Documentation

void TextView::Paint ( const Rect rDirty  )  [virtual]

Paint window content

Description:
This function gets called whenever an area of the window has to be redrawn. Usually you should only draw from inside the Paint function. If you need to redraw a window (when lets say some content must be updated), simply call Invalidate() which will then (asynchronly) call this paint function.

Usually you should draw the background using Window::DrawBackground(rDirty) and the border with DrawBorder(rRect). This way the user has full control over the appearance of your window, meaning he can change the background and border style.
The window content area itself is defined by the border margin and the window margin. Every window may define a margin. If you draw content into this window always make sure to not draw into the margin area. Additionally, the border has a margin too. As the user has full control to select any border for your window make sure to user the current borders margin when drawing window content. the dra Window::Paint() just redraws the background using DrawBackground. Overload this member function to add custom dawing code
Overload this member function to add custom dawing code
Parameters:
rDirty - Dirty rectangular region which has to be redrawn. Prior entering this function the painters clip region is automatically set to this dirty region.
See also:
DrawBorder, DrawBackground, Border, GetBorder, GetBorder::Margin, GetMargin

Reimplemented from SkyGI::ScrollView.

void TextView::SetTextFlags ( TextFlags  nTextFlags  ) 

TextFlags TextView::GetTextFlags (  ) 

Point TextView::GetSizeHint ( enumSizeHint  nSizeHint  )  [virtual]

Get size hint

Description:
Overload this member function for derived classes to inform the GUI about size hints for your widget.
SIZE_HINT_PREFERRED
Return the preferred size of the widget (may depend on the actual content)
SIZE_HINT_MINIMUM
Return the minimum size the widget needs to display a proper content
Note:
If you want to get the minimum or preferred size of a window always use GetMinimumSize or GetPreferredSize. Don't call GetSizeHint directly
See also:
GetPreferredSize, GetMinimumSize, SetMinimumSize

Reimplemented from SkyGI::Window.

void TextView::HandleMessage ( const Message pMessage  )  [virtual]

Reimplemented from SkyGI::Window.

void TextView::ScrollToLine ( int  iTopLine  ) 

void TextView::KeyDown ( const InputEvent nInputEvent  )  [virtual]

Reimplemented from SkyGI::Window.

Reimplemented in SkyGI::ComboTextView, FindBarTextView, and SkyGI::ListViewNodeEdit.

void TextView::OnTimer ( int  iTimerID,
void *  vpCookie 
) [virtual]

Reimplemented from SkyGI::Window.

bool TextView::FocusGet (  )  [virtual]

Reimplemented from SkyGI::Window.

bool TextView::FocusLost (  )  [virtual]

Reimplemented from SkyGI::Window.

Reimplemented in SkyGI::ListViewNodeEdit.

void TextView::MouseDown ( const InputEvent nInputEvent  )  [virtual]

Mouse pressed

Description:
This function gets called when a mouse press occured inside this window.
Overload this member function to react on mouse presses.
Parameters:
nButton - MouseButton which was pressed
nMouseButtonMask - Mask showing which mouse buttons were pressed when the mouse press occured
nInputEvent - INPUT_EVENT_MOUSE_PRESS for a single and INPUTE_EVENT_MOUSE_DOUBLECLICK for a doubleclick

Reimplemented from SkyGI::Window.

void TextView::MouseWheel ( const InputEvent nInputEvent  )  [virtual]

Reimplemented from SkyGI::Window.

void TextView::Sized ( const Point pDelta  )  [virtual]

Called when window is resized

Description:
Overload this function to get notified when the window is resized
Note:
Call this function from the overloaded function to perform automatic window layout on child windows
Parameters:
pDelta - Size the window was resized
See also:
MoveTo, MoveBy, SetRect, Moved, Layout

Reimplemented from SkyGI::Window.

Document * TextView::GetDocument (  ) 

Get the TextView embedded Document

Description:
Returns a pointer to the embedded TextView Document
See also:
GetLines, GetBuffer, Document

DocumentBuffer & TextView::GetBuffer (  ) 

Get the TextView content

Description:
Returns a pointer to the TextViews content. Use GetBuffer()[0].szText to access the first line of the document. (Line 0 is always present).
See also:
GetLines, GetDocument
Examples:
listview.cpp.

int TextView::GetLines (  ) 

Get number of lines

Description:
Returns the number of text lines
See also:
GetBuffer, GetDocument

void TextView::Set ( const String pString  ) 

Set text of text view

Description:
Removes any previous text with Clear() and inserts specified text at (0,0)
Parameters:
pString Text to insert
See also:
Insert, Clear, Set
Examples:
layoutview.cpp.

void TextView::Insert ( const String pString,
const Point cPos,
bool  bUndoAble = false,
Rect rUpdateRect = NULL,
Point pNewPos = NULL 
)

Insert text at specified position

Description:
Inserts the text at specified position
Parameters:
pString Text to insert
cPos Position to insert text at
See also:
Append, Clear, Set

void TextView::Append ( const String pString,
bool  bAsNewLine = false,
bool  bUndoAble = false 
)

Append text to the TextView

Description:
Appends pString either as a new line at the bottom of the text or at the end of the last line
Parameters:
pString Text to add, may contain a newline to add multiple lines at once
bAsNewLine If true the text will be added at the bottom starting in a new line
See also:
Clear, Insert, Set

void TextView::Remove ( const Point cPos,
bool  bUndoAble = false,
Rect rUpdateRect = NULL,
Point pNewPos = NULL 
)

void TextView::Remove ( const Point cTL,
const Point cBR,
bool  bUndoAble = false 
)

void TextView::Clear (  ) 

Clear text from the TextView

Description:
Removes the entire text and positions the cursor at (0,0)
See also:
Append, Insert, Set

bool TextView::LoseFocus (  )  [virtual]

Focus about to be removed

Description:
Return false to prevent from a focus switch initiated either from the VKEY_TAB, SetFocus or SwitchFocus. If a another window gets focused with the mouse this function will not be called, because such a focus switch is possible always.
See also:
SetFocus, SwitchFocus, SetTabOrder, GetTabOrder, HandleTabKey

Reimplemented from SkyGI::Window.

void TextView::Enable ( bool  bEnable = true  )  [virtual]

Reimplemented from SkyGI::Window.

void TextView::SetPasswordMode ( bool  bEnable  ) 

bool TextView::GetPasswordMode (  ) 

void TextView::SetLeadingImage ( Image pImage,
int  iLeadingSpacing 
)

void TextView::OnChanged (  )  [virtual]

void TextView::OnConfirm (  )  [virtual]

Reimplemented in SkyGI::ListViewNodeEdit.

void TextView::SetCursor ( unsigned int  uiCursorPositionFlag  )  [virtual]

void TextView::SetDocumentParser ( DocumentParser pDocumentParser  )  [virtual]

DocumentParser * TextView::GetDocumentParser (  ) 

void TextView::MouseMove ( const InputEvent nInputEvent  )  [virtual]

Mouse move

Description:
This function gets called when the mouse cursor was moved inside the window. Mouse move events are only generated after a call to EnableMouseMoveEvents(). Use DisableMouseMoveEvents() to disable further generation of mouse move events.
Overload this member function to react on mouse move events.
Parameters:
pNewPosition - Current mouse cursor position
pOldPosition - Old mouse cursor position
nMouseButtonMask - Mask showing which mouse buttons were pressed when the mouse move occured

Reimplemented from SkyGI::Window.

void TextView::MouseUp ( const InputEvent nInputEvent  )  [virtual]

Mouse release

Description:
This function gets called when a mouse release occured inside this window.
Overload this member function to react on mouse releases.
Parameters:
nButton - MouseButton which was released
nMouseButtonMask - Mask showing which additional mouse buttons were pressed when the mouse release occured
nInputEvent - INPUT_EVENT_MOUSE_RELEASE

Reimplemented from SkyGI::Window.

bool TextView::LoadDocument ( const String szFilePath  ) 

bool TextView::SaveDocument ( const String szFilePath  ) 

bool TextView::SetFont ( Font pFont  )  [virtual]

Reimplemented from SkyGI::Window.

void TextView::SetSelection ( const Point cTopLeft,
const Point cBottomRight 
)

void TextView::ClearSelection ( bool  bRemoveSelectedText  ) 

bool TextView::GetSelectionRectangle ( Point pRectTopLeft,
Point pRectBottomRight 
)

void TextView::MoveCursorHorizontal ( int  iDelta,
bool  bSelect = false 
)

void TextView::MoveCursorVertical ( int  iDelta,
bool  bSelect = false 
)

bool TextView::GetSelectedText ( String pText  ) 

bool TextView::GetText ( String pText,
int  iLeft,
int  iTop,
int  iRight,
int  iBottom 
)

void TextView::Copy (  ) 

void TextView::Paste (  ) 

void TextView::Delete (  ) 

void TextView::Cut (  ) 

void TextView::SelectAll (  ) 

bool TextView::PointInsideSelection ( const Point pPoint  ) 

void TextView::AddUndoNode ( const String szText,
int  enumAction,
const Point pPos 
)

void TextView::Undo (  ) 

void TextView::Redo (  ) 

void TextView::ClearUndoNodes (  ) 

int TextView::UndoCount (  ) 

int TextView::RedoCount (  ) 

bool TextView::IsDirty (  ) 

void TextView::SetDirty ( bool  bDirty  ) 

void TextView::ScrollToEnd (  ) 

void TextView::ScrollToBegin (  ) 

bool TextView::ScrollUp ( int  iLines = 1  ) 

bool TextView::ScrollDown ( int  iLines = 1  ) 

void SkyGI::TextView::SwitchFocusOnEnter ( bool  bSwitch  )  [inline]

void TextView::OnContextMenu ( const InputEvent nInputEvent  )  [virtual]

void TextView::OnCursorPositionChanged ( const Point pPosition  )  [virtual]

Point TextView::GetCursorPosition (  ) 

void SkyGI::TextView::EnableFindBar ( bool  bEnable  )  [inline]

bool SkyGI::TextView::FindBarEnabled (  )  [inline]

void TextView::ShowFindBar (  ) 

void TextView::OnVerticalScroll ( int  iValue,
int  iOldValue 
) [virtual]

Gets called when a ScrollBar action occured

Overload this method to react on ScrollBar events. Optionally you can directly connect to a method to the ScrollBar::Changed signal.

Reimplemented from SkyGI::ScrollView.

DocumentLine * TextView::GetLine ( int  iLine  ) 

String TextView::GetWordAt ( const Point cPos  ) 

String TextView::GetWordAt ( const Point cPos,
Rect rRect 
)

bool TextView::IsTextSelected (  ) 

void TextView::SetCursorPosition ( const Point nNewPos,
bool  bUpdateLayer,
bool  bShift,
bool  bRemoveSelection,
bool  bClearSelection = true 
) [protected]

void TextView::InvalidateLine ( int  iLine,
int  iNumLines = 1 
) [protected]

void TextView::InvalidateUpdateRect ( const Rect rUpdateRect  )  [protected]


Member Data Documentation

signal0 SkyGI::TextView::Changed

signal0 SkyGI::TextView::Confirm

signal1<const InputEvent&> SkyGI::TextView::ContextMenu

signal1<const Point&> SkyGI::TextView::CursorPositionChanged

signal0 SkyGI::TextView::Dirty


Generated on Thu Dec 13 18:14:45 2007 for SkyGI by  doxygen 1.5.1-p1