File: input.h

package info (click to toggle)
libforms 1.0.93sp1-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 11,548 kB
  • sloc: ansic: 97,227; sh: 9,236; makefile: 858
file content (211 lines) | stat: -rw-r--r-- 7,473 bytes parent folder | download | duplicates (2)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/*
 *  This file is part of the XForms library package.
 *
 *  XForms is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU Lesser General Public License as
 *  published by the Free Software Foundation; either version 2.1, or
 *  (at your option) any later version.
 *
 *  XForms is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with XForms.  If not, see <http://www.gnu.org/licenses/>.
 */

/********************** crop here for forms.h **********************/

/**
 * \file input.h
 */

#ifndef FL_INPUT_H
#define FL_INPUT_H


/***** Types    *****/

typedef enum {
    FL_NORMAL_INPUT,
    FL_FLOAT_INPUT,
    FL_INT_INPUT,
    FL_DATE_INPUT,
    FL_MULTILINE_INPUT,
    FL_HIDDEN_INPUT,
    FL_SECRET_INPUT
} FL_INPUT_TYPE;

/* for date input */

enum {
    FL_INPUT_MMDD,
    FL_INPUT_DDMM
};

/***** Defaults *****/

#define FL_INPUT_BOXTYPE    FL_DOWN_BOX
#define FL_INPUT_COL1       FL_COL1
#define FL_INPUT_COL2       FL_MCOL
#define FL_INPUT_LCOL       FL_LCOL
#define FL_INPUT_ALIGN      FL_ALIGN_LEFT

/***** Others   *****/

#define FL_INPUT_TCOL       FL_LCOL
#define FL_INPUT_CCOL       FL_BLUE

#define FL_RINGBELL         ( 1 << 4 )

/***** Routines *****/

FL_EXPORT FL_OBJECT * fl_create_input( int          type,
                                       FL_Coord     x,
                                       FL_Coord     y,
                                       FL_Coord     w,
                                       FL_Coord     h,
                                       const char * label );

FL_EXPORT FL_OBJECT * fl_add_input( int          type,
                                    FL_Coord     x,
                                    FL_Coord     y,
                                    FL_Coord     w,
                                    FL_Coord     h,
                                    const char * label );

FL_EXPORT void fl_set_input( FL_OBJECT  * ob,
                             const char * str );

FL_EXPORT void fl_set_input_return( FL_OBJECT    * ob,
                                    unsigned int   when );

FL_EXPORT void fl_set_input_color( FL_OBJECT * ob,
                                   FL_COLOR    textcol,
                                   FL_COLOR    curscol );

FL_EXPORT void fl_get_input_color( FL_OBJECT * ob,
                                   FL_COLOR  * textcol,
                                   FL_COLOR  * curscol );

FL_EXPORT void fl_set_input_scroll( FL_OBJECT * ob,
                                    int         yes );

FL_EXPORT void fl_set_input_cursorpos( FL_OBJECT * ob,
                                       int         xpos,
                                       int         ypos );

FL_EXPORT void fl_set_input_selected( FL_OBJECT * ob,
                                      int         yes );

FL_EXPORT void fl_set_input_selected_range( FL_OBJECT * ob,
                                            int         begin,
                                            int         end );

FL_EXPORT const char *fl_get_input_selected_range( FL_OBJECT * ob,
                                                   int       * begin,
                                                   int       * end );

FL_EXPORT void fl_set_input_maxchars( FL_OBJECT * ob,
                                      int         maxchars );

FL_EXPORT void fl_set_input_format( FL_OBJECT * ob,
                                    int         fmt,
                                    int         sep );

FL_EXPORT void fl_set_input_hscrollbar( FL_OBJECT * ob,
                                        int         pref );

FL_EXPORT void fl_set_input_vscrollbar( FL_OBJECT * ob,
                                        int         pref );

FL_EXPORT void fl_set_input_topline( FL_OBJECT * ob,
                                     int         top );

FL_EXPORT void fl_set_input_scrollbarsize( FL_OBJECT * ob,
                                           int         hh,
                                           int         vw );

FL_EXPORT void fl_get_input_scrollbarsize( FL_OBJECT * ob,
                                           int       * hh,
                                           int       * vw );

FL_EXPORT void fl_set_input_xoffset( FL_OBJECT * ob,
                                     int         xoff );

FL_EXPORT int fl_get_input_xoffset( FL_OBJECT * ob );

FL_EXPORT int fl_set_input_fieldchar( FL_OBJECT * ob,
                                      int         fchar );

FL_EXPORT int fl_get_input_topline( FL_OBJECT * ob );

FL_EXPORT int fl_get_input_screenlines( FL_OBJECT * ob );

FL_EXPORT int fl_get_input_cursorpos( FL_OBJECT * ob,
                                      int       * x,
                                      int       * y );

FL_EXPORT void fl_set_input_cursor_visible( FL_OBJECT * ob,
                                            int         visible );

FL_EXPORT int fl_get_input_numberoflines( FL_OBJECT * ob );

FL_EXPORT void fl_get_input_format( FL_OBJECT * ob,
                                    int       * fmt,
                                    int       * sep );

FL_EXPORT const char * fl_get_input( FL_OBJECT * ob );

typedef int ( * FL_INPUTVALIDATOR )(FL_OBJECT *,
                                    const char *,
                                    const char *,
                                    int );

FL_EXPORT FL_INPUTVALIDATOR fl_set_input_filter( FL_OBJECT         * ob,
                                                 FL_INPUTVALIDATOR   validate );

FL_EXPORT int fl_validate_input( FL_OBJECT *obj );

#define fl_set_input_shortcut   fl_set_object_shortcut

/* edit keys. */

typedef struct {
    /* basic editing */

    long del_prev_char;     /* delete previous char    */
    long del_next_char;     /* delete next char        */
    long del_prev_word;     /* delete previous word    */
    long del_next_word;     /* delete next word        */

    /* movement */

    long moveto_prev_line;  /* one line  up             */
    long moveto_next_line;  /* one line down            */
    long moveto_prev_char;  /* one char left            */
    long moveto_next_char;  /* one char right           */
    long moveto_prev_word;  /* one word left            */
    long moveto_next_word;  /* one word right           */
    long moveto_prev_page;  /* one page up              */
    long moveto_next_page;  /* one page down            */
    long moveto_bol;        /* move to begining of line */
    long moveto_eol;        /* move to end of line      */
    long moveto_bof;        /* move to begin of file    */
    long moveto_eof;        /* move to end of file      */

    /* misc. stuff */

    long transpose;         /* switch two char positions */
    long paste;             /* paste the edit buffer    */
    long backspace;         /* another  del_prev_char   */
    long del_to_bol;        /* cut to begining of line  */
    long del_to_eol;        /* cut to end of line       */
    long clear_field;       /* delete everything        */
    long del_to_eos;        /* not implemented          */
} FL_EditKeymap;

FL_EXPORT void fl_set_input_editkeymap( const FL_EditKeymap * keymap );

#endif /* ! defined FL_INPUT_H */