2014-01-19 07:57:54 -05:00
|
|
|
#ifndef __TEXTBOX_H__
|
|
|
|
#define __TEXTBOX_H__
|
|
|
|
|
2014-03-22 16:04:19 -04:00
|
|
|
typedef struct
|
|
|
|
{
|
2014-01-19 07:57:54 -05:00
|
|
|
unsigned long flags;
|
2014-03-22 16:04:19 -04:00
|
|
|
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;
|
2014-01-19 07:57:54 -05:00
|
|
|
} textbox;
|
|
|
|
|
|
|
|
|
2014-03-22 16:04:19 -04:00
|
|
|
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,
|
2014-01-19 07:57:54 -05:00
|
|
|
} TextboxFlags;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-22 16:04:19 -04:00
|
|
|
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 );
|
2014-01-19 07:57:54 -05:00
|
|
|
|
2014-03-22 16:04:19 -04:00
|
|
|
void textbox_free ( textbox *tb );
|
2014-01-19 07:57:54 -05:00
|
|
|
|
2014-03-22 16:04:19 -04:00
|
|
|
void textbox_font ( textbox *tb, char *font, char *fg, char *bg );
|
2014-01-19 07:57:54 -05:00
|
|
|
|
2014-03-22 16:04:19 -04:00
|
|
|
void textbox_text ( textbox *tb, char *text );
|
|
|
|
void textbox_show ( textbox *tb );
|
|
|
|
void textbox_draw ( textbox *tb );
|
2014-01-19 07:57:54 -05:00
|
|
|
|
2014-03-22 16:04:19 -04:00
|
|
|
int textbox_keypress ( textbox *tb, XEvent *ev );
|
2014-01-19 07:57:54 -05:00
|
|
|
|
2014-03-22 16:04:19 -04:00
|
|
|
void textbox_cursor_end ( textbox *tb );
|
2014-05-14 13:51:48 -04:00
|
|
|
void textbox_move (textbox *tb, int x, int y);
|
2014-05-14 14:56:38 -04:00
|
|
|
void textbox_hide ( textbox *tb );
|
2014-01-19 07:57:54 -05:00
|
|
|
#endif //__TEXTBOX_H__
|