File: textinput.h

package info (click to toggle)
searchandrescue 0.8.2-10
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,656 kB
  • ctags: 6,111
  • sloc: ansic: 89,072; cpp: 7,691; sh: 90; makefile: 80
file content (62 lines) | stat: -rw-r--r-- 1,336 bytes parent folder | download | duplicates (6)
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
/*
			   Text Input Prompt
 */

#ifndef TEXTINPUT_H
#define TEXTINPUT_H

#include "gw.h"

typedef struct {

	gw_display_struct	*display;
	GWFont			*font;

	char	*label;
	char	*buf;
	int	pos,
		len;		/* Number of characters in buffer not
				 * counting last null character */

	/* Position of the start (upper left corner) of last value
	 * text position in window coordinates
	 *
	 * This is updated each time SARTextInputDraw() is called
	 */
	int last_value_x, last_value_y;

	void *data;
	void (*func_cb)(const char *, void *);

	char	**history;
	int	total_history, last_history_num;

} text_input_struct;
#define TEXT_INPUT(p)	((text_input_struct *)(p))


extern text_input_struct *SARTextInputNew(
	gw_display_struct *display,
	GWFont *font
);
extern void SARTextInputDelete(text_input_struct *p);

extern void SARTextInputHandleKey(
	text_input_struct *p, int k, Boolean state
);
extern void SARTextInputHandlePointer(
	text_input_struct *p,
	int x, int y, gw_event_type type, int btn_num
);

extern Boolean SARTextInputIsMapped(text_input_struct *p);
extern void SARTextInputMap(
	text_input_struct *p,
	const char *label, const char *value,
	void (*func_cb)(const char *, void *),
	void *data
);
extern void SARTextInputUnmap(text_input_struct *p);
extern void SARTextInputDraw(text_input_struct *p);

#endif	/* TEXTINPUT_H */