]>
Commit | Line | Data |
---|---|---|
6fb96a3f | 1 | #ifndef H_NEWT_PR |
2 | #define H_NEWT_PR | |
3 | ||
6f481af2 | 4 | #define COLORSET_ROOT NEWT_COLORSET_ROOT |
5 | #define COLORSET_BORDER NEWT_COLORSET_BORDER | |
6 | #define COLORSET_WINDOW NEWT_COLORSET_WINDOW | |
7 | #define COLORSET_SHADOW NEWT_COLORSET_SHADOW | |
8 | #define COLORSET_TITLE NEWT_COLORSET_TITLE | |
9 | #define COLORSET_BUTTON NEWT_COLORSET_BUTTON | |
10 | #define COLORSET_ACTBUTTON NEWT_COLORSET_ACTBUTTON | |
11 | #define COLORSET_CHECKBOX NEWT_COLORSET_CHECKBOX | |
12 | #define COLORSET_ACTCHECKBOX NEWT_COLORSET_ACTCHECKBOX | |
13 | #define COLORSET_ENTRY NEWT_COLORSET_ENTRY | |
14 | #define COLORSET_LABEL NEWT_COLORSET_LABEL | |
15 | #define COLORSET_LISTBOX NEWT_COLORSET_LISTBOX | |
16 | #define COLORSET_ACTLISTBOX NEWT_COLORSET_ACTLISTBOX | |
17 | #define COLORSET_TEXTBOX NEWT_COLORSET_TEXTBOX | |
18 | #define COLORSET_ACTTEXTBOX NEWT_COLORSET_ACTTEXTBOX | |
b7dcb540 | 19 | |
a1f11019 | 20 | int newtSetFlags(int oldFlags, int newFlags, enum newtFlagsSense sense); |
21 | ||
6fb96a3f | 22 | void newtGotorc(int row, int col); |
a1f11019 | 23 | void newtGetrc(int * row, int * col); |
45f6c4fd | 24 | void newtGetWindowPos(int * x, int * y); |
6fb96a3f | 25 | void newtDrawBox(int left, int top, int width, int height, int shadow); |
26 | void newtClearBox(int left, int top, int width, int height); | |
27 | ||
28 | int newtGetKey(void); | |
7ff5fd71 | 29 | void newtTrashScreen(void); |
6fb96a3f | 30 | |
45c366b1 | 31 | struct newtComponent_struct { |
6fb96a3f | 32 | /* common data */ |
45f6c4fd | 33 | int height, width; |
6fb96a3f | 34 | int top, left; |
35 | int takesFocus; | |
913d0524 | 36 | int isMapped; |
6fb96a3f | 37 | |
38 | struct componentOps * ops; | |
39 | ||
eedf3ffa | 40 | newtCallback callback; |
41 | void * callbackData; | |
42 | ||
c101e99e RJ |
43 | newtCallback destroyCallback; |
44 | void * destroyCallbackData; | |
45 | ||
6fb96a3f | 46 | void * data; |
47 | } ; | |
48 | ||
e90f9163 | 49 | enum eventResultTypes { ER_IGNORED, ER_SWALLOWED, ER_EXITFORM, ER_SETFOCUS, |
6f481af2 | 50 | ER_NEXTCOMP }; |
6fb96a3f | 51 | struct eventResult { |
52 | enum eventResultTypes result; | |
14b08682 | 53 | union { |
6f481af2 | 54 | newtComponent focus; |
14b08682 | 55 | } u; |
45f6c4fd | 56 | }; |
6fb96a3f | 57 | |
45f6c4fd | 58 | enum eventTypes { EV_FOCUS, EV_UNFOCUS, EV_KEYPRESS, EV_MOUSE }; |
14b08682 | 59 | enum eventSequence { EV_EARLY, EV_NORMAL, EV_LATE }; |
6fb96a3f | 60 | |
61 | struct event { | |
62 | enum eventTypes event; | |
14b08682 | 63 | enum eventSequence when; |
6fb96a3f | 64 | union { |
6f481af2 | 65 | int key; |
66 | struct { | |
67 | enum { MOUSE_MOTION, MOUSE_BUTTON_DOWN, MOUSE_BUTTON_UP } type; | |
68 | int x, y; | |
69 | } mouse; | |
6fb96a3f | 70 | } u; |
71 | } ; | |
72 | ||
73 | struct componentOps { | |
45c366b1 | 74 | void (* draw)(newtComponent c); |
75 | struct eventResult (* event)(newtComponent c, struct event ev); | |
76 | void (* destroy)(newtComponent c); | |
8f52cd47 | 77 | void (* place)(newtComponent c, int newLeft, int newTop); |
78 | void (* mapped)(newtComponent c, int isMapped); | |
6fb96a3f | 79 | } ; |
80 | ||
8f52cd47 | 81 | void newtDefaultPlaceHandler(newtComponent c, int newLeft, int newTop); |
82 | void newtDefaultMappedHandler(newtComponent c, int isMapped); | |
45c366b1 | 83 | struct eventResult newtDefaultEventHandler(newtComponent c, |
6f481af2 | 84 | struct event ev); |
8735cc88 | 85 | |
feef2cb5 | 86 | int _newt_wstrlen(const char *str, int len); |
feef2cb5 | 87 | #define wstrlen(str,len) _newt_wstrlen((str),(len)) |
b9b1302c | 88 | void trim_string(char *title, int chrs); |
349586bb | 89 | |
6fb96a3f | 90 | #endif /* H_NEWT_PR */ |