AspectSizable Class Template Reference
[Aspect ClassesLayout of widgets in windows]

"size" property of their objects. More...

Inherited by WidgetButton, WidgetCheckBox, WidgetComboBox, WidgetCoolbar [private], WidgetDataGrid, WidgetDateTimePicker, WidgetGroupBox, WidgetMDIParent, WidgetProgressBar, WidgetRadioButton, WidgetSlider, WidgetSpinner, WidgetSplitter, WidgetStatic, WidgetStatusBar [protected], WidgetTabSheet, WidgetTextBox, WidgetTextBox< EventHandlerClass, MessageMapPolicy >, WidgetTextBox< EventHandlerClass, MessageMapPolicy, SmartWin::RichTextBox< EventHandlerClass, MessageMapPolicy > >, WidgetTextBox< Parent, MessageMapPolicy >, WidgetToolbar [private], WidgetTreeView, WidgetWindowBase, WidgetWindowBase< EventHandlerClass, SmartWin::MessageMapPolicyDialogWidget >, WidgetWindowBase< EventHandlerClass, SmartWin::MessageMapPolicyModalDialogWidget >, and WidgetWindowBase< EventHandlerClass, unUsed >.

List of all members.

Public Member Functions

void bringToBottom ()
 Brings the widget to the bottom.
void bringToFront ()
 Brings the widget to the front.
Rectangle getBounds () const
 Returns the position and size of the window.
Point getClientAreaSize () const
 Returns the size of the client area of the window.
Point getPosition () const
 Returns the position of the window.
Point getSize () const
 Returns the size of the window.
Point getTextSize (const SmartUtil::tstring &text)
 Fills a Point with the size of text to be drawn in the Widget's font.
void maximize ()
 Maximize your window.
void minimize ()
 Minimize your window.
void onMoved (typename MessageMapType::itsVoidFunctionTakingPoint eventHandler)
void onSized (typename MessageMapType::itsVoidFunctionTakingWindowSizedEventResult eventHandler)
void restore ()
 Restores your window.
void setBounds (int x, int y, int width, int height, bool updateWindow=true)
 Sets the new size and position of the window.
void setBounds (const Point &newPos, const Point &newSize, bool updateWindow=true)
 Sets the new size and position of the window.
void setBounds (const Rectangle &rect, bool updateWindow=true)
 Sets the new size and position of the window.
void setPositionPerPlace (SmartWin::Place &bound)
 Given a bounding Place class, place this Widget and adjust to the next position.
void setSizeAsCol (const Rectangle &rect, int rows, int rownum, int border=0, bool updateWindow=true)
 Given a bounding rectangle with rows, put this Widget in the rownum position.
void setSizeAsGridPerPlace (SmartWin::Place &bound, int rows, int cols)
 this Widget in the next cell.
void setSizeAsRow (const Rectangle &rect, int cols, int colnum, int border=0, bool updateWindow=true)
 Given a bounding rectangle with cols, put this Widget in the colnum position.
void setSizePerTextPerPlace (SmartWin::Place &bound, const SmartUtil::tstring &text, int extraX=0, int extraY=0)
 Place after sizing for the Widget's text, and adjust to the next position.

Static Public Member Functions

static Point getDesktopSize ()
 Returns the screen size.


Detailed Description

template<class EventHandlerClass, class WidgetType, class MessageMapType>
class SmartWin::AspectSizable< EventHandlerClass, WidgetType, MessageMapType >

"size" property of their objects.

E.g. the WidgetTextBox have a "size" Aspect therefore it realizes the AspectSizable through inheritance.
Note!
All coordinates have zenith top-left corner of either the desktop display or the client area of the parent Widget.
Note!
There are two different ways to calculate the position of a Widget, one is in screen coordinates which starts top left of the desktop window, the other way is relative to its parent Widget which starts at the top left of the parent Widgets client area which is the total area of the Widget after the border, menu, toolbar etc have been taken away.
In addition all bounding Rectangles dealt with through this class are giving their down right coordinates in SIZES and not in POSITIONS!


Member Function Documentation

void bringToBottom (  ) 

Brings the widget to the bottom.

Makes the widget become the bottom most widget meaning it will be obscured by all other widgets which are contained in the same container widget.
For instance if you have two widgets which partially hides eachother and you call bringToBottom on one of them it will make sure that the widget you call bringToBottom on will be the one which will be invisible and the other one will be all visible by the parts which are obscured by the this widget.

void bringToFront (  ) 

Brings the widget to the front.

Makes the widget become the front most widget meaning it will not be obscured by other widgets which are contained in the same container widget.
For instance if you have two widgets which partially hides eachother and you call bringToFront on one of them it will make sure that the widget you call bringToFront on will be the one which will be all visible and the other one will be partially hidden by the parts which are obscured by the this widget.

Rectangle getBounds (  )  const

Returns the position and size of the window.

Note that this is in screen coordinates meaning the position returned is relative to the upper left corner of the desktop screen, the function also returns in the size member of the Rectangle the size of the window and not the position of the lower right point. Values includes borders, frames and toolbar etc of the window.

Point getClientAreaSize (  )  const

Returns the size of the client area of the window.

This differs from getSize because it disregards the border and headers, this function only returns the client area of the Widget meaning the area which it is possible to draw on.

Point getDesktopSize (  )  [static]

Returns the screen size.

This is the screen size, and useful for making applications that must adapt to different screen sizes.

Point getPosition (  )  const

Returns the position of the window.

Note that this is in screen coordinates meaning the position returned is relative to the upper left corner of the desktop screen.

Reimplemented in WidgetProgressBar, and WidgetSlider.

Point getSize (  )  const

Returns the size of the window.

Includes the border, frame and toolbar etc of the window.

Point getTextSize ( const SmartUtil::tstring &  text  ) 

Fills a Point with the size of text to be drawn in the Widget's font.

getTextSize determines the height and width that text will take.
This is useful if you want to allocate enough space to fit known text.
It accounts for the set font too.

void maximize (  ) 

Maximize your window.

This will make the window fill the whole area that the window has available.
This function cannot be called for any Widget types other than those derived from WidgetWindowBase.

void minimize (  ) 

Minimize your window.

This will make the window become minimized.
This function cannot be called for any Widget types other than those derived from WidgetWindowBase.

void restore (  ) 

Restores your window.

This will make the window become restored.
This function cannot be called for any Widget types other than those derived from WidgetWindowBase.

void setBounds ( int  x,
int  y,
int  width,
int  height,
bool  updateWindow = true 
)

Sets the new size and position of the window.

x is the new horizontal position of your window.
y is the new vertical position of your window.
width is the new width and height is the new height of your window.
Zenith is as in all other bounds function top/left.
A call to this function will (probably) also MOVE your Widget too.

void setBounds ( const Point newPos,
const Point newSize,
bool  updateWindow = true 
)

Sets the new size and position of the window.

The input parameter newPos of type Point defines the new position of the window.
The newSize member of type Point is the new size of the window.
A call to this function will (probably) also MOVE your Widget too.

void setBounds ( const Rectangle rect,
bool  updateWindow = true 
)

Sets the new size and position of the window.

The input parameter Rectangle defines the new size (and position) of the window.
The pos member of the Rectangle is the position and the size member is the size.
So a call to this function will (probably) also MOVE your Widget too.

void setPositionPerPlace ( SmartWin::Place bound  ) 

Given a bounding Place class, place this Widget and adjust to the next position.

This function places the Widget into the bounding rectangle specified by bound.
The size of the Widget is preserved.
The Widgets are sized and placed from left to right until a row is full, and then continues with the next row.
The internal position of bound is updated.

void setSizeAsCol ( const Rectangle rect,
int  rows,
int  rownum,
int  border = 0,
bool  updateWindow = true 
)

Given a bounding rectangle with rows, put this Widget in the rownum position.

The rect defines a column made up of a number of rows. The rownum specifies a zero based index of the row to place the Widget. [ row0 ]
[ row1 ]
...
[ rownum ]
[ ]

Of course you could just generate a new bounding rectangle, but this is easier.

void setSizeAsGridPerPlace ( SmartWin::Place bound,
int  rows,
int  cols 
)

this Widget in the next cell.

Bound determines the bounding rectangle, and borders.
rows and cols determine the size and position of each cell.
The internal position of bound is updated.
The Widgets are sized and placed according to the current cell, from left to right until a row is full, and then continues with the next row.

void setSizeAsRow ( const Rectangle rect,
int  cols,
int  colnum,
int  border = 0,
bool  updateWindow = true 
)

Given a bounding rectangle with cols, put this Widget in the colnum position.

The rect defines a row made up of a number of columns. The colnum specifies a zero based index of the column to place the Widget.
[ col0 ] [ col1 ] ... [ colnum ] [ ] [ ]

void setSizePerTextPerPlace ( SmartWin::Place bound,
const SmartUtil::tstring &  text,
int  extraX = 0,
int  extraY = 0 
)

Place after sizing for the Widget's text, and adjust to the next position.

This function places the Widget into the bounding rectangle specified by bound.
The idea is that the size of certain Widgets should really be large enough to show their text. Buttons and text areas are examples.
The size of the Widget is calculated from the size of getText().
It is optionally adjusted by the extraX and extraY.
The Widgets are sized and placed from left to right until a row is full, and then continues with the next row.
The internal position of bound is updated.

Back to SmartWin website
SourceForge.net Logo