Download
schrockwell
/PopUp
/PopUp.h
(View History)
schrockwell Rename kPopUpStyleAll to kPopUpStyleDefault | Latest amendment: 2 on 2025-10-15 |
1 | #ifndef __POPUP_H__ |
2 | #define __POPUP_H__ |
3 | |
4 | #define kPopUpStyleText 0x01 // draw current item text |
5 | #define kPopUpStyleCaret 0x02 // draw disclosure triangle |
6 | #define kPopUpStyleCheck 0x04 // check current item in menu |
7 | #define kPopUpStyleDefault (kPopUpStyleText | kPopUpStyleCaret | kPopUpStyleCheck) |
8 | |
9 | typedef struct PopUpRec |
10 | { |
11 | WindowPtr window; |
12 | MenuHandle menu; |
13 | Rect bounds; |
14 | short item; |
15 | short style; |
16 | } PopUpRec, *PopUpPtr, **PopUpHandle; |
17 | |
18 | // Returns a newly-allocated pointer to a PopUpRec |
19 | PopUpPtr CreatePopUp(WindowPtr window, Rect *bounds, MenuHandle menu, short style); |
20 | |
21 | // Frees memory |
22 | void DisposePopUp(PopUpPtr popup); |
23 | |
24 | // Paints the control frame, text, and other elements. Must be called |
25 | // during the window update cycle, between BeginUpdate() and EndUpdate() |
26 | void DrawPopUp(PopUpPtr popup); |
27 | |
28 | // Hook to handle mouse-down events that trigger the menu. Must be called |
29 | // in the main event loop. Returns true if the event was handled. |
30 | Boolean HandlePopUpEvent(PopUpPtr popup, EventRecord *eventPtr); |
31 | |
32 | // Changes the currently-selected item index and repaints the control |
33 | void SelectPopUpItem(PopUpPtr popup, short item); |
34 | |
35 | // Library use only |
36 | void _DrawPopUpItem(PopUpPtr popup); |
37 | Boolean _HandlePopUpMouseDownInContent(PopUpPtr popup, EventRecord *eventPtr); |
38 | #endif |