winutil.h File Reference

winutil.h File Reference
+ This reference page is linked to from the following overview topics:

#include "maxheap.h"
#include <limits>
#include <float.h>
#include <locale.h>
#include "coreexp.h"
#include <wtypes.h>
#include <CommCtrl.h>
#include "strclass.h"
#include "ipoint2.h"
#include "box2.h"
#include "containers/Array.h"
#include "plugapi.h"

Macros

#define MAKEPOINT(lparam, pt)   { pt.x = (short)LOWORD(lparam); pt.y = (short)HIWORD(lparam); }
 
#define CUSTLIST_DISABLED   (1<<0)
 
#define CUSTLIST_MED_DISABLED   (1<<1)
 
#define CUSTLIST_SEPARATOR   (1<<2)
 
#define CUSTLIST_DBL_SERPARATOR   (1<<3)
 
#define CUSTLIST_RED   (1<<4)
 
#define MAX_MB_HOLD   0x0001
 
#define MAX_MB_DONTSHOWAGAIN   0x0002
 

Functions

CoreExport float GetWindowFloat (HWND hwnd, BOOL *valid=NULL)
 
CoreExport int GetWindowInt (HWND hwnd, BOOL *valid=NULL)
 
CoreExport BOOL SetWindowTextInt (HWND hwnd, int i)
 
CoreExport BOOL SetWindowTextFloat (HWND hwnd, float f, int precision=3)
 
CoreExport BOOL SetDlgItemFloat (HWND hwnd, int idControl, float val)
 
CoreExport float GetDlgItemFloat (HWND hwnd, int idControl, BOOL *valid=NULL)
 
CoreExport void SetDlgFont (HWND hDlg, HFONT hFont)
 
CoreExport void SlideWindow (HWND hwnd, int x, int y)
 
CoreExport void StretchWindow (HWND hwnd, int w, int h)
 
CoreExport BOOL CenterWindow (HWND hWndChild, HWND hWndParent)
 
CoreExport void GetClientRectP (HWND hwnd, Rect *rect)
 
CoreExport void DrawIconButton (HDC hdc, HBITMAP hBitmap, Rect &wrect, Rect &brect, BOOL in)
 
CoreExport int GetListHieght (HWND hList)
 
CoreExport void ShadedVertLine (HDC hdc, int x, int y0, int y1, BOOL in)
 
CoreExport void ShadedHorizLine (HDC hdc, int y, int x0, int x1, BOOL in)
 
CoreExport void ShadedRect (HDC hdc, RECT &rect)
 
CoreExport void Rect3D (HDC hdc, RECT &rect, BOOL in)
 
CoreExport void WhiteRect3D (HDC hdc, RECT rect, BOOL in)
 
CoreExport void DrawButton (HDC hdc, RECT rect, BOOL in)
 
CoreExport void SetPathWithEllipses (HWND hwnd, const MCHAR *path, HFONT hFont)
 Sets a pathname in an edit control, truncating with an ellipses if the pathname is too long. More...
 
UtilExport void DisplayStringWithEllipses (const MCHAR *displayString, HWND hWnd, int additionalSpace=0)
 Displays a string in an HWND (typically an edit control), trimming beginning characters with an ellipses if the string is too long. More...
 
UtilExport void DisplayStringWithEllipses (const MCHAR *displayString, HWND hWnd, HFONT hFont, int additionalSpace=0)
 Displays a string in an HWND (typically an edit control), trimming beginning characters with an ellipses if the string is too long. More...
 
CoreExport int UpdateComboBoxDropDownWidth (HWND hComboBox, bool vScroll=true)
 Updates the width of a combo-box drop-down window to make all its items fit. More...
 
CoreExport void XORDottedRect (HWND hwnd, IPoint2 p0, IPoint2 p1, int solidToRight=0, bool bErase=false, bool bDelayUpdate=false)
 XOR drawing method of rectangle. More...
 
CoreExport void XORDottedCircle (HWND hwnd, IPoint2 p0, IPoint2 p1, int solidToRight=0, bool bErase=false, bool bDelayUpdate=false)
 XOR drawing method of circle. More...
 
CoreExport void XORDottedPolyline (HWND hwnd, int count, IPoint2 *pts, int solid=0, bool bErase=false, bool bDelayUpdate=false)
 XOR drawing method of polylines. More...
 
CoreExport void XORRect (HDC hdc, RECT &r, int border=1)
 
CoreExport BOOL IsVistaAeroEnabled ()
 Vista Aero related method. More...
 
CoreExport BOOL IsThemeSupported ()
 If theme is supported on current OS. More...
 

Macro Definition Documentation

#define MAKEPOINT (   lparam,
  pt 
)    { pt.x = (short)LOWORD(lparam); pt.y = (short)HIWORD(lparam); }
#define CUSTLIST_DISABLED   (1<<0)
#define CUSTLIST_MED_DISABLED   (1<<1)
#define CUSTLIST_SEPARATOR   (1<<2)
#define CUSTLIST_DBL_SERPARATOR   (1<<3)
#define CUSTLIST_RED   (1<<4)
#define MAX_MB_HOLD   0x0001
#define MAX_MB_DONTSHOWAGAIN   0x0002

Function Documentation

CoreExport float GetWindowFloat ( HWND  hwnd,
BOOL *  valid = NULL 
)
CoreExport int GetWindowInt ( HWND  hwnd,
BOOL *  valid = NULL 
)
CoreExport BOOL SetWindowTextInt ( HWND  hwnd,
int  i 
)
CoreExport BOOL SetWindowTextFloat ( HWND  hwnd,
float  f,
int  precision = 3 
)
CoreExport BOOL SetDlgItemFloat ( HWND  hwnd,
int  idControl,
float  val 
)
CoreExport float GetDlgItemFloat ( HWND  hwnd,
int  idControl,
BOOL *  valid = NULL 
)
CoreExport void SetDlgFont ( HWND  hDlg,
HFONT  hFont 
)
CoreExport void SlideWindow ( HWND  hwnd,
int  x,
int  y 
)
CoreExport void StretchWindow ( HWND  hwnd,
int  w,
int  h 
)
CoreExport BOOL CenterWindow ( HWND  hWndChild,
HWND  hWndParent 
)
CoreExport void GetClientRectP ( HWND  hwnd,
Rect rect 
)
CoreExport void DrawIconButton ( HDC  hdc,
HBITMAP  hBitmap,
Rect wrect,
Rect brect,
BOOL  in 
)
CoreExport int GetListHieght ( HWND  hList)
CoreExport void ShadedVertLine ( HDC  hdc,
int  x,
int  y0,
int  y1,
BOOL  in 
)
CoreExport void ShadedHorizLine ( HDC  hdc,
int  y,
int  x0,
int  x1,
BOOL  in 
)
CoreExport void ShadedRect ( HDC  hdc,
RECT &  rect 
)
CoreExport void Rect3D ( HDC  hdc,
RECT &  rect,
BOOL  in 
)
CoreExport void WhiteRect3D ( HDC  hdc,
RECT  rect,
BOOL  in 
)
CoreExport void DrawButton ( HDC  hdc,
RECT  rect,
BOOL  in 
)
CoreExport void SetPathWithEllipses ( HWND  hwnd,
const MCHAR path,
HFONT  hFont 
)

Sets a pathname in an edit control, truncating with an ellipses if the pathname is too long.

UtilExport void DisplayStringWithEllipses ( const MCHAR displayString,
HWND  hWnd,
int  additionalSpace = 0 
)

Displays a string in an HWND (typically an edit control), trimming beginning characters with an ellipses if the string is too long.

Parameters
displayStringThe string to be displayed.
hWndThe hWnd to display the string in - uses existing font
additionalSpaceReserved space in pixels that reduces string display area in hWnd
UtilExport void DisplayStringWithEllipses ( const MCHAR displayString,
HWND  hWnd,
HFONT  hFont,
int  additionalSpace = 0 
)

Displays a string in an HWND (typically an edit control), trimming beginning characters with an ellipses if the string is too long.

Parameters
displayStringThe string to be displayed.
hWndThe window to display the string in
hFontThe font to use in the window
additionalSpaceReserved space in pixels that reduces string display area in hWnd
CoreExport int UpdateComboBoxDropDownWidth ( HWND  hComboBox,
bool  vScroll = true 
)

Updates the width of a combo-box drop-down window to make all its items fit.

Call this function if some strings in your combo-box are longer than the actual combo-box control's width. This function will update the width of the combo-box to make the widest combo-box item fit.

Parameters
hComboBoxThe handle of the combobox to update
vScrolltrue if the width of a vertical scroll bar should be taken into account
Returns
-1 if the combo-box could not be updated successfully, the new width of the combo-box drop down otherwise.
CoreExport void XORDottedRect ( HWND  hwnd,
IPoint2  p0,
IPoint2  p1,
int  solidToRight = 0,
bool  bErase = false,
bool  bDelayUpdate = false 
)

XOR drawing method of rectangle.

This method will draw a dotted or solid rectangle onto the specified window. This method can provide better compatibility with Vista Aero than using GDI function directly.

Parameters
[in]hwndWindow handle of the window on which the drawing will occur.
[in]p0One corner of the rectangle.
[in]p1p0's diagonal in the rectangle.
[in]solidToRightIf zero, the rectangle will be dotted. If less than zero, and p0.x >= p1.x, the line will be solid, otherwize dotted. If greater than zero, and p0.x <= p1.x, the line will be solid, otherwize dotted.
[in]bEraseWhether to erase the foreground and use the background to fill the affected pixels, this is only valid for the window handle associated with graphic window.
[in]bDelayUpdateif true, the result image will be stored on the back buffer and won't be presented to screen immediately. If next drawing function is invoked with bDelayUpdate being false, then the image will be presented combined with the result of previous drawing function. If the drawing result is not necessary to be seen immediately, passing true to this parameter will reduce the times of back buffer presenting, thus optimize the performance. This is only valid for window handle associated with graphic window.
CoreExport void XORDottedCircle ( HWND  hwnd,
IPoint2  p0,
IPoint2  p1,
int  solidToRight = 0,
bool  bErase = false,
bool  bDelayUpdate = false 
)

XOR drawing method of circle.

This method will draw a dotted or solid circle onto the specified window. This method can provide better compatibility with Vista Aero than using GDI function directly.

Parameters
[in]hwndWindow handle of the window on which the drawing will occur.
[in]p0One corner of the circle's bounding rectangle.
[in]p1p0's diagonal in the rectangle.
[in]solidToRightIf zero, the circle will be dotted. If less than zero, and p0.x >= p1.x, the line will be solid, otherwize dotted. If greater than zero, and p0.x <= p1.x, the line will be solid, otherwize dotted.
[in]bEraseWhether to erase the foreground and use the background to fill the affected pixels, this is only valid for the window handle associated with graphic window.
[in]bDelayUpdateif true,the result image will be stored on the back buffer and won't be presented to screen immediately. If next drawing function is invoked with bDelayUpdate being false, then the image will be presented combined with the result of previous drawing function. If the drawing result is not necessary to be seen immediately, passing true to this parameter will reduce the times of back buffer presenting, thus optimize the performance. This is only valid for window handle associated with graphic window.
CoreExport void XORDottedPolyline ( HWND  hwnd,
int  count,
IPoint2 pts,
int  solid = 0,
bool  bErase = false,
bool  bDelayUpdate = false 
)

XOR drawing method of polylines.

This method will draw dotted or solid polylines onto the specified window. This method can provide better compatibility with Vista Aero than using GDI function directly.

Parameters
[in]hwndWindow handle of the window on which the drawing will occur.
[in]countThe count of corners of the polylines.
[in]ptsPointer to the corners.
[in]solidIf nonzero, the polylines will be solid, otherwize dotted.
[in]bEraseWhether to erase the foreground and use the background to fill the affected pixels, this is only valid for the window handle associated with graphic window.
[in]bDelayUpdateif true, the result image will be stored on the back buffer and won't be presented to screen immediately. If next drawing function is invoked with bDelayUpdate being false, then the image will be presented combined with the result of previous drawing function. If the drawing result is not necessary to be seen immediately, passing true to this parameter will reduce the times of back buffer presenting, thus optimize the performance. This is only valid for window handle associated with graphic window.
CoreExport void XORRect ( HDC  hdc,
RECT &  r,
int  border = 1 
)
CoreExport BOOL IsVistaAeroEnabled ( )

Vista Aero related method.

This method will tell whether the Vista Aero is turned on or not.

Returns
TRUE if Vista Aero is turned on, otherwize FALSE. On Window XP or previous Windows, it will always return FALSE.
CoreExport BOOL IsThemeSupported ( )

If theme is supported on current OS.

Specifically, any Windows versions above Windows XP (Windows 5.1)should be able to support OS theme.

Returns
TRUE if the OS supports theme(Windows XP or later), otherwise FALSE.