os::View Class Reference
[The Syllable Graphical User Interface API]

Base class for all GUI components. More...

Inheritance diagram for os::View:

os::Handler os::DropdownMenu::DropdownView os::IconView::MainView os::AlertView os::Control os::DropdownMenu os::ImageView os::LayoutView os::ListViewCol os::ListViewContainer os::ListViewHeader os::Menu os::PopupMenu os::ProgressView os::Separator os::Splitter os::StringView os::TableView os::TabView os::TextEdit os_priv::SplitterSeparator TopView List of all members.

Public Member Functions

 View (const Rect &cFrame, const String &cTitle, uint32 nResizeMask=CF_FOLLOW_LEFT|CF_FOLLOW_TOP, uint32 nFlags=WID_WILL_DRAW|WID_CLEAR_BACKGROUND)
 View constructor.
virtual ~View ()
 View destructor.
virtual void AttachedToWindow ()
virtual void AllAttached ()
virtual void DetachedFromWindow ()
virtual void AllDetached ()
virtual void Activated (bool bIsActive)
 Hook called when the view gain or loose focus.
virtual void WindowActivated (bool bIsActive)
 Hook called when the window hosting this view gain or loose focus.
virtual void Paint (const Rect &cUpdateRect)
 Called by the system update "damaged" areas of the view.
virtual void MouseMove (const Point &cNewPos, int nCode, uint32 nButtons, Message *pcData)
 Hook called by the system when the mouse is moved.
virtual void MouseDown (const Point &cPosition, uint32 nButtons)
 Hook called by the system when a mouse button is pressed.
virtual void MouseUp (const Point &cPosition, uint32 nButtons, Message *pcData)
 Hook called by the system when a mouse button is release.
virtual void KeyDown (const char *pzString, const char *pzRawString, uint32 nQualifiers)
 Hook called by the system when a key is pressed while the view has focus.
virtual void KeyUp (const char *pzString, const char *pzRawString, uint32 nQualifiers)
 Hook called by the system when a key is released while the view has focus.
virtual void FrameMoved (const Point &cDelta)
 Virtual hook called by the system when the view is moved within it's parent.
virtual void FrameSized (const Point &cDelta)
 Virtual hook called by the system when the view is resized.
virtual void ViewScrolled (const Point &cDelta)
 Virtual hook called by the system when the view content is scrolled.
virtual void FontChanged (Font *pcNewFont)
 Called to notify the view that the font has changed.
virtual Point GetPreferredSize (bool bLargest) const
virtual Point GetContentSize () const
virtual void WheelMoved (const Point &cDelta)
 Hook called by the system when the scroll-wheel is rotated.
virtual void AddChild (View *pcView, bool bAssignTabOrder=false)
void RemoveChild (View *pcChild)
void RemoveThis ()
ViewGetChildAt (const Point &cPos) const
ViewGetChildAt (int nIndex) const
ViewGetParent () const
ScrollBarGetVScrollBar () const
ScrollBarGetHScrollBar () const
WindowGetWindow () const
String GetTitle () const
virtual int GetTabOrder () const
 Get the keybord manouvering order.
virtual void SetTabOrder (int nOrder=NEXT_TAB_ORDER)
 Set the keyboard manouvering sorting order.
virtual const ShortcutKeyGetShortcut () const
virtual void SetShortcut (const ShortcutKey &cShortcut)
 Set keyboard shortcut.
virtual void SetShortcutFromLabel (const String &cLabel)
 Set keyboard shortcut from Label.
void SetContextMenu (Menu *pcMenu)
 Set popup menu for a View.
MenuGetContextMenu () const
 Get popup menu.
uint32 GetQualifiers () const
void GetMouse (Point *pcPosition, uint32 *pnButtons) const
void SetMousePos (const Point &cPosition)
void BeginDrag (Message *pcData, const Point &cOffset, const Bitmap *pcBitmap, Handler *pcReplyTarget=NULL)
 Start a drag and drop operation.
void BeginDrag (Message *pcData, const Point &cOffset, const Rect &cBounds, Handler *pcReplyTarget=NULL)
 Start a drag and drop operation.
void SetFlags (uint32 nFlags)
uint32 GetFlags (uint32 nMask=~0L) const
void SetResizeMask (uint32 nFlags)
uint32 GetResizeMask () const
void Show (bool bVisible=true)
 Show/hide a view and all it's children.
void Hide ()
bool IsVisible () const
virtual void MakeFocus (bool bFocus=true)
virtual bool HasFocus () const
Rect GetFrame () const
Rect GetBounds () const
Rect GetNormalizedBounds () const
float Width () const
float Height () const
Point GetLeftTop () const
virtual void SetFrame (const Rect &cRect, bool bNotifyServer=true)
 Set the size and position relative to the parent view.
virtual void MoveBy (const Point &cDelta)
 Move the view within the parent coordinate system.
virtual void MoveBy (float vDeltaX, float vDeltaY)
 
See also:
MoveBy( const Point& cDelta )

virtual void MoveTo (const Point &cPos)
 Set the views position within the parent coordinate system.
virtual void MoveTo (float x, float y)
 
See also:
MoveTo( const Point& cPos )

virtual void ResizeBy (const Point &cDelta)
virtual void ResizeBy (float vDeltaW, float vDeltaH)
virtual void ResizeTo (const Point &cSize)
 Set a new absolute size for the view.
virtual void ResizeTo (float W, float H)
 Set a new absolute size for the view.
void SetDrawingRegion (const Region &cReg)
 Restrict rendering using a clipping region.
void ClearDrawingRegion ()
 Remove any previously assigned drawing region.
void SetShapeRegion (const Region &cReg)
 Define a non-square shape for the view.
void ClearShapeRegion ()
 Remove any previously assigned shape region.
virtual int ToggleDepth ()
Point ConvertFromParent (const Point &cPoint) const
void ConvertFromParent (Point *cPoint) const
Rect ConvertFromParent (const Rect &cRect) const
void ConvertFromParent (Rect *cRect) const
Point ConvertToWindow (const Point &cPoint) const
void ConvertToWindow (Point *cPoint) const
Rect ConvertToWindow (const Rect &cRect) const
void ConvertToWindow (Rect *cRect) const
Point ConvertFromWindow (const Point &cPoint) const
void ConvertFromWindow (Point *cPoint) const
Rect ConvertFromWindow (const Rect &cRect) const
void ConvertFromWindow (Rect *cRect) const
Point ConvertToScreen (const Point &cPoint) const
void ConvertToScreen (Point *cPoint) const
Rect ConvertToScreen (const Rect &cRect) const
void ConvertToScreen (Rect *cRect) const
Point ConvertFromScreen (const Point &cPoint) const
void ConvertFromScreen (Point *cPoint) const
Rect ConvertFromScreen (const Rect &cRect) const
void ConvertFromScreen (Rect *cRect) const
void Invalidate (const Rect &cRect, bool bRecurse=false)
 Add a rectangle to the damage list.
void Invalidate (bool bRecurse=false)
 Invalidate the whole view.
void Flush ()
 Flush the render queue.
void Sync ()
 Flush the render queue.
void SetDrawingMode (drawing_mode nMode)
drawing_mode GetDrawingMode () const
void SetFont (Font *pcFont)
 Change the views text font.
FontGetFont () const
void SetFgColor (int nRed, int nGreen, int nBlue, int nAlpha=255)
void SetFgColor (Color32_s sColor)
Color32_s GetFgColor () const
void SetBgColor (int nRed, int nGreen, int nBlue, int nAlpha=255)
void SetBgColor (Color32_s sColor)
Color32_s GetBgColor () const
void SetEraseColor (int nRed, int nGreen, int nBlue, int nAlpha=255)
void SetEraseColor (Color32_s sColor)
Color32_s GetEraseColor () const
void MovePenTo (const Point &cPos)
void MovePenTo (float x, float y)
void MovePenBy (const Point &cPos)
void MovePenBy (float x, float y)
Point GetPenPosition () const
 Get the current pen position.
void DrawLine (const Point &cToPoint)
void DrawLine (const Point &cFromPnt, const Point &cToPnt)
virtual void ScrollBy (const Point &cDelta)
virtual void ScrollBy (float vDeltaX, float vDeltaY)
virtual void ScrollTo (Point cTopLeft)
virtual void ScrollTo (float x, float y)
Point GetScrollOffset () const
void ScrollRect (const Rect &cSrcRect, const Rect &cDstRect)
 Copy a rectangle from one location to another within the view.
void FillRect (const Rect &cRect)
void FillRect (const Rect &cRect, Color32_s sColor)
void DrawBitmap (const Bitmap *pcBitmap, const Rect &cSrcRect, const Rect &cDstRect)
 Render a bitmap into the view.
void EraseRect (const Rect &cRect)
void DrawFrame (const Rect &cRect, uint32 nFlags)
void DrawString (const Point &cPos, const String &cString)
void DrawString (const String &cString)
 Render a text-string at the current pen position.
void DrawString (const char *pzStr, int Len=-1)
void DrawText (const Rect &cPos, const String &cString, uint32 nFlags=0)
 Render a text-string in a specified rectangle.
void DrawSelectedText (const Rect &cPos, const String &cString, const IPoint &cSel1, const IPoint &cSel2, uint32 nMode=SEL_CHAR, uint32 nFlags=0)
void GetSelection (const String &cClipboard="__system_clipboard__")
void GetTruncatedStrings (const char **pazStringArray, int nStringCount, uint32 nMode, float nWidth, char **pazResultArray) const
float GetStringWidth (const String &cString) const
float GetStringWidth (const char *pzString, int nLen=-1) const
void GetStringWidths (const char **apzStringArray, const int *anLengthArray, int nStringCount, float *avWidthArray) const
Point GetTextExtent (const String &cString, uint32 nFlags=0, int nTargetWidth=-1) const
int GetStringLength (const String &cString, float vWidth, bool bIncludeLast=false) const
int GetStringLength (const char *pzString, int nLen, float vWidth, bool bIncludeLast=false) const
void GetStringLengths (const char **apzStringArray, const int *anLengthArray, int nStringCount, float vWidth, int *anMaxLengthArray, bool bIncludeLast=false) const
void GetFontHeight (font_height *psHeight) const
void Ping (int nSize=0) const
ConvertToParent
Convert a point or rectangle from local to parent coordinate system

Description:
Convert a point or rectangle from local to parent coordinate system
Note:
Warning:
Parameters:
\return 
See also:
Author:
Kurt Skauen ([email protected])


Point ConvertToParent (const Point &cPoint) const
 Translate a os::Point into our parents coordinate system.
void ConvertToParent (Point *cPoint) const
 Translate a os::Point into our parents coordinate system.
Rect ConvertToParent (const Rect &cRect) const
void ConvertToParent (Rect *cRect) const

Friends

class Window
class ScrollBar
class Font

Classes

class  Private

Detailed Description

The View class is the work horse in the GUI. Before you can render any graphics into a window, you have to create one or more views and attatch them to it. Views can be added to a window, or to another view to create a hierarchy. To render someting into a window you normaly inherit this class and overload the Pain() function. Each view has it's own graphical environment consisting of three colors (foreground background and erase), a pen position and the drawing mode. Each view lives in a coordinate system relative to its parent. Views are also responsible for receiving user input. The active view in the active window receives keybord and mouse events.

See also:
os::Window, os::Handler, os::view_flags
Author:
Kurt Skauen ([email protected])


Constructor & Destructor Documentation

View::View ( const Rect cFrame,
const String cTitle,
uint32  nResizeMask = CF_FOLLOW_LEFT | CF_FOLLOW_TOP,
uint32  nFlags = WID_WILL_DRAW | WID_CLEAR_BACKGROUND 
)

Parameters:
cFrame The frame rectangle in the parents coordinate system.
pzTitle The logical name of the view. This parameter is newer rendered anywhere, but is passed to the Handler::Handler() constructor to identify the view.
nResizeMask Flags defining how the views frame rectangle is affected if the parent view is resized.
nFlags Various flags to control the views behavour.
See also:
AttachedToWindow(), AllAttached(), os::view_flags, os::view_resize_flags, Handler::Handler()
Author:
Kurt Skauen ([email protected])

View::~View (  )  [virtual]

Description:
The destructor will release all resources used by the view itseld, and then recursively delete all child views.
To prevent a children to be deleted you must unlink it with View::RemoveChild() before deleting it's parent.
Author:
Kurt Skauen ([email protected])


Member Function Documentation

void View::AttachedToWindow (  )  [virtual]

Reimplemented in os::ColorSelector, os::Control, os::DirectoryView, os::FrameView, os::IconDirectoryView, os::Menu, os::RadioButton, os::Slider, os::StringView, and os::TableView.

void View::AllAttached (  )  [virtual]

Reimplemented in os::DropdownMenu::DropdownView, os::DropdownMenu, os::LayoutView, os::ListView, os::AlertView, os::Spinner, os::TableView, and os::TabView.

void View::DetachedFromWindow (  )  [virtual]

Reimplemented in os::Control, os::DirectoryView, os::IconDirectoryView, and os::Menu.

void View::AllDetached (  )  [virtual]

void View::Activated ( bool  bIsActive  )  [virtual]

Description:
This is a callback member that can be overloaded by derived classes to learn when the view is activated and when it is deactivated. The bIsActive parameter tell whether the focus was lost or gained.
The view has focus when it is the active view in the active window.
Note:
This is a hook function that is called by the system to notify about an event. You should never call this member yourself.
The window is locked when this member is called.
Parameters:
bIsActive - true if the view gain and false if it loose focus.
See also:
MakeFocus(), WindowActivated()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu::DropdownView, os::TextEdit, os::Button, os::CheckBox, os::DropdownMenu, os::ImageButton, os::ScrollBar, os::Slider, os::Spinner, and os::TextView.

void View::WindowActivated ( bool  bIsActive  )  [virtual]

Description:
This is a callback member that can be overloaded by derived classes to learn when the window that this view is hosted by is activated and when it is deactivated. The bIsActive parameter tell whether the focus was lost or gained. This member is called whenever the window changes focus independent of whether the view is active or not.
Note:
This is a hook function that is called by the system to notify about an event. You should never call this member yourself.
The window is locked when this member is called.
Parameters:
bIsActive - true if the window gain and false if it loose focus.
See also:
MakeFocus(), Activated()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::IconView::MainView, and os::Menu.

void View::Paint ( const Rect cUpdateRect  )  [virtual]

Description:
Note:
Warning:
Parameters:
cUpdateRect A rectangle enclosing all damaged areas. This is just a rough "worst-case", further fine-grained clipping will be performed by the Application Server to avoid updating non-damaged pixels and make the update as fast and flicker-free as possible.
See also:
Invalidate(), Flush()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu::DropdownView, os::IconView::MainView, os::ListViewCol, os_priv::SplitterSeparator, os::TextEdit, os::Button, os::CheckBox, os::DropdownMenu, os::FrameView, os::ImageButton, os::ImageView, os::ListView, os::Menu, os::PopupMenu, os::RadioButton, os::AlertView, os::ProgressView, os::ScrollBar, os::Separator, os::Slider, os::Spinner, os::StringView, os::TableView, os::TabView, os::TextView, and os::TreeView.

void View::MouseMove ( const Point cNewPos,
int  nCode,
uint32  nButtons,
Message pcData 
) [virtual]

Description:
This member is called from the window thread whenever the mouse is moved above the view or if the view has focus.
Oveload this member if your view need to handle mouse-move events.
The default implementation of this member will call MouseMove() on it's parent view if one exists.
Parameters:
cNewPos New mouse position given in the views coordinate system.
nCode Enter/exit code. This is MOUSE_ENTERED when the mouse first enter the view, MOUSE_EXITED when the mouse leaves the view, MOUSE_INSIDE whenever the mouse move withing the boundary of the view and MOUSE_OUTSIDE when the mouse move outside the view (will only happen if the view has focus).
nButtons Bitmask telling which buttons that are currently pressed. Bit 0 is button 1 (left), bit 1 is button 2 (right), and bit 2 is button 3 (middle), and so on.
pcData Pointer to a Message object containing the dragged data if the user is in the middle of a drag and drop operation. Otherwise this pointer is NULL. Look at BeginDrag() for a more detailed description of the drag and drop system.
See also:
MouseDown(), MouseUp(), WheelMoved(), BeginDrag()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu::DropdownView, os::IconView::MainView, os::ListViewCol, os_priv::SplitterSeparator, os::TextEdit, os::Button, os::DirectoryView, os::IconDirectoryView, os::ImageButton, os::ListView, os::Menu, os::PopupMenu, os::ScrollBar, os::Slider, os::Spinner, os::Splitter, os::TabView, and os::TextView.

void View::MouseDown ( const Point cPosition,
uint32  nButtons 
) [virtual]

Description:
This member is called from the window thread whenever a mouse button is clicked above the view. You can overload this member if your view need to know about mouse-down events.
A view will not automatically take focus when clicked so if you want that behaviour you must call MakeFocus() from an overloaded version of this member.
The default implementation of this member will call MouseDown() on it's parent view if one exists.
Parameters:
cPosition Mouse position in the views coordinate system at the time the mouse was pressed.
nButtons Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up.
See also:
MouseUp(), MouseMove(), WheelMoved()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu::DropdownView, os::IconView::MainView, os::ListViewCol, os_priv::SplitterSeparator, os::TextEdit, os::Button, os::CheckBox, os::DropdownMenu, os::ImageButton, os::ListView, os::Menu, os::PopupMenu, os::RadioButton, os::ScrollBar, os::Slider, os::Spinner, os::TabView, and os::TextView.

void View::MouseUp ( const Point cPosition,
uint32  nButtons,
Message pcData 
) [virtual]

Description:
This member is called from the window thread whenever a mouse button is released above the view. You can overload this member if your view need to know about mouse-up events or if your view support drag and drop.
If mouse-up was the result of ending a drag and drop operation the pcData member will point to a Message containing the dragged data. Look at BeginDrag() for a more detailed description of the drag and drop system.
The default implementation of this member will call MouseDown() on it's parent view if one exists.
Parameters:
cPosition Mouse position in the views coordinate system at the time the mouse was pressed.
nButtons Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up.
pcData Pointer to a Message object containing the dragged data if this mouse-up was the end of a drag and drop operation. If no data was dragged it will be NULL.
See also:
MouseDown(), MouseMove(), WheelMoved()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu::DropdownView, os::IconView::MainView, os::ListViewCol, os::TextEdit, os::Button, os::CheckBox, os::DirectoryView, os::IconDirectoryView, os::ImageButton, os::ListView, os::Menu, os::PopupMenu, os::RadioButton, os::ScrollBar, os::Slider, os::Spinner, os::Splitter, os::TabView, and os::TextView.

void View::KeyDown ( const char *  pzString,
const char *  pzRawString,
uint32  nQualifiers 
) [virtual]

Description:
Overload this member if your view need to handle keyboard input. This member is called to allow the view to handle M_KEY_DOWN messages. The most common members are exctracted from the message and passed as parameters but you might need to obtain the raw message with os::Looper::GetCurrentMessage() and find some members yourself if you the data you needed are not passed in.
For example if you need the raw key-code for the pressed key you will have to lookup the "_raw_key" member from the message.
Parameters:
pzString String containing a single UTF-8 encoded character. This is the character generated by the pressed key according to the current keymap accounting for any qualifiers that might be pressed.
pzRawString Same as pzString except that the key is converted without accounting for qualifiers. Ie. if 'A' is pressed while pressing <SHIFT> pzString will contain 'A' and pzRawString will contain 'a'.
nQualifiers Bitmask describing which qualifiers that was active when the key was pressed.
See also:
KeyUp(), os::Looper::GetCurrentMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu::DropdownView, os::DropdownMenu::DropdownTextView, os::IconView::MainView, TopView, os::Button, os::CheckBox, os::DirectoryView, os::DropdownMenu, os::IconDirectoryView, os::ListView, os::Menu, os::RadioButton, os::ScrollBar, os::Slider, os::Spinner, os::Splitter, os::TabView, and os::TextView.

void View::KeyUp ( const char *  pzString,
const char *  pzRawString,
uint32  nQualifiers 
) [virtual]

Description:
This is the counterpart to KeyDown().
See also:
KeyDown()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::Button, os::CheckBox, and os::Spinner.

void View::FrameMoved ( const Point cDelta  )  [virtual]

Description:
Overload this member if you need to know when the view is moved within the coordinate system of the parent.
Note:
This member is called after the view is moved. If you need the old position you can subtract the cDelta value from the current position.
Parameters:
cDelta The distance the view was moved.
See also:
FrameSized(), SetFrame(), MoveBy(), MoveTo()
Author:
Kurt Skauen ([email protected])

Reimplemented in TopView.

void View::FrameSized ( const Point cDelta  )  [virtual]

Description:
Overload this member if you need to know when the view is resized.
Note:
This member is called after the view is resized. If you need the old size you can subtract the cDelta calue from the current size.
Parameters:
cDelta The distance the bottom/right corner was moved relative to the upper/left corner.
See also:
FrameMoved(), SetFrame, ResizeBy(), ResizeTo()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::IconView::MainView, os::TextEdit, TopView, os::DropdownMenu, os::FrameView, os::LayoutView, os::ListView, os::Menu, os::ProgressView, os::ScrollBar, os::Slider, os::Spinner, os::Splitter, os::TableView, os::TabView, and os::TextView.

void View::ViewScrolled ( const Point cDelta  )  [virtual]

Description:
Overload this member if you need to know when the views content has been scrolled with the ScrollBy() or ScrollTo() members.
See the ScrollBy() documentation for more details on scrolling.
Note:
This member is called after the view has been scrolled. If you need the old scroll offset you can subtract the cDelta value from the current scroll offset.
Parameters:
cDelta The distance the view was scrolled.
See also:
ScrollBy(), ScrollTo(), GetScrollOffset()
Author:
Kurt Skauen ([email protected])

void View::FontChanged ( Font pcNewFont  )  [virtual]

Description:
FontChanged() is a virtual hook function that can be overloaded by inheriting classes to track changes to the view's font.
This hook function is called whenver the font is replaced through the View::SetFont() member or if the currently assigned font is modified in a way that whould alter the graphical appearance of the font.
Note:
View::SetFont() will call FontChanged() syncronously and will cause FontChanged() to be called even if the view is not yet added to a window. Changes done to the font-object cause a message to be sendt to the window thread and FontChanged() will then be called asyncronously from the window thread when the message arrive. For this reason it is only possible to track changes done to the font object itself when the view is added to a window.
Parameters:
pcNewFont Pointer to the affected font (same as returned by GetFont()).
See also:
SetFont(), os::Font
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu::DropdownView, os::TextEdit, os::FrameView, and os::TextView.

Point View::GetPreferredSize ( bool  bLargest  )  const [virtual]

Reimplemented in os::TextEdit, os::Button, os::CheckBox, os::DropdownMenu, os::FrameView, os::ImageButton, os::ImageView, os::LayoutView, os::Menu, os::PopupMenu, os::RadioButton, os::ScrollBar, os::Separator, os::Slider, os::Spinner, os::Splitter, os::StringView, os::TableView, os::TabView, and os::TextView.

Point View::GetContentSize (  )  const [virtual]

void View::WheelMoved ( const Point cDelta  )  [virtual]

Description:
This member is called from the window thread whenever the user rotates the scroll wheel with the mouse pointer above this view.
The default implementation of this member will call WheelMoved() on it's parent view if one exists.
Since:
V0.3.7
Parameters:
cDelta Delta movement. Normally only the y value is used but it is possible for the mouse driver to also support horizontal scroll wheel functionality. The delta value is normally +/- 1.0 for each "click" on the wheel.
See also:
MouseMove(), MouseDown(), MouseUp()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu::DropdownView, os::IconView::MainView, os::DropdownMenu, os::ScrollBar, os::Spinner, and os::TextView.

void View::AddChild ( View pcView,
bool  bAssignTabOrder = false 
) [virtual]

void View::RemoveChild ( View pcChild  ) 

void View::RemoveThis (  ) 

View * View::GetChildAt ( const Point cPos  )  const

View * View::GetChildAt ( int  nIndex  )  const

View * View::GetParent (  )  const

ScrollBar * View::GetVScrollBar (  )  const

ScrollBar * View::GetHScrollBar (  )  const

Window* os::View::GetWindow (  )  const [inline]

String View::GetTitle (  )  const

int View::GetTabOrder (  )  const [virtual]

Description:
This member is called by the system to decide which view to select next when the <TAB> key is pressed. The focus is given to the next view with higher or equal tab-order as the current. You can overload this member to decide the order whenever it is called, or rely on the default implementation that will return whatever was set by SetTabOrder(). A negative return value means that the view should not be skipped when searching for the next view to activate.
Returns:
The views sorting order for keyboard manouvering.
See also:
SetTabOrder()
Author:
Kurt Skauen ([email protected])

void View::SetTabOrder ( int  nOrder = NEXT_TAB_ORDER  )  [virtual]

Description:
Set the value that will be returned by GetTabOrder().
Parameters:
nOrder - The sorting order.
See also:
GetTabOrder()
Author:
Kurt Skauen ([email protected])

Reimplemented in os::DropdownMenu, os::IconView, and os::TextView.

const ShortcutKey & View::GetShortcut (  )  const [virtual]

void View::SetShortcut ( const ShortcutKey cShortcut  )  [virtual]

Description:
Sets a shortcut that activates the View. The exact behaviour of shortcuts is defined in the various subclasses. For a Button, for instance, pressing the associated key will "push" the button, releasing the associated key will "release" the button and send the associated message. Pressing any other key while the shortcut key is still held, will cancel the operation. Please note that most widgets (including Button) will automatically extract keyboard shortcuts from their labels.
Parameters:
cShortcut - key combination to activate View.
See also:
Control::SetLabel(), GetShortcut(), SetShortcutFromLabel(), ShortcutKey
Author:
Henrik Isaksson ([email protected])

void View::SetShortcutFromLabel ( const String cLabel  )  [virtual]

Description:
Like SetShortcut(), but the key is extracted from a text label. The character following the first unescaped underscore character (_) is used.
Parameters:
cLabel - text string containing shortcut.
See also:
GetShortcut(), SetShortcutFromLabel(), ShortcutKey
Author:
Henrik Isaksson ([email protected])

void View::SetContextMenu ( Menu pcMenu  ) 

Description:
Set a popup menu to be used for this View. The popup menu is opened when the user right-clicks inside the View, unless the right-click event is consumed by the subclass.
Parameters:
pcMenu - popup menu for this View. Deleted automatically.
See also:
GetContextMenu()
Author:
Henrik Isaksson ([email protected])

Menu * View::GetContextMenu (  )  const

Description:
Returns the popup menu assigned to this View, or null if no popup menu is assigned.
See also:
SetContextMenu()
Author:
Henrik Isaksson ([email protected])

uint32 View::GetQualifiers (  )  const

void View::GetMouse ( Point pcPosition,
uint32 *  pnButtons 
) const

void View::SetMousePos ( const Point cPosition  ) 

void View::BeginDrag ( Message pcData,
const Point cHotSpot,
const Bitmap pcBitmap,
Handler pcReplyHandler = NULL 
)

Description:
This member is normally called from the MouseMove() member to initiate a drag and drop operation. The function takes a os::Message containing the data to drag, and information about how to visually represent the dragged data to the user. The visual representation can be eighter a bitmap (possibly with an alpha-channel to make it half-transparent) or a simple rectangle.
When a drag and drop operation is in progress the application server will include the message given here in pcData in M_MOUSE_MOVED (os::View::MouseMove()) messages sendt to views as the user moves the mouse and also in the M_MOUSE_UP (os::View::MouseUp()) message that terminate the operation.
Parameters:
pcData A os::Message object containing the data to be dragged.
cHotSpot Mouse position relative to the visible representation of the dragged object.
pcBitmap A bitmap that will be used as the visible representation of the dragged data. The bitmap can have an alpha channel.
cBounds And alternate way to visually represent the dragged data. If a rectangle is used instead of an bitmap the appserver will render a rectangle instead of a bitmap.
pcReplyHandler The handler that should receive replies sendt by the receiver of the dragged data.
See also:
MouseMove(), MouseUp(), os::Message, os::Handler
Author:
Kurt Skauen ([email protected])

void View::BeginDrag ( Message pcData,
const Point cHotSpot,
const Rect cBounds,
Handler pcReplyHandler = NULL 
)

Description:
Same as void View::BeginDrag( Message* pcData, const Point& cHotSpot, const Bitmap* pcBitmap, Handler* pcReplyHandler ) except that this version accept a rectangle instead of a bitmap for the "drag gismo".
When starting a drag operation with this member the appserver will render a x-or'ed rectangle according to cBounds to indicate the drag. This is useful when the selection image would be to large to be rendered efficiently or when there is no good graphical representation of the dragged data.
See void View::BeginDrag( Message* pcData, const Point& cHotSpot, const Bitmap* pcBitmap, Handler* pcReplyHandler ) for a more detailed description of the drag and drop system.
See also:
void View::BeginDrag( Message* pcData, const Point& cHotSpot, const Bitmap* pcBitmap, Handler* pcReplyHandler )
Author:
Kurt Skauen ([email protected])

void View::SetFlags ( uint32  nFlags  ) 

Reimplemented in os::StatusPanel.

uint32 View::GetFlags ( uint32  nMask = ~0L  )  const

void View::SetResizeMask ( uint32  nFlags  ) 

uint32 View::GetResizeMask (  )  const

void View::Show ( bool  bVisible = true  ) 

Description:
Calling show with bVisible == false on a view have the same effect as unlinking it from it's parent, except that the view will remember it's entire state like the font, colors, position, depth, etc etc. A subsequent call to Show() with bVisible == true will restore the view compleatly.
Calls to Show() can be nested. If it is called twice with bVisible == false it must be called twice with bVisible == true before the view is made visible. It is safe to call Show(false) on a view before it is attached to a window. The view will then remember it's state and will not be visible when attached to a window later on.
A hidden view will not receive paint messages or input events from keybord or mouse. It will still receive messages targeted directly at the view.
Note:
It is NOT leagal to show a visible view! Calling Show(true) before Show(false) is an error.
Parameters:
bVisible - A boolean telling if the view should be hidden or viewed.
See also:
IsVisible(), Window::Show()
Author:
Kurt Skauen ([email protected])

void os::View::Hide (  )  [inline]

bool View::IsVisible (  )  const

void View::MakeFocus ( bool  bFocus = true  )  [virtual]

Reimplemented in os::IconView.

bool View::HasFocus (  )  const [virtual]

Reimplemented in os::ListView.

Rect View::GetFrame (  )  const

Rect View::GetBounds (  )  const

Rect View::GetNormalizedBounds (  )  const

float View::Width (  )  const

float View::Height (  )  const

Point View::GetLeftTop (  )  const

void View::SetFrame ( const Rect cRect,
bool  bNotifyServer = true 
) [virtual]

Description:
Set the frame-rectangle of the view relative to it's parent. If this cause new areas of this view or any of it's siblings/childs the affected views will receive a paint message to update the newly exposed areas.
If the upper-left corner of the view is moved the View::FrameMoved() hook will be called and if the lower-right corner move relative to the upper-left corner the View::FrameSized() hook will be called.
Parameters:
cRect The new frame rectangle.
See also:
ResizeTo(), ResizeBy(), MoveTo(), MoveBy()
Author:
Kurt Skauen ([email protected])

void View::MoveBy ( const Point cDelta  )  [virtual]

Description:
Move the view relative to it's current position.
Parameters:
cDelta The distance to move the view.
See also:
MoveTo()
Author:
Kurt Skauen ([email protected])

void View::MoveBy ( float  vDeltaX,
float  vDeltaY 
) [virtual]

void View::MoveTo ( const Point cPos  )  [virtual]

Description:
Move the view to a new absolute position within the parents coordinate system.
Parameters:
cPos The new position of the upper/left corner of the view
See also:
MoveBy()
Author:
Kurt Skauen ([email protected])

void View::MoveTo ( float  x,
float  y 
) [virtual]

void View::ResizeBy ( const Point cDelta  )  [virtual]

void View::ResizeBy ( float  vDeltaW,
float  vDeltaH 
) [virtual]

void View::ResizeTo ( const Point cSize  )  [virtual]

Description:
See ResizeTo(float,float)
Parameters:
cSize New size (os::Point::x is width, os::Point::y is height).
See also:
ResizeTo(float,float)
Author:
Kurt Skauen ([email protected])

void View::ResizeTo ( float  w,
float  h 
) [virtual]

Description:
Move the bottom/right corner of the view to give it the new size. The top/left corner will not be affected. This will cause FrameSized() to be called and any child views to be resized according to their resize flags if the new size differ from the previous.
Note:
Coordinates start in the middle of a pixel and all rectangles are inclusive so the real width and height in pixels will be 1 larger than the value given in w and h.
Parameters:
w New width
h New height.
Returns:
Error codes:
See also:
ResizeTo(const Point&), ResizeBy(), SetFrame()
Author:
Kurt Skauen ([email protected])

void View::SetDrawingRegion ( const Region cReg  ) 

Description:
Restrict rendering using a clipping region. By assigning a drawing region to a view you can restrict what areas of the view that will be affected by subsequent rendering commands. Only areas represented by the region (and are not obscured by other views or resides outside the view frame) will be rendered to.
Unlike SetShapeRegion() the drawing region is not inherited by children views and it will not affect the shape of the view (ie. it will not make any areas of the view transparent) and it will not affect hit testing.
Parameters:
cReg A region defining drawable areas. The rectangles in the region should be in the views own coordinate system.
Returns:
Error codes:
Since:
0.3.7
See also:
Author:
Kurt Skauen ([email protected])

void View::ClearDrawingRegion (  ) 

Description:
Remove any previously assigned drawing region and allow subsequent rendering commands to alter any visible areas of the view (rendering will still be restricted by the damage-list during a Paint() update).
Since:
0.3.7
See also:
SetDrawingRegion(), SetShapeRegion(), ClearShapeRegion()
Author:
Kurt Skauen ([email protected])

void View::SetShapeRegion ( const Region cReg  ) 

Description:
Define a non-square shape for the view.
Normally a view's shape is defined by a simple rectangle but it is possible to define views with complex shapes and even with holes by restricting the shape using a clipping region. A clipping region (os::Region) is basically a list of non-overlapping visible rectangles. When adding a shape-defining clipping region to a view all areas not covered by a rectangle in the region will be transparent.
Note that defining complex shapes with many rectangles can quickly become expensive, espesially if multiple complexly shaped views are siblings.
Parameters:
cReg The region defining the new shape of the view. The rectangles in the region should be in the views own coordinate system.
Since:
0.3.7
See also:
ClearShapeRegion(), SetDrawingRegion(), os::Window::SetShapeRegion()
Author:
Kurt Skauen ([email protected])

void View::ClearShapeRegion (  ) 

Description:
Restore the view to it's normal rectangular shape as defined by it's frame rectangle.
Note:
Clearing the shape rectangle will automatically flush the render queue.
See also:
SetShapeRegion(), os::Window::ClearShapeRegion()
Author:
Kurt Skauen ([email protected])

int View::ToggleDepth (  )  [virtual]

Point View::ConvertToParent ( const Point cPoint  )  const

Returning the the result

void View::ConvertToParent ( Point pcPoint  )  const

Modifying the passet Point object

Rect View::ConvertToParent ( const Rect cRect  )  const

void View::ConvertToParent ( Rect cRect  )  const

Point View::ConvertFromParent ( const Point cPoint  )  const

void View::ConvertFromParent ( Point cPoint  )  const

Rect View::ConvertFromParent ( const Rect cRect  )  const

void View::ConvertFromParent ( Rect cRect  )  const

Point View::ConvertToWindow ( const Point cPoint  )  const

void View::ConvertToWindow ( Point cPoint  )  const

Rect View::ConvertToWindow ( const Rect cRect  )  const

void View::ConvertToWindow ( Rect cRect  )  const

Point View::ConvertFromWindow ( const Point cPoint  )  const

void View::ConvertFromWindow ( Point cPoint  )  const

Rect View::ConvertFromWindow ( const Rect cRect  )  const

void View::ConvertFromWindow ( Rect cRect  )  const

Point View::ConvertToScreen ( const Point cPoint  )  const

void View::ConvertToScreen ( Point cPoint  )  const

Rect View::ConvertToScreen ( const Rect cRect  )  const

void View::ConvertToScreen ( Rect cRect  )  const

Point View::ConvertFromScreen ( const Point cPoint  )  const

void View::ConvertFromScreen ( Point cPoint  )  const

Rect View::ConvertFromScreen ( const Rect cRect  )  const

void View::ConvertFromScreen ( Rect cRect  )  const

void View::Invalidate ( const Rect cRect,
bool  bRecurse = false 
)

Description:
To avoid rendering the whole view when a new area is made visible, the appserver maintain a damage list containing areas made visible since the last paint message was sendt to the view. When the View respond to the paint message the appserver will clip the rendering to the damage list to avoid rendering any pixels that are still intact. By calling Invalidate() you can force an area into the damage list, and make the appserver send a paint message to the view. This will again make the Paint() member be called to revalidate the damaged areas.
Parameters:
cRect The rectangle to invalidate.
bRecurse If true cRect will also be converted into each children's coordinate system and added to their damage list.
See also:
Invalidate( bool ), Paint()
Author:
Kurt Skauen ([email protected])

void View::Invalidate ( bool  bRecurse = false  ) 

Description:
Same as calling Invalidate( GetBounds() ), but more efficient since the appserver know that the whole view is to be invalidated, and does not have to merge the rectangle into the clipping region.
Parameters:
bRecurse - True if all childs should be invalidated reqursivly aswell.
See also:
Invalidate( const Rect&, bool ), Paint()
Author:
Kurt Skauen ([email protected])

void View::Flush ( void   ) 

Description:
Call the window's Flush() member to flush the render queue.
If the view is not attached to a window, this member does nothing.
To get more info take a look at Window::Flush()
See also:
Sync(), Window::Flush()
Author:
Kurt Skauen ([email protected])

void View::Sync ( void   ) 

Description:
Call the window's Flush() member to flush the render queue and syncronize the view with the appserver.
If the view is not attached to a window, this member does nothing.
To get more info take a look at Window::Flush()
See also:
Sync(), Window::Flush()
Author:
Kurt Skauen ([email protected])

void View::SetDrawingMode ( drawing_mode  nMode  ) 

drawing_mode View::GetDrawingMode (  )  const

void View::SetFont ( Font pcFont  ) 

Description:
Replace the font used when rendering text and notify the view itself about the change by calling the View::FontChanged() hook function.
Font's are reference counted and SetFont() will call Font::AddRef() on the new font and Font::Release() on the old font. This means that you retain ownership on the font even after View::SetFont() returns. You must therefor normally call Font::Release() on the font after setting it.
The view will be affected by changes applied to the font after it is set. If someone change the properties of the font later the view will again be notified through the View::FontChanged() hook
Parameters:
pcFont Pointer to the new font. It's reference count will be increased by one.
See also:
DrawString(), os::Font
Author:
Kurt Skauen ([email protected])

Font * View::GetFont (  )  const

void View::SetFgColor ( int  nRed,
int  nGreen,
int  nBlue,
int  nAlpha = 255 
)

void View::SetFgColor ( Color32_s  sColor  ) 

Color32_s View::GetFgColor (  )  const

void View::SetBgColor ( int  nRed,
int  nGreen,
int  nBlue,
int  nAlpha = 255 
)

void View::SetBgColor ( Color32_s  sColor  ) 

Color32_s View::GetBgColor (  )  const

void View::SetEraseColor ( int  nRed,
int  nGreen,
int  nBlue,
int  nAlpha = 255 
)

void View::SetEraseColor ( Color32_s  sColor  ) 

Color32_s View::GetEraseColor (  )  const

void View::MovePenTo ( const Point cPos  ) 

void os::View::MovePenTo ( float  x,
float  y 
) [inline]

void View::MovePenBy ( const Point cPos  ) 

void os::View::MovePenBy ( float  x,
float  y 
) [inline]

Point View::GetPenPosition (  )  const

Note:
This member will do a syncronous request to the application server which is a rather expensive operation. Since some operations like text-rendering move the cursor in a fashion that is not predictable by the View class it does not cache the pen position. You should avoid using this member unless you have to know how much the pen was moved by a text rendering operation.
Returns:
The current pen position in the views coordinate system.
See also:
MovePenTo(), MovePenBy()
Author:
Kurt Skauen ([email protected])

void View::DrawLine ( const Point cToPoint  ) 

void View::DrawLine ( const Point cFromPnt,
const Point cToPnt 
)

void View::ScrollBy ( const Point cDelta  )  [virtual]

virtual void os::View::ScrollBy ( float  vDeltaX,
float  vDeltaY 
) [inline, virtual]

void View::ScrollTo ( Point  cTopLeft  )  [virtual]

virtual void os::View::ScrollTo ( float  x,
float  y 
) [inline, virtual]

Point View::GetScrollOffset (  )  const

void View::ScrollRect ( const Rect cSrcRect,
const Rect cDstRect 
)

Description:
ScrollRect() will copy the source rectangle to the destination rectangle using the blitter. If parts of the source rectangle is obscured (by another window/view or the screen edge) and the same area in the destination area is not that area in the destination rectangle will be invalidated (see Invalidate()).
Note:
Scrolling an area within the view might affect the current "damage-list" of the view and cause a repaint message to be sendt to the view. If ScrollRect() is called repeatadly and the application for some reason can't handle the generated repaint messages fast enough more and more damage-rectangles will accumulate in the views damage list slowing things further down until the appserver is broght to a grinding halt. To avoid this situation the next paint message received after a call to ScrollRect() will cause Sync() instead of Flush() to be called when Paint() returns to syncronize the application with the appserver. So even though the ScrollRect() member itself is asyncronous it might cause Sync() to be called and will have the performance implications mentioned in the documentation of Sync()
Parameters:
cSrcRect The source rectangle in the views coordinate system.
cSrcRect The destination rectangle in the views coordinate system. This rectangle should have the same size but a difference position than the cSrcRect. In a future version it might be possible to scale the rectangle by using a different size so make sure they don't differ or you might get a surprice some day.
See also:
ScrollTo(), ScrollBy(), Sync()
Author:
Kurt Skauen ([email protected])

void View::FillRect ( const Rect cRect  ) 

void View::FillRect ( const Rect cRect,
Color32_s  sColor 
)

void View::DrawBitmap ( const Bitmap pcBitmap,
const Rect cSrcRect,
const Rect cDstRect 
)

Description:
DrawBitmap() copy a region of a bitmap into the view performing any required color space conversion.
How the bitmap is rendered depends on the drawing mode and the format of the source bitmap.
The following drawing modes are suppoted by DrawBitmap():
DM_COPY:
Copy the content of the bitmap directly into the view. Only color space conversion is performed (when needed).

DM_OVER:

Almost like DM_COPY but pixels with the value TRANSPARENT_CMAP8 in CS_CMAP8 bitmaps or TRANSPARENT_RGB32 in CS_RGB32 bitmaps will not be copyed.

DM_BLEND:

Blend the bitmap into the original content of the view based on the bitmaps alpha channel. This mode only works for CS_RGB32 bitmaps.

Parameters:
pcBitmap The bitmap to render. Only CS_CMAP8, CS_RGB15, CS_RGB16, and CS_RGB32 type bitmaps are currently supported.
cSrcRect The source rectangle. Only the area described by this rectangle will be copyed into the view.
cDstRect Destination rectangle.
See also:
Bitmap
Author:
Kurt Skauen ([email protected])

void View::EraseRect ( const Rect cRect  ) 

void View::DrawFrame ( const Rect cRect,
uint32  nFlags 
)

void View::DrawString ( const Point cPos,
const String cString 
)

void View::DrawString ( const String cString  ) 

Description:
DrawString() render an UTF-8 encoded character string at the current pen position using the current font, pen color and drawing mode.
There is a few issues you should be aware of when rendering text. Since AtheOS antialiaze the glyphs to improve the quality and readability of the text it need a bit more information than just a pen color. If the drawing mode is DM_COPY the text will be antialiazed against color of the current background pen (as set by SetBgColor()). If it is DM_OVER the text will be antialiazed against the existing graphics under the text. If the drawing mode is DM_BLEND the antialiazing is written to the alpha channel of the destination bitmap. This is useful when you render text into a transparent bitmap that will later be render on top of a background with unknown color. One examaple of this is when you create a bitmap that will be used as a drag and drop image. This mode only work when rendering into 32-bit bitmaps.
You should always use the DM_COPY mode when rendering against a static background where you know the background color. When using DM_OVER it is necessary to read the old pixels from the frame-buffer and this is a very slow operations.
Parameters:
cString UTF-8 encoded string to render.
nLength Number of bytes to render from pString. If the string is NULL terminated a length of -1 can be used to render the entire string.
See also:
SetFont(), os::Font, SetDrawingMode(), SetFgColor(), SetBgColor()
Author:
Kurt Skauen ([email protected])

void View::DrawString ( const char *  pzStr,
int  Len = -1 
)

void View::DrawText ( const Rect cPos,
const String cString,
uint32  nFlags = 0 
)

Description:
DrawText() renders a UTF-8 encoded character string inside the rectangle specified, using the current font, pen color and drawing mode.
DrawText() parses the specified text string for the following formatting codes:
\n = newline
_ = underscore next character
ESCc = center text
ESCl = left align text
ESCr = right align text
There is a few issues you should be aware of when rendering text. Since Syllable antialiases the glyphs to improve the quality and readability of the text, it needs a bit more information than just a pen color. If the drawing mode is DM_COPY the text will be antialiased against the colour of the current background pen (as set by SetBgColor()). If it is DM_OVER the text will be antialiased against the existing graphics under the text. If the drawing mode is DM_BLEND the antialiazing is written to the alpha channel of the destination bitmap. This is useful when you render text into a transparent bitmap that will later be rendered on top of a background with unknown color. One examaple of this is when you create a bitmap that will be used as a drag and drop image. This mode only works when rendering into 32-bit bitmaps.
You should always use the DM_COPY mode when rendering against a static background where you know the background color. When using DM_OVER it is necessary to read the old pixels from the frame-buffer and this is a very slow operations.
Parameters:
cPos Rectangle to render the text in, the text may be centred, left or right aligned inside this rectangle.
cString UTF-8 encoded string to render.
nLength Number of bytes to render from pString. If the string is NULL terminated a length of -1 can be used to render the entire string.
nFlags Flags that control how the text is rendered.
See also:
SetFont(), os::Font, SetDrawingMode(), SetFgColor(), SetBgColor()
Author:
Henrik Isaksson ([email protected])

void View::DrawSelectedText ( const Rect cPos,
const String cString,
const IPoint cSel1,
const IPoint cSel2,
uint32  nMode = SEL_CHAR,
uint32  nFlags = 0 
)

void View::GetSelection ( const String cClipboard = "__system_clipboard__"  ) 

void os::View::GetTruncatedStrings ( const char **  pazStringArray,
int  nStringCount,
uint32  nMode,
float  nWidth,
char **  pazResultArray 
) const

float View::GetStringWidth ( const String cString  )  const

float View::GetStringWidth ( const char *  pzString,
int  nLen = -1 
) const

void os::View::GetStringWidths ( const char **  apzStringArray,
const int *  anLengthArray,
int  nStringCount,
float *  avWidthArray 
) const

Point View::GetTextExtent ( const String cString,
uint32  nFlags = 0,
int  nTargetWidth = -1 
) const

int View::GetStringLength ( const String cString,
float  vWidth,
bool  bIncludeLast = false 
) const

int View::GetStringLength ( const char *  pzString,
int  nLen,
float  vWidth,
bool  bIncludeLast = false 
) const

void View::GetStringLengths ( const char **  apzStringArray,
const int *  anLengthArray,
int  nStringCount,
float  vWidth,
int *  anMaxLengthArray,
bool  bIncludeLast = false 
) const

void View::GetFontHeight ( font_height psHeight  )  const

void View::Ping ( int  nSize = 0  )  const


Friends And Related Function Documentation

friend class Window [friend]

Reimplemented from os::Handler.

friend class ScrollBar [friend]

friend class Font [friend]


Generated on Sat May 9 22:51:53 2009 for Syllable higlevel API by  doxygen 1.5.1