summaryrefslogtreecommitdiffstats
path: root/include/textbox.h
blob: 4e4061b1a095bf4ba6d2107a4751d855237116e9 (plain)
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
#ifndef __TEXTBOX_H__
#define __TEXTBOX_H__

typedef struct {
    unsigned long flags;
    Window window, parent;
    short x, y, w, h;
    short cursor;
    XftFont *font;
    XftColor color_fg, color_bg;
    char *text, *prompt;
    XIM xim;
    XIC xic;
    XGlyphInfo extents;
} textbox;


typedef enum {
    TB_AUTOHEIGHT = 1<<0,
    TB_AUTOWIDTH = 1<<1,
    TB_LEFT = 1<<16,
    TB_RIGHT = 1<<17,
    TB_CENTER = 1<<18,
    TB_EDITABLE = 1<<19,
} TextboxFlags;




textbox* textbox_create( Window parent,
                         TextboxFlags flags,
                         short x, short y, short w, short h,
                         char *font, char *fg, char *bg,
                         char *text, char *prompt );

void textbox_free( textbox *tb );

void textbox_font( textbox *tb, char *font, char *fg, char *bg );

void textbox_text( textbox *tb, char *text );
void textbox_show( textbox *tb );
void textbox_draw( textbox *tb );

int textbox_keypress( textbox *tb, XEvent *ev );

void textbox_cursor_end( textbox *tb );
#endif //__TEXTBOX_H__