Pyro higlevel API
Classes | Public Types | Public Member Functions | List of all members
os::ToolBar Class Reference

ToolBar. More...

Inheritance diagram for os::ToolBar:
os::LayoutView os::View os::Handler

Classes

class  Private
 

Public Types

enum  ToolBarObjectMode {
  TB_FIXED_WIDTH = 0,
  TB_FREE_WIDTH = 1,
  TB_FIXED_MINIMUM = 2
}
 

Public Member Functions

 ToolBar (const Rect &cFrame, const String &cTitle, uint32 nResizeMask=CF_FOLLOW_LEFT|CF_FOLLOW_TOP, uint32 nFlags=WID_WILL_DRAW|WID_FULL_UPDATE_ON_RESIZE)
 Constructor. More...
 
virtual ~ToolBar ()
 
LayoutNodeAddButton (const String &cName, const String &cText, Image *pcIcon, Message *pcMsg)
 Add button to ToolBar. More...
 
LayoutNodeAddPopupMenu (const String &cName, const String &cText, Image *pcIcon, Menu *pcMenu)
 Add PopupMenu to ToolBar. More...
 
LayoutNodeAddSeparator (const String &cName)
 Add Separator to ToolBar. More...
 
LayoutNodeAddChild (View *pcPanel, ToolBarObjectMode eMode, float vWeight=100.0f)
 Add View to ToolBar. More...
 
- Public Member Functions inherited from os::LayoutView
 LayoutView (const Rect &cFrame, const String &cTitle, LayoutNode *pcRoot=NULL, uint32 nResizeMask=CF_FOLLOW_ALL, uint32 nFlags=WID_WILL_DRAW|WID_CLEAR_BACKGROUND)
 
virtual ~LayoutView ()
 
LayoutNodeGetRoot () const
 Get root layout. More...
 
void SetRoot (LayoutNode *pcRoot)
 Set root layout. More...
 
LayoutNodeFindNode (const String &cName, bool bRecursive=true)
 Find node by name. More...
 
void InvalidateLayout ()
 Recalculate layout. More...
 
virtual Point GetPreferredSize (bool bLargest) const
 
virtual void AllAttached ()
 
virtual void FrameSized (const Point &cDelta)
 Virtual hook called by the system when the view is resized. More...
 
- Public Member Functions inherited from os::View
 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. More...
 
virtual ~View ()
 View destructor. More...
 
virtual void AttachedToWindow ()
 
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 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 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 ()
 
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. More...
 
virtual void SetTabOrder (int nOrder=NEXT_TAB_ORDER)
 Set the keyboard manouvering sorting order. More...
 
virtual const ShortcutKeyGetShortcut () const
 
virtual void SetShortcut (const ShortcutKey &cShortcut)
 Set keyboard shortcut. More...
 
virtual void SetShortcutFromLabel (const String &cLabel)
 Set keyboard shortcut from Label. More...
 
void SetContextMenu (Menu *pcMenu)
 Set popup menu for a View. More...
 
MenuGetContextMenu () const
 Get popup menu. More...
 
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. 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)
 Set a new absolute size for the view. More...
 
virtual void ResizeTo (float W, float H)
 Set a new absolute size for the view. More...
 
void SetDrawingRegion (const Region &cReg)
 Restrict rendering using a clipping region. More...
 
void ClearDrawingRegion ()
 Remove any previously assigned drawing region. More...
 
void SetShapeRegion (const Region &cReg)
 Define a non-square shape for the view. More...
 
void ClearShapeRegion ()
 Remove any previously assigned shape region. More...
 
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 DrawRoundedFrame (const os::Rect &cReizeFrame=os::Rect(1, 4,-1,-4), const os::Color32_s &cColor=get_default_color(COL_SHADOW))
 
void DrawRoundedFrame (const os::Rect &cFrame, const os::Rect &cReizeFrame=os::Rect(1, 4,-1,-4), const os::Color32_s &cColor=get_default_color(COL_SHADOW))
 
void DrawString (const Point &cPos, const String &cString)
 
void DrawString (const String &cString)
 Render a text-string at the current pen position. More...
 
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. More...
 
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
 
void SetToolTip (const os::String &t)
 
os::String GetToolTip () const
 
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
 
- Public Member Functions inherited from os::Handler
 Handler (const String &cName)
 Construct a handler. More...
 
virtual ~Handler ()
 Destructor. More...
 
virtual void TimerTick (int nID)
 Timer dispatch member. More...
 
virtual void HandleMessage (Message *pcMessage)
 Handle a message targeted at this handler. More...
 
String GetName () const
 Get the handlers name. More...
 
void SetName (const String &cName)
 Rename the handler. More...
 
LooperGetLooper () const
 Get a pointer to the looper this handler belongs to. More...
 
void SetNextHandler (Handler *pcNextHandler)
 Set a handler that should handle messages this handler is not interrested in. More...
 
HandlerGetNextHandler () const
 Get the next handler in a handler chain. More...
 
void AddFilter (MessageFilter *pcFilter)
 
void RemoveFilter (MessageFilter *pcFilter)
 
const MsgFilterListGetFilterList () const
 
const uint32 GetToken ()
 Get the handlers token. More...
 

Detailed Description

Description:
Example:
ToolBar* pcToolBar = new ToolBar( GetBounds(), "pcToolbar", CF_FOLLOW_ALL );
pcToolBar->AddButton( "", "New", pcNewIcon, NULL );
pcToolBar->AddButton( "", "Open", pcOpenIcon, NULL );
pcToolBar->AddSeparator( "" );
pcToolBar->AddButton( "", "Test", pcTestIcon, NULL );
AddChild( pcToolBar );
See Also
Author
Henrik Isaksson (henri.nosp@m.k@is.nosp@m.aksso.nosp@m.n.tk)

Member Enumeration Documentation

Enumerator
TB_FIXED_WIDTH 
TB_FREE_WIDTH 

Fixed size, equal to all other objects with fixed size.

TB_FIXED_MINIMUM 

Free size, fill remaining space.

Constructor & Destructor Documentation

ToolBar::ToolBar ( const Rect cFrame,
const String cName,
uint32  nResizeMask = CF_FOLLOW_LEFT | CF_FOLLOW_TOP,
uint32  nFlags = WID_WILL_DRAW | WID_FULL_UPDATE_ON_RESIZE 
)
Description:
Parameters
cFrameThe frame rectangle in the parents coordinate system.
pzNameThe logical name of the view. This parameter is newer rendered anywhere, but is passed to the Handler::Handler() constructor to identify the view.
nResizeMaskFlags defining how the view's frame rectangle is affected if the parent view is resized.
nFlagsVarious flags to control the view's behaviour.
See Also
Author
Henrik Isaksson (henri.nosp@m.k@is.nosp@m.aksso.nosp@m.n.tk)

References os::LayoutNode::AddChild(), os::ToolBar::Private::m_pcRoot, os::ToolBar::Private::m_pcSpacer, and os::LayoutView::SetRoot().

ToolBar::~ToolBar ( )
virtual

Member Function Documentation

LayoutNode * ToolBar::AddButton ( const String cName,
const String cText,
Image pcIcon,
Message pcMsg 
)
Description:
Parameters
cNameA name that can be used to find this object.
cTextThe text to display in the button.
pcIconIcon to show above the text (or null for no icon).
pcMsgMessage to be sent upon activation (clicking the button).
See Also
AddChild(), AddSeparator(), AddPopupMenu()
Author
Henrik Isaksson (henri.nosp@m.k@is.nosp@m.aksso.nosp@m.n.tk)

References AddChild(), os::ImageButton::IB_TEXT_BOTTOM, and TB_FIXED_WIDTH.

LayoutNode * ToolBar::AddChild ( View pcView,
ToolBarObjectMode  eMode,
float  vWeight = 100.0f 
)
LayoutNode * ToolBar::AddPopupMenu ( const String cName,
const String cText,
Image pcIcon,
Menu pcMenu 
)
Description:
Parameters
cNameA name that can be used to find this object.
cTextThe text to display in the button.
pcIconIcon to show above the text (or null for no icon).
pcMenuMenu to display.
pcMsgMessage to be sent upon activation (clicking the button).
See Also
AddButton(), AddSeparator(), AddChild()
Author
Henrik Isaksson (henri.nosp@m.k@is.nosp@m.aksso.nosp@m.n.tk)

References AddChild(), and TB_FIXED_WIDTH.

LayoutNode * ToolBar::AddSeparator ( const String cName)
Description:
Parameters
cNameA name that can be used to find this object.
See Also
AddButton(), AddChild(), AddPopupMenu()
Author
Henrik Isaksson (henri.nosp@m.k@is.nosp@m.aksso.nosp@m.n.tk)

References AddChild(), and TB_FIXED_MINIMUM.