Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

846 lines
19 KiB

  1. /*
  2. * API.C
  3. * GizmoBar Version 1.00, Win32 version August 1993
  4. *
  5. * API functions affecting a GizmoBar and a message processing function to
  6. * handle the equivalent called through messages.
  7. *
  8. * Copyright (c)1993 Microsoft Corporation, All Rights Reserved
  9. *
  10. * Kraig Brockschmidt, Software Design Engineer
  11. * Microsoft Systems Developer Relations
  12. *
  13. * Internet : kraigb@microsoft.com
  14. * Compuserve: >INTERNET:kraigb@microsoft.com
  15. */
  16. #include <windows.h>
  17. #include "gizmoint.h"
  18. /*
  19. * GBMessageHandler
  20. *
  21. * Purpose:
  22. * Processes control messages that are equivalents of available
  23. * control API. The data passed with these messages is simply
  24. * extracted from structures and passed as parameters to their
  25. * equivalent function.
  26. *
  27. * Parameters:
  28. * <Standard Message Parameters> plus
  29. * pGB LPGIZMOBAR providing control-specific data.
  30. *
  31. * Return Value:
  32. * LRESULT Return value from equivalent API function.
  33. */
  34. LRESULT GBMessageHandler(HWND hWnd, UINT iMsg, WPARAM wParam
  35. , LPARAM lParam, LPGIZMOBAR pGB)
  36. {
  37. LRESULT lRet=0L;
  38. LPCREATEGIZMO pCG;
  39. LPGBMSG pMsg;
  40. LPGBGETTEXT pGT;
  41. LPGBGETINT pGI;
  42. LPGBSETINT pSI;
  43. if (NULL==pGB)
  44. return 0L;
  45. switch (iMsg)
  46. {
  47. case GBM_HWNDASSOCIATESET:
  48. lRet=(LRESULT)(UINT)GBHwndAssociateSet(hWnd, (HWND)wParam);
  49. break;
  50. case GBM_HWNDASSOCIATEGET:
  51. lRet=(LRESULT)(UINT)GBHwndAssociateGet(hWnd);
  52. break;
  53. case GBM_GIZMOADD:
  54. pCG=(LPCREATEGIZMO)lParam;
  55. lRet=(LRESULT)GBGizmoAdd(pCG->hWndParent, pCG->iType, pCG->iGizmo
  56. , pCG->uID, pCG->dx, pCG->dy, pCG->pszText, pCG->hBmp
  57. , pCG->iImage, pCG->uState);
  58. break;
  59. case GBM_GIZMOREMOVE:
  60. lRet=(LRESULT)GBGizmoRemove(hWnd, wParam);
  61. break;
  62. case GBM_GIZMOSENDMESSAGE:
  63. pMsg=(LPGBMSG)lParam;
  64. lRet=GBGizmoSendMessage(hWnd, wParam, pMsg->iMsg, pMsg->wParam, pMsg->lParam);
  65. break;
  66. case GBM_GIZMOSHOW:
  67. lRet=(LRESULT)GBGizmoShow(hWnd, wParam, (BOOL)LOWORD(lParam));
  68. break;
  69. case GBM_GIZMOENABLE:
  70. lRet=(LRESULT)GBGizmoEnable(hWnd, wParam, (BOOL)LOWORD(lParam));
  71. break;
  72. case GBM_GIZMOCHECK:
  73. lRet=(LRESULT)GBGizmoCheck(hWnd, wParam, (BOOL)LOWORD(lParam));
  74. break;
  75. case GBM_GIZMOFOCUSSET:
  76. lRet=(LRESULT)GBGizmoFocusSet(hWnd, wParam);
  77. break;
  78. case GBM_GIZMOEXIST:
  79. lRet=(LRESULT)GBGizmoExist(hWnd, wParam);
  80. break;
  81. case GBM_GIZMOTYPEGET:
  82. lRet=(LRESULT)GBGizmoTypeGet(hWnd, wParam);
  83. break;
  84. case GBM_GIZMODATASET:
  85. lRet=(LRESULT)GBGizmoDataSet(hWnd, wParam, (DWORD)lParam);
  86. break;
  87. case GBM_GIZMODATAGET:
  88. lRet=(LRESULT)GBGizmoDataGet(hWnd, wParam);
  89. break;
  90. case GBM_GIZMONOTIFYSET:
  91. lRet=(LRESULT)GBGizmoNotifySet(hWnd, wParam, (BOOL)LOWORD(lParam));
  92. break;
  93. case GBM_GIZMONOTIFYGET:
  94. lRet=(LRESULT)GBGizmoNotifyGet(hWnd, wParam);
  95. break;
  96. case GBM_GIZMOTEXTGET:
  97. pGT=(LPGBGETTEXT)lParam;
  98. lRet=(LRESULT)GBGizmoTextGet(hWnd, wParam, pGT->psz, pGT->cch);
  99. break;
  100. case GBM_GIZMOTEXTSET:
  101. GBGizmoTextSet(hWnd, wParam, (LPTSTR)lParam);
  102. break;
  103. case GBM_GIZMOINTGET:
  104. pGI=(LPGBGETINT)lParam;
  105. lRet=(LRESULT)GBGizmoIntGet(hWnd, wParam, &pGI->fSuccess, pGI->fSigned);
  106. break;
  107. case GBM_GIZMOINTSET:
  108. pSI=(LPGBSETINT)lParam;
  109. GBGizmoIntSet(hWnd, wParam, pSI->uValue, pSI->fSigned);
  110. break;
  111. default:
  112. break;
  113. }
  114. return lRet;
  115. }
  116. /*
  117. * PGizmoFromHwndID
  118. *
  119. * Purpose:
  120. * Retrieves the pGizmo for the given GizmoBar and the gizmo ID.
  121. *
  122. * Parameters:
  123. * hWnd HWND of a GizmoBar.
  124. * uID UINT gizmo identifier.
  125. *
  126. * Return Value:
  127. * LPGIZMO NULL if the gizmo does not exist or hWnd is invalid.
  128. * non-NULL LPGIZMO otherwise.
  129. */
  130. LPGIZMO PGizmoFromHwndID(HWND hWnd, UINT uID)
  131. {
  132. LPGIZMOBAR pGB;
  133. if (!IsWindow(hWnd))
  134. return FALSE;
  135. pGB=(LPGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
  136. if (NULL==pGB)
  137. return FALSE;
  138. return GizmoPFind(&pGB->pGizmos, uID);
  139. }
  140. /*
  141. * GBHwndAssociateSet
  142. *
  143. * Purpose:
  144. * Changes the associate window of a GizmoBar.
  145. *
  146. * Parameters:
  147. * hWnd HWND of the control window.
  148. *
  149. * Set Parameters:
  150. * hWndAssociate HWND of new associate.
  151. *
  152. * Return Value:
  153. * HWND Handle of previous associate.
  154. */
  155. HWND WINAPI GBHwndAssociateSet(HWND hWnd, HWND hWndNew)
  156. {
  157. HWND hWndOld=NULL;
  158. LPGIZMOBAR pGB;
  159. pGB=(LPGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
  160. if (NULL!=pGB)
  161. {
  162. hWndOld=pGB->hWndAssociate;
  163. pGB->hWndAssociate=hWndNew;
  164. if (NULL!=hWndOld)
  165. SendCommand(hWndOld, pGB->uID, GBN_ASSOCIATELOSS, hWnd);
  166. if (NULL!=hWndNew)
  167. SendCommand(hWndNew, pGB->uID, GBN_ASSOCIATEGAIN, hWnd);
  168. }
  169. return hWndOld;
  170. }
  171. /*
  172. * GBHwndAssociateGet
  173. *
  174. * Purpose:
  175. * Retrieves the associate window of a GizmoBar
  176. *
  177. * Parameters:
  178. * hWnd HWND of the control window.
  179. *
  180. * Set Parameters:
  181. * hWndAssociate HWND of new associate.
  182. *
  183. * Return Value:
  184. * HWND Handle of current associate.
  185. */
  186. HWND WINAPI GBHwndAssociateGet(HWND hWnd)
  187. {
  188. HWND hWndOld=NULL;
  189. LPGIZMOBAR pGB;
  190. pGB=(LPGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
  191. if (NULL!=pGB)
  192. hWndOld=pGB->hWndAssociate;
  193. return hWndOld;
  194. }
  195. /*
  196. * GBGizmoAdd
  197. *
  198. * Purpose:
  199. * Creates a new gizmo on the GizmoBar. Subsequent operations should
  200. * be done using the identifier, uID, for this gizmo.
  201. *
  202. * Parameters:
  203. * hWnd HWND of the GizmoBar.
  204. * iType UINT type of the gizmo to create.
  205. * iGizmo UINT position (zero-based) at which to place the gizmo.
  206. * uID UINT identifier for WM_COMMAND from this gizmo.
  207. * dx, dy UINT dimensions of the gizmo.
  208. * pszText LPTSTR initial text for edit, list, combo, and text gizmos.
  209. * hBitmap HBITMAP for gizmos of the button types (COMMAND or
  210. * ATTRIBUTE) specifies a source bitmap from which the
  211. * button image is taken.
  212. * iImage UINT index into hBitmap for the image for this button.
  213. * uState UINT initial state of the gizmo.
  214. *
  215. * Return Value:
  216. * BOOL TRUE if creation succeeded, FALSE otherwise.
  217. */
  218. BOOL WINAPI GBGizmoAdd(HWND hWnd, UINT iType, UINT iGizmo, UINT uID
  219. , UINT dx, UINT dy, LPTSTR pszText, HBITMAP hBmp, UINT iImage, UINT uState)
  220. {
  221. BOOL fSuccess;
  222. LPGIZMOBAR pGB;
  223. LPGIZMO pGizmo;
  224. if (!IsWindow(hWnd))
  225. return FALSE;
  226. pGB=(LPGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
  227. if (NULL==pGB)
  228. return FALSE;
  229. /*
  230. * This automatically creates the windows, allocates structures, includes
  231. * the gizmo in pGB->pGizmos, and so forth.
  232. */
  233. pGizmo=GizmoPAllocate((LPINT)&fSuccess, &pGB->pGizmos, hWnd, iType
  234. , iGizmo, uID, dx, dy, pszText, hBmp, iImage, uState);
  235. if (fSuccess)
  236. {
  237. if (NULL!=pGB->hWndAssociate)
  238. SendCommand(pGB->hWndAssociate,GBN_GIZMOADDED, pGB->uID, hWnd);
  239. InvalidateRect(hWnd, NULL, TRUE);
  240. UpdateWindow(hWnd);
  241. }
  242. else
  243. GizmoPFree(&pGB->pGizmos, pGizmo);
  244. return fSuccess;
  245. }
  246. /*
  247. * GBGizmoRemove
  248. *
  249. * Purpose:
  250. * Removes an existing gizmo from the GizmoBar.
  251. *
  252. * Parameters:
  253. * hWnd HWND of the GizmoBar.
  254. * uID UINT identifier for this gizmo.
  255. *
  256. * Return Value:
  257. * BOOL TRUE if deletion succeeded, FALSE otherwise.
  258. */
  259. BOOL WINAPI GBGizmoRemove(HWND hWnd, UINT uID)
  260. {
  261. LPGIZMOBAR pGB;
  262. LPGIZMO pGizmo;
  263. if (!IsWindow(hWnd))
  264. return FALSE;
  265. pGB=(LPGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
  266. if (NULL==pGB)
  267. return FALSE;
  268. pGizmo=GizmoPFind(&pGB->pGizmos, uID);
  269. if (NULL==pGizmo)
  270. return FALSE;
  271. GizmoPFree(&pGB->pGizmos, pGizmo);
  272. if (NULL!=pGB->hWndAssociate)
  273. SendCommand(pGB->hWndAssociate, GBN_GIZMOREMOVED, pGB->uID, hWnd);
  274. InvalidateRect(hWnd, NULL, TRUE);
  275. UpdateWindow(hWnd);
  276. return TRUE;
  277. }
  278. /*
  279. * GBGizmoSendMessage
  280. *
  281. * Purpose:
  282. * Implements the equivalent of SendMessage to a gizmo in the
  283. * GizmoBar. Separators, command buttons, and attribute buttons
  284. * do not accept messages.
  285. *
  286. * Parameters:
  287. * hWnd HWND of the GizmoBar.
  288. * uID UINT identifier of the gizmo to affect.
  289. * iMsg UINT message to send.
  290. * wParam WPARAM of the message.
  291. * lParam LPARAM of the message.
  292. *
  293. * Return Value:
  294. * LRESULT Return value from the message. 0L if the
  295. * gizmo does not accept messages.
  296. */
  297. LRESULT WINAPI GBGizmoSendMessage(HWND hWnd, UINT uID, UINT iMsg
  298. , WPARAM wParam, LPARAM lParam)
  299. {
  300. LPGIZMO pGizmo;
  301. LONG lRet=0L;
  302. pGizmo=PGizmoFromHwndID(hWnd, uID);
  303. if (NULL!=pGizmo && NULL!=pGizmo->hWnd)
  304. lRet=SendMessage(pGizmo->hWnd, iMsg, wParam, lParam);
  305. return lRet;
  306. }
  307. /*
  308. * GBGizmoShow
  309. *
  310. * Purpose:
  311. * Shows or hides a control, adjusting the positions of all others
  312. * to make room for or reuse the space for this control.
  313. *
  314. * Parameters:
  315. * hWnd HWND of the GizmoBar.
  316. * uID UINT identifier of the gizmo to affect.
  317. * fShow BOOL TRUE to show the gizmo, FALSE to hide it.
  318. *
  319. * Return Value:
  320. * BOOL TRUE if the function was successful, FALSE otherwise.
  321. */
  322. BOOL WINAPI GBGizmoShow(HWND hWnd, UINT uID, BOOL fShow)
  323. {
  324. BOOL fRet=FALSE;
  325. LPGIZMO pGizmo;
  326. pGizmo=PGizmoFromHwndID(hWnd, uID);
  327. if (NULL!=pGizmo)
  328. {
  329. if (fShow && pGizmo->fHidden)
  330. {
  331. if (NULL!=pGizmo->hWnd)
  332. ShowWindow(pGizmo->hWnd, SW_SHOWNORMAL);
  333. GizmosExpand(pGizmo);
  334. }
  335. if (!fShow && !pGizmo->fHidden)
  336. {
  337. if (NULL!=pGizmo->hWnd)
  338. ShowWindow(pGizmo->hWnd, SW_HIDE);
  339. GizmosCompact(pGizmo);
  340. }
  341. //This will be right even if we didn't change anything.
  342. pGizmo->fHidden=!fShow;
  343. }
  344. InvalidateRect(hWnd, NULL, TRUE);
  345. UpdateWindow(hWnd);
  346. return fRet;
  347. }
  348. /*
  349. * GBGizmoEnable
  350. *
  351. * Purpose:
  352. * Enables or disables a control on the GizmoBar.
  353. *
  354. * Parameters:
  355. * hWnd HWND of the GizmoBar.
  356. * uID UINT identifier of the gizmo to affect.
  357. * fEnable BOOL TRUE to enable the gizmo, FALSE otherwise.
  358. *
  359. * Return Value:
  360. * BOOL TRUE if the gizmo was previously disabled, FALSE
  361. * otherwise.
  362. */
  363. BOOL WINAPI GBGizmoEnable(HWND hWnd, UINT uID, BOOL fEnable)
  364. {
  365. LPGIZMO pGizmo;
  366. BOOL fRet=FALSE;
  367. pGizmo=PGizmoFromHwndID(hWnd, uID);
  368. if (NULL==pGizmo)
  369. return FALSE;
  370. fRet=(BOOL)(BUTTONGROUP_DISABLED & pGizmo->uState);
  371. //Use windows to enable or disable window gizmos
  372. if (NULL!=pGizmo->hWnd)
  373. EnableWindow(pGizmo->hWnd, fEnable);
  374. else
  375. {
  376. //If we're not down, command and attribute buttons act the same.
  377. if (!(BUTTONGROUP_DOWN & pGizmo->uState))
  378. GizmoPStateSet(hWnd, pGizmo, fEnable ? COMMANDBUTTON_UP : COMMANDBUTTON_DISABLED);
  379. else
  380. {
  381. //Attribute buttons are a little more sensitive with DOWNDISABLED
  382. GizmoPStateSet(hWnd, pGizmo
  383. , fEnable ? ATTRIBUTEBUTTON_DOWN : ATTRIBUTEBUTTON_DOWNDISABLED);
  384. }
  385. }
  386. return fRet;
  387. }
  388. /*
  389. * GBGizmoCheck
  390. *
  391. * Purpose:
  392. * Checks or unchecks an attribute button in the GizmoBar. If the
  393. * gizmo is part of a group of mutually exclusive attributes, then
  394. * other gizmos are unchecked when this one is checked. If this is
  395. * the only one checked in these circumstances, this function is a NOP.
  396. *
  397. * Parameters:
  398. * hWnd HWND of the GizmoBar.
  399. * uID UINT identifier of the gizmo to affect.
  400. * fCheck BOOL TRUE to check this gizmo, FALSE to uncheck.
  401. *
  402. * Return Value:
  403. * BOOL TRUE if the change took place. FALSE otherwise.
  404. */
  405. BOOL WINAPI GBGizmoCheck(HWND hWnd, UINT uID, BOOL fCheck)
  406. {
  407. LPGIZMOBAR pGB;
  408. LPGIZMO pGizmo;
  409. if (!IsWindow(hWnd))
  410. return FALSE;
  411. pGB=(LPGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
  412. if (NULL==pGB)
  413. return FALSE;
  414. pGizmo=GizmoPFind(&pGB->pGizmos, uID);
  415. if (NULL!=pGizmo)
  416. GizmoPCheck(hWnd, pGizmo, fCheck);
  417. return TRUE;
  418. }
  419. /*
  420. * GBGizmoFocusSet
  421. *
  422. * Purpose:
  423. * Sets the focus to a partuclar gizmo in the gizmo if that gizmo
  424. * can accept the focus. Separators, attribute buttons, text,
  425. * and command buttons cannot have the focus.
  426. *
  427. * Parameters:
  428. * hWnd HWND of the GizmoBar.
  429. * uID UINT identifier of the gizmo to affect.
  430. *
  431. * Return Value:
  432. * BOOL TRUE if the focus was set. FALSE otherwise, such as
  433. * when uID identifies a control that cannot have focus.
  434. */
  435. UINT WINAPI GBGizmoFocusSet(HWND hWnd, UINT uID)
  436. {
  437. LPGIZMO pGizmo;
  438. BOOL fRet=FALSE;
  439. pGizmo=PGizmoFromHwndID(hWnd, uID);
  440. if (NULL!=pGizmo && NULL!=pGizmo->hWnd)
  441. {
  442. fRet=TRUE;
  443. SetFocus(pGizmo->hWnd);
  444. }
  445. return fRet;
  446. }
  447. /*
  448. * GBGizmoExist
  449. *
  450. * Purpose:
  451. * Determines if a gizmo of a given identifier exists in the GizmoBar.
  452. *
  453. * Parameters:
  454. * hWnd HWND of the GizmoBar.
  455. * uID UINT identifier to verify.
  456. *
  457. * Return Value:
  458. * BOOL TRUE if the gizmo exists, FALSE otherwise.
  459. */
  460. BOOL WINAPI GBGizmoExist(HWND hWnd, UINT uID)
  461. {
  462. return (NULL!=PGizmoFromHwndID(hWnd, uID));
  463. }
  464. /*
  465. * GBGizmoTypeGet
  466. *
  467. * Purpose:
  468. * Returns the type of the gizmo specified by the given identifer.
  469. *
  470. * Parameters:
  471. * hWnd HWND of the GizmoBar.
  472. * uID UINT identifier to find.
  473. *
  474. * Return Value:
  475. * int A GIZMOTYPE_* value if the function is successful,
  476. * otherwise -1.
  477. */
  478. int WINAPI GBGizmoTypeGet(HWND hWnd, UINT uID)
  479. {
  480. int iRet=-1;
  481. LPGIZMO pGizmo;
  482. pGizmo=PGizmoFromHwndID(hWnd, uID);
  483. if (NULL!=pGizmo)
  484. iRet=pGizmo->iType;
  485. return iRet;
  486. }
  487. /*
  488. * GBGizmoDataSet
  489. * GBGizmoDataGet
  490. *
  491. * Purpose:
  492. * Sets or retrieves an extra DWORD value associated with the given gizmo.
  493. * Applications can store any information here they please.
  494. *
  495. * Parameters:
  496. * hWnd HWND of the GizmoBar.
  497. * uID UINT identifier of the gizmo.
  498. * dwData (Set only) DWORD data to store with the gizmo.
  499. *
  500. * Return Value:
  501. * DWORD Set: Previous value
  502. * Get: Current value
  503. */
  504. DWORD WINAPI GBGizmoDataSet(HWND hWnd, UINT uID, DWORD dwData)
  505. {
  506. LPGIZMO pGizmo;
  507. DWORD dw=0L;
  508. pGizmo=PGizmoFromHwndID(hWnd, uID);
  509. if (NULL!=pGizmo)
  510. {
  511. dw=pGizmo->dwData;
  512. pGizmo->dwData=dwData;
  513. }
  514. return dw;
  515. }
  516. DWORD WINAPI GBGizmoDataGet(HWND hWnd, UINT uID)
  517. {
  518. LPGIZMO pGizmo;
  519. DWORD dw=0L;
  520. pGizmo=PGizmoFromHwndID(hWnd, uID);
  521. if (NULL!=pGizmo)
  522. dw=pGizmo->dwData;
  523. return dw;
  524. }
  525. /*
  526. * GBGizmoNotifySet
  527. * GBGizmoNotifyGet
  528. *
  529. * Purpose:
  530. * Sets or retrieves the notify status of a gizmo. If notify is FALSE,
  531. * the no WM_COMMAND messages are sent from the GizmoBar to the parent
  532. * window when this gizmo is used.
  533. *
  534. * Parameters:
  535. * hWnd HWND of the GizmoBar.
  536. * uID UINT identifier of the gizmo.
  537. * fNotify (Set only) BOOL new notify status to set.
  538. *
  539. * Return Value:
  540. * BOOL Set: Previous value of the notify flag.
  541. * Get: Current value of the notify flag.
  542. */
  543. BOOL WINAPI GBGizmoNotifySet(HWND hWnd, UINT uID, BOOL fNotify)
  544. {
  545. LPGIZMO pGizmo;
  546. BOOL fRet=FALSE;
  547. pGizmo=PGizmoFromHwndID(hWnd, uID);
  548. if (NULL!=pGizmo)
  549. {
  550. fRet=pGizmo->fNotify;
  551. pGizmo->fNotify=fNotify;
  552. }
  553. return fRet;
  554. }
  555. BOOL WINAPI GBGizmoNotifyGet(HWND hWnd, UINT uID)
  556. {
  557. LPGIZMO pGizmo;
  558. BOOL fRet=FALSE;
  559. pGizmo=PGizmoFromHwndID(hWnd, uID);
  560. if (NULL!=pGizmo)
  561. fRet=pGizmo->fNotify;
  562. return fRet;
  563. }
  564. /*
  565. * GBGizmoTextSet
  566. * GBGizmoTextGet
  567. *
  568. * Purpose:
  569. * Retrieves or sets text in a GizmoBar gizmo. Separators, command buttons,
  570. * and attribute buttons are not affected by this call.
  571. *
  572. * Parameters:
  573. * hWnd HWND of the GizmoBar.
  574. * uID UINT identifying the gizmo.
  575. * psz LPTSTR (Set) providing the text to show in the window
  576. * or (Get) pointing to a buffer to receive the text.
  577. * cch (Get only) UINT maximum number of chars to copy to psz.
  578. *
  579. * Return Value:
  580. * int Number of characters copied to psz.
  581. */
  582. void WINAPI GBGizmoTextSet(HWND hWnd, UINT uID, LPTSTR psz)
  583. {
  584. //This fails on non-windowed gizmos anyway, so we don't check.
  585. SetDlgItemText(hWnd, uID, psz);
  586. return;
  587. }
  588. int WINAPI GBGizmoTextGet(HWND hWnd, UINT uID, LPTSTR psz, UINT cch)
  589. {
  590. //This fails on non-windowed gizmos anyway, so we don't check.
  591. return GetDlgItemText(hWnd, uID, psz, cch);
  592. }
  593. /*
  594. * GBGizmoIntSet
  595. * GBGizmoIntGet
  596. *
  597. * Purpose:
  598. * Retrieves or sets an integer in a GizmoBar gizmo. Separators, command
  599. * buttons, and attribute buttons are not affected by this call.
  600. *
  601. * Parameters:
  602. * hWnd HWND of the GizmoBar.
  603. * uID UINT identifying the gizmo.
  604. *
  605. * (Set only)
  606. * u UINT value to set in the gizmo.
  607. * fSigned BOOL TRUE to indicate if the value is signed.
  608. *
  609. * (Get only)
  610. * pfTrans BOOL FAR * in which the success of the function is returned.
  611. * fSigned BOOL TRUE to indicate if the value is signed.
  612. *
  613. * Return Value:
  614. * (Set): None
  615. * (Get): UINT Integer translation of the gizmo's text.
  616. */
  617. void WINAPI GBGizmoIntSet(HWND hWnd, UINT uID, UINT u, BOOL fSigned)
  618. {
  619. //This fails on non-windowed gizmos anyway, so we don't check.
  620. SetDlgItemInt(hWnd, uID, u, fSigned);
  621. return;
  622. }
  623. UINT WINAPI GBGizmoIntGet(HWND hWnd, UINT uID, BOOL FAR *pfTrans, BOOL fSigned)
  624. {
  625. //This fails on non-windowed gizmos anyway, so we don't check.
  626. return GetDlgItemInt(hWnd, uID, pfTrans, fSigned);
  627. }