Vaca::DockBar Class Reference

#include <DockBar.h>

Inheritance diagram for Vaca::DockBar:

Vaca::Register< T > Vaca::Widget Vaca::Component Vaca::Referenceable Vaca::NonCopyable Vaca::ToolBar

List of all members.


Detailed Description

A dockable bar.

Each dock bar as two possible states: docked or floating. When it's floating, the DockBar is inside a DockFrame, when the DockBar is docked, it's inside a DockArea.

See also:
ToolBar

Public Member Functions

 DockBar (const String &title, Frame *parent, Style style=DockBarStyle)
 Creates a new DockBar.
virtual ~DockBar ()
virtual void setVisible (bool visible)
 You can use setVisible() to hide or show the DockBar.
virtual Rect getLayoutBounds ()
 Leaves some space for the gripper (using measureGripper()).
void setFullDrag (bool state)
bool isFullDrag ()
void setFloatingGripper (bool state)
 If state is true, the gripper is drawn on floating mode too.
bool isFloatingGripper ()
 Default value: false.
bool isDocked ()
 Returns true if the bar is docked in a DockArea.
bool isFloating ()
 Returns true if the bar is floating in a DockFrame.
void dockIn (DockArea *dockArea)
void floatOut ()
FramegetOwnerFrame ()
DockAreagetDockArea ()
DockFramegetDockFrame ()
DockInfogetDockInfo ()
virtual Size getDockedSize (Side side)
virtual Size getFloatingSize ()

Protected Member Functions

virtual void onPreferredSize (Size &sz)
 It should calculates the preferred size for this widget.
virtual void onDockFrameClose (CloseEvent &ev)
 Called when m_dockFrame is closed by its "Close" button.
virtual void onPaint (Graphics &g)
 Calls paintGripper().
virtual void onResize (const Size &sz)
 When the gripper is visible in the floating state (m_floatingGripper == true), we must to repaint the DockBar's gripper when the DockBar is resized.
virtual void onMouseDown (MouseEvent &ev)
 The mouse is inside the Widget and the user press a mouse's button.
virtual void onMouseMove (MouseEvent &ev)
 The mouse is moving inside the Widget's client area.
virtual void onMouseUp (MouseEvent &ev)
 The mouse is inside the Widget and the user release a mouse's button.
virtual void onDoubleClick (MouseEvent &ev)
 The user made double click over the widget.
virtual void onCancelMode ()
 Event generated when the user press ESC in a drag-and-drop operation for example.
virtual void onDocking ()
 Event called when the DockBar is docked in a new DockArea.
virtual void onFloating ()
 Event called when the DockBar was docked and now is floating in some DockFrame.
virtual void onResizingFrame (DockFrame *frame, CardinalDirection dir, Rect &rc)
 When the DockBar is floating, and its DockFrame container is resized (DockFrame::onResizing), this event is fired.
virtual void paintGripper (Graphics &g)
virtual Size measureGripper (bool docked, Side dockSide)
virtual Side getGripperSide (bool docked, Side dockSide)
virtual bool isGripperVisible (bool docked, Side dockSide)

Private Member Functions

void makeDock (DockArea *dockArea, DockInfo *dockInfo)
void makeFloat (const Rect *rect=NULL)
void beginDrag ()
 Creates the DragInfo to start dragging this DockBar.
void dragBar ()
 Moves the DockBar to the place that indicates the current m_drag information.
void endDrag ()
 Destroys the DragInfo (m_drag).
void cleanUp ()
 Used to hide the DockBar.
void cleanFrame ()
void focusOwner ()
 Focus the owner window.
DockInfocalcDestination (Rect &rc)
void drawTracker (Graphics &g)
void cleanTracker (Graphics &g)
DockAreaxorTracker (Graphics &g)

Static Private Member Functions

static Size getNonClientSizeForADockFrame ()

Private Attributes

DockAream_dockArea
 In what DockArea is the DockBar docked? It's != NULL only if the DockBar is docked.
DockFramem_dockFrame
 The DockFrame that contains the DockBar when it's floating.
DragInfo * m_drag
 Drag stuff.
Framem_owner
 The Frame that own the DockBar.
DockInfom_dockInfo
 Information of the DockBar when it's docked (or the information about the last docked position).
bool m_fullDrag
bool m_floatingGripper

Friends

class DockArea
class DockFrame

Constructor & Destructor Documentation

DockBar::DockBar ( const String title,
Frame parent,
Style  style = DockBarStyle 
)

Creates a new DockBar.

DockBar::~DockBar (  )  [virtual]


Member Function Documentation

void DockBar::setVisible ( bool  visible  )  [virtual]

You can use setVisible() to hide or show the DockBar.

If you hide the DockBar, this method deletes the Vaca::DockFrame if it exist, or remove the DockBar from the Vaca::DockArea. All is automatic.

Reimplemented from Vaca::Widget.

Rect DockBar::getLayoutBounds (  )  [virtual]

Leaves some space for the gripper (using measureGripper()).

Reimplemented from Vaca::Widget.

void DockBar::setFullDrag ( bool  state  ) 

bool DockBar::isFullDrag (  ) 

void DockBar::setFloatingGripper ( bool  state  ) 

If state is true, the gripper is drawn on floating mode too.

By default, the gripper is not drawn in floating mode.

bool DockBar::isFloatingGripper (  ) 

Default value: false.

bool DockBar::isDocked (  ) 

Returns true if the bar is docked in a DockArea.

bool DockBar::isFloating (  ) 

Returns true if the bar is floating in a DockFrame.

void DockBar::dockIn ( DockArea dockArea  ) 

void DockBar::floatOut (  ) 

Frame * DockBar::getOwnerFrame (  ) 

DockArea * DockBar::getDockArea (  ) 

DockFrame * DockBar::getDockFrame (  ) 

DockInfo * DockBar::getDockInfo (  ) 

Size DockBar::getDockedSize ( Side  side  )  [virtual]

Reimplemented in Vaca::ToolBar.

Size DockBar::getFloatingSize (  )  [virtual]

Reimplemented in Vaca::ToolBar.

void DockBar::onPreferredSize ( Size sz  )  [protected, virtual]

It should calculates the preferred size for this widget.

Parameters:
sz It's for input and output. You should put the preferred size in this value, but also you should read the input value to know if you must to fit the widget in some size. The possible values for sz are:
  • sz = Size(0, 0) to calculate the preferred size without restrictions.
  • sz = Size(width, 0) to calculate the preferred size with restricted <= width.
  • sz = Size(0, height) to calculate the preferred size with restricted <= height.

Reimplemented from Vaca::Widget.

void DockBar::onDockFrameClose ( CloseEvent ev  )  [protected, virtual]

Called when m_dockFrame is closed by its "Close" button.

void DockBar::onPaint ( Graphics g  )  [protected, virtual]

Calls paintGripper().

Reimplemented from Vaca::Widget.

void DockBar::onResize ( const Size sz  )  [protected, virtual]

When the gripper is visible in the floating state (m_floatingGripper == true), we must to repaint the DockBar's gripper when the DockBar is resized.

Reimplemented from Vaca::Widget.

void DockBar::onMouseDown ( MouseEvent ev  )  [protected, virtual]

The mouse is inside the Widget and the user press a mouse's button.

Win32 Specific:
This event is generated when WM_LBUTTONDOWN(W32), WM_MBUTTONDOWN(W32), or WM_RBUTTONDOWN(W32) message is received.

Reimplemented from Vaca::Widget.

void DockBar::onMouseMove ( MouseEvent ev  )  [protected, virtual]

The mouse is moving inside the Widget's client area.

If you capture the mouse, you should use the System::getCursorPos function to get the cursor position when it's outside the widget's client area.

Reimplemented from Vaca::Widget.

void DockBar::onMouseUp ( MouseEvent ev  )  [protected, virtual]

The mouse is inside the Widget and the user release a mouse's button.

Win32 Specific:
This event is generated when WM_LBUTTONUP(W32), WM_MBUTTONUP(W32), or WM_RBUTTONUP(W32) message is received.

Reimplemented from Vaca::Widget.

void DockBar::onDoubleClick ( MouseEvent ev  )  [protected, virtual]

The user made double click over the widget.

The default implementation calls onMouseDown, so it is like a single click (converts double-clicks to single-clicks).

Warning:
If you override this event, don't call the base implementation.
See also:
onMouseDown

Reimplemented from Vaca::Widget.

void DockBar::onCancelMode (  )  [protected, virtual]

Event generated when the user press ESC in a drag-and-drop operation for example.

Win32 Specific:
This event is generated when WM_CANCELMODE(W32) message is received.

Reimplemented from Vaca::Widget.

void DockBar::onDocking (  )  [protected, virtual]

Event called when the DockBar is docked in a new DockArea.

You can use getDockArea() method to known where the DockBar is docked.

Reimplemented in Vaca::ToolBar.

void DockBar::onFloating (  )  [protected, virtual]

Event called when the DockBar was docked and now is floating in some DockFrame.

Reimplemented in Vaca::ToolBar.

void DockBar::onResizingFrame ( DockFrame frame,
CardinalDirection  dir,
Rect rc 
) [protected, virtual]

When the DockBar is floating, and its DockFrame container is resized (DockFrame::onResizing), this event is fired.

Reimplemented in Vaca::ToolBar.

void DockBar::paintGripper ( Graphics g  )  [protected, virtual]

Size DockBar::measureGripper ( bool  docked,
Side  dockSide 
) [protected, virtual]

Returns:
This must return Size(gripperWidth, 0), Size(0, gripperHeight), or Size(0, 0) if the gripper is hidden (use isGripperVisible() to know that).

Side DockBar::getGripperSide ( bool  docked,
Side  dockSide 
) [protected, virtual]

bool DockBar::isGripperVisible ( bool  docked,
Side  dockSide 
) [protected, virtual]

void DockBar::makeDock ( DockArea dockArea,
DockInfo dockInfo 
) [private]

void DockBar::makeFloat ( const Rect rect = NULL  )  [private]

void DockBar::beginDrag (  )  [private]

Creates the DragInfo to start dragging this DockBar.

..

void DockBar::dragBar (  )  [private]

Moves the DockBar to the place that indicates the current m_drag information.

void DockBar::endDrag (  )  [private]

Destroys the DragInfo (m_drag).

void DockBar::cleanUp (  )  [private]

Used to hide the DockBar.

It deletes the m_dockFrame and removes this DockBar from m_dockArea (if it isn't NULL).

void DockBar::cleanFrame (  )  [private]

void DockBar::focusOwner (  )  [private]

Focus the owner window.

DockInfo * DockBar::calcDestination ( Rect rc  )  [private]

void DockBar::drawTracker ( Graphics g  )  [private]

void DockBar::cleanTracker ( Graphics g  )  [private]

DockArea * DockBar::xorTracker ( Graphics g  )  [private]

Size DockBar::getNonClientSizeForADockFrame (  )  [static, private]

Todo:
Move this method to DockFrame


Friends And Related Function Documentation

friend class DockArea [friend]

friend class DockFrame [friend]


Member Data Documentation

In what DockArea is the DockBar docked? It's != NULL only if the DockBar is docked.

The DockFrame that contains the DockBar when it's floating.

It's != NULL only if the DockBar is floating.

DragInfo* Vaca::DockBar::m_drag [private]

Drag stuff.

Not NULL means that the user is dragging the DockBar.

The Frame that own the DockBar.

This owner generally should have some DockArea to dock the DockBar, but isn't obligatory.

Information of the DockBar when it's docked (or the information about the last docked position).

This can be a derived class of DockInfo, used by your own DockArea (like BandedDockArea does).

bool Vaca::DockBar::m_fullDrag [private]