|
|
1.1 root 1: /*
2: * API.C
3: * GizmoBar Version 1.00, March 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)1992 Microsoft Corporation, All Rights Reserved
9: *
10: * Kraig Brockschmidt, Software Design Engineer
11: * Microsoft Systems Developer Relations
12: *
13: * Internet : [email protected]
14: * Compuserve: >INTERNET:[email protected]
15: */
16:
17: #ifdef WIN32
18: #define _INC_OLE
19: #define __RPC_H__
20: #endif
21:
22:
23: #define STRICT
24: #include <windows.h>
25: #include "gizmoint.h"
26:
27:
28:
29: /*
30: * GBMessageHandler
31: *
32: * Purpose:
33: * Processes control messages that are equivalents of available
34: * control API. The data passed with these messages is simply
35: * extracted from structures and passed as parameters to their
36: * equivalent function.
37: *
38: * Parameters:
39: * <Standard Message Parameters> plus
40: * pGB PGIZMOBAR providing control-specific data.
41: *
42: * Return Value:
43: * LRESULT Return value from equivalent API function.
44: */
45:
46: LRESULT GBMessageHandler(HWND hWnd, UINT iMsg, WPARAM wParam
47: , LPARAM lParam, PGIZMOBAR pGB)
48: {
49: LRESULT lRet=0L;
50: PCREATEGIZMO pCG;
51: PGBMSG pMsg;
52: PGBGETTEXT pGT;
53: PGBGETINT pGI;
54: PGBSETINT pSI;
55:
56: if (NULL==pGB)
57: return 0L;
58:
59: switch (iMsg)
60: {
61: case GBM_HWNDASSOCIATESET:
62: lRet=(LRESULT)(UINT)GBHwndAssociateSet(hWnd, (HWND)wParam);
63: break;
64:
65: case GBM_HWNDASSOCIATEGET:
66: lRet=(LRESULT)(UINT)GBHwndAssociateGet(hWnd);
67: break;
68:
69: case GBM_GIZMOADD:
70: pCG=(PCREATEGIZMO)lParam;
71: lRet=(LRESULT)GBGizmoAdd(pCG->hWndParent, pCG->iType, pCG->iGizmo
72: , pCG->uID, pCG->dx, pCG->dy, pCG->pszText, pCG->hBmp
73: , pCG->iImage, pCG->uState);
74: break;
75:
76: case GBM_GIZMOREMOVE:
77: lRet=(LRESULT)GBGizmoRemove(hWnd, wParam);
78: break;
79:
80: case GBM_GIZMOSENDMESSAGE:
81: pMsg=(PGBMSG)lParam;
82: lRet=GBGizmoSendMessage(hWnd, wParam, pMsg->iMsg, pMsg->wParam, pMsg->lParam);
83: break;
84:
85: case GBM_GIZMOSHOW:
86: lRet=(LRESULT)GBGizmoShow(hWnd, wParam, (BOOL)LOWORD(lParam));
87: break;
88:
89: case GBM_GIZMOENABLE:
90: lRet=(LRESULT)GBGizmoEnable(hWnd, wParam, (BOOL)LOWORD(lParam));
91: break;
92:
93: case GBM_GIZMOCHECK:
94: lRet=(LRESULT)GBGizmoCheck(hWnd, wParam, (BOOL)LOWORD(lParam));
95: break;
96:
97: case GBM_GIZMOFOCUSSET:
98: lRet=(LRESULT)GBGizmoFocusSet(hWnd, wParam);
99: break;
100:
101: case GBM_GIZMOEXIST:
102: lRet=(LRESULT)GBGizmoExist(hWnd, wParam);
103: break;
104:
105: case GBM_GIZMOTYPEGET:
106: lRet=(LRESULT)GBGizmoTypeGet(hWnd, wParam);
107: break;
108:
109: case GBM_GIZMODATASET:
110: lRet=(LRESULT)GBGizmoDataSet(hWnd, wParam, (DWORD)lParam);
111: break;
112:
113: case GBM_GIZMODATAGET:
114: lRet=(LRESULT)GBGizmoDataGet(hWnd, wParam);
115: break;
116:
117: case GBM_GIZMONOTIFYSET:
118: lRet=(LRESULT)GBGizmoNotifySet(hWnd, wParam, (BOOL)LOWORD(lParam));
119: break;
120:
121: case GBM_GIZMONOTIFYGET:
122: lRet=(LRESULT)GBGizmoNotifyGet(hWnd, wParam);
123: break;
124:
125: case GBM_GIZMOTEXTGET:
126: pGT=(PGBGETTEXT)lParam;
127: lRet=(LRESULT)GBGizmoTextGet(hWnd, wParam, pGT->psz, pGT->cch);
128: break;
129:
130: case GBM_GIZMOTEXTSET:
131: GBGizmoTextSet(hWnd, wParam, (LPSTR)lParam);
132: break;
133:
134: case GBM_GIZMOINTGET:
135: pGI=(PGBGETINT)lParam;
136: lRet=(LRESULT)GBGizmoIntGet(hWnd, wParam, &pGI->fSuccess, pGI->fSigned);
137: break;
138:
139:
140: case GBM_GIZMOINTSET:
141: pSI=(PGBSETINT)lParam;
142: GBGizmoIntSet(hWnd, wParam, pSI->uValue, pSI->fSigned);
143: break;
144:
145: default:
146: break;
147: }
148:
149: return lRet;
150: }
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161: /*
162: * PGizmoFromHwndID
163: *
164: * Purpose:
165: * Retrieves the pGizmo for the given GizmoBar and the gizmo ID.
166: *
167: * Parameters:
168: * hWnd HWND of a GizmoBar.
169: * uID UINT gizmo identifier.
170: *
171: * Return Value:
172: * PGIZMO NULL if the gizmo does not exist or hWnd is invalid.
173: * non-NULL PGIZMO otherwise.
174: */
175:
176: PGIZMO PGizmoFromHwndID(HWND hWnd, UINT uID)
177: {
178: PGIZMOBAR pGB;
179:
180: if (!IsWindow(hWnd))
181: return FALSE;
182:
183: pGB=(PGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
184:
185: if (NULL==pGB)
186: return FALSE;
187:
188: return GizmoPFind(&pGB->pGizmos, uID);
189: }
190:
191:
192:
193:
194:
195:
196: /*
197: * GBHwndAssociateSet
198: *
199: * Purpose:
200: * Changes the associate window of a GizmoBar.
201: *
202: * Parameters:
203: * hWnd HWND of the control window.
204: *
205: * Set Parameters:
206: * hWndAssociate HWND of new associate.
207: *
208: * Return Value:
209: * HWND Handle of previous associate.
210: */
211:
212: HWND WINAPI GBHwndAssociateSet(HWND hWnd, HWND hWndNew)
213: {
214: HWND hWndOld=NULL;
215: PGIZMOBAR pGB;
216: UINT uID;
217:
218: pGB=(PGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
219:
220: if (NULL!=pGB)
221: {
222: #ifdef WIN32
223: uID=GetWindowLong(hWnd, GWL_ID);
224: #else
225: uID=GetWindowWord(hWnd, GWW_ID);
226: #endif
227:
228: hWndOld=pGB->hWndAssociate;
229: pGB->hWndAssociate=hWndNew;
230:
231: if (NULL!=hWndOld)
232: SendCommand(hWndOld, uID, GBN_ASSOCIATELOSS, hWnd);
233:
234: if (NULL!=hWndNew)
235: SendCommand(hWndNew, uID, GBN_ASSOCIATEGAIN, hWnd);
236: }
237:
238: return hWndOld;
239: }
240:
241:
242:
243:
244:
245: /*
246: * GBHwndAssociateGet
247: *
248: * Purpose:
249: * Retrieves the associate window of a GizmoBar
250: *
251: * Parameters:
252: * hWnd HWND of the control window.
253: *
254: * Set Parameters:
255: * hWndAssociate HWND of new associate.
256: *
257: * Return Value:
258: * HWND Handle of current associate.
259: */
260:
261: HWND WINAPI GBHwndAssociateGet(HWND hWnd)
262: {
263: HWND hWndOld=NULL;
264: PGIZMOBAR pGB;
265:
266: pGB=(PGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
267:
268: if (NULL!=pGB)
269: hWndOld=pGB->hWndAssociate;
270:
271: return hWndOld;
272: }
273:
274:
275:
276:
277:
278: /*
279: * GBGizmoAdd
280: *
281: * Purpose:
282: * Creates a new gizmo on the GizmoBar. Subsequent operations should
283: * be done using the identifier, uID, for this gizmo.
284: *
285: * Parameters:
286: * hWnd HWND of the GizmoBar.
287: * iType UINT type of the gizmo to create.
288: * iGizmo UINT position (zero-based) at which to place the gizmo.
289: * uID UINT identifier for WM_COMMAND from this gizmo.
290: * dx, dy UINT dimensions of the gizmo.
291: * pszText LPSTR initial text for edit, list, combo, and text gizmos.
292: * hBitmap HBITMAP for gizmos of the button types (COMMAND or
293: * ATTRIBUTE) specifies a source bitmap from which the
294: * button image is taken.
295: * iImage UINT index into hBitmap for the image for this button.
296: * uState UINT initial state of the gizmo.
297: *
298: * Return Value:
299: * BOOL TRUE if creation succeeded, FALSE otherwise.
300: */
301:
302: BOOL WINAPI GBGizmoAdd(HWND hWnd, UINT iType, UINT iGizmo, UINT uID
303: , UINT dx, UINT dy, LPSTR pszText, HBITMAP hBmp, UINT iImage, UINT uState)
304: {
305: BOOL fSuccess;
306: PGIZMOBAR pGB;
307: PGIZMO pGizmo;
308:
309: if (!IsWindow(hWnd))
310: return FALSE;
311:
312: pGB=(PGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
313:
314: if (NULL==pGB)
315: return FALSE;
316:
317: /*
318: * This automatically creates the windows, allocates structures, includes
319: * the gizmo in pGB->pGizmos, and so forth.
320: */
321: pGizmo=GizmoPAllocate((LPINT)&fSuccess, &pGB->pGizmos, hWnd, iType
322: , iGizmo, uID, dx, dy, pszText, hBmp, iImage, uState);
323:
324: if (fSuccess)
325: {
326: if (NULL!=pGB->hWndAssociate)
327: {
328: #ifdef WIN32
329: SendCommand(pGB->hWndAssociate,GBN_GIZMOADDED,
330: GetWindowLong(hWnd, GWL_ID),hWnd);
331: #else
332: SendCommand(pGB->hWndAssociate,GBN_GIZMOADDED,
333: GetWindowWord(hWnd, GWW_ID),hWnd);
334: #endif
335: }
336:
337: InvalidateRect(hWnd, NULL, TRUE);
338: UpdateWindow(hWnd);
339: }
340: else
341: GizmoPFree(&pGB->pGizmos, pGizmo);
342:
343: return fSuccess;
344: }
345:
346:
347:
348:
349:
350: /*
351: * GBGizmoRemove
352: *
353: * Purpose:
354: * Removes an existing gizmo from the GizmoBar.
355: *
356: * Parameters:
357: * hWnd HWND of the GizmoBar.
358: * uID UINT identifier for this gizmo.
359: *
360: * Return Value:
361: * BOOL TRUE if deletion succeeded, FALSE otherwise.
362: */
363:
364: BOOL WINAPI GBGizmoRemove(HWND hWnd, UINT uID)
365: {
366: PGIZMOBAR pGB;
367: PGIZMO pGizmo;
368:
369: if (!IsWindow(hWnd))
370: return FALSE;
371:
372: pGB=(PGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
373:
374: if (NULL==pGB)
375: return FALSE;
376:
377: pGizmo=GizmoPFind(&pGB->pGizmos, uID);
378:
379: if (NULL==pGizmo)
380: return FALSE;
381:
382: GizmoPFree(&pGB->pGizmos, pGizmo);
383:
384: if (NULL!=pGB->hWndAssociate)
385: {
386: #ifdef WIN32
387: SendCommand(pGB->hWndAssociate, GBN_GIZMOREMOVED
388: , GetWindowLong(hWnd, GWL_ID), hWnd);
389: #else
390: SendCommand(pGB->hWndAssociate, GBN_GIZMOREMOVED
391: , GetWindowWord(hWnd, GWW_ID), hWnd);
392: #endif
393: }
394:
395: InvalidateRect(hWnd, NULL, TRUE);
396: UpdateWindow(hWnd);
397: return TRUE;
398: }
399:
400:
401:
402:
403:
404:
405: /*
406: * GBGizmoSendMessage
407: *
408: * Purpose:
409: * Implements the equivalent of SendMessage to a gizmo in the
410: * GizmoBar. Separators, command buttons, and attribute buttons
411: * do not accept messages.
412: *
413: * Parameters:
414: * hWnd HWND of the GizmoBar.
415: * uID UINT identifier of the gizmo to affect.
416: * iMsg UINT message to send.
417: * wParam WPARAM of the message.
418: * lParam LPARAM of the message.
419: *
420: * Return Value:
421: * LRESULT Return value from the message. 0L if the
422: * gizmo does not accept messages.
423: */
424:
425: LRESULT WINAPI GBGizmoSendMessage(HWND hWnd, UINT uID, UINT iMsg
426: , WPARAM wParam, LPARAM lParam)
427: {
428: PGIZMO pGizmo;
429: LONG lRet=0L;
430:
431: pGizmo=PGizmoFromHwndID(hWnd, uID);
432:
433: if (NULL!=pGizmo && NULL!=pGizmo->hWnd)
434: lRet=SendMessage(pGizmo->hWnd, iMsg, wParam, lParam);
435:
436: return lRet;
437: }
438:
439:
440:
441:
442:
443:
444: /*
445: * GBGizmoShow
446: *
447: * Purpose:
448: * Shows or hides a control, adjusting the positions of all others
449: * to make room for or reuse the space for this control.
450: *
451: * Parameters:
452: * hWnd HWND of the GizmoBar.
453: * uID UINT identifier of the gizmo to affect.
454: * fShow BOOL TRUE to show the gizmo, FALSE to hide it.
455: *
456: * Return Value:
457: * BOOL TRUE if the function was successful, FALSE otherwise.
458: */
459:
460: BOOL WINAPI GBGizmoShow(HWND hWnd, UINT uID, BOOL fShow)
461: {
462: BOOL fRet=FALSE;
463: PGIZMO pGizmo;
464:
465: pGizmo=PGizmoFromHwndID(hWnd, uID);
466:
467: if (NULL!=pGizmo)
468: {
469: if (fShow && pGizmo->fHidden)
470: {
471: if (NULL!=pGizmo->hWnd)
472: ShowWindow(pGizmo->hWnd, SW_SHOWNORMAL);
473:
474: GizmosExpand(pGizmo);
475: }
476:
477: if (!fShow && !pGizmo->fHidden)
478: {
479: if (NULL!=pGizmo->hWnd)
480: ShowWindow(pGizmo->hWnd, SW_HIDE);
481:
482: GizmosCompact(pGizmo);
483: }
484:
485: //This will be right even if we didn't change anything.
486: pGizmo->fHidden=!fShow;
487: }
488:
489: InvalidateRect(hWnd, NULL, TRUE);
490: UpdateWindow(hWnd);
491: return fRet;
492: }
493:
494:
495:
496:
497:
498:
499: /*
500: * GBGizmoEnable
501: *
502: * Purpose:
503: * Enables or disables a control on the GizmoBar.
504: *
505: * Parameters:
506: * hWnd HWND of the GizmoBar.
507: * uID UINT identifier of the gizmo to affect.
508: * fEnable BOOL TRUE to enable the gizmo, FALSE otherwise.
509: *
510: * Return Value:
511: * BOOL TRUE if the gizmo was previously disabled, FALSE
512: * otherwise.
513: */
514:
515: BOOL WINAPI GBGizmoEnable(HWND hWnd, UINT uID, BOOL fEnable)
516: {
517: PGIZMO pGizmo;
518: BOOL fRet=FALSE;
519:
520: pGizmo=PGizmoFromHwndID(hWnd, uID);
521:
522: if (NULL==pGizmo)
523: return FALSE;
524:
525: fRet=(BOOL)(BUTTONGROUP_DISABLED & pGizmo->uState);
526:
527: //Use windows to enable or disable window gizmos
528: if (NULL!=pGizmo->hWnd)
529: EnableWindow(pGizmo->hWnd, fEnable);
530: else
531: {
532: //If we're not down, command and attribute buttons act the same.
533: if (!(BUTTONGROUP_DOWN & pGizmo->uState))
534: GizmoPStateSet(hWnd, pGizmo, fEnable ? COMMANDBUTTON_UP : COMMANDBUTTON_DISABLED);
535: else
536: {
537: //Attribute buttons are a little more sensitive with DOWNDISABLED
538: GizmoPStateSet(hWnd, pGizmo
539: , fEnable ? ATTRIBUTEBUTTON_DOWN : ATTRIBUTEBUTTON_DOWNDISABLED);
540: }
541: }
542:
543: return fRet;
544: }
545:
546:
547:
548:
549:
550:
551:
552: /*
553: * GBGizmoCheck
554: *
555: * Purpose:
556: * Checks or unchecks an attribute button in the GizmoBar. If the
557: * gizmo is part of a group of mutually exclusive attributes, then
558: * other gizmos are unchecked when this one is checked. If this is
559: * the only one checked in these circumstances, this function is a NOP.
560: *
561: * Parameters:
562: * hWnd HWND of the GizmoBar.
563: * uID UINT identifier of the gizmo to affect.
564: * fCheck BOOL TRUE to check this gizmo, FALSE to uncheck.
565: *
566: * Return Value:
567: * BOOL TRUE if the change took place. FALSE otherwise.
568: */
569:
570: BOOL WINAPI GBGizmoCheck(HWND hWnd, UINT uID, BOOL fCheck)
571: {
572: PGIZMOBAR pGB;
573: PGIZMO pGizmo;
574:
575: if (!IsWindow(hWnd))
576: return FALSE;
577:
578: pGB=(PGIZMOBAR)GetWindowLong(hWnd, GBWL_STRUCTURE);
579:
580: if (NULL==pGB)
581: return FALSE;
582:
583: pGizmo=GizmoPFind(&pGB->pGizmos, uID);
584:
585: if (NULL!=pGizmo)
586: GizmoPCheck(hWnd, pGizmo, fCheck);
587:
588: return TRUE;
589: }
590:
591:
592:
593:
594:
595:
596: /*
597: * GBGizmoFocusSet
598: *
599: * Purpose:
600: * Sets the focus to a partuclar gizmo in the gizmo if that gizmo
601: * can accept the focus. Separators, attribute buttons, text,
602: * and command buttons cannot have the focus.
603: *
604: * Parameters:
605: * hWnd HWND of the GizmoBar.
606: * uID UINT identifier of the gizmo to affect.
607: *
608: * Return Value:
609: * BOOL TRUE if the focus was set. FALSE otherwise, such as
610: * when uID identifies a control that cannot have focus.
611: */
612:
613: UINT WINAPI GBGizmoFocusSet(HWND hWnd, UINT uID)
614: {
615: PGIZMO pGizmo;
616: BOOL fRet=FALSE;
617:
618: pGizmo=PGizmoFromHwndID(hWnd, uID);
619:
620: if (NULL!=pGizmo && NULL!=pGizmo->hWnd)
621: {
622: fRet=TRUE;
623: SetFocus(pGizmo->hWnd);
624: }
625:
626: return fRet;
627: }
628:
629:
630:
631:
632:
633: /*
634: * GBGizmoExist
635: *
636: * Purpose:
637: * Determines if a gizmo of a given identifier exists in the GizmoBar.
638: *
639: * Parameters:
640: * hWnd HWND of the GizmoBar.
641: * uID UINT identifier to verify.
642: *
643: * Return Value:
644: * BOOL TRUE if the gizmo exists, FALSE otherwise.
645: */
646:
647: BOOL WINAPI GBGizmoExist(HWND hWnd, UINT uID)
648: {
649: return (NULL!=PGizmoFromHwndID(hWnd, uID));
650: }
651:
652:
653:
654:
655:
656: /*
657: * GBGizmoTypeGet
658: *
659: * Purpose:
660: * Returns the type of the gizmo specified by the given identifer.
661: *
662: * Parameters:
663: * hWnd HWND of the GizmoBar.
664: * uID UINT identifier to find.
665: *
666: * Return Value:
667: * int A GIZMOTYPE_* value if the function is successful,
668: * otherwise -1.
669: */
670:
671: int WINAPI GBGizmoTypeGet(HWND hWnd, UINT uID)
672: {
673: int iRet=-1;
674: PGIZMO pGizmo;
675:
676: pGizmo=PGizmoFromHwndID(hWnd, uID);
677:
678: if (NULL!=pGizmo)
679: iRet=pGizmo->iType;
680:
681: return iRet;
682: }
683:
684:
685:
686:
687:
688: /*
689: * GBGizmoDataSet
690: * GBGizmoDataGet
691: *
692: * Purpose:
693: * Sets or retrieves an extra DWORD value associated with the given gizmo.
694: * Applications can store any information here they please.
695: *
696: * Parameters:
697: * hWnd HWND of the GizmoBar.
698: * uID UINT identifier of the gizmo.
699: * dwData (Set only) DWORD data to store with the gizmo.
700: *
701: * Return Value:
702: * DWORD Set: Previous value
703: * Get: Current value
704: */
705:
706: DWORD WINAPI GBGizmoDataSet(HWND hWnd, UINT uID, DWORD dwData)
707: {
708: PGIZMO pGizmo;
709: DWORD dw=0L;
710:
711: pGizmo=PGizmoFromHwndID(hWnd, uID);
712:
713: if (NULL!=pGizmo)
714: {
715: dw=pGizmo->dwData;
716: pGizmo->dwData=dwData;
717: }
718:
719: return dw;
720: }
721:
722:
723:
724: DWORD WINAPI GBGizmoDataGet(HWND hWnd, UINT uID)
725: {
726: PGIZMO pGizmo;
727: DWORD dw=0L;
728:
729: pGizmo=PGizmoFromHwndID(hWnd, uID);
730:
731: if (NULL!=pGizmo)
732: dw=pGizmo->dwData;
733:
734: return dw;
735: }
736:
737:
738:
739:
740:
741:
742: /*
743: * GBGizmoNotifySet
744: * GBGizmoNotifyGet
745: *
746: * Purpose:
747: * Sets or retrieves the notify status of a gizmo. If notify is FALSE,
748: * the no WM_COMMAND messages are sent from the GizmoBar to the parent
749: * window when this gizmo is used.
750: *
751: * Parameters:
752: * hWnd HWND of the GizmoBar.
753: * uID UINT identifier of the gizmo.
754: * fNotify (Set only) BOOL new notify status to set.
755: *
756: * Return Value:
757: * BOOL Set: Previous value of the notify flag.
758: * Get: Current value of the notify flag.
759: */
760:
761: BOOL WINAPI GBGizmoNotifySet(HWND hWnd, UINT uID, BOOL fNotify)
762: {
763: PGIZMO pGizmo;
764: BOOL fRet=FALSE;
765:
766: pGizmo=PGizmoFromHwndID(hWnd, uID);
767:
768: if (NULL!=pGizmo)
769: {
770: fRet=pGizmo->fNotify;
771: pGizmo->fNotify=fNotify;
772: }
773:
774: return fRet;
775: }
776:
777:
778: BOOL WINAPI GBGizmoNotifyGet(HWND hWnd, UINT uID)
779: {
780: PGIZMO pGizmo;
781: BOOL fRet=FALSE;
782:
783: pGizmo=PGizmoFromHwndID(hWnd, uID);
784:
785: if (NULL!=pGizmo)
786: fRet=pGizmo->fNotify;
787:
788: return fRet;
789: }
790:
791:
792:
793:
794:
795:
796:
797: /*
798: * GBGizmoTextSet
799: * GBGizmoTextGet
800: *
801: * Purpose:
802: * Retrieves or sets text in a GizmoBar gizmo. Separators, command buttons,
803: * and attribute buttons are not affected by this call.
804: *
805: * Parameters:
806: * hWnd HWND of the GizmoBar.
807: * uID UINT identifying the gizmo.
808: * psz LPSTR (Set) providing the text to show in the window
809: * or (Get) pointing to a buffer to receive the text.
810: * cch (Get only) UINT maximum number of chars to copy to psz.
811: *
812: * Return Value:
813: * int Number of characters copied to psz.
814: */
815:
816: void WINAPI GBGizmoTextSet(HWND hWnd, UINT uID, LPSTR psz)
817: {
818: //This fails on non-windowed gizmos anyway, so we don't check.
819: SetDlgItemText(hWnd, uID, psz);
820: return;
821: }
822:
823:
824: int WINAPI GBGizmoTextGet(HWND hWnd, UINT uID, LPSTR psz, UINT cch)
825: {
826: //This fails on non-windowed gizmos anyway, so we don't check.
827: return GetDlgItemText(hWnd, uID, psz, cch);
828: }
829:
830:
831:
832:
833:
834:
835:
836:
837: /*
838: * GBGizmoIntSet
839: * GBGizmoIntGet
840: *
841: * Purpose:
842: * Retrieves or sets an integer in a GizmoBar gizmo. Separators, command
843: * buttons, and attribute buttons are not affected by this call.
844: *
845: * Parameters:
846: * hWnd HWND of the GizmoBar.
847: * uID UINT identifying the gizmo.
848: *
849: * (Set only)
850: * u UINT value to set in the gizmo.
851: * fSigned BOOL TRUE to indicate if the value is signed.
852: *
853: * (Get only)
854: * pfTrans BOOL FAR * in which the success of the function is returned.
855: * fSigned BOOL TRUE to indicate if the value is signed.
856: *
857: * Return Value:
858: * (Set): None
859: * (Get): UINT Integer translation of the gizmo's text.
860: */
861:
862: void WINAPI GBGizmoIntSet(HWND hWnd, UINT uID, UINT u, BOOL fSigned)
863: {
864: //This fails on non-windowed gizmos anyway, so we don't check.
865: SetDlgItemInt(hWnd, uID, u, fSigned);
866: return;
867: }
868:
869:
870:
871: UINT WINAPI GBGizmoIntGet(HWND hWnd, UINT uID, BOOL FAR *pfTrans, BOOL fSigned)
872: {
873: //This fails on non-windowed gizmos anyway, so we don't check.
874: return GetDlgItemInt(hWnd, uID, pfTrans, fSigned);
875: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.