File: gui_edit.h

package info (click to toggle)
lbreakout2 2.6.5-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 8,888 kB
  • sloc: ansic: 29,983; sh: 4,352; makefile: 958; yacc: 288; sed: 16
file content (87 lines) | stat: -rw-r--r-- 3,662 bytes parent folder | download | duplicates (7)
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
/***************************************************************************
                          gui_edit.h  -  description
                             -------------------
    begin                : Wed Oct 16 2002
    copyright            : (C) 2002 by Michael Speck
    email                : kulkanie@gmx.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef __GUI_EDIT_H
#define __GUI_EDIT_H

/*
====================================================================
Create a single/multi-line editable widget. By checking the 
measurements of the standard font the number of lines and the 
line width is determined. If the edit is single-lined height is
always one but edit becomes scrollable.
  'border': between text and frame
  'text': is copied and displayed when first shown
  'size': limit of characters (excluding the \0)
Per default the edit accepts all non-whitespace characters.
====================================================================
*/
GuiWidget* gui_edit_create(
    GuiWidget *parent, int x, int y, int width, int height,
    void (*user_event_handler)(GuiWidget*,GuiEvent*),
    int border, int multi_line, int size, char *text );

/*
====================================================================
Resize the edit buffer and clear any text. (no update)
====================================================================
*/
void gui_edit_resize_buffer( GuiWidget *edit, int size );
/*
====================================================================
Set the edit's text. This resets the edit cursor's position to
end of text and updates displayed edit if visible.
====================================================================
*/
void gui_edit_set_text( GuiWidget *edit, char *text );
/*
====================================================================
Copy characters from 'start' to 'length' of the edit string to 
'buffer' (at maximum limit characters including \0). If 'length' is 
-1 the characters copied are those from 'start' to end of text.
====================================================================
*/
int gui_edit_get_text( 
    GuiWidget *edit, char *buffer, int limit, 
    int start, int length );
/*
====================================================================
Update the blinking cursor flag (no update) of the edit and in 
case a key is pressed call gui_edit_handle_key().
====================================================================
*/
void gui_edit_update( GuiWidget *widget, int ms );
/*
====================================================================
Select a character filter.
  default: all non-whitespaces >=32 && <= 128
  alpha: A-Z,a-z
  numerical: -,0-9
  alphanumerical: A-Z,a-z,0-9
  alphanumerical2: + underscores
====================================================================
*/
enum {
    GUI_EDIT_DEFAULT = 0,
    GUI_EDIT_ALPHA,
    GUI_EDIT_NUMERICAL,
    GUI_EDIT_ALPHANUMERICAL,
    GUI_EDIT_ALPHANUMERICAL2
};
void gui_edit_set_filter( GuiWidget *edit, int type );

#endif