home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / gizmobar.h < prev    next >
C/C++ Source or Header  |  1998-04-24  |  7KB  |  243 lines

  1. /*
  2.  * GIZMOBAR.H
  3.  * GizmoBar Version 1.01
  4.  *
  5.  * Public definitions for application that use the GizmoBar such as
  6.  * messages, prototypes for API functions, notification codes, and
  7.  * control styles.
  8.  *
  9.  * Copyright (c)1993-1996 Microsoft Corporation, All Rights Reserved
  10.  *
  11.  * Kraig Brockschmidt, Software Design Engineer
  12.  * Microsoft Systems Developer Relations
  13.  *
  14.  * Internet  :  kraigb@microsoft.com
  15.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  16.  */
  17.  
  18.  
  19. #ifndef _GIZMOBAR_H_
  20. #define _GIZMOBAR_H_
  21.  
  22. #include <bttncur.h>
  23.  
  24. #ifdef __cplusplus
  25. extern "C"
  26.     {
  27. #endif
  28.  
  29.  
  30. //Classname
  31. #define CLASS_GIZMOBAR  TEXT("gizmobar")
  32.  
  33.  
  34. //Message API Functions
  35. HWND    WINAPI GBHwndAssociateSet(HWND, HWND);
  36. HWND    WINAPI GBHwndAssociateGet(HWND);
  37.  
  38. BOOL    WINAPI GBGizmoAddW(HWND, UINT, UINT, UINT, UINT, UINT, LPWSTR , HBITMAP, UINT, UINT);
  39. BOOL    WINAPI GBGizmoAddA(HWND, UINT, UINT, UINT, UINT, UINT, LPSTR , HBITMAP, UINT, UINT);
  40.  
  41. int     WINAPI GBGizmoTextGetW(HWND, UINT, LPWSTR, UINT);
  42. int     WINAPI GBGizmoTextGetA(HWND, UINT, LPSTR, UINT);
  43.  
  44. void    WINAPI GBGizmoTextSetW(HWND, UINT, LPWSTR);
  45. void    WINAPI GBGizmoTextSetA(HWND, UINT, LPSTR);
  46.  
  47. #ifdef UNICODE
  48. #define GBGizmoAdd      GBGizmoAddW
  49. #define GBGizmoTextGet  GBGizmoTextGetW
  50. #define GBGizmoTextSet  GBGizmoTextSetW
  51. #else
  52. #define GBGizmoAdd      GBGizmoAddA
  53. #define GBGizmoTextGet  GBGizmoTextGetA
  54. #define GBGizmoTextSet  GBGizmoTextSetA
  55. #endif
  56.  
  57. BOOL    WINAPI GBGizmoRemove(HWND, UINT);
  58.  
  59. LRESULT WINAPI GBGizmoSendMessage(HWND, UINT, UINT, WPARAM, LPARAM);
  60.  
  61. BOOL    WINAPI GBGizmoShow(HWND, UINT, BOOL);
  62. BOOL    WINAPI GBGizmoEnable(HWND, UINT, BOOL);
  63. BOOL    WINAPI GBGizmoCheck(HWND, UINT, BOOL);
  64. UINT    WINAPI GBGizmoFocusSet(HWND, UINT);
  65. BOOL    WINAPI GBGizmoExist(HWND, UINT);
  66.  
  67. int     WINAPI GBGizmoTypeGet(HWND, UINT);
  68.  
  69. DWORD   WINAPI GBGizmoDataSet(HWND, UINT, DWORD);
  70. DWORD   WINAPI GBGizmoDataGet(HWND, UINT);
  71. BOOL    WINAPI GBGizmoNotifySet(HWND, UINT, BOOL);
  72. BOOL    WINAPI GBGizmoNotifyGet(HWND, UINT);
  73.  
  74. UINT    WINAPI GBGizmoIntGet(HWND, UINT, BOOL FAR *, BOOL);
  75. void    WINAPI GBGizmoIntSet(HWND, UINT, UINT, BOOL);
  76.  
  77.  
  78.  
  79. //Notification codes sent via WM_COMMAND from GBHwndAssociateSet
  80. #define GBN_ASSOCIATEGAIN               1
  81. #define GBN_ASSOCIATELOSS               2
  82. #define GBN_GIZMOADDED                  3
  83. #define GBN_GIZMOREMOVED                4
  84.  
  85. //Message equivalents for functions.
  86. #define GBM_HWNDASSOCIATESET            (WM_USER+0)
  87. #define GBM_HWNDASSOCIATEGET            (WM_USER+1)
  88. #define GBM_GIZMOADDW                   (WM_USER+2)
  89. #define GBM_GIZMOADDA                   (WM_USER+3)
  90. #define GBM_GIZMOREMOVE                 (WM_USER+4)
  91. #define GBM_GIZMOSENDMESSAGE            (WM_USER+5)
  92. #define GBM_GIZMOSHOW                   (WM_USER+6)
  93. #define GBM_GIZMOENABLE                 (WM_USER+7)
  94. #define GBM_GIZMOCHECK                  (WM_USER+8)
  95. #define GBM_GIZMOFOCUSSET               (WM_USER+9)
  96. #define GBM_GIZMOEXIST                  (WM_USER+10)
  97. #define GBM_GIZMOTYPEGET                (WM_USER+11)
  98. #define GBM_GIZMODATASET                (WM_USER+12)
  99. #define GBM_GIZMODATAGET                (WM_USER+13)
  100. #define GBM_GIZMONOTIFYSET              (WM_USER+14)
  101. #define GBM_GIZMONOTIFYGET              (WM_USER+15)
  102. #define GBM_GIZMOTEXTGETA               (WM_USER+16)
  103. #define GBM_GIZMOTEXTGETW               (WM_USER+17)
  104. #define GBM_GIZMOTEXTSETA               (WM_USER+18)
  105. #define GBM_GIZMOTEXTSETW               (WM_USER+19)
  106. #define GBM_GIZMOINTGET                 (WM_USER+20)
  107. #define GBM_GIZMOINTSET                 (WM_USER+21)
  108.  
  109. #ifdef UNICODE
  110. #define GBM_GIZMOTEXTGET GBM_GIZMOTEXTGETW
  111. #define GBM_GIZMOTEXTSET GBM_GIZMOTEXTSETW
  112. #define GBM_GIZMOADD GBM_GIZMOADDW
  113. #else
  114. #define GBM_GIZMOTEXTGET GBM_GIZMOTEXTGETA
  115. #define GBM_GIZMOTEXTSET GBM_GIZMOTEXTSETA
  116. #define GBM_GIZMOADD GBM_GIZMOADDA
  117. #endif
  118.  
  119.  
  120.  
  121. /*
  122.  * Structure passed in lParam of GBM_GIZMOADD that mirrors the
  123.  * parameters to GBGizmoAdd.
  124.  */
  125.  
  126. typedef struct
  127.     {
  128.     HWND        hWndParent;         //Parent window
  129.     UINT        iType;              //Type of gizmo
  130.     UINT        iGizmo;             //Position to create gizmo
  131.     UINT        uID;                //Identifier of gizmo
  132.     UINT        dx;                 //Dimensions of gizmo
  133.     UINT        dy;
  134.     LPSTR       pszText;            //Gizmo text
  135.     HBITMAP     hBmp;               //Source of gizmo button image.
  136.     UINT        iImage;             //Index of image from hBmp
  137.     UINT        uState;             //Initial state of the gizmo.
  138.     } CREATEGIZMOA, FAR *LPCREATEGIZMOA;
  139. typedef struct
  140.     {
  141.     HWND        hWndParent;         //Parent window
  142.     UINT        iType;              //Type of gizmo
  143.     UINT        iGizmo;             //Position to create gizmo
  144.     UINT        uID;                //Identifier of gizmo
  145.     UINT        dx;                 //Dimensions of gizmo
  146.     UINT        dy;
  147.     LPWSTR      pszText;            //Gizmo text
  148.     HBITMAP     hBmp;               //Source of gizmo button image.
  149.     UINT        iImage;             //Index of image from hBmp
  150.     UINT        uState;             //Initial state of the gizmo.
  151.     } CREATEGIZMOW, FAR *LPCREATEGIZMOW;
  152.  
  153. #ifdef UNICODE
  154. typedef CREATEGIZMOW    CREATEGIZMO;
  155. typedef LPCREATEGIZMOW  LPCREATEGIZMO;
  156. #define CBCREATEGIZMO sizeof(CREATEGIZMOW)
  157. #else
  158. typedef CREATEGIZMOA    CREATEGIZMO;
  159. typedef LPCREATEGIZMOA  LPCREATEGIZMO;
  160. #define CBCREATEGIZMO sizeof(CREATEGIZMOA)
  161. #endif
  162.  
  163.  
  164. //For GBM_GIZMOSENDMESSAGE
  165. typedef struct
  166.     {
  167.     UINT        iMsg;
  168.     WPARAM      wParam;
  169.     LPARAM      lParam;
  170.     } GBMSG, FAR * LPGBMSG;
  171.  
  172. #define CBGBMSG sizeof(GBMSG);
  173.  
  174. //For GBM_GIZMOGETTEXT
  175. typedef struct
  176.     {
  177.     LPSTR       psz;
  178.     UINT        cch;
  179.     } GBGETTEXTA, FAR * LPGBGETTEXTA;
  180. typedef struct
  181.     {
  182.     LPWSTR      psz;
  183.     UINT        cch;
  184.     } GBGETTEXTW, FAR * LPGBGETTEXTW;
  185.  
  186. #ifdef UNICODE
  187. typedef GBGETTEXTW  GBGETTEXT;
  188. typedef LPGBGETTEXTW  LPGBGETTEXT;
  189. #define CBGBGETTEXT sizeof(GBGETTEXTW);
  190. #else
  191. typedef GBGETTEXTA  GBGETTEXT;
  192. typedef LPGBGETTEXTA  LPGBGETTEXT;
  193. #define CBGBGETTEXT sizeof(GBGETTEXTA);
  194. #endif
  195.  
  196.  
  197. //For GBM_GIZMOGETINT
  198. typedef struct
  199.     {
  200.     BOOL        fSigned;
  201.     BOOL        fSuccess;
  202.     } GBGETINT, FAR * LPGBGETINT;
  203.  
  204. #define CBGBGETINT sizeof(GBGETINT);
  205.  
  206.  
  207. //For GBM_GIZMOSETINT
  208. typedef struct
  209.     {
  210.     UINT        uValue;
  211.     BOOL        fSigned;
  212.     } GBSETINT, FAR * LPGBSETINT;
  213.  
  214. #define CBGBSETINT sizeof(GBSETINT);
  215.  
  216.  
  217.  
  218. //Gizmo control types.  DO NOT CHANGE THESE!
  219. #define GIZMOTYPE_EDIT                  0x0001
  220. #define GIZMOTYPE_LISTBOX               0x0002
  221. #define GIZMOTYPE_COMBOBOX              0x0004
  222. #define GIZMOTYPE_BUTTONNORMAL          0x0008
  223. #define GIZMOTYPE_TEXT                  0x0010
  224. #define GIZMOTYPE_SEPARATOR             0x0020
  225. #define GIZMOTYPE_BUTTONATTRIBUTEIN     0x0040
  226. #define GIZMOTYPE_BUTTONATTRIBUTEEX     0x0080
  227. #define GIZMOTYPE_BUTTONCOMMAND         0x0100
  228.  
  229.  
  230. //Generic state flags for non-buttons based on BTTNCUR.H's groups.
  231. #define GIZMO_NORMAL                    (BUTTONGROUP_ACTIVE)
  232. #define GIZMO_DISABLED                  (BUTTONGROUP_DISABLED)
  233.  
  234.  
  235.  
  236. #ifdef __cplusplus
  237.     }   //Match with extern "C" above.
  238. #endif
  239.  
  240.  
  241.  
  242. #endif //_GIZMOBAR_H_
  243.