Vaca::BandedDockArea Class Reference

#include <BandedDockArea.h>

Inheritance diagram for Vaca::BandedDockArea:

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

List of all members.


Detailed Description

An area where you can put DockBars separated by bands.

Public Member Functions

 BandedDockArea (Side side, Widget *parent, Style style=BandedDockAreaStyle)
virtual ~BandedDockArea ()
virtual bool hitTest (DockBar *bar, const Point &cursor, const Point &anchor, bool fromInside)
 Returns true if the point pt is inside a valid rectangle to dock in this DockArea.
virtual DockInfocreateDefaultDockInfo (DockBar *bar)
 Returns a default DockInfo for the floating DockBar that want to be docked by double-click by first-time.
virtual DockInfocreateDockInfo (DockBar *bar, const Point &cursor, const Point &anchor)
virtual void drawXorTracker (Graphics &g, DockInfo *dockInfo)
 Draws the tracker (generally a rectangle) in Xor mode that represents the specified dockInfo.
virtual void layout ()
 Lays out all dock bars inside the dock area using the DockInfo of each DockBar.

Protected Member Functions

virtual void onPreferredSize (Size &sz)
 It should calculates the preferred size for this widget.
virtual void onPaint (Graphics &g)
 Called then the WM_PAINT event is received.
virtual void onAddDockBar (DockBar *dockBar)
 You can use onAddDockBar to hook the addDockBar action.
virtual void onRemoveDockBar (DockBar *dockBar)
 You can use onRemoveDockBar to hook the removeDockBar action.
virtual void onRedock (DockBar *dockBar, DockInfo *newDockInfo)
 Event generated when the user start dragging the dockBar from this DockArea.

Private Member Functions

void updateBandSize (int bandIndex)
Rect getBandBounds (int bandIndex)
void fitBounds (int bandIndex, int barIndex1, std::vector< Rect > &bounds)

Private Attributes

std::vector< BandInfom_bandInfo

Classes

struct  BandInfo

Constructor & Destructor Documentation

BandedDockArea::BandedDockArea ( Side  side,
Widget parent,
Style  style = BandedDockAreaStyle 
)

BandedDockArea::~BandedDockArea (  )  [virtual]


Member Function Documentation

bool BandedDockArea::hitTest ( DockBar bar,
const Point cursor,
const Point anchor,
bool  fromInside 
) [virtual]

Returns true if the point pt is inside a valid rectangle to dock in this DockArea.

Parameters:
bar The DockBar to dock.
cursor Absolute position.
fromInside True means that we are already inside the DockArea, so try to use the more biggest are to return a true hit-test.

Implements Vaca::DockArea.

DockInfo * BandedDockArea::createDefaultDockInfo ( DockBar bar  )  [virtual]

Returns a default DockInfo for the floating DockBar that want to be docked by double-click by first-time.

Implements Vaca::DockArea.

DockInfo * BandedDockArea::createDockInfo ( DockBar bar,
const Point cursor,
const Point anchor 
) [virtual]

Returns:
A new created dockInfo (you must to delete this pointer).

Implements Vaca::DockArea.

void BandedDockArea::drawXorTracker ( Graphics g,
DockInfo dockInfo 
) [virtual]

Draws the tracker (generally a rectangle) in Xor mode that represents the specified dockInfo.

Implements Vaca::DockArea.

void BandedDockArea::layout (  )  [virtual]

Lays out all dock bars inside the dock area using the DockInfo of each DockBar.

See also:
DockBar, DockInfo

Implements Vaca::DockArea.

void BandedDockArea::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.

Implements Vaca::DockArea.

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

Called then the WM_PAINT event is received.

The default implementation calls the Graphics::noPaint to know that this widget doesn't paint the surface. If you override this method, remember: (1) to draw inside the Widget::getClientBounds limits, and (2) don't call the base method onPaint().

Warning:
Don't try to override the onPaint of a system control (like Button, Edit, etc.). You must to use the CustomButton, CustomEdit, etc. to do that.
 class MyWidget : public Panel
 {
 public:
   ...
   virtual void onPaint(Graphics& g)
   {
     Rect rc = getClientBounds();
     g.drawEllipse(rc);
   }
 };

See also:
onReflectedDrawItem

Reimplemented from Vaca::Widget.

void BandedDockArea::onAddDockBar ( DockBar dockBar  )  [protected, virtual]

You can use onAddDockBar to hook the addDockBar action.

 void MyDockArea::onAddDockBar(DockBar* dockBar)
 {
   // do something, like add the dockBar in
   // some internal structure...
 }

Reimplemented from Vaca::DockArea.

void BandedDockArea::onRemoveDockBar ( DockBar dockBar  )  [protected, virtual]

You can use onRemoveDockBar to hook the removeDockBar action.

 void MyDockArea::onRemoveDockBar(DockBar* dockBar)
 {
   // do something, like remove the dockBar from 
   // some internal structure...
 }

Reimplemented from Vaca::DockArea.

void BandedDockArea::onRedock ( DockBar dockBar,
DockInfo newDockInfo 
) [protected, virtual]

Event generated when the user start dragging the dockBar from this DockArea.

Event generated when the user finish the dragging of the dockBar that start from this DockArea.

Parameters:
newDockInfo The new dockInfo where the dockBar will be docked. NULL means that dockBar will be floating, or the drag operation was canceled.

Reimplemented from Vaca::DockArea.

void BandedDockArea::updateBandSize ( int  bandIndex  )  [private]

Rect BandedDockArea::getBandBounds ( int  bandIndex  )  [private]

void BandedDockArea::fitBounds ( int  bandIndex,
int  barIndex1,
std::vector< Rect > &  bounds 
) [private]


Member Data Documentation