Warning cleanups - api.
This commit is contained in:
parent
bb351a0665
commit
919dc4c069
285
api/epplet.c
285
api/epplet.c
|
@ -98,7 +98,7 @@ static void (*focusin_func) (void *data, Window win) = NULL;
|
|||
static void (*focusout_func) (void *data, Window win) = NULL;
|
||||
static int (*delete_func) (void *data, Window win) = NULL;
|
||||
static void (*event_func) (void *data, XEvent * ev) = NULL;
|
||||
static void (*comms_func) (void *data, char *s) = NULL;
|
||||
static void (*comms_func) (void *data, const char *s) = NULL;
|
||||
static void (*child_func) (void *data, int pid, int exit_code) = NULL;
|
||||
|
||||
/* For Keeping a list of windows owned by the epplet, to loop through and
|
||||
|
@ -108,8 +108,8 @@ static void Epplet_unregister_window(Epplet_window win);
|
|||
static void Epplet_window_destroy_children(Epplet_window win);
|
||||
static Epplet_window Epplet_window_get_from_Window(Window win);
|
||||
static Window Epplet_internal_create_window(int w, int h,
|
||||
char *title, char vertical,
|
||||
char decorate);
|
||||
const char *title,
|
||||
char vertical, char decorate);
|
||||
static void remember_stuff(void *data);
|
||||
|
||||
#define MWM_HINTS_DECORATIONS (1L << 1)
|
||||
|
@ -148,7 +148,7 @@ static void CommsSetup(void);
|
|||
static void CommsFindCommsWindow(void);
|
||||
static void CommsHandleDestroy(Window win);
|
||||
static int CommsHandlePropertyNotify(XEvent * ev);
|
||||
static void ECommsSend(char *s);
|
||||
static void ECommsSend(const char *s);
|
||||
static char *ECommsGet(XEvent * ev);
|
||||
static char *ECommsWaitForMessage(void);
|
||||
|
||||
|
@ -156,9 +156,9 @@ static void Epplet_handle_timer(void);
|
|||
static ETimer *Epplet_get_first(void);
|
||||
static void Epplet_handle_event(XEvent * ev);
|
||||
static Bool ev_check(Display * d, XEvent * ev, XPointer p);
|
||||
static char *win_name = NULL;
|
||||
static char *win_version = NULL;
|
||||
static char *win_info = NULL;
|
||||
static const char *win_name = NULL;
|
||||
static const char *win_version = NULL;
|
||||
static const char *win_info = NULL;
|
||||
|
||||
static void Epplet_event(Epplet_gadget gadget, XEvent * ev);
|
||||
static void Epplet_add_gad(Epplet_gadget gadget);
|
||||
|
@ -182,9 +182,9 @@ static void Epplet_textbox_handle_keyevent(XEvent * ev,
|
|||
Epplet_gadget g);
|
||||
static void Epplet_refresh_backgrounds(void);
|
||||
static void Epplet_textbox_textsize(Epplet_gadget gadget, int *w,
|
||||
int *h, char *s);
|
||||
int *h, const char *s);
|
||||
int Epplet_textbox_spacesize(Epplet_gadget gadget);
|
||||
static void Epplet_find_instance(char *name);
|
||||
static void Epplet_find_instance(const char *name);
|
||||
|
||||
typedef struct gad_general
|
||||
{
|
||||
|
@ -410,7 +410,7 @@ HandleXError(Display * d, XErrorEvent * ev)
|
|||
#endif
|
||||
|
||||
void
|
||||
Epplet_send_ipc(char *s)
|
||||
Epplet_send_ipc(const char *s)
|
||||
{
|
||||
ECommsSend(s);
|
||||
}
|
||||
|
@ -422,9 +422,8 @@ Epplet_wait_for_ipc(void)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_Init(char *name,
|
||||
char *version,
|
||||
char *info, int w, int h, int argc, char **argv, char vertical)
|
||||
Epplet_Init(const char *name, const char *version, const char *info,
|
||||
int w, int h, int argc, char **argv, char vertical)
|
||||
{
|
||||
struct sigaction sa;
|
||||
char s[1024];
|
||||
|
@ -506,7 +505,7 @@ Epplet_Init(char *name,
|
|||
XStoreName(disp, mainwin->win, epplet_name);
|
||||
xch = XAllocClassHint();
|
||||
xch->res_name = epplet_name;
|
||||
xch->res_class = "Epplet";
|
||||
xch->res_class = (char *)"Epplet";
|
||||
XSetClassHint(disp, mainwin->win, xch);
|
||||
XFree(xch);
|
||||
/* set the size hints */
|
||||
|
@ -617,7 +616,7 @@ Epplet_Init(char *name,
|
|||
}
|
||||
|
||||
static Window
|
||||
Epplet_internal_create_window(int w, int h, char *title, char vertical,
|
||||
Epplet_internal_create_window(int w, int h, const char *title, char vertical,
|
||||
char decorate)
|
||||
{
|
||||
XSetWindowAttributes attr;
|
||||
|
@ -664,7 +663,7 @@ Epplet_internal_create_window(int w, int h, char *title, char vertical,
|
|||
XStoreName(disp, ret->win, title);
|
||||
xch = XAllocClassHint();
|
||||
xch->res_name = epplet_name;
|
||||
xch->res_class = "Epplet_window";
|
||||
xch->res_class = (char *)"Epplet_window";
|
||||
XSetClassHint(disp, ret->win, xch);
|
||||
XFree(xch);
|
||||
/* set the size hints */
|
||||
|
@ -712,19 +711,19 @@ Epplet_internal_create_window(int w, int h, char *title, char vertical,
|
|||
}
|
||||
|
||||
Window
|
||||
Epplet_create_window(int w, int h, char *title, char vertical)
|
||||
Epplet_create_window(int w, int h, const char *title, char vertical)
|
||||
{
|
||||
return Epplet_internal_create_window(w, h, title, vertical, 1);
|
||||
}
|
||||
|
||||
Window
|
||||
Epplet_create_window_borderless(int w, int h, char *title, char vertical)
|
||||
Epplet_create_window_borderless(int w, int h, const char *title, char vertical)
|
||||
{
|
||||
return Epplet_internal_create_window(w, h, title, vertical, 0);
|
||||
}
|
||||
|
||||
Window
|
||||
Epplet_create_window_config(int w, int h, char *title,
|
||||
Epplet_create_window_config(int w, int h, const char *title,
|
||||
void (*ok_func) (void *data),
|
||||
void *ok_data, void (*apply_func) (void *data),
|
||||
void *apply_data,
|
||||
|
@ -856,7 +855,6 @@ Epplet_window_destroy(Window newwin)
|
|||
XMaskEvent(disp, StructureNotifyMask, &ev);
|
||||
|
||||
free(win);
|
||||
win = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -974,7 +972,7 @@ Epplet_handle_delete_event(Window xwin)
|
|||
}
|
||||
|
||||
static void
|
||||
remember_stuff(void *data)
|
||||
remember_stuff(void *data __UNUSED__)
|
||||
{
|
||||
Epplet_remember();
|
||||
}
|
||||
|
@ -1041,7 +1039,7 @@ Epplet_get_main_window(void)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_imageclass_apply(char *iclass, char *state, Window ww)
|
||||
Epplet_imageclass_apply(const char *iclass, const char *state, Window ww)
|
||||
{
|
||||
char s[1024];
|
||||
|
||||
|
@ -1051,8 +1049,8 @@ Epplet_imageclass_apply(char *iclass, char *state, Window ww)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_imageclass_paste(char *iclass, char *state, Window ww, int x, int y,
|
||||
int w, int h)
|
||||
Epplet_imageclass_paste(const char *iclass, const char *state, Window ww,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
Pixmap p = 0, m = 0;
|
||||
char s[1024], *msg;
|
||||
|
@ -1079,7 +1077,7 @@ Epplet_imageclass_paste(char *iclass, char *state, Window ww, int x, int y,
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_imageclass_get_pixmaps(char *iclass, char *state, Pixmap * p,
|
||||
Epplet_imageclass_get_pixmaps(const char *iclass, const char *state, Pixmap * p,
|
||||
Pixmap * m, int w, int h)
|
||||
{
|
||||
Pixmap pp = 0, mm = 0;
|
||||
|
@ -1124,8 +1122,8 @@ Epplet_imageclass_get_pixmaps(char *iclass, char *state, Pixmap * p,
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_textclass_draw(char *iclass, char *state, Window ww, int x, int y,
|
||||
char *txt)
|
||||
Epplet_textclass_draw(const char *iclass, const char *state, Window ww, int x,
|
||||
int y, const char *txt)
|
||||
{
|
||||
char s[1024];
|
||||
|
||||
|
@ -1135,7 +1133,7 @@ Epplet_textclass_draw(char *iclass, char *state, Window ww, int x, int y,
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_textclass_get_size(char *iclass, int *w, int *h, char *txt)
|
||||
Epplet_textclass_get_size(const char *iclass, int *w, int *h, const char *txt)
|
||||
{
|
||||
char s[1024], *msg = NULL;
|
||||
|
||||
|
@ -1266,7 +1264,8 @@ Epplet_register_event_handler(void (*func)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_register_comms_handler(void (*func) (void *data, char *s), void *data)
|
||||
Epplet_register_comms_handler(void (*func) (void *data, const char *s),
|
||||
void *data)
|
||||
{
|
||||
comms_data = data;
|
||||
comms_func = func;
|
||||
|
@ -1449,7 +1448,8 @@ Epplet_handle_event(XEvent * ev)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_timer(void (*func) (void *data), void *data, double in, char *name)
|
||||
Epplet_timer(void (*func) (void *data), void *data, double in,
|
||||
const char *name)
|
||||
{
|
||||
ETimer *et, *ptr, *pptr;
|
||||
double tally;
|
||||
|
@ -1499,7 +1499,7 @@ Epplet_timer(void (*func) (void *data), void *data, double in, char *name)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_remove_timer(char *name)
|
||||
Epplet_remove_timer(const char *name)
|
||||
{
|
||||
ETimer *et, *ptr, *pptr;
|
||||
|
||||
|
@ -1528,7 +1528,7 @@ Epplet_remove_timer(char *name)
|
|||
}
|
||||
|
||||
void *
|
||||
Epplet_timer_get_data(char *name)
|
||||
Epplet_timer_get_data(const char *name)
|
||||
{
|
||||
ETimer *et, *ptr;
|
||||
|
||||
|
@ -1813,7 +1813,7 @@ CommsFindCommsWindow(void)
|
|||
}
|
||||
|
||||
static void
|
||||
ECommsSend(char *s)
|
||||
ECommsSend(const char *s)
|
||||
{
|
||||
char ss[21];
|
||||
int i, j, k, len;
|
||||
|
@ -1849,15 +1849,13 @@ ECommsSend(char *s)
|
|||
}
|
||||
|
||||
static Bool
|
||||
ev_check(Display * d, XEvent * ev, XPointer p)
|
||||
ev_check(Display * d __UNUSED__, XEvent * ev, XPointer p __UNUSED__)
|
||||
{
|
||||
if (((ev->type == ClientMessage) && (ev->xclient.window == my_win)) ||
|
||||
((ev->type == DestroyNotify) &&
|
||||
(ev->xdestroywindow.window == comms_win)))
|
||||
return True;
|
||||
return False;
|
||||
d = NULL;
|
||||
p = NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -1971,7 +1969,7 @@ Epplet_find_file(const char *name)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_paste_image(char *image, Window ww, int x, int y)
|
||||
Epplet_paste_image(const char *image, Window ww, int x, int y)
|
||||
{
|
||||
Imlib_Image *im;
|
||||
|
||||
|
@ -1986,7 +1984,8 @@ Epplet_paste_image(char *image, Window ww, int x, int y)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_paste_image_size(char *image, Window ww, int x, int y, int w, int h)
|
||||
Epplet_paste_image_size(const char *image, Window ww, int x, int y, int w,
|
||||
int h)
|
||||
{
|
||||
Imlib_Image *im;
|
||||
|
||||
|
@ -2074,11 +2073,11 @@ Epplet_gadget_get_height(Epplet_gadget gad)
|
|||
int
|
||||
Epplet_gadget_get_type(Epplet_gadget gad)
|
||||
{
|
||||
return (gad ? GADGET_GET_TYPE(gad) : -1);
|
||||
return gad ? (int)GADGET_GET_TYPE(gad) : -1;
|
||||
}
|
||||
|
||||
Epplet_gadget
|
||||
Epplet_create_textbox(char *image, char *contents, int x, int y,
|
||||
Epplet_create_textbox(const char *image, const char *contents, int x, int y,
|
||||
int w, int h, char size, void (*func) (void *data),
|
||||
void *data)
|
||||
{
|
||||
|
@ -2135,7 +2134,7 @@ Epplet_create_textbox(char *image, char *contents, int x, int y,
|
|||
return (Epplet_gadget) g;
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
Epplet_textbox_contents(Epplet_gadget eg)
|
||||
{
|
||||
GadTextBox *g;
|
||||
|
@ -2163,7 +2162,7 @@ Epplet_reset_textbox(Epplet_gadget eg)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_textbox_insert(Epplet_gadget eg, char *new_contents)
|
||||
Epplet_textbox_insert(Epplet_gadget eg, const char *new_contents)
|
||||
{
|
||||
GadTextBox *g;
|
||||
int len, w, h;
|
||||
|
@ -2229,7 +2228,7 @@ Epplet_textbox_insert(Epplet_gadget eg, char *new_contents)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_change_textbox(Epplet_gadget eg, char *new_contents)
|
||||
Epplet_change_textbox(Epplet_gadget eg, const char *new_contents)
|
||||
{
|
||||
GadTextBox *g;
|
||||
int len, w, h;
|
||||
|
@ -2286,7 +2285,7 @@ void
|
|||
Epplet_draw_textbox(Epplet_gadget eg)
|
||||
{
|
||||
GadTextBox *g;
|
||||
char *state;
|
||||
const char *state;
|
||||
unsigned long gc_valuemask = 0;
|
||||
XGCValues gc_values;
|
||||
GC gc;
|
||||
|
@ -2418,8 +2417,8 @@ Epplet_draw_textbox(Epplet_gadget eg)
|
|||
int
|
||||
Epplet_textbox_spacesize(Epplet_gadget gadget)
|
||||
{
|
||||
char *s1 = "Z Z";
|
||||
char *s2 = "ZZ";
|
||||
const char *s1 = "Z Z";
|
||||
const char *s2 = "ZZ";
|
||||
int size1, size2, h;
|
||||
GadTextBox *g;
|
||||
|
||||
|
@ -2433,7 +2432,7 @@ Epplet_textbox_spacesize(Epplet_gadget gadget)
|
|||
}
|
||||
|
||||
static void
|
||||
Epplet_textbox_textsize(Epplet_gadget gadget, int *w, int *h, char *s)
|
||||
Epplet_textbox_textsize(Epplet_gadget gadget, int *w, int *h, const char *s)
|
||||
{
|
||||
GadTextBox *g;
|
||||
|
||||
|
@ -2462,10 +2461,8 @@ Epplet_textbox_handle_keyevent(XEvent * ev, Epplet_gadget gadget)
|
|||
int len, char_width, text_width, h;
|
||||
static char kbuf[20];
|
||||
KeySym keysym;
|
||||
XKeyEvent *kev;
|
||||
GadTextBox *g;
|
||||
|
||||
kev = (XKeyEvent *) ev;
|
||||
g = (GadTextBox *) gadget;
|
||||
|
||||
len = XLookupString(&ev->xkey, (char *)kbuf, sizeof(kbuf), &keysym, NULL);
|
||||
|
@ -2562,19 +2559,19 @@ Epplet_textbox_handle_keyevent(XEvent * ev, Epplet_gadget gadget)
|
|||
case XK_End:
|
||||
case XK_KP_End:
|
||||
{
|
||||
int w, h;
|
||||
int ww, hh;
|
||||
|
||||
if (g->contents && (g->cursor_pos != strlen(g->contents)))
|
||||
{
|
||||
g->cursor_pos = strlen(g->contents);
|
||||
|
||||
Epplet_textbox_textsize(g, &w, &h, g->contents);
|
||||
Epplet_textbox_textsize(g, &ww, &hh, g->contents);
|
||||
|
||||
g->x_offset = 0;
|
||||
if (w > g->w)
|
||||
g->x_offset -= w - g->w + CRSR_WDTH + 5;
|
||||
if (ww > g->w)
|
||||
g->x_offset -= ww - g->w + CRSR_WDTH + 5;
|
||||
|
||||
g->to_cursor = w;
|
||||
g->to_cursor = ww;
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
@ -2664,8 +2661,8 @@ Epplet_textbox_handle_keyevent(XEvent * ev, Epplet_gadget gadget)
|
|||
}
|
||||
|
||||
Epplet_gadget
|
||||
Epplet_create_button(char *label, char *image, int x, int y,
|
||||
int w, int h, char *std, Window parent,
|
||||
Epplet_create_button(const char *label, const char *image, int x, int y,
|
||||
int w, int h, const char *std, Window parent,
|
||||
Epplet_gadget pop_parent,
|
||||
void (*func) (void *data), void *data)
|
||||
{
|
||||
|
@ -2729,7 +2726,7 @@ Epplet_create_button(char *label, char *image, int x, int y,
|
|||
|
||||
/* A cut down version for text-only buttons */
|
||||
Epplet_gadget
|
||||
Epplet_create_text_button(char *label, int x, int y,
|
||||
Epplet_create_text_button(const char *label, int x, int y,
|
||||
int w, int h, void (*func) (void *data), void *data)
|
||||
{
|
||||
return Epplet_create_button(label, NULL, x, y, w, h, NULL, 0, NULL, func,
|
||||
|
@ -2738,7 +2735,7 @@ Epplet_create_text_button(char *label, int x, int y,
|
|||
|
||||
/* A cut down version for stdimage-only buttons */
|
||||
Epplet_gadget
|
||||
Epplet_create_std_button(char *std, int x, int y,
|
||||
Epplet_create_std_button(const char *std, int x, int y,
|
||||
void (*func) (void *data), void *data)
|
||||
{
|
||||
return Epplet_create_button(NULL, NULL, x, y, 12, 12, std, 0, NULL, func,
|
||||
|
@ -2747,7 +2744,7 @@ Epplet_create_std_button(char *std, int x, int y,
|
|||
|
||||
/* A cut down version for image-only buttons */
|
||||
Epplet_gadget
|
||||
Epplet_create_image_button(char *image, int x, int y,
|
||||
Epplet_create_image_button(const char *image, int x, int y,
|
||||
int w, int h, void (*func) (void *data), void *data)
|
||||
{
|
||||
return Epplet_create_button(NULL, image, x, y, w, h, NULL, 0, NULL, func,
|
||||
|
@ -2758,7 +2755,7 @@ void
|
|||
Epplet_draw_button(Epplet_gadget eg)
|
||||
{
|
||||
GadButton *g;
|
||||
char *state;
|
||||
const char *state;
|
||||
|
||||
g = (GadButton *) eg;
|
||||
if (g->hilited)
|
||||
|
@ -2898,7 +2895,7 @@ Epplet_draw_button(Epplet_gadget eg)
|
|||
}
|
||||
|
||||
Epplet_gadget
|
||||
Epplet_create_togglebutton(char *label, char *image, int x,
|
||||
Epplet_create_togglebutton(const char *label, const char *image, int x,
|
||||
int y, int w, int h, int *val,
|
||||
void (*func) (void *data), void *data)
|
||||
{
|
||||
|
@ -2944,7 +2941,7 @@ void
|
|||
Epplet_draw_togglebutton(Epplet_gadget eg)
|
||||
{
|
||||
GadToggleButton *g;
|
||||
char *state;
|
||||
const char *state;
|
||||
|
||||
g = (GadToggleButton *) eg;
|
||||
if (g->hilited)
|
||||
|
@ -3144,7 +3141,7 @@ void
|
|||
Epplet_draw_hslider(Epplet_gadget eg)
|
||||
{
|
||||
GadHSlider *g;
|
||||
char *state;
|
||||
const char *state;
|
||||
|
||||
g = (GadHSlider *) eg;
|
||||
if (g->hilited)
|
||||
|
@ -3223,7 +3220,7 @@ void
|
|||
Epplet_draw_vslider(Epplet_gadget eg)
|
||||
{
|
||||
GadVSlider *g;
|
||||
char *state;
|
||||
const char *state;
|
||||
|
||||
g = (GadVSlider *) eg;
|
||||
if (g->hilited)
|
||||
|
@ -3365,7 +3362,7 @@ Epplet_draw_vbar(Epplet_gadget eg)
|
|||
}
|
||||
|
||||
Epplet_gadget
|
||||
Epplet_create_image(int x, int y, int w, int h, char *image)
|
||||
Epplet_create_image(int x, int y, int w, int h, const char *image)
|
||||
{
|
||||
GadImage *g;
|
||||
|
||||
|
@ -3429,7 +3426,7 @@ Epplet_draw_image(Epplet_gadget eg, char un_only)
|
|||
}
|
||||
|
||||
Epplet_gadget
|
||||
Epplet_create_label(int x, int y, char *label, char size)
|
||||
Epplet_create_label(int x, int y, const char *label, char size)
|
||||
{
|
||||
GadLabel *g;
|
||||
|
||||
|
@ -3588,16 +3585,17 @@ Epplet_create_popup(void)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_add_popup_entry(Epplet_gadget gadget, char *label, char *pixmap,
|
||||
void (*func) (void *data), void *data)
|
||||
Epplet_add_popup_entry(Epplet_gadget gadget, const char *label,
|
||||
const char *pixmap, void (*func) (void *data),
|
||||
void *data)
|
||||
{
|
||||
Epplet_add_sized_popup_entry(gadget, label, pixmap, -1, -1, func, data);
|
||||
}
|
||||
|
||||
void
|
||||
Epplet_add_sized_popup_entry(Epplet_gadget gadget, char *label, char *pixmap,
|
||||
int w, int h, void (*func) (void *data),
|
||||
void *data)
|
||||
Epplet_add_sized_popup_entry(Epplet_gadget gadget, const char *label,
|
||||
const char *pixmap, int w, int h,
|
||||
void (*func) (void *data), void *data)
|
||||
{
|
||||
GadPopup *g;
|
||||
|
||||
|
@ -3793,13 +3791,13 @@ Epplet_pop_popup(Epplet_gadget gadget, Window ww)
|
|||
}
|
||||
else
|
||||
{
|
||||
int rw, rh, dd, x, y;
|
||||
int rw, rh, rr, x, y;
|
||||
Window dw;
|
||||
unsigned int b, d;
|
||||
|
||||
XGetGeometry(disp, root, &dw, &x, &y,
|
||||
(unsigned int *)&rw, (unsigned int *)&rh, &b, &d);
|
||||
XQueryPointer(disp, root, &dw, &dw, &dd, &dd, &x, &y, &b);
|
||||
XQueryPointer(disp, root, &dw, &dw, &rr, &rr, &x, &y, &b);
|
||||
g->x = x - (g->w / 2);
|
||||
g->y = y - 8;
|
||||
if (g->x < 0)
|
||||
|
@ -3816,8 +3814,9 @@ Epplet_pop_popup(Epplet_gadget gadget, Window ww)
|
|||
}
|
||||
|
||||
Epplet_gadget
|
||||
Epplet_create_popupbutton(char *label, char *image, int x,
|
||||
int y, int w, int h, char *std, Epplet_gadget popup)
|
||||
Epplet_create_popupbutton(const char *label, const char *image, int x,
|
||||
int y, int w, int h, const char *std,
|
||||
Epplet_gadget popup)
|
||||
{
|
||||
GadPopupButton *g;
|
||||
XSetWindowAttributes attr;
|
||||
|
@ -3869,7 +3868,7 @@ void
|
|||
Epplet_draw_popupbutton(Epplet_gadget eg)
|
||||
{
|
||||
GadPopupButton *g;
|
||||
char *state;
|
||||
const char *state;
|
||||
|
||||
GADGET_CONFIRM_TYPE(eg, E_POPUPBUTTON);
|
||||
g = (GadPopupButton *) eg;
|
||||
|
@ -3978,7 +3977,7 @@ Epplet_change_popbutton_popup(Epplet_gadget gadget, Epplet_gadget popup)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_change_popbutton_label(Epplet_gadget gadget, char *label)
|
||||
Epplet_change_popbutton_label(Epplet_gadget gadget, const char *label)
|
||||
{
|
||||
GadPopupButton *g;
|
||||
GadGeneral *gg;
|
||||
|
@ -3999,7 +3998,7 @@ Epplet_change_popbutton_label(Epplet_gadget gadget, char *label)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_change_image(Epplet_gadget gadget, int w, int h, char *image)
|
||||
Epplet_change_image(Epplet_gadget gadget, int w, int h, const char *image)
|
||||
{
|
||||
GadImage *g;
|
||||
GadGeneral *gg;
|
||||
|
@ -4018,7 +4017,7 @@ Epplet_change_image(Epplet_gadget gadget, int w, int h, char *image)
|
|||
|
||||
void
|
||||
Epplet_move_change_image(Epplet_gadget gadget, int x, int y, int w, int h,
|
||||
char *image)
|
||||
const char *image)
|
||||
{
|
||||
GadImage *g;
|
||||
GadGeneral *gg;
|
||||
|
@ -4039,7 +4038,7 @@ Epplet_move_change_image(Epplet_gadget gadget, int x, int y, int w, int h,
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_change_label(Epplet_gadget gadget, char *label)
|
||||
Epplet_change_label(Epplet_gadget gadget, const char *label)
|
||||
{
|
||||
GadLabel *g;
|
||||
GadGeneral *gg;
|
||||
|
@ -4060,7 +4059,7 @@ Epplet_change_label(Epplet_gadget gadget, char *label)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_move_change_label(Epplet_gadget gadget, int x, int y, char *label)
|
||||
Epplet_move_change_label(Epplet_gadget gadget, int x, int y, const char *label)
|
||||
{
|
||||
GadLabel *g;
|
||||
GadGeneral *gg;
|
||||
|
@ -4907,17 +4906,11 @@ Epplet_gadget_hide(Epplet_gadget gadget)
|
|||
break;
|
||||
case E_IMAGE:
|
||||
{
|
||||
GadImage *g;
|
||||
|
||||
g = (GadImage *) gadget;
|
||||
Epplet_draw_image(gadget, 1);
|
||||
}
|
||||
break;
|
||||
case E_LABEL:
|
||||
{
|
||||
GadLabel *g;
|
||||
|
||||
g = (GadLabel *) gadget;
|
||||
Epplet_draw_label(gadget, 1);
|
||||
}
|
||||
break;
|
||||
|
@ -5032,17 +5025,11 @@ Epplet_gadget_show(Epplet_gadget gadget)
|
|||
break;
|
||||
case E_IMAGE:
|
||||
{
|
||||
GadImage *g;
|
||||
|
||||
g = (GadImage *) gadget;
|
||||
Epplet_draw_image(gadget, 0);
|
||||
}
|
||||
break;
|
||||
case E_LABEL:
|
||||
{
|
||||
GadLabel *g;
|
||||
|
||||
g = (GadLabel *) gadget;
|
||||
Epplet_draw_label(gadget, 0);
|
||||
}
|
||||
break;
|
||||
|
@ -5073,10 +5060,8 @@ void
|
|||
Epplet_gadget_move(Epplet_gadget gadget, int x, int y)
|
||||
{
|
||||
GadImage *g; /* Image is the lowest common denominator, sorta. */
|
||||
GadGeneral *gg;
|
||||
|
||||
g = (GadImage *) gadget;
|
||||
gg = (GadGeneral *) gadget;
|
||||
Epplet_gadget_draw(gadget, 1, 0);
|
||||
g->x = x;
|
||||
g->y = y;
|
||||
|
@ -5116,63 +5101,29 @@ Epplet_gadget_data_changed(Epplet_gadget gadget)
|
|||
gg = (GadGeneral *) gadget;
|
||||
if (!gg->visible)
|
||||
return;
|
||||
|
||||
switch (gg->type)
|
||||
{
|
||||
case E_HSLIDER:
|
||||
{
|
||||
GadHSlider *g;
|
||||
|
||||
g = (GadHSlider *) gadget;
|
||||
Epplet_draw_hslider(gadget);
|
||||
}
|
||||
Epplet_draw_hslider(gadget);
|
||||
break;
|
||||
case E_VSLIDER:
|
||||
{
|
||||
GadVSlider *g;
|
||||
|
||||
g = (GadVSlider *) gadget;
|
||||
Epplet_draw_vslider(gadget);
|
||||
}
|
||||
Epplet_draw_vslider(gadget);
|
||||
break;
|
||||
case E_TOGGLEBUTTON:
|
||||
{
|
||||
GadToggleButton *g;
|
||||
|
||||
g = (GadToggleButton *) gadget;
|
||||
Epplet_draw_togglebutton(gadget);
|
||||
}
|
||||
Epplet_draw_togglebutton(gadget);
|
||||
break;
|
||||
case E_IMAGE:
|
||||
{
|
||||
GadImage *g;
|
||||
|
||||
g = (GadImage *) gadget;
|
||||
Epplet_draw_image(gadget, 0);
|
||||
}
|
||||
Epplet_draw_image(gadget, 0);
|
||||
break;
|
||||
case E_LABEL:
|
||||
{
|
||||
GadLabel *g;
|
||||
|
||||
g = (GadLabel *) gadget;
|
||||
Epplet_draw_label(gadget, 0);
|
||||
}
|
||||
Epplet_draw_label(gadget, 0);
|
||||
break;
|
||||
case E_HBAR:
|
||||
{
|
||||
GadHBar *g;
|
||||
|
||||
g = (GadHBar *) gadget;
|
||||
Epplet_draw_hbar(gadget);
|
||||
}
|
||||
Epplet_draw_hbar(gadget);
|
||||
break;
|
||||
case E_VBAR:
|
||||
{
|
||||
GadVBar *g;
|
||||
|
||||
g = (GadVBar *) gadget;
|
||||
Epplet_draw_vbar(gadget);
|
||||
}
|
||||
Epplet_draw_vbar(gadget);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -5354,7 +5305,7 @@ Epplet_free_rgb_buf(RGB_buf buf)
|
|||
}
|
||||
|
||||
static void
|
||||
Epplet_handle_child(int num)
|
||||
Epplet_handle_child(int num __UNUSED__)
|
||||
{
|
||||
int status;
|
||||
pid_t pid;
|
||||
|
@ -5370,24 +5321,22 @@ Epplet_handle_child(int num)
|
|||
(*child_func) (child_data, pid, code);
|
||||
}
|
||||
}
|
||||
return;
|
||||
num = 0;
|
||||
}
|
||||
|
||||
int
|
||||
Epplet_run_command(char *cmd)
|
||||
Epplet_run_command(const char *cmd)
|
||||
{
|
||||
return system(cmd);
|
||||
}
|
||||
|
||||
char *
|
||||
Epplet_read_run_command(char *cmd)
|
||||
const char *
|
||||
Epplet_read_run_command(const char *cmd)
|
||||
{
|
||||
return (cmd);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
int
|
||||
Epplet_spawn_command(char *cmd)
|
||||
Epplet_spawn_command(const char *cmd)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
|
@ -5431,7 +5380,7 @@ Epplet_register_child_handler(void (*func)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_change_button_label(Epplet_gadget gadget, char *label)
|
||||
Epplet_change_button_label(Epplet_gadget gadget, const char *label)
|
||||
{
|
||||
GadButton *g;
|
||||
GadGeneral *gg;
|
||||
|
@ -5447,7 +5396,7 @@ Epplet_change_button_label(Epplet_gadget gadget, char *label)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_change_button_image(Epplet_gadget gadget, char *image)
|
||||
Epplet_change_button_image(Epplet_gadget gadget, const char *image)
|
||||
{
|
||||
GadButton *g;
|
||||
GadGeneral *gg;
|
||||
|
@ -5469,7 +5418,7 @@ Epplet_clear_window(Window ww)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_show_about(char *name)
|
||||
Epplet_show_about(const char *name __UNUSED__)
|
||||
{
|
||||
char s[1024];
|
||||
|
||||
|
@ -5478,7 +5427,7 @@ Epplet_show_about(char *name)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_dialog_ok(char *text)
|
||||
Epplet_dialog_ok(const char *text)
|
||||
{
|
||||
char *s;
|
||||
|
||||
|
@ -5495,7 +5444,7 @@ Epplet_dialog_ok(char *text)
|
|||
}
|
||||
|
||||
static void
|
||||
Epplet_find_instance(char *name)
|
||||
Epplet_find_instance(const char *name)
|
||||
{
|
||||
struct stat st;
|
||||
struct flock fl;
|
||||
|
@ -5526,12 +5475,12 @@ Epplet_find_instance(char *name)
|
|||
{
|
||||
if (mkdir(s, S_IRWXU) < 0)
|
||||
{
|
||||
char err[255];
|
||||
char buf[255];
|
||||
|
||||
Esnprintf(err, sizeof(err),
|
||||
Esnprintf(buf, sizeof(buf),
|
||||
"Unable to create epplet config directory %s -- %s.\n",
|
||||
s, strerror(errno));
|
||||
Epplet_dialog_ok(err);
|
||||
Epplet_dialog_ok(buf);
|
||||
epplet_instance = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -5545,12 +5494,12 @@ Epplet_find_instance(char *name)
|
|||
{
|
||||
if (mkdir(s, S_IRWXU) < 0)
|
||||
{
|
||||
char err[255];
|
||||
char buf[255];
|
||||
|
||||
Esnprintf(err, sizeof(err),
|
||||
Esnprintf(buf, sizeof(buf),
|
||||
"Unable to create epplet config directory %s -- %s.\n",
|
||||
s, strerror(errno));
|
||||
Epplet_dialog_ok(err);
|
||||
Epplet_dialog_ok(buf);
|
||||
epplet_instance = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -5787,7 +5736,7 @@ Epplet_clear_config(void)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_add_config(char *key, char *value)
|
||||
Epplet_add_config(const char *key, const char *value)
|
||||
{
|
||||
if (!key)
|
||||
return;
|
||||
|
@ -5809,14 +5758,14 @@ Epplet_add_config(char *key, char *value)
|
|||
config_dict->num_entries++;
|
||||
}
|
||||
|
||||
char *
|
||||
Epplet_query_config(char *key)
|
||||
const char *
|
||||
Epplet_query_config(const char *key)
|
||||
{
|
||||
int i;
|
||||
ConfigItem *ci;
|
||||
|
||||
if (!key)
|
||||
return ((char *)NULL);
|
||||
return NULL;
|
||||
for (i = 0; i < config_dict->num_entries; i++)
|
||||
{
|
||||
ci = &(config_dict->entries[i]);
|
||||
|
@ -5824,17 +5773,17 @@ Epplet_query_config(char *key)
|
|||
/* we've found the key */
|
||||
return (ci->value);
|
||||
}
|
||||
return ((char *)NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
Epplet_query_config_def(char *key, char *def)
|
||||
const char *
|
||||
Epplet_query_config_def(const char *key, const char *def)
|
||||
{
|
||||
int i;
|
||||
ConfigItem *ci;
|
||||
|
||||
if (!key)
|
||||
return (def);
|
||||
return def;
|
||||
for (i = 0; i < config_dict->num_entries; i++)
|
||||
{
|
||||
ci = &(config_dict->entries[i]);
|
||||
|
@ -5843,11 +5792,11 @@ Epplet_query_config_def(char *key, char *def)
|
|||
return (ci->value);
|
||||
}
|
||||
Epplet_add_config(key, def); /* Not found. Add the default. */
|
||||
return (def);
|
||||
return def;
|
||||
}
|
||||
|
||||
void
|
||||
Epplet_modify_config(char *key, char *value)
|
||||
Epplet_modify_config(const char *key, const char *value)
|
||||
{
|
||||
int i;
|
||||
ConfigItem *ci;
|
||||
|
@ -5881,7 +5830,7 @@ Epplet_modify_config(char *key, char *value)
|
|||
}
|
||||
|
||||
void
|
||||
Epplet_modify_multi_config(char *shortkey, char **values, int num)
|
||||
Epplet_modify_multi_config(const char *shortkey, char **values, int num)
|
||||
{
|
||||
int i, j, k, matches;
|
||||
char key[64], key2[64];
|
||||
|
@ -5942,7 +5891,7 @@ Epplet_modify_multi_config(char *shortkey, char **values, int num)
|
|||
}
|
||||
|
||||
char **
|
||||
Epplet_query_multi_config(char *shortkey, int *num)
|
||||
Epplet_query_multi_config(const char *shortkey, int *num)
|
||||
{
|
||||
char **result = NULL;
|
||||
char *s;
|
||||
|
|
287
api/epplet.h.in
287
api/epplet.h.in
|
@ -55,16 +55,16 @@ int Esnprintf(char *str, size_t count, const char *fmt, ...);
|
|||
typedef struct _etimer ETimer;
|
||||
typedef void *Epplet_gadget;
|
||||
typedef struct _rgb_buf
|
||||
{
|
||||
Imlib_Image *im;
|
||||
}
|
||||
{
|
||||
Imlib_Image *im;
|
||||
}
|
||||
*RGB_buf;
|
||||
|
||||
typedef struct _configitem
|
||||
{
|
||||
char *key;
|
||||
char *value;
|
||||
}
|
||||
{
|
||||
char *key;
|
||||
char *value;
|
||||
}
|
||||
ConfigItem;
|
||||
typedef enum gad_type
|
||||
{
|
||||
|
@ -91,7 +91,8 @@ typedef enum gad_type
|
|||
/* sized window. You also need to pass your argc and argv parameters your */
|
||||
/* main() function gets. vertical is a flag as to if the app is vertical. */
|
||||
/* Apps that are more horizontal than vertical should set this to 0. */
|
||||
void Epplet_Init(char *name, char *version, char *info, int w, int h,
|
||||
void Epplet_Init(const char *name, const char *version,
|
||||
const char *info, int w, int h,
|
||||
int argc, char **argv, char vertical);
|
||||
|
||||
/****************************************************************************/
|
||||
|
@ -121,17 +122,17 @@ Window Epplet_get_main_window(void);
|
|||
Display *Epplet_get_display(void);
|
||||
|
||||
/* Get locations and sizes of gadgets */
|
||||
int Epplet_gadget_get_x(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_y(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_width(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_height(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_type(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_x(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_y(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_width(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_height(Epplet_gadget gad);
|
||||
int Epplet_gadget_get_type(Epplet_gadget gad);
|
||||
|
||||
/****************************************************************************/
|
||||
/* IPC calls */
|
||||
/****************************************************************************/
|
||||
/* send the string "s" to Enlightenment */
|
||||
void Epplet_send_ipc(char *s);
|
||||
void Epplet_send_ipc(const char *s);
|
||||
|
||||
/* sit and wait for an IPc message - nothing happens whilst waiting no */
|
||||
/* timers run, no events or anything else is handled. */
|
||||
|
@ -140,27 +141,32 @@ char *Epplet_wait_for_ipc(void);
|
|||
/* take the imageclass called iclass in state state ("normal", "hilited", */
|
||||
/* "clicked") and set it as the backgorund pixmap to window ww and have */
|
||||
/* its shape mask be the shape of the window ww */
|
||||
void Epplet_imageclass_apply(char *iclass, char *state, Window ww);
|
||||
void Epplet_imageclass_apply(const char *iclass,
|
||||
const char *state, Window ww);
|
||||
|
||||
/* paste the imageclass iclass in state state in window ww at (x,y) at a */
|
||||
/* size of (w x h) */
|
||||
void Epplet_imageclass_paste(char *iclass, char *state, Window ww,
|
||||
int x, int y, int w, int h);
|
||||
void Epplet_imageclass_paste(const char *iclass,
|
||||
const char *state, Window ww, int x,
|
||||
int y, int w, int h);
|
||||
|
||||
/* return pixmaps of imageclass iclass in the state state and place the */
|
||||
/* pixmap and mask ID's in the Pixmaps Id's poitned to by p and m, and have */
|
||||
/* the pximaps be of size (w x h) */
|
||||
void Epplet_imageclass_get_pixmaps(char *iclass, char *state, Pixmap * p,
|
||||
void Epplet_imageclass_get_pixmaps(const char *iclass,
|
||||
const char *state, Pixmap * p,
|
||||
Pixmap * m, int w, int h);
|
||||
|
||||
/* draw the text class tclass in state state on window ww at x, y with the */
|
||||
/* text "txt" */
|
||||
void Epplet_textclass_draw(char *tclass, char *state, Window ww, int x,
|
||||
int y, char *txt);
|
||||
void Epplet_textclass_draw(const char *tclass, const char *state,
|
||||
Window ww, int x, int y,
|
||||
const char *txt);
|
||||
|
||||
/* get the size text for textclass tclass will be using the text "txt" and */
|
||||
/* return widht and height to the int's pointed to by e and h */
|
||||
void Epplet_textclass_get_size(char *tclass, int *w, int *h, char *txt);
|
||||
void Epplet_textclass_get_size(const char *tclass, int *w,
|
||||
int *h, const char *txt);
|
||||
|
||||
/* the epplet main loop - once you've set up and showed your epplet window */
|
||||
/* call this */
|
||||
|
@ -169,77 +175,88 @@ void Epplet_Loop(void);
|
|||
/* call the function func with data as its data param whenever an expose */
|
||||
/* happens and needs to be handled */
|
||||
void Epplet_register_expose_handler(void (*func)
|
||||
(void *data, Window win, int x, int y, int w, int h),
|
||||
(void *data, Window win,
|
||||
int x, int y, int w, int h),
|
||||
void *data);
|
||||
|
||||
/* call func whenever the epplet is moved */
|
||||
void Epplet_register_move_resize_handler(void (*func)
|
||||
(void *data, Window win, int x, int y, int w, int h),
|
||||
void *data);
|
||||
(void *data, Window win,
|
||||
int x, int y, int w,
|
||||
int h), void *data);
|
||||
|
||||
/* call func whenever a button is pressed */
|
||||
void Epplet_register_button_press_handler(void (*func)
|
||||
(void *data, Window win, int x, int y, int b),
|
||||
(void *data,
|
||||
Window win, int x,
|
||||
int y, int b),
|
||||
void *data);
|
||||
|
||||
/* call func whenever a button is released */
|
||||
void Epplet_register_button_release_handler(void (*func)
|
||||
(void *data, Window win, int x, int y, int b),
|
||||
(void *data,
|
||||
Window win, int x,
|
||||
int y, int b),
|
||||
void *data);
|
||||
|
||||
/* call func whenever a key is pressed (pass a string version of the key */
|
||||
/* pressed to the regsitsered function) */
|
||||
void Epplet_register_key_press_handler(void (*func)
|
||||
(void *data, Window win, char *key),
|
||||
void *data);
|
||||
(void *data, Window win,
|
||||
char *key), void *data);
|
||||
|
||||
/* call func whenever a key is released (pass a string version of the key */
|
||||
/* pressed to the regsitsered function) */
|
||||
void Epplet_register_key_release_handler(void (*func)
|
||||
(void *data, Window win, char *key),
|
||||
(void *data, Window win,
|
||||
char *key),
|
||||
void *data);
|
||||
|
||||
/* call func whenever a the mouse is moved in a window */
|
||||
void Epplet_register_mouse_motion_handler(void (*func)
|
||||
(void *data, Window win, int x, int y),
|
||||
void *data);
|
||||
(void *data,
|
||||
Window win, int x,
|
||||
int y), void *data);
|
||||
|
||||
/* call func whenever a the mouse enters a window */
|
||||
void Epplet_register_mouse_enter_handler(void (*func)
|
||||
(void *data, Window win),
|
||||
(void *data,
|
||||
Window win),
|
||||
void *data);
|
||||
|
||||
/* call func whenever a the mouse leaves a window */
|
||||
void Epplet_register_mouse_leave_handler(void (*func)
|
||||
(void *data, Window win),
|
||||
(void *data,
|
||||
Window win),
|
||||
void *data);
|
||||
|
||||
/* call func whenever focus is active on your epplet window */
|
||||
void Epplet_register_focus_in_handler(void (*func)
|
||||
(void *data, Window win),
|
||||
(void *data, Window win),
|
||||
void *data);
|
||||
|
||||
/* call func whenever leaves your epplet window */
|
||||
void Epplet_register_focus_out_handler(void (*func)
|
||||
(void *data, Window win),
|
||||
(void *data, Window win),
|
||||
void *data);
|
||||
|
||||
/* call func and pass a pointer to n XEvent on every event that happens */
|
||||
void Epplet_register_event_handler(void (*func)
|
||||
(void *data, XEvent * ev),
|
||||
(void *data, XEvent * ev),
|
||||
void *data);
|
||||
|
||||
/* call func and pass a string (that you dont have to free) with the IPC */
|
||||
/* message whenever e sends you an IPC message */
|
||||
void Epplet_register_comms_handler(void (*func)
|
||||
(void *data, char *s),
|
||||
(void *data, const char *s),
|
||||
void *data);
|
||||
|
||||
/* call func when a window is closed by the wm. This func must return a
|
||||
* value. Return 1 and the window will be destroyed for you, return 0 and it
|
||||
* will not */
|
||||
void Epplet_register_delete_event_handler(int (*func)
|
||||
(void *data, Window win),
|
||||
(void *data,
|
||||
Window win),
|
||||
void *data);
|
||||
|
||||
/****************************************************************************/
|
||||
|
@ -249,15 +266,15 @@ void Epplet_register_delete_event_handler(int (*func)
|
|||
/* run function func and pass data data to it in in seconds (in is double */
|
||||
/* so you can for exmaple use 0.5 to have that function called in 0.5 */
|
||||
/* seconds from now ). You also attach the name to the timeout of name */
|
||||
void Epplet_timer(void (*func) (void *data), void *data, double in,
|
||||
char *name);
|
||||
void Epplet_timer(void (*func) (void *data), void *data,
|
||||
double in, const char *name);
|
||||
|
||||
/* delete any timeout of name name in the queue. you should use unique */
|
||||
/* names for different timeouts in the queue */
|
||||
void Epplet_remove_timer(char *name);
|
||||
void Epplet_remove_timer(const char *name);
|
||||
|
||||
/* get the data passed to a timer */
|
||||
void *Epplet_timer_get_data(char *name);
|
||||
void *Epplet_timer_get_data(const char *name);
|
||||
|
||||
/* get the current time as a double (time is in seconds since Jan 1, 1970 */
|
||||
double Epplet_get_time(void);
|
||||
|
@ -276,43 +293,50 @@ double Epplet_get_time(void);
|
|||
/* unless you want a special parent (only buttons can be speically parented */
|
||||
/* and the function func si called whne the button is clicked and data is */
|
||||
/* passed to that function */
|
||||
Epplet_gadget Epplet_create_button(char *label, char *image, int x, int y,
|
||||
int w, int h, char *std, Window parent,
|
||||
Epplet_gadget Epplet_create_button(const char *label, const char *image,
|
||||
int x, int y, int w, int h,
|
||||
const char *std, Window parent,
|
||||
Epplet_gadget pop_parent,
|
||||
void (*func) (void *data), void *data);
|
||||
void (*func) (void *data), void *data);
|
||||
|
||||
/* A cut down version for text-only buttons */
|
||||
Epplet_gadget Epplet_create_text_button(char *label, int x, int y,
|
||||
Epplet_gadget Epplet_create_text_button(const char *label, int x, int y,
|
||||
int w, int h,
|
||||
void (*func) (void *data), void *data);
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
|
||||
/* A cut down version for std-image-only buttons */
|
||||
Epplet_gadget Epplet_create_std_button(char *std, int x, int y,
|
||||
void (*func) (void *data), void *data);
|
||||
Epplet_gadget Epplet_create_std_button(const char *std, int x, int y,
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
|
||||
/* A cut down version for image-only buttons */
|
||||
Epplet_gadget Epplet_create_image_button(char *image, int x, int y,
|
||||
Epplet_gadget Epplet_create_image_button(const char *image, int x, int y,
|
||||
int w, int h,
|
||||
void (*func) (void *data), void *data);
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
|
||||
/* create a textbox at coordinates (x, y), with 'image' as bg, 'contents' as
|
||||
* the default contents, w, h, and 'size' as the font size. When ENTER is
|
||||
* pressed in the textbox, 'func' is executed.
|
||||
* */
|
||||
Epplet_gadget Epplet_create_textbox(char *image, char *contents, int x,
|
||||
int y, int w, int h, char size,
|
||||
void (*func) (void *data),
|
||||
Epplet_gadget Epplet_create_textbox(const char *image,
|
||||
const char *contents, int x, int y,
|
||||
int w, int h, char size,
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
|
||||
/* Retrieve the current contents of the textbox */
|
||||
char *Epplet_textbox_contents(Epplet_gadget g);
|
||||
const char *Epplet_textbox_contents(Epplet_gadget g);
|
||||
|
||||
/* Reset the textbox */
|
||||
void Epplet_reset_textbox(Epplet_gadget eg);
|
||||
|
||||
/* Change the contents of a textbox */
|
||||
void Epplet_change_textbox(Epplet_gadget eg, char *new_contents);
|
||||
void Epplet_textbox_insert(Epplet_gadget eg, char *new_contents);
|
||||
void Epplet_change_textbox(Epplet_gadget eg,
|
||||
const char *new_contents);
|
||||
void Epplet_textbox_insert(Epplet_gadget eg,
|
||||
const char *new_contents);
|
||||
|
||||
/* create drawing area at (x,y) of size (w x h) */
|
||||
Epplet_gadget Epplet_create_drawingarea(int x, int y, int w, int h);
|
||||
|
@ -322,26 +346,32 @@ Epplet_gadget Epplet_create_drawingarea(int x, int y, int w, int h);
|
|||
/* max is the maximum value. max should always > min. the slider can move */
|
||||
/* by step units as a minimum step, and moves by jump whenever you click */
|
||||
/* either side of the slider. whenever the slider changed func is called */
|
||||
Epplet_gadget Epplet_create_hslider(int x, int y, int len, int min, int max,
|
||||
int step, int jump, int *val,
|
||||
void (*func) (void *data), void *data);
|
||||
Epplet_gadget Epplet_create_hslider(int x, int y, int len, int min,
|
||||
int max, int step, int jump, int *val,
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
|
||||
/* same as horizontal slider except vertical */
|
||||
Epplet_gadget Epplet_create_vslider(int x, int y, int len, int min, int max,
|
||||
int step, int jump, int *val,
|
||||
void (*func) (void *data), void *data);
|
||||
Epplet_gadget Epplet_create_vslider(int x, int y, int len, int min,
|
||||
int max, int step, int jump, int *val,
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
|
||||
/* create a button (like normal buttons) except it toggles the value */
|
||||
/* pointed to by val between 1 and 0. func is called whenever it changes */
|
||||
Epplet_gadget Epplet_create_togglebutton(char *label, char *pixmap, int x,
|
||||
int y, int w, int h, int *val,
|
||||
void (*func) (void *data),
|
||||
Epplet_gadget Epplet_create_togglebutton(const char *label,
|
||||
const char *image,
|
||||
int x, int y, int w, int h,
|
||||
int *val,
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
|
||||
/* creates a button just like normal button except it pops up the popup */
|
||||
/* when clicked */
|
||||
Epplet_gadget Epplet_create_popupbutton(char *label, char *image, int x,
|
||||
int y, int w, int h, char *std,
|
||||
Epplet_gadget Epplet_create_popupbutton(const char *label,
|
||||
const char *image,
|
||||
int x, int y, int w, int h,
|
||||
const char *std,
|
||||
Epplet_gadget popup);
|
||||
|
||||
/* creates an empty popup */
|
||||
|
@ -349,13 +379,18 @@ Epplet_gadget Epplet_create_popup(void);
|
|||
|
||||
/* adds an image file pixmaps or label to the popup gadget and calls */
|
||||
/* func when it is selected */
|
||||
void Epplet_add_popup_entry(Epplet_gadget gadget, char *label,
|
||||
char *pixmap,
|
||||
void (*func) (void *data), void *data);
|
||||
void Epplet_add_popup_entry(Epplet_gadget gadget,
|
||||
const char *label,
|
||||
const char *pixmap,
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
/* same as above, but specify a size */
|
||||
void Epplet_add_sized_popup_entry(Epplet_gadget gadget, char *label,
|
||||
char *pixmap, int w, int h,
|
||||
void (*func) (void *data), void *data);
|
||||
void Epplet_add_sized_popup_entry(Epplet_gadget gadget,
|
||||
const char *label,
|
||||
const char *pixmap,
|
||||
int w, int h,
|
||||
void (*func) (void *data),
|
||||
void *data);
|
||||
|
||||
/* remove an entry from a popup gadget */
|
||||
/* If entry num is positive or zero then it is relateive to elements */
|
||||
|
@ -363,7 +398,8 @@ void Epplet_add_sized_popup_entry(Epplet_gadget gadget, char *lab
|
|||
/* added to the list. If entry_num is negative then is is relateive to */
|
||||
/* elements most recently added, -1 is the elemet most recently */
|
||||
/* added to the popup */
|
||||
void Epplet_remove_popup_entry(Epplet_gadget gadget, int entry_num);
|
||||
void Epplet_remove_popup_entry(Epplet_gadget gadget,
|
||||
int entry_num);
|
||||
|
||||
/* get the number of entries in a popup */
|
||||
int Epplet_popup_entry_num(Epplet_gadget gadget);
|
||||
|
@ -373,11 +409,13 @@ void *Epplet_popup_entry_get_data(Epplet_gadget gadget,
|
|||
int entry_num);
|
||||
|
||||
/* creates an image widget of the file image at (x,y) of size (w x h) */
|
||||
Epplet_gadget Epplet_create_image(int x, int y, int w, int h, char *image);
|
||||
Epplet_gadget Epplet_create_image(int x, int y, int w, int h,
|
||||
const char *image);
|
||||
|
||||
/* puts a label widget of text label at (x,y) of size size. sizes are 0, 1 */
|
||||
/* 2 and 3. 0 is normal , 1 is tiny, 2 is medium and 3 is big. experiment */
|
||||
Epplet_gadget Epplet_create_label(int x, int y, char *label, char size);
|
||||
Epplet_gadget Epplet_create_label(int x, int y, const char *label,
|
||||
char size);
|
||||
|
||||
/* creates a horizontal progress bar at (x,y) of size (w x h) displaying the */
|
||||
/* value val points to that is a value of 0-100. dir is the direction 0 */
|
||||
|
@ -418,7 +456,8 @@ void Epplet_gadget_data_changed(Epplet_gadget gadget);
|
|||
/* Redraw a gadget. un_only should be set to 1 if you only want to "undraw"
|
||||
* the existing gadget. force should be 1 if you want to draw it even if it
|
||||
* is invisible. Beware that this could be a Bad Thing (tm). */
|
||||
void Epplet_gadget_draw(Epplet_gadget gadget, int un_only, int force);
|
||||
void Epplet_gadget_draw(Epplet_gadget gadget, int un_only,
|
||||
int force);
|
||||
|
||||
/* Redraw all gadgets. */
|
||||
void Epplet_redraw(void);
|
||||
|
@ -430,7 +469,7 @@ void Epplet_change_popbutton_popup(Epplet_gadget gadget,
|
|||
|
||||
/* change the label string contents of the gadget popbutton */
|
||||
void Epplet_change_popbutton_label(Epplet_gadget gadget,
|
||||
char *label);
|
||||
const char *label);
|
||||
|
||||
/* display the popup gadget above or below (dpeending where the window ww */
|
||||
/* is) the window ww, or if it's 0, deisplay where the pointer is */
|
||||
|
@ -438,17 +477,19 @@ void Epplet_pop_popup(Epplet_gadget gadget, Window ww);
|
|||
|
||||
/* change the image file and widht & height of the image gadget */
|
||||
void Epplet_change_image(Epplet_gadget gadget, int w, int h,
|
||||
char *image);
|
||||
const char *image);
|
||||
|
||||
/* change the x and y coordinates of the image gadget and change the image */
|
||||
void Epplet_move_change_image(Epplet_gadget gadget, int x, int y,
|
||||
int w, int h, char *image);
|
||||
int w, int h, const char *image);
|
||||
|
||||
/* change the label string contents of the gadget label */
|
||||
void Epplet_change_label(Epplet_gadget gadget, char *label);
|
||||
void Epplet_change_label(Epplet_gadget gadget,
|
||||
const char *label);
|
||||
|
||||
/* move the label to a new x/y and change the text too */
|
||||
void Epplet_move_change_label(Epplet_gadget gadget, int x, int y, char *label);
|
||||
void Epplet_move_change_label(Epplet_gadget gadget, int x, int y,
|
||||
const char *label);
|
||||
|
||||
/****************************************************************************/
|
||||
/* Some window creation functions for configs, questions, external displays */
|
||||
|
@ -457,17 +498,24 @@ void Epplet_move_change_label(Epplet_gadget gadget, int x, int y,
|
|||
|
||||
/* Create a window of width w, height h, with title title, using the themes
|
||||
* vertical (1), or horizontal (0) background */
|
||||
Window Epplet_create_window(int w, int h, char *title, char vertical);
|
||||
Window Epplet_create_window_borderless(int w, int h, char *title, char vertical);
|
||||
Window Epplet_create_window(int w, int h, const char *title,
|
||||
char vertical);
|
||||
Window Epplet_create_window_borderless(int w, int h,
|
||||
const char *title,
|
||||
char vertical);
|
||||
|
||||
/* Create a config window, of width w, height h, with title title, using the
|
||||
* functions listed for ok, apply and cancel. If you specify any of the
|
||||
* functions as null, the button won't be displayed. This means you can get
|
||||
* just Ok and Cancel by supplying NULL for apply_cb. */
|
||||
Window Epplet_create_window_config(int w, int h, char *title,
|
||||
void (*ok_func) (void *data), void *ok_data,
|
||||
void (*apply_func) (void *data), void *apply_data,
|
||||
void (*cancel_func) (void *data), void *cancel_data);
|
||||
Window Epplet_create_window_config(int w, int h, const char *title,
|
||||
void (*ok_func) (void *data),
|
||||
void *ok_data,
|
||||
void (*apply_func) (void *data),
|
||||
void *apply_data,
|
||||
void (*cancel_func) (void
|
||||
*data),
|
||||
void *cancel_data);
|
||||
|
||||
/* This is how you add gadgets to specific windows. When you create a
|
||||
* window, its context is automatically pushed for you. This means any
|
||||
|
@ -506,11 +554,12 @@ void Epplet_draw_outline(Window win, int x, int y, int w, int h,
|
|||
int Epplet_get_color(int r, int g, int b);
|
||||
|
||||
/* pasye the image file image onto window ww, at its original size at (x,y) */
|
||||
void Epplet_paste_image(char *image, Window ww, int x, int y);
|
||||
void Epplet_paste_image(const char *image, Window ww,
|
||||
int x, int y);
|
||||
|
||||
/* paste the image file image onto window ww at (x,y), at size (w x h) */
|
||||
void Epplet_paste_image_size(char *image, Window ww, int x, int y,
|
||||
int w, int h);
|
||||
void Epplet_paste_image_size(const char *image, Window ww,
|
||||
int x, int y, int w, int h);
|
||||
|
||||
/* syncronize all draws (guarantees they are done) */
|
||||
void Esync(void);
|
||||
|
@ -554,23 +603,27 @@ void Epplet_free_rgb_buf(RGB_buf buf);
|
|||
for each color. Defaults to 0. accum_alpha is the accumulation buffer
|
||||
for the alpha channel. defaults to 0. */
|
||||
GLXContext Epplet_bind_double_GL(Epplet_gadget da, int red,
|
||||
int blue, int green, int alpha, int aux_buffers, int depth,
|
||||
int stencil, int accum_red, int accum_green, int accum_blue,
|
||||
int accum_alpha);
|
||||
int blue, int green, int alpha,
|
||||
int aux_buffers, int depth,
|
||||
int stencil, int accum_red,
|
||||
int accum_green, int accum_blue,
|
||||
int accum_alpha);
|
||||
|
||||
/* The same as double buffer, except if this call succedes you are
|
||||
returned a single buffered context. */
|
||||
GLXContext Epplet_bind_single_GL(Epplet_gadget da, int red,
|
||||
int blue, int green, int alpha, int aux_buffers, int depth,
|
||||
int stencil, int accum_red, int accum_green, int accum_blue,
|
||||
int accum_alpha);
|
||||
int blue, int green, int alpha,
|
||||
int aux_buffers, int depth,
|
||||
int stencil, int accum_red,
|
||||
int accum_green, int accum_blue,
|
||||
int accum_alpha);
|
||||
|
||||
/* This is the "quick" way to define and bind a "good enough" context.
|
||||
The idea here is that this context should give you a basic RGB
|
||||
double buffer with minimal depth buffer, and NO other buffers. Its very
|
||||
basic, but its good enough for simple rendering with light sources
|
||||
and basic texture mapping. */
|
||||
GLXContext Epplet_default_bind_GL(Epplet_gadget da);
|
||||
GLXContext Epplet_default_bind_GL(Epplet_gadget da);
|
||||
|
||||
/* Destroy (unbind) a glx context. */
|
||||
void Epplet_unbind_GL(GLXContext cx);
|
||||
|
@ -580,21 +633,23 @@ void Epplet_unbind_GL(GLXContext cx);
|
|||
/* command execution/spawing wrappers to make life easy */
|
||||
|
||||
/* This runs the command passed to it and returns its exit code: */
|
||||
int Epplet_run_command(char *cmd);
|
||||
char *Epplet_read_run_command(char *cmd);
|
||||
int Epplet_spawn_command(char *cmd);
|
||||
int Epplet_run_command(const char *cmd);
|
||||
const char *Epplet_read_run_command(const char *cmd);
|
||||
int Epplet_spawn_command(const char *cmd);
|
||||
void Epplet_pause_spawned_command(int pid);
|
||||
void Epplet_unpause_spawned_command(int pid);
|
||||
void Epplet_kill_spawned_command(int pid);
|
||||
void Epplet_destroy_spawned_command(int pid);
|
||||
void Epplet_register_child_handler(void (*func)
|
||||
(void *data, int pid, int exit_code),
|
||||
void *data);
|
||||
void Epplet_change_button_label(Epplet_gadget gadget, char *label);
|
||||
void Epplet_change_button_image(Epplet_gadget gadget, char *image);
|
||||
(void *data, int pid,
|
||||
int exit_code), void *data);
|
||||
void Epplet_change_button_label(Epplet_gadget gadget,
|
||||
const char *label);
|
||||
void Epplet_change_button_image(Epplet_gadget gadget,
|
||||
const char *image);
|
||||
void Epplet_clear_window(Window ww);
|
||||
void Epplet_show_about(char *name);
|
||||
void Epplet_dialog_ok(char *text);
|
||||
void Epplet_show_about(const char *name);
|
||||
void Epplet_dialog_ok(const char *text);
|
||||
int Epplet_get_hslider_clicked(Epplet_gadget gadget);
|
||||
int Epplet_get_vslider_clicked(Epplet_gadget gadget);
|
||||
|
||||
|
@ -603,42 +658,46 @@ int Epplet_get_vslider_clicked(Epplet_gadget gadget);
|
|||
/****************************************************************************/
|
||||
/* Load the config file (initializes the config data). */
|
||||
void Epplet_load_config(void);
|
||||
|
||||
/* Load config data from a specific file, overriding any previous data. */
|
||||
void Epplet_load_config_file(const char *);
|
||||
|
||||
/* This returns the instance of this epplet. */
|
||||
int Epplet_get_instance(void);
|
||||
|
||||
/* Here you can query a config setting. */
|
||||
char *Epplet_query_config(char *key);
|
||||
const char *Epplet_query_config(const char *key);
|
||||
|
||||
/* Same as above, but returns the value of default instead of NULL if no */
|
||||
/* match is found. */
|
||||
char *Epplet_query_config_def(char *key, char *def);
|
||||
const char *Epplet_query_config_def(const char *key, const char *def);
|
||||
|
||||
/* Use this to change or add a config setting. */
|
||||
void Epplet_modify_config(char *key, char *value);
|
||||
void Epplet_modify_config(const char *key, const char *value);
|
||||
|
||||
/* If you *know* a key doesn't exist, use this to add it. It takes less */
|
||||
/* time than the above function. */
|
||||
void Epplet_add_config(char *key, char *value);
|
||||
void Epplet_add_config(const char *key, const char *value);
|
||||
|
||||
/* If you have a set of configurations that belong together and whose */
|
||||
/* number may change at runtime, use these: */
|
||||
|
||||
/* Here you can define multiple settings. 'num' is the number of strings */
|
||||
/* in the 'values' array. */
|
||||
void Epplet_modify_multi_config(char *key, char **values, int num);
|
||||
void Epplet_modify_multi_config(const char *key, char **values,
|
||||
int num);
|
||||
|
||||
/* This lets you query for multiple settings. */
|
||||
/* Note that you have to free the result that is returned here, in contrast */
|
||||
/* to Epplet_query_config(). The pointer to 'num' returns the number of */
|
||||
/* strings that are returned. */
|
||||
char **Epplet_query_multi_config(char *key, int *num);
|
||||
char **Epplet_query_multi_config(const char *key, int *num);
|
||||
|
||||
/* This lets you save your current config settings. This is done automati- */
|
||||
/* cally when you call Epplet_cleanup(), so you only need to call this when */
|
||||
/* you want to force the configs to disk for some reason. */
|
||||
void Epplet_save_config(void);
|
||||
|
||||
/* Delete the config information. */
|
||||
void Epplet_clear_config(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue