CWinRect Class ReferenceEncapsulates a rectangle object.
More...
#include <WinRect.h>
List of all members.
|
Public Member Functions |
|
| CWinRect () |
| | Constructor.
|
|
virtual | ~CWinRect () |
| | Destructor.
|
|
| operator LPRECT () |
| | Returns a pointer to the encapsulated rectangle.
|
|
| operator RECT & () |
| | Returns a reference to the encapsulated rectangle.
|
|
LONG | Width () |
| | Returns the width of the rectangle.
|
|
LONG | Height () |
| | Returns the height of the rectangle.
|
Static Public Member Functions |
| static DWORD | CombineOverlapping (LPRECT pRectList, DWORD dwRectListSize, LONG xThreshold, LONG yThreshold, DWORD max=MAXDWORD, LPDWORD pdwFree=NULL) |
| | Combines an overlapping rectangle list.
|
| static BOOL | IsAdjacentRect (LPRECT pRect1, LPRECT pRect2, LONG xThreshold=0, LONG yThreshold=0) |
| | Returns non-zero if the rectangles are 'close' as defined by the threshold.
|
| static BOOL | AddRectToList (LPRECT pRect, LPRECT pRectList, DWORD dwRectListSize, LONG xThreshold=0, LONG yThreshold=0) |
| | Adds a rectangle to a list.
|
|
static LONG | Width (LPRECT pRect) |
| | Returns the width of the rectangle.
|
|
static LONG | Height (LPRECT pRect) |
| | Returns the height of the rectangle.
|
| static BOOL | CalculateIdealLayout (SPanelLayout *pSl, LPRECT pRect, long lNumPanels) |
| | Calculates the ideal rectangle to contain a number of rectangles.
|
| static BOOL | CalculateLayout (SPanelLayout *pSl, LPRECT pRect, long lNumPanels, double dPanelAspectRatio=(double) 3/(double) 4) |
| | Divides the specified rect into ideal panels for the specified aspect ratio.
|
| static BOOL | GetPanelPosition (SPanelLayout *pSl, long lPanel, LPRECT pRect) |
| | Gets the position of a particular panel within a layout.
|
| static long | HitTest (SPanelLayout *pSl, LPPOINT pPt) |
| | Returns the panel in which a specified point lies.
|
Classes |
| struct | SPanelLayout |
| | Contains information on a panel layout. More...
|
Detailed Description
Encapsulates a rectangle object.
Simple wrapper. I should really add a lot more to this class.
Member Function Documentation
| BOOL CWinRect::AddRectToList |
( |
LPRECT |
pRect, |
|
|
LPRECT |
pRectList, |
|
|
DWORD |
dwRectListSize, |
|
|
LONG |
xThreshold = 0, |
|
|
LONG |
yThreshold = 0 |
|
) |
[static] |
|
|
|
Adds a rectangle to a list.
- Parameters:
-
| [in] | pRect | - Rectangle to add |
| [in] | pRectList | - List of rectangles |
| [in] | dwRectListSize | - Number of rectangles in pRectList |
| [in] | xThreshold | - Horizontal threshold |
| [in] | yThreshold | - Vertical threshold |
This function adds a rectangle to the list by scanning for a free slot marked by all the rectangle values being set to zero. It also checks each rectangle in the list for one that is 'close' as defined by the threshold values. If a 'close' rectangle is found, then this rectangle is added to the 'close' rectangle by creating a unioned rectangle. That is, the smallest rectangle that completely encompases both the new rectangle and the 'close' rectangle.
- Returns:
- Non-zero if rectangle was added
- See also:
|
| BOOL CWinRect::CalculateIdealLayout |
( |
SPanelLayout * |
pSl, |
|
|
LPRECT |
pRect, |
|
|
long |
lNumPanels |
|
) |
[static] |
|
|
|
Calculates the ideal rectangle to contain a number of rectangles.
- Parameters:
-
| [in] | pSl | - SPanelLayout structure that receives information about the layout. |
| [in] | pRect | - Actual size of a single panel. |
| [in] | lNumPanels | - Number of panels desired. |
This function returns an minimal bounding box containing the specified number of panels at the specified size. pSl contains information about the layout such as the number of rows and columns.
- Returns:
- Non-zero if successful
- See also:
|
| BOOL CWinRect::CalculateLayout |
( |
SPanelLayout * |
pSl, |
|
|
LPRECT |
pRect, |
|
|
long |
lNumPanels, |
|
|
double |
dPanelAspectRatio = (double) 3/(double) 4 |
|
) |
[static] |
|
|
|
Divides the specified rect into ideal panels for the specified aspect ratio.
- Parameters:
-
| [in] | pSl | - SPanelLayout structure that receives information about the layout. |
| [in] | pRect | - Size of the bounding rectangle |
| [in] | lNumPanels | - Number of panels desired. |
| [in] | dPanelAspectRatio | - Aspect ratio of individual panels. height / width |
This will divide the specified rectangle into optimal number of rows and columns to best achieve the specified aspect ratio and number of panels.
- Returns:
- Non-zero if success
- See also:
|
| DWORD CWinRect::CombineOverlapping |
( |
LPRECT |
pRectList, |
|
|
DWORD |
dwRectListSize, |
|
|
LONG |
xThreshold, |
|
|
LONG |
yThreshold, |
|
|
DWORD |
max = MAXDWORD, |
|
|
LPDWORD |
pdwFree = NULL |
|
) |
[static] |
|
|
|
Combines an overlapping rectangle list.
- Parameters:
-
| [in] | pRectList | - Array of RECT structures |
| [in] | dwRectListSize | - Rectangles in pRectList |
| [in] | xThreshold | - Horizontal overlap threshold |
| [in] | yThreshold | - Vertical overlap threshold |
| [in] | max | - Maximum number to combine |
| [in] | pdwFree | - Next free rectangle |
This function does not defrag the rectangle list. Free rectangles are marked by setting all their values to zero.
- Returns:
- Number of rectangles consolidated
- See also:
|
| BOOL CWinRect::GetPanelPosition |
( |
SPanelLayout * |
pSl, |
|
|
long |
lPanel, |
|
|
LPRECT |
pRect |
|
) |
[static] |
|
|
|
Gets the position of a particular panel within a layout.
- Parameters:
-
| [in] | pSl | - SPanelLayout structure describing the layout. |
| [in] | lPanel | - Zero based panel index |
| [in] | pRect | - Recieves the panel position. |
- Returns:
- Non-zero if success
- See also:
|
| long CWinRect::HitTest |
( |
SPanelLayout * |
pSl, |
|
|
LPPOINT |
pPt |
|
) |
[static] |
|
|
|
Returns the panel in which a specified point lies.
- Parameters:
-
| [in] | pSl | - SPanelLayout structure describing the layout. |
| [in] | pPt | - Point to test. |
Checks the point against the specified layout to determine where the point lies.
- Returns:
- Zero based panel index.
- See also:
|
| BOOL CWinRect::IsAdjacentRect |
( |
LPRECT |
pRect1, |
|
|
LPRECT |
pRect2, |
|
|
LONG |
xThreshold = 0, |
|
|
LONG |
yThreshold = 0 |
|
) |
[static] |
|
|
|
Returns non-zero if the rectangles are 'close' as defined by the threshold.
- Parameters:
-
| [in] | pRect1 | - First rectangle |
| [in] | pRect2 | - Second rectangle |
| [in] | xThreshold | - Horizontal threshold |
| [in] | yThreshold | - Vertical threshold |
- Returns:
- Non-zero if rectangles are 'close' as defined by threshold
- See also:
|
The documentation for this class was generated from the following files:
|