Files
amiwm-neo/libami/gadget_textinput.h
Adrian Chadd 0e5c81f6e3 [libami] add button, textbox and textinput from requestchoice/executecmd
Marcus had written up workbench style widgets inside the two external
helper programs requestchoice and executecmd.  This ports the code over
to libami.

Note that there isn't a generic gadget or collection of gadgets yet -
this is purely a refactor of the code, and the upcoming commit that
migrates requestchoice/executecmd over to use them just handles them
directly via xlib like they have always done.
2022-04-09 17:33:21 -07:00

47 lines
1.2 KiB
C

#ifndef __LIBAMI__GADGET_TEXTINPUT_H__
#define __LIBAMI__GADGET_TEXTINPUT_H__
struct gadget_textinput {
Display *dpy;
struct DrawInfo *dri;
Window w;
GC gc;
#ifdef USE_FONTSETS
XIC xic;
#endif
int x;
int y;
int width;
int height;
/* XXX TODO: create a string representation here already */
char *buf;
int len;
int size;
/* Position of textbox cursor and rendering start */
int cur_pos;
int left_pos;
int cur_x;
int selected;
int crlf;
};
extern struct gadget_textinput * gadget_textinput_create(Display *dpy,
struct DrawInfo *dri, GC gc, Window mainwin,
int x, int y, int width, int height, int text_size);
#ifdef USE_FONTSETS
extern void gadget_textinput_set_xic(struct gadget_textinput *g, XIC xic);
#endif
extern void gadget_textinput_repaint(struct gadget_textinput *b);
extern void gadget_textinput_free(struct gadget_textinput *b);
extern void gadget_textinput_keyevent(struct gadget_textinput *b,
XKeyEvent *e);
extern void gadget_textinput_buttonevent(struct gadget_textinput *b,
XButtonEvent *e);
extern void gadget_textinput_selected(struct gadget_textinput *b, int selected);
extern int gadget_textinput_crlf(struct gadget_textinput *b);
#endif /* __LIBAMI__GADGET_TEXTINPUT_H__ */