mCtrl  0.9.0
expand.h File Reference

Expand control (MC_WC_EXPAND). More...

Go to the source code of this file.

Initialization Functions

BOOL mcExpand_Initialize (void)
 
void mcExpand_Terminate (void)
 

Window Class

#define MC_WC_EXPANDW   L"mCtrl.expand"
 
#define MC_WC_EXPANDA   "mCtrl.expand"
 

Control Styles

#define MC_EXS_CACHESIZES   0x0001
 Cache expanded and collapsed sizes.
 
#define MC_EXS_RESIZEENTIREWINDOW   0x0002
 Expanded and collapsed sizes are interpreted for whole window.
 
#define MC_EXS_DOUBLEBUFFER   0x0004
 Enable painting with double buffering.
 

Control Messages

#define MC_EXM_SETCOLLAPSEDSIZE   (MC_EXM_FIRST + 0)
 Specify size of parent's client area when in collapsed state.
 
#define MC_EXM_GETCOLLAPSEDSIZE   (MC_EXM_FIRST + 1)
 Gets size of parent's client area when in collapsed state.
 
#define MC_EXM_SETEXPANDEDSIZE   (MC_EXM_FIRST + 2)
 Specify size of parent's client area when in expanded state.
 
#define MC_EXM_GETEXPANDEDSIZE   (MC_EXM_FIRST + 3)
 Gets size of parent's client area when in expanded state.
 
#define MC_EXM_EXPAND   (MC_EXM_FIRST + 4)
 Sets current state of the control to expanded or collapsed.
 
#define MC_EXM_TOGGLE   (MC_EXM_FIRST + 5)
 Toggles current state of the control between expanded and collapsed.
 
#define MC_EXM_ISEXPANDED   (MC_EXM_FIRST + 6)
 Gets current state of the control.
 

Unicode Resolution

#define MC_WC_EXPAND   MCTRL_NAME_AW(MC_WC_EXPAND)
 

Detailed Description

Expand control (MC_WC_EXPAND).

The expand control is a utility control used to toggle size of another window between "collapsed" and "expanded" states.

In addition, when collapsing, the control automatically disables and hides all child windows of the managed window which fall out of the visible area; and when expaning it enables and shows all the child windows revealed by the resize operation.

Window

By default the managed window is a parent window of the control. Use message CCM_SETNOTIFYWINDOW to change what window the control manages.

Note
The root control also gets all the notifications from the control.

and Collapsed Sizes

If both width and height the of the expanded and/or collapsed sizes is zero, the control computes automatically from analyzes of position and size of all child windows of the managed window (usually the parent).

The width of the managed window is kept unchanged in this automatic regime. The height of the managed window is calculated so that all child windows of the managed window are visible (the expanded state) or all child windows positioned below the expand control itself are hidden (the collapsed state).

If you use style MC_EXS_CACHESIZES, the computed sizes are retained for next use, i.e. the sizes are computed only once.

You can set expanded and collapsed sizes explicitely with message MC_EXM_SETCOLLAPSEDSIZE and MC_EXM_SETEXPANDEDSIZE respectivelly.

State

After creation of the control, its logical state is collapsed. Though the control does not resize the dialog because it may not be already fully initialized, e.g. if the expand control is not last control created in the dialog.

Therefore it is supposed that application explicitely sends the message MC_EXM_EXPAND after the dialog and all its children are created, usually as part of the WM_INITDIALOG handling.

These standard messages are handled by the control:

These standard notifications are sent by the control:

Macro Definition Documentation

#define MC_WC_EXPANDW   L"mCtrl.expand"

Window class name (unicode variant).

#define MC_WC_EXPANDA   "mCtrl.expand"

Window class name (ANSI variant).

#define MC_EXS_CACHESIZES   0x0001

Cache expanded and collapsed sizes.

When in the automatic mode, this style allows the control to store expanded and/or collapsed sizes instead of recomputing it each time its state changes.

#define MC_EXS_RESIZEENTIREWINDOW   0x0002

Expanded and collapsed sizes are interpreted for whole window.

If this style is not set, they determine client size only.

#define MC_EXS_DOUBLEBUFFER   0x0004

Enable painting with double buffering.

It prevents flickering when the control is being continuously resized.

#define MC_EXM_SETCOLLAPSEDSIZE   (MC_EXM_FIRST + 0)

Specify size of parent's client area when in collapsed state.

If you set both width and height to zero, then the size is computed automatically from position of all controls in the dialog.

Parameters
wParamReserved, set to zero.
lParam[in](DWORD) The size. Low-order word specifies width and high-order word specifies height.
Returns
(DWORD) The original size.
#define MC_EXM_GETCOLLAPSEDSIZE   (MC_EXM_FIRST + 1)

Gets size of parent's client area when in collapsed state.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(DWORD) The size. Low-order word specifies width and high-order word specifies height.
#define MC_EXM_SETEXPANDEDSIZE   (MC_EXM_FIRST + 2)

Specify size of parent's client area when in expanded state.

If you set both width and height to zero, then the size is computed automatically from position of all controls in the dialog.

Parameters
wParamReserved, set to zero.
lParam[in](DWORD) The size. Low-order word specifies width and high-order word specifies height.
Returns
(DWORD) The original size.
#define MC_EXM_GETEXPANDEDSIZE   (MC_EXM_FIRST + 3)

Gets size of parent's client area when in expanded state.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(DWORD) The size. Low-order word specifies width and high-order word specifies height.
#define MC_EXM_EXPAND   (MC_EXM_FIRST + 4)

Sets current state of the control to expanded or collapsed.

Parameters
wParam[in](BOOL) Set to TRUE to expand, FALSE to collapse.
lParamReserved, set to zero.
Returns
(BOOL) TRUE on success, FALSE on failure.
#define MC_EXM_TOGGLE   (MC_EXM_FIRST + 5)

Toggles current state of the control between expanded and collapsed.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(BOOL) TRUE on success, FALSE on failure.
#define MC_EXM_ISEXPANDED   (MC_EXM_FIRST + 6)

Gets current state of the control.

Parameters
wParamReserved, set to zero.
lParamReserved, set to zero.
Returns
(BOOL) TRUE if expanded, FALSE if collapsed.
#define MC_WC_EXPAND   MCTRL_NAME_AW(MC_WC_EXPAND)

Unicode-resolution alias.

See Also
MC_WC_EXPANDW MC_WC_EXPANDA

Function Documentation

BOOL mcExpand_Initialize ( void  )

Registers window class of the control.

Returns
TRUE on success, FALSE on failure.
void mcExpand_Terminate ( void  )

Unregisters window class of the control.