This source file includes following definitions.
- input_get_text
- input_get_ctext
- input_is_empty
1
2
3
4
5
6 #ifndef MC__WIDGET_INPUT_H
7 #define MC__WIDGET_INPUT_H
8
9 #include <limits.h>
10
11
12
13 #define INPUT(x) ((WInput *)(x))
14
15
16 #define INPUT_LAST_TEXT ((char *) 2)
17
18
19
20 typedef enum
21 {
22 WINPUTC_MAIN,
23 WINPUTC_MARK,
24 WINPUTC_UNCHANGED,
25 WINPUTC_HISTORY,
26 WINPUTC_COUNT_COLORS
27 } input_colors_enum_t;
28
29
30 typedef enum
31 {
32 INPUT_COMPLETE_NONE = 0,
33 INPUT_COMPLETE_FILENAMES = 1 << 0,
34 INPUT_COMPLETE_HOSTNAMES = 1 << 1,
35 INPUT_COMPLETE_COMMANDS = 1 << 2,
36 INPUT_COMPLETE_VARIABLES = 1 << 3,
37 INPUT_COMPLETE_USERNAMES = 1 << 4,
38 INPUT_COMPLETE_CD = 1 << 5,
39 INPUT_COMPLETE_SHELL_ESC = 1 << 6,
40 } input_complete_t;
41
42
43
44 typedef int input_colors_t[WINPUTC_COUNT_COLORS];
45
46 typedef struct
47 {
48 Widget widget;
49
50 GString *buffer;
51 const int *color;
52 int point;
53 int mark;
54 int term_first_shown;
55 gboolean first;
56 int disable_update;
57 gboolean is_password;
58 gboolean init_from_history;
59 gboolean need_push;
60 gboolean strip_password;
61 GPtrArray *completions;
62 input_complete_t completion_flags;
63 char charbuf[MB_LEN_MAX];
64 size_t charpoint;
65 WLabel *label;
66 struct input_history_t
67 {
68 char *name;
69 GList *list;
70 GList *current;
71 gboolean changed;
72 } history;
73 } WInput;
74
75
76
77 extern int quote;
78
79 extern const global_keymap_t *input_map;
80
81
82 extern input_colors_t input_colors;
83
84
85
86 WInput *input_new (int y, int x, const int *colors,
87 int len, const char *text, const char *histname,
88 input_complete_t completion_flags);
89
90 cb_ret_t input_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data);
91 void input_set_default_colors (void);
92 cb_ret_t input_handle_char (WInput * in, int key);
93 void input_assign_text (WInput * in, const char *text);
94 void input_insert (WInput * in, const char *text, gboolean insert_extra_space);
95 void input_set_point (WInput * in, int pos);
96 void input_update (WInput * in, gboolean clear_first);
97 void input_enable_update (WInput * in);
98 void input_disable_update (WInput * in);
99 void input_clean (WInput * in);
100
101
102 void input_complete (WInput * in);
103 void input_complete_free (WInput * in);
104
105
106
107
108
109
110
111
112
113
114
115
116 static inline char *
117 input_get_text (const WInput *in)
118 {
119 return g_strndup (in->buffer->str, in->buffer->len);
120 }
121
122
123
124
125
126
127
128
129
130
131 static inline const char *
132 input_get_ctext (const WInput *in)
133 {
134 return in->buffer->str;
135 }
136
137
138
139
140
141
142
143
144
145
146 static inline gboolean
147 input_is_empty (const WInput *in)
148 {
149 return (in->buffer->len == 0);
150 }
151
152
153
154
155 #endif