Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

os::View Class Reference

Base class for all GUI components. More...

#include <view.h>

Inheritance diagram for os::View::

os::Handler os::AlertView os::Control os::DropdownMenu os::LayoutView os::ListViewCol os::ListViewContainer os::ListViewHeader os::Menu os::ProgressBar os::ProgressView os::StringView os::TableView os::TabView os::TextEdit TopView List of all members.

Public Methods

 View (const Rect &cFrame, const std::string &cTitle, uint32 nResizeMask=CF_FOLLOW_LEFT|CF_FOLLOW_TOP, uint32 nFlags=WID_WILL_DRAW|WID_CLEAR_BACKGROUND)
 View constructor. More...

virtual ~View ()
 View destructor. More...

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. More...

virtual void WindowActivated (bool bIsActive)
 Hook called when the window hosting this view gain or loose focus. More...

virtual void Paint (const Rect &cUpdateRect)
 Called by the system update "damaged" areas of the view. More...

virtual void MouseMove (const Point &cNewPos, int nCode, uint32 nButtons, Message *pcData)
 Hook called by the system when the mouse is moved. More...

virtual void MouseDown (const Point &cPosition, uint32 nButtons)
 Hook called by the system when a mouse button is pressed. More...

virtual void MouseUp (const Point &cPosition, uint32 nButtons, Message *pcData)
 Hook called by the system when a mouse button is release. More...

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. More...

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. More...

virtual void FrameMoved (const Point &cDelta)
 Virtual hook called by the system when the view is moved within it's parent. More...

virtual void FrameSized (const Point &cDelta)
 Virtual hook called by the system when the view is resized. More...

virtual void ViewScrolled (const Point &cDelta)
 Virtual hook called by the system when the view content is scrolled. More...

virtual void FontChanged (Font *pcNewFont)
 Called to notify the view that the font has changed. More...

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. More...

virtual void AddChild (View *pcView, bool bAssignTabOrder=false)
void RemoveChild (View *pcChild)
void RemoveThis ()
View * GetChildAt (const Point &cPos)
View * GetChildAt (int nIndex)
View * GetParent () const
ScrollBarGetVScrollBar () const
ScrollBarGetHScrollBar () const
WindowGetWindow () const
std::string GetTitle () const
virtual int GetTabOrder ()
 Get the keybord manouvering order. More...

virtual void SetTabOrder (int nOrder)
 Set the keyboard manouvering sorting order. More...

uint32 GetQualifiers () const
void GetMouse (Point *pcPosition, uint32 *pnButtons)
void SetMousePos (const Point &cPosition)
void BeginDrag (Message *pcData, const Point &cOffset, const Bitmap *pcBitmap, Handler *pcReplyTarget=NULL)
 Start a drag and drop operation. More...

void BeginDrag (Message *pcData, const Point &cOffset, const Rect &cBounds, Handler *pcReplyTarget=NULL)
 Start a drag and drop operation. More...

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. More...

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. More...

virtual void MoveBy (const Point &cDelta)
 Move the view within the parent coordinate system. More...

virtual void MoveBy (float vDeltaX, float vDeltaY)
virtual void MoveTo (const Point &cPos)
 Set the views position within the parent coordinate system. More...

virtual void MoveTo (float x, float y)
virtual void ResizeBy (const Point &cDelta)
virtual void ResizeBy (float vDeltaW, float vDeltaH)
virtual void ResizeTo (const Point &cSize)
virtual void ResizeTo (float W, float H)
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. More...

void Invalidate (bool bRecurse=false)
 Invalidate the whole view. More...

void Flush ()
 Flush the render queue. More...

void Sync ()
 Flush the render queue. More...

void SetDrawingMode (drawing_mode nMode)
drawing_mode GetDrawingMode () const
void SetFont (Font *pcFont)
 Change the views text font. More...

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. More...

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. More...

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. More...

void EraseRect (const Rect &cRect)
void DrawFrame (const Rect &cRect, uint32 nFlags)
void DrawChar (int nChar)
void DrawChar (int nChar, const Point &cPos)
void DrawString (const char *pzString)
void DrawString (const char *pString, int nLength)
 Render a text-string at the current pen position. More...

void DrawString (const std::string &cString)
void DrawString (const char *pzString, const Point &cPos)
void DrawString (const char *pString, int nLength, const Point &cPos)
void DrawString (const std::string &cString, const Point &cPos)
void GetTruncatedStrings (const char **pazStringArray, int nStringCount, uint32 nMode, float nWidth, char **pazResultArray) const
float GetStringWidth (const char *pzString) const
float GetStringWidth (const char *pzString, int nLength) const
float GetStringWidth (const std::string &cString) const
void GetStringWidths (const char **apzStringArray, const int *anLengthArray, int nStringCount, float *avWidthArray) const
int GetStringLength (const char *pzString, float vWidth, bool bIncludeLast=false) const
int GetStringLength (const char *pzString, int nLength, float vWidth, bool bIncludeLast=false) const
int GetStringLength (const std::string &cString, 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)
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 (kurt@atheos.cx)


Point ConvertToParent (const Point &cPoint) const
 Translate a os::Point into our parents coordinate system. More...

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

Rect ConvertToParent (const Rect &cRect) const
void ConvertToParent (Rect *cRect) const

Friends

class Window
class ScrollBar
class Font

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 (kurt@atheos.cx)


Constructor & Destructor Documentation

View::View const Rect & cFrame,
const std::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 (kurt@atheos.cx)

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 (kurt@atheos.cx)


Member Function Documentation

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 (kurt@atheos.cx)

Reimplemented in os::TextEdit, os::Button, and os::TextView.

void View::AddChild View * pcChild,
bool bAssignTabOrder = false
[virtual]
 

void View::AllAttached void [virtual]
 

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

void View::AllDetached [virtual]
 

void View::AttachedToWindow void [virtual]
 

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

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 (kurt@atheos.cx)

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 (kurt@atheos.cx)

void View::ConvertFromParent Rect * pcRect const
 

Rect View::ConvertFromParent const Rect & cRect const
 

void View::ConvertFromParent Point * pcPoint const
 

Point View::ConvertFromParent const Point & cPoint const
 

void View::ConvertFromScreen Rect * pcRect const
 

Rect View::ConvertFromScreen const Rect & cRect const
 

void View::ConvertFromScreen Point * pcPoint const
 

Point View::ConvertFromScreen const Point & cPoint const
 

void View::ConvertFromWindow Rect * pcRect const
 

Rect View::ConvertFromWindow const Rect & cRect const
 

void View::ConvertFromWindow Point * pcPoint const
 

Point View::ConvertFromWindow const Point & cPoint const
 

void View::ConvertToParent Rect * pcRect const
 

Rect View::ConvertToParent const Rect & cRect const
 

void View::ConvertToParent Point * pcPoint const
 

Modifying the passet Point object

Point View::ConvertToParent const Point & cPoint const
 

Returning the the result

void View::ConvertToScreen Rect * pcRect const
 

Rect View::ConvertToScreen const Rect & cRect const
 

void View::ConvertToScreen Point * pcPoint const
 

Point View::ConvertToScreen const Point & cPoint const
 

void View::ConvertToWindow Rect * pcRect const
 

Rect View::ConvertToWindow const Rect & cRect const
 

void View::ConvertToWindow Point * pcPoint const
 

Point View::ConvertToWindow const Point & cPoint const
 

void View::DetachedFromWindow void [virtual]
 

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

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.

Note:
In the future this member will scale the bitmap if cSrcRect and cDstRect differ in size. This is not yet implemented so only the position (top/left corner) of the destination rectangle is considered. It is therefor important that you make sure that the size of the two rectangles are equal or you will get some nasty surprises when scaling is implemented.
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. Currently only the position is considered. The top/left corner from cSrcRect will be placed at the top/left position of cDstRect. In the future the bitmap will be scaled to fit into the destination rectangle. This is not yet implemented (see note).
See also:
Bitmap
Author:
Kurt Skauen (kurt@atheos.cx)

void os::View::DrawChar int nChar,
const Point & cPos
[inline]
 

void os::View::DrawChar int nChar [inline]
 

void View::DrawFrame const Rect & a_cRect,
uint32 nStyle
 

void View::DrawLine const Point & cFromPnt,
const Point & cToPnt
 

void View::DrawLine const Point & cToPnt
 

void View::DrawString const std::string & cString,
const Point & cPos
 

void View::DrawString const char * pzString,
int nLength,
const Point & cPos
 

void View::DrawString const char * pzString,
const Point & cPos
 

void View::DrawString const std::string & cString
 

void View::DrawString const char * pString,
int nLength
 

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:
pString   Pointer to the 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 (kurt@atheos.cx)

void View::DrawString const char * pzString
 

Description:
This is the same as void DrawString( const char* pString, int nLength ) except that it assumes the string is NULL terminated and will always render the entire string.
Parameters:
pzString   The NULL terminated string to render
See also:
void DrawString( const char* pString, int nLength )
Author:
Kurt Skauen (kurt@atheos.cx)

void View::EraseRect const Rect & cRect
 

void View::FillRect const Rect & cRect,
Color32_s sColor
 

void View::FillRect const Rect & cRect
 

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 do nothing.

To get more info take a look at Window::Flush()

See also:
Sync(), Window::Flush()
Author:
Kurt Skauen (kurt@atheos.cx)

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 (kurt@atheos.cx)

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

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 (kurt@atheos.cx)

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 (kurt@atheos.cx)

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

Color32_s View::GetBgColor const
 

Rect View::GetBounds const
 

View * View::GetChildAt int nIndex
 

View * View::GetChildAt const Point & cPos
 

Point View::GetContentSize const [virtual]
 

drawing_mode View::GetDrawingMode const
 

Color32_s View::GetEraseColor const
 

Color32_s View::GetFgColor const
 

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

Font * View::GetFont const
 

void View::GetFontHeight font_height * psHeight const
 

Rect View::GetFrame const
 

ScrollBar * View::GetHScrollBar void const
 

Point View::GetLeftTop const
 

void View::GetMouse Point * pcPosition,
uint32 * pnButtons
 

Rect View::GetNormalizedBounds const
 

View * View::GetParent void const
 

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 (kurt@atheos.cx)

Point View::GetPreferredSize bool bLargest const [virtual]
 

Reimplemented in os::TextEdit, os::Button, os::CheckBox, os::DropdownMenu, os::FrameView, os::LayoutView, os::Menu, os::ProgressBar, os::RadioButton, os::ScrollBar, os::Slider, os::Spinner, os::StringView, os::TableView, os::TabView, and os::TextView.

uint32 View::GetQualifiers const
 

uint32 View::GetResizeMask const
 

Point View::GetScrollOffset void const
 

int View::GetStringLength const std::string & cString,
float vWidth,
bool bIncludeLast = false
const
 

int View::GetStringLength const char * pzString,
int nLength,
float vWidth,
bool bIncludeLast = false
const
 

int View::GetStringLength const char * pzString,
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
 

float View::GetStringWidth const std::string & cString const
 

float View::GetStringWidth const char * pzString,
int nLength
const
 

float View::GetStringWidth const char * pzString const
 

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

int View::GetTabOrder [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 (kurt@atheos.cx)

std::string View::GetTitle const
 

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

ScrollBar * View::GetVScrollBar void const
 

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

bool View::HasFocus void const [virtual]
 

Reimplemented in os::ListView.

float View::Height const
 

void os::View::Hide [inline]
 

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 (kurt@atheos.cx)

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 (kurt@atheos.cx)

bool View::IsVisible const
 

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 (kurt@atheos.cx)

Reimplemented in os::Button, os::DirectoryView, os::DropdownMenu, os::ListView, os::Menu, 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 (kurt@atheos.cx)

Reimplemented in os::Button.

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

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 (kurt@atheos.cx)

Reimplemented in os::Button, os::CheckBox, os::DropdownMenu, os::Menu, os::RadioButton, os::ScrollBar, os::Slider, os::Spinner, os::TabView, and os::TextView.

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 have 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 have 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 (kurt@atheos.cx)

Reimplemented in os::Button, os::DirectoryView, os::Menu, 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 (kurt@atheos.cx)

Reimplemented in os::Button, os::CheckBox, os::DirectoryView, os::Menu, os::RadioButton, os::ScrollBar, os::Slider, os::Spinner, os::TabView, and os::TextView.

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

See also:
MoveBy( const Point& cDelta )

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 (kurt@atheos.cx)

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

void View::MovePenBy const Point & cPos
 

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

void View::MovePenTo const Point & cPos
 

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

See also:
MoveTo( const Point& cPos )

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 (kurt@atheos.cx)

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 (kurt@atheos.cx)

Reimplemented in os::ListViewCol, os::TextEdit, os::Button, os::CheckBox, os::DropdownMenu, os::FrameView, os::ListView, os::Menu, os::ProgressBar, os::RadioButton, os::AlertView, os::ProgressView, os::ScrollBar, os::Slider, os::StringView, os::TableView, os::TabView, and os::TextView.

void View::Ping int nSize = 0
 

void View::RemoveChild View * pcChild
 

void View::RemoveThis void
 

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

void View::ResizeBy const Point & cDelta [virtual]
 

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

void View::ResizeTo const Point & cSize [virtual]
 

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

void View::ScrollBy const Point & cDelta [virtual]
 

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 (kurt@atheos.cx)

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

void View::ScrollTo Point cTopLeft [virtual]
 

void View::SetBgColor Color32_s sColor
 

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

void View::SetDrawingMode drawing_mode eMode
 

void View::SetEraseColor Color32_s sColor
 

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

void View::SetFgColor Color32_s sColor
 

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

void View::SetFlags uint32 nFlags
 

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 (kurt@atheos.cx)

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 (kurt@atheos.cx)

void View::SetMousePos const Point & cPosition
 

void View::SetResizeMask uint32 nFlags
 

void View::SetTabOrder int nOrder [virtual]
 

Description:
Set the value that will be returned by GetTabOrder().
Parameters:
nOrder   - The sorting order.
See also:
GetTabOrder()
Author:
Kurt Skauen (kurt@atheos.cx)

Reimplemented in os::TextView.

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 (kurt@atheos.cx)

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 do nothing.

To get more info take a look at Window::Flush()

See also:
Sync(), Window::Flush()
Author:
Kurt Skauen (kurt@atheos.cx)

int View::ToggleDepth void [virtual]
 

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 (kurt@atheos.cx)

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 (kurt@atheos.cx)

Reimplemented in os::ScrollBar, os::Spinner, and os::TextView.

float View::Width const
 

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 (kurt@atheos.cx)

Reimplemented in os::Menu.


Friends And Related Function Documentation

friend class Font [friend]
 

friend class ScrollBar [friend]
 

friend class Window [friend]
 

Reimplemented from os::Handler.


Generated at Tue Sep 11 15:27:57 2001 for AtheOS higlevel API by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001