Vaca::GroupBox Class Reference

#include <GroupBox.h>

Inheritance diagram for Vaca::GroupBox:

Vaca::Widget Vaca::Component Vaca::Referenceable Vaca::NonCopyable

List of all members.


Detailed Description

An edge (with a label optionally) that can be used to group sub-widgets.

Public Member Functions

 GroupBox (const String &text, Widget *parent, Style style=GroupBoxStyle)
virtual ~GroupBox ()
virtual Rect getLayoutBounds ()
 Returns the area where the Layout must arrange the collection of children.
Size getNonClientSize ()

Protected Member Functions

virtual void onPreferredSize (Size &sz)
 It should calculates the preferred size for this widget.
virtual bool wndProc (UINT message, WPARAM wParam, LPARAM lParam, LRESULT &lResult)
 The customized window procedure for this particular widget.

Constructor & Destructor Documentation

GroupBox::GroupBox ( const String text,
Widget parent,
Style  style = GroupBoxStyle 
)

GroupBox::~GroupBox (  )  [virtual]


Member Function Documentation

Rect GroupBox::getLayoutBounds (  )  [virtual]

Returns the area where the Layout must arrange the collection of children.

It's generally the client bounds, but other widgets (like Tab) could use a small area inside the widget.

See also:
getClientBounds

Reimplemented from Vaca::Widget.

Size GroupBox::getNonClientSize (  ) 

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

bool GroupBox::wndProc ( UINT  message,
WPARAM  wParam,
LPARAM  lParam,
LRESULT &  lResult 
) [protected, virtual]

The customized window procedure for this particular widget.

Win32 Specific:
This is called from Widget::globalWndProc. It should returns true when the defWndProc doesn't need to be called.

This method is called to intercept any message after the creation of the widget, and before the destruction. To intercept messages outside that range (before creation, and after disposition), you should customize defWndProc().

This method mainly converts a message to a event:

For reflection, it does:

  • When WM_COMMAND is received, the onReflectedCommand() event of the child is called when it is a WM_COMMAND from a control, or the onCommand() event of this widget is called when the command come from a menu or an accelerator.
  • When WM_NOTIFY is received, the onReflectedNotify() event of the child is called.
  • When WM_DRAWITEM is received, the onReflectedDrawItem() event of the child is called.

How to extend widget::wndProc method?

 class MyWidget : public Widget {
   ...
 protected:
   virtual bool wndProc(UINT message, WPARAM wParam, LPARAM lParam, LRESULT& lResult)
   {
     if (Widget::wndProc(message, wParam, lParam, lResult))
       return true;

     // ...Your code here...

     return false;
   }
   ...
 }

Returns:
True if the message was used and lResult contains a valid value to be returned by globalWndProc.
See also:
globalWndProc, getGlobalWndProc, defWndProc

Reimplemented from Vaca::Widget.