File: newt_pr.h

package info (click to toggle)
newt 0.52.17-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,676 kB
  • ctags: 2,049
  • sloc: ansic: 9,249; python: 711; makefile: 259; sh: 9
file content (94 lines) | stat: -rw-r--r-- 2,761 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef H_NEWT_PR
#define H_NEWT_PR

#define COLORSET_ROOT 		NEWT_COLORSET_ROOT
#define COLORSET_BORDER 	NEWT_COLORSET_BORDER
#define COLORSET_WINDOW		NEWT_COLORSET_WINDOW
#define COLORSET_SHADOW		NEWT_COLORSET_SHADOW
#define COLORSET_TITLE		NEWT_COLORSET_TITLE
#define COLORSET_BUTTON		NEWT_COLORSET_BUTTON
#define COLORSET_ACTBUTTON	NEWT_COLORSET_ACTBUTTON
#define COLORSET_CHECKBOX	NEWT_COLORSET_CHECKBOX
#define COLORSET_ACTCHECKBOX	NEWT_COLORSET_ACTCHECKBOX
#define COLORSET_ENTRY		NEWT_COLORSET_ENTRY
#define COLORSET_LABEL		NEWT_COLORSET_LABEL
#define COLORSET_LISTBOX	NEWT_COLORSET_LISTBOX
#define COLORSET_ACTLISTBOX	NEWT_COLORSET_ACTLISTBOX
#define COLORSET_TEXTBOX	NEWT_COLORSET_TEXTBOX
#define COLORSET_ACTTEXTBOX	NEWT_COLORSET_ACTTEXTBOX

int newtSetFlags(int oldFlags, int newFlags, enum newtFlagsSense sense);

void newtGotorc(int row, int col);
void newtGetrc(int * row, int * col);
void newtGetWindowPos(int * x, int * y);
void newtDrawBox(int left, int top, int width, int height, int shadow);
void newtClearBox(int left, int top, int width, int height);

int newtGetKey(void);
void newtTrashScreen(void);

struct newtComponent_struct {
    /* common data */
    int height, width;
    int top, left;
    int takesFocus;
    int isMapped;

    struct componentOps * ops;

    newtCallback callback;
    void * callbackData;

    newtCallback destroyCallback;
    void * destroyCallbackData;

    void * data;
} ;

enum eventResultTypes { ER_IGNORED, ER_SWALLOWED, ER_EXITFORM, ER_SETFOCUS,
			ER_NEXTCOMP };
struct eventResult {
    enum eventResultTypes result;
    union {
	newtComponent focus;
    } u;
};

enum eventTypes { EV_FOCUS, EV_UNFOCUS, EV_KEYPRESS, EV_MOUSE };
enum eventSequence { EV_EARLY, EV_NORMAL, EV_LATE };

struct event {
    enum eventTypes event;
    enum eventSequence when;
    union {
	int key;
	struct {
	    enum { MOUSE_MOTION, MOUSE_BUTTON_DOWN, MOUSE_BUTTON_UP } type;
	    int x, y;
	} mouse;
    } u;
} ;

struct componentOps {
    void (* draw)(newtComponent c);
    struct eventResult (* event)(newtComponent c, struct event ev);
    void (* destroy)(newtComponent c);
    void (* place)(newtComponent c, int newLeft, int newTop);
    void (* mapped)(newtComponent c, int isMapped);
} ;

void newtDefaultPlaceHandler(newtComponent c, int newLeft, int newTop);
void newtDefaultMappedHandler(newtComponent c, int isMapped);
struct eventResult newtDefaultEventHandler(newtComponent c,
					   struct event ev);

int _newt_wstrlen(const char *str, int len);
void write_string_int(const char *, char *);
void write_nstring_int(const char *, int, char *);
char get_text_direction(const char *);

#define wstrlen(str,len) _newt_wstrlen((str),(len))
void trim_string(char *title, int chrs);

#endif /* H_NEWT_PR */