1999-10-13 08:14:42 -07:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* Enlightenment - The Window Manager that dares to do what others don't */
|
|
|
|
/*****************************************************************************/
|
2000-01-05 08:24:01 -08:00
|
|
|
/* Copyright (C) 1997 - 2000 Carsten Haitzler (The Rasterman) */
|
1999-10-13 08:14:42 -07:00
|
|
|
/* */
|
|
|
|
/* This program and utilites is free software; you can redistribute it */
|
|
|
|
/* and/or modify it under the terms of the License shown in COPYING */
|
|
|
|
/* */
|
|
|
|
/* This software is distributed in the hope that it will be useful, */
|
|
|
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
|
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xresource.h>
|
|
|
|
#include <X11/Xutil.h>
|
2006-03-31 14:56:17 -08:00
|
|
|
#include <Imlib2.h>
|
1999-10-13 08:14:42 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <pwd.h>
|
2006-04-15 12:39:32 -07:00
|
|
|
#include <ctype.h>
|
1999-10-13 08:14:42 -07:00
|
|
|
#include <sys/types.h>
|
1999-10-22 09:43:22 -07:00
|
|
|
#include <sys/stat.h>
|
1999-10-13 08:14:42 -07:00
|
|
|
|
2007-03-17 21:49:48 -07:00
|
|
|
#ifdef HAVE_GLX
|
2000-01-14 16:42:59 -08:00
|
|
|
#include <GL/glx.h>
|
|
|
|
#endif
|
|
|
|
|
1999-11-29 15:21:26 -08:00
|
|
|
#if defined(sun) && !defined(__sun__)
|
2000-01-14 18:30:43 -08:00
|
|
|
#define __sun__
|
1999-11-29 15:21:26 -08:00
|
|
|
#endif
|
|
|
|
|
2007-03-18 15:29:36 -07:00
|
|
|
#define Evsnprintf vsnprintf
|
|
|
|
#define Esnprintf snprintf
|
1999-11-10 15:37:53 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Data structures & primitives */
|
|
|
|
/****************************************************************************/
|
|
|
|
typedef struct _etimer ETimer;
|
2000-01-14 18:30:43 -08:00
|
|
|
typedef void *Epplet_gadget;
|
2021-08-26 11:13:56 -07:00
|
|
|
|
|
|
|
typedef struct {
|
2013-07-13 12:07:12 -07:00
|
|
|
Imlib_Image *im;
|
2021-08-26 11:13:56 -07:00
|
|
|
} *RGB_buf;
|
1999-10-13 08:14:42 -07:00
|
|
|
|
2021-08-26 11:13:56 -07:00
|
|
|
typedef struct {
|
2013-07-13 12:07:12 -07:00
|
|
|
char *key;
|
|
|
|
char *value;
|
2021-08-26 11:13:56 -07:00
|
|
|
} ConfigItem;
|
|
|
|
|
|
|
|
typedef enum {
|
2000-04-30 16:19:22 -07:00
|
|
|
E_BUTTON,
|
|
|
|
E_DRAWINGAREA,
|
|
|
|
E_TEXTBOX,
|
|
|
|
E_HSLIDER,
|
|
|
|
E_VSLIDER,
|
|
|
|
E_TOGGLEBUTTON,
|
|
|
|
E_POPUPBUTTON,
|
|
|
|
E_POPUP,
|
|
|
|
E_IMAGE,
|
|
|
|
E_LABEL,
|
|
|
|
E_HBAR,
|
|
|
|
E_VBAR
|
|
|
|
} GadType;
|
1999-10-22 09:43:22 -07:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Initialization call */
|
|
|
|
/****************************************************************************/
|
1999-10-22 09:43:22 -07:00
|
|
|
/* This sets everything up - connects to X, finds E, creates a window... */
|
|
|
|
/* Parameters are: a name, version, info, then width and height in w, h. */
|
|
|
|
/* width and height are multiples of 16 pixels so (2, 2) will make a 32x32 */
|
|
|
|
/* 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. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_Init(const char *name, const char *version,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *info, int w, int h,
|
2000-01-14 18:30:43 -08:00
|
|
|
int argc, char **argv, char vertical);
|
1999-10-22 09:43:22 -07:00
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
/* Cleanup call */
|
|
|
|
/****************************************************************************/
|
|
|
|
/* You HAVE to call this before exiting your epplet! */
|
|
|
|
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_cleanup(void);
|
1999-10-22 09:43:22 -07:00
|
|
|
|
2021-08-26 10:21:02 -07:00
|
|
|
/* Adjust priority */
|
|
|
|
EAPI void Epplet_adjust_priority(int nice);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* actualy display the app */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_show(void);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* ask E to remember stuff about it - you don't need to do this at startup */
|
|
|
|
/* or whenver the Epplet moves etc.- this is done for you, but if you need */
|
|
|
|
/* to for some special reason - call it */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_remember(void);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
2010-07-30 04:34:08 -07:00
|
|
|
/* if you dont want E to remember anything abotu you or start you up anymore */
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call this - this is a good call to make if you want to exit and never */
|
|
|
|
/* have yourself started up again by E */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_unremember(void);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* return the window id of the main epplet window */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Window Epplet_get_main_window(void);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* return the X display connection used */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Display *Epplet_get_display(void);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
2000-04-27 21:22:02 -07:00
|
|
|
/* Get locations and sizes of gadgets */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI int Epplet_gadget_get_x(Epplet_gadget gad);
|
|
|
|
EAPI int Epplet_gadget_get_y(Epplet_gadget gad);
|
|
|
|
EAPI int Epplet_gadget_get_width(Epplet_gadget gad);
|
|
|
|
EAPI int Epplet_gadget_get_height(Epplet_gadget gad);
|
|
|
|
EAPI int Epplet_gadget_get_type(Epplet_gadget gad);
|
2000-04-27 21:22:02 -07:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/****************************************************************************/
|
|
|
|
/* IPC calls */
|
|
|
|
/****************************************************************************/
|
|
|
|
/* send the string "s" to Enlightenment */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_send_ipc(const char *s);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* sit and wait for an IPc message - nothing happens whilst waiting no */
|
|
|
|
/* timers run, no events or anything else is handled. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI char *Epplet_wait_for_ipc(void);
|
1999-10-13 08:14:42 -07:00
|
|
|
|
|
|
|
/* 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 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_imageclass_apply(const char *iclass,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *state, Window ww);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* paste the imageclass iclass in state state in window ww at (x,y) at a */
|
|
|
|
/* size of (w x h) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_imageclass_paste(const char *iclass,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *state, Window ww, int x,
|
|
|
|
int y, int w, int h);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* 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) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_imageclass_get_pixmaps(const char *iclass,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *state, Pixmap * p,
|
2000-01-14 18:30:43 -08:00
|
|
|
Pixmap * m, int w, int h);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* draw the text class tclass in state state on window ww at x, y with the */
|
|
|
|
/* text "txt" */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_textclass_draw(const char *tclass, const char *state,
|
2013-07-13 12:07:12 -07:00
|
|
|
Window ww, int x, int y,
|
|
|
|
const char *txt);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* 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 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_textclass_get_size(const char *tclass, int *w,
|
2013-07-13 12:07:12 -07:00
|
|
|
int *h, const char *txt);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* the epplet main loop - once you've set up and showed your epplet window */
|
|
|
|
/* call this */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_Loop(void);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call the function func with data as its data param whenever an expose */
|
|
|
|
/* happens and needs to be handled */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_expose_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, Window win,
|
|
|
|
int x, int y, int w, int h),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever the epplet is moved */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_move_resize_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, Window win,
|
|
|
|
int x, int y, int w,
|
|
|
|
int h), void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever a button is pressed */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_button_press_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data,
|
|
|
|
Window win, int x,
|
|
|
|
int y, int b),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever a button is released */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_button_release_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data,
|
|
|
|
Window win, int x,
|
|
|
|
int y, int b),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever a key is pressed (pass a string version of the key */
|
|
|
|
/* pressed to the regsitsered function) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_key_press_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, Window win,
|
|
|
|
char *key), void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever a key is released (pass a string version of the key */
|
|
|
|
/* pressed to the regsitsered function) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_key_release_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, Window win,
|
|
|
|
char *key),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever a the mouse is moved in a window */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_mouse_motion_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data,
|
|
|
|
Window win, int x,
|
|
|
|
int y), void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever a the mouse enters a window */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_mouse_enter_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data,
|
|
|
|
Window win),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever a the mouse leaves a window */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_mouse_leave_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data,
|
|
|
|
Window win),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever focus is active on your epplet window */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_focus_in_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, Window win),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func whenever leaves your epplet window */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_focus_out_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, Window win),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func and pass a pointer to n XEvent on every event that happens */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_event_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, XEvent * ev),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* call func and pass a string (that you dont have to free) with the IPC */
|
|
|
|
/* message whenever e sends you an IPC message */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_comms_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, const char *s),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-12-12 08:01:50 -08:00
|
|
|
/* 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 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_register_delete_event_handler(int (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data,
|
|
|
|
Window win),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
1999-10-13 08:14:42 -07:00
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
/* Timer timeout functions - this lets you appear to have threads when you */
|
|
|
|
/* dont have any at all */
|
|
|
|
/****************************************************************************/
|
|
|
|
/* 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 */
|
2021-08-26 11:13:56 -07:00
|
|
|
EAPI void Epplet_timer(void (*func)(void *data), void *data,
|
2013-07-13 12:07:12 -07:00
|
|
|
double in, const char *name);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* delete any timeout of name name in the queue. you should use unique */
|
|
|
|
/* names for different timeouts in the queue */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_remove_timer(const char *name);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-20 15:23:29 -07:00
|
|
|
/* get the data passed to a timer */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void *Epplet_timer_get_data(const char *name);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* get the current time as a double (time is in seconds since Jan 1, 1970 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI double Epplet_get_time(void);
|
1999-10-13 08:14:42 -07:00
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
/* widgets available from the epplet api that use images from E to define */
|
|
|
|
/* their look. if you change themes in E all the widgets will change too */
|
|
|
|
/****************************************************************************/
|
|
|
|
/* create a button with either label label or image file image at (x,y) with */
|
|
|
|
/* with a size of (w x h), OR make a standard button of name std whihc is */
|
|
|
|
/* (12x12) pixels in size. Valid standard butotns are: "ARROW_UP", */
|
|
|
|
/* "ARROW_DOWN", "ARROW_LEFT", "ARROW_RIGHT", "PLAY", "STOP", "PAUSE", */
|
|
|
|
/* "PREVIOUS", "NEXT", "EJECT", "CLOSE", "FAST_FORWARD", "REWIND", "REPEAT", */
|
|
|
|
/* "SKIP", "HELP", "CONFIGURE" */
|
|
|
|
/* parent is the parent window - normally you only need to use 0 for this */
|
|
|
|
/* 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 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_button(const char *label, const char *image,
|
2013-07-13 12:07:12 -07:00
|
|
|
int x, int y, int w, int h,
|
|
|
|
const char *std, Window parent,
|
2000-01-14 18:30:43 -08:00
|
|
|
Epplet_gadget pop_parent,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data), void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
Sat Dec 04 22:46:57 GMT 1999
(gilbertt)
Added some less complex button functions, left the old one in place, so as
not to break anyone's lovely epplets :)
Here's what you got:
/* A cut down version for text-only buttons */
Epplet_gadget Epplet_create_text_button(char *label, int x, int y,
int w, int h,
void (*func) (void *data), void *data);
/* A cut down version for stdimage-only buttons */
Epplet_gadget Epplet_create_std_button(char *std, int x, int y,
int w, int h,
void (*func) (void *data), void *data);
Those window things in the original one should really be buried in the api,
and not public, but I won't break anyone's code. There ya go :)
SVN revision: 1497
1999-12-04 10:19:04 -08:00
|
|
|
/* A cut down version for text-only buttons */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_text_button(const char *label, int x, int y,
|
2000-01-14 18:30:43 -08:00
|
|
|
int w, int h,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data),
|
2013-07-13 12:07:12 -07:00
|
|
|
void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-12-04 10:33:47 -08:00
|
|
|
/* A cut down version for std-image-only buttons */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_std_button(const char *std, int x, int y,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data),
|
2013-07-13 12:07:12 -07:00
|
|
|
void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-12-04 10:33:47 -08:00
|
|
|
/* A cut down version for image-only buttons */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_image_button(const char *image, int x, int y,
|
2000-01-14 18:30:43 -08:00
|
|
|
int w, int h,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data),
|
2013-07-13 12:07:12 -07:00
|
|
|
void *data);
|
1999-11-09 10:25:10 -08:00
|
|
|
|
|
|
|
/* 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.
|
|
|
|
* */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_textbox(const char *image,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *contents, int x, int y,
|
|
|
|
int w, int h, char size,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data), void *data);
|
1999-11-09 10:25:10 -08:00
|
|
|
|
1999-12-20 07:41:23 -08:00
|
|
|
/* Retrieve the current contents of the textbox */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI const char *Epplet_textbox_contents(Epplet_gadget g);
|
1999-11-09 10:25:10 -08:00
|
|
|
|
1999-11-10 19:02:47 -08:00
|
|
|
/* Reset the textbox */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_reset_textbox(Epplet_gadget eg);
|
1999-11-10 19:02:47 -08:00
|
|
|
|
1999-11-11 19:46:39 -08:00
|
|
|
/* Change the contents of a textbox */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_change_textbox(Epplet_gadget eg,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *new_contents);
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_textbox_insert(Epplet_gadget eg,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *new_contents);
|
1999-11-11 19:46:39 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* create drawing area at (x,y) of size (w x h) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_drawingarea(int x, int y, int w, int h);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* create horizontal slider at x, y of length len. the minimum length is 9 */
|
|
|
|
/* pixels, and the width is always 8 pixels. min is the minimum value and */
|
|
|
|
/* 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 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_hslider(int x, int y, int len, int min,
|
2013-07-13 12:07:12 -07:00
|
|
|
int max, int step, int jump, int *val,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data), void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* same as horizontal slider except vertical */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_vslider(int x, int y, int len, int min,
|
2013-07-13 12:07:12 -07:00
|
|
|
int max, int step, int jump, int *val,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data), void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* 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 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_togglebutton(const char *label,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *image,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
int *val,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data),
|
2000-01-14 18:30:43 -08:00
|
|
|
void *data);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* creates a button just like normal button except it pops up the popup */
|
|
|
|
/* when clicked */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_popupbutton(const char *label,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *image,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
const char *std,
|
2000-01-14 18:30:43 -08:00
|
|
|
Epplet_gadget popup);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* creates an empty popup */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_popup(void);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* adds an image file pixmaps or label to the popup gadget and calls */
|
|
|
|
/* func when it is selected */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_add_popup_entry(Epplet_gadget gadget,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *label,
|
|
|
|
const char *pixmap,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data),
|
2013-07-13 12:07:12 -07:00
|
|
|
void *data);
|
Wed Apr 26 20:06:43 PDT 2000
(KainX)
First off, I altered the API library so that images would be properly scaled
before being drawn, rather than just assuming that the image size was okay. I
also added a function, Epplet_add_sized_popup_entry(), to allow for image
buttons with scaled images in a popup. Added popup support to E-Toolbox as
well. You can now have buttons that popup other buttons, and those other
buttons can have images or labels. So can the popup button itself, and the
popup button can be a "standard" button too. (The only caviat is that the
popup button must come before any of the buttons in the menu that it pops up;
no biggie.)
I've included a sample config file to demonstrate this. popup-sample.cfg
shows a single 1x1 up-arrow button which pops up several other buttons. Nice
and small; stays out of your way until you need it. :-)
I had to fix several issues with the epplet library to make some of this stuff
work, but nothing that violates the spirit of epplets. For example,
Epplet_gadget_show() now delays the actual drawing of the epplet gadgets until
the epplet itself is unhidden. And the image button sizing bug with the popup
stuff is fixed. Stuff like that. =)
I'm going to try to add a GUI configuration interface, as well as come up with
some more sophisticated sample configs. Just give me time.
Also, if you have a toolbox icon (preferably rendered) or can make one, please
let me know. E-Toolbox needs an icon. :-)
SVN revision: 2558
2000-04-26 22:25:45 -07:00
|
|
|
/* same as above, but specify a size */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_add_sized_popup_entry(Epplet_gadget gadget,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *label,
|
|
|
|
const char *pixmap,
|
|
|
|
int w, int h,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*func)(void *data),
|
2013-07-13 12:07:12 -07:00
|
|
|
void *data);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-23 03:15:45 -07:00
|
|
|
/* remove an entry from a popup gadget */
|
|
|
|
/* If entry num is positive or zero then it is relateive to elements */
|
1999-10-23 14:07:31 -07:00
|
|
|
/* least recently added to the popup gadget, zero is the element first */
|
|
|
|
/* added to the list. If entry_num is negative then is is relateive to */
|
|
|
|
/* elements most recently added, -1 is the elemet most recently */
|
2000-01-14 18:30:43 -08:00
|
|
|
/* added to the popup */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_remove_popup_entry(Epplet_gadget gadget,
|
2013-07-13 12:07:12 -07:00
|
|
|
int entry_num);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-28 16:30:09 -07:00
|
|
|
/* get the number of entries in a popup */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI int Epplet_popup_entry_num(Epplet_gadget gadget);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-28 16:30:09 -07:00
|
|
|
/* get the data of a callback of a popup entry */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void *Epplet_popup_entry_get_data(Epplet_gadget gadget,
|
2000-01-14 18:30:43 -08:00
|
|
|
int entry_num);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* creates an image widget of the file image at (x,y) of size (w x h) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_image(int x, int y, int w, int h,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *image);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* 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 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_label(int x, int y, const char *label,
|
2013-07-13 12:07:12 -07:00
|
|
|
char size);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* 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 */
|
|
|
|
/* indicates left to right and 1 indicates right to left */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_hbar(int x, int y, int w, int h, char dir,
|
2000-01-14 18:30:43 -08:00
|
|
|
int *val);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* creates a vertical progress bar - dir of 0 is top to bottom, 1 is bottom */
|
|
|
|
/* to top */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Epplet_gadget Epplet_create_vbar(int x, int y, int w, int h, char dir,
|
2000-01-14 18:30:43 -08:00
|
|
|
int *val);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* get the window id of the windopw to draw in in the drawing area */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Window Epplet_get_drawingarea_window(Epplet_gadget gadget);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* change the background to either verticla or horizontal for the epplet */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_background_properties(char vertical, Window win);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* destroy a gadget */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_gadget_destroy(Epplet_gadget gadget);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* hide a gadget */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_gadget_hide(Epplet_gadget gadget);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* show a gadget */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_gadget_show(Epplet_gadget gadget);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-12-16 13:17:27 -08:00
|
|
|
/* move a gadget */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_gadget_move(Epplet_gadget gadget, int x, int y);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-30 03:04:44 -07:00
|
|
|
/* get the callback data from a gadget */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void *Epplet_gadget_get_data(Epplet_gadget gadget);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-30 03:04:44 -07:00
|
|
|
/* if you chaged the value a gadget is pointing to call this on the gadget */
|
1999-10-13 08:14:42 -07:00
|
|
|
/* so it can update and redraw */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_gadget_data_changed(Epplet_gadget gadget);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-12-16 13:17:27 -08:00
|
|
|
/* Redraw a gadget. un_only should be set to 1 if you only want to "undraw"
|
2000-01-14 18:30:43 -08:00
|
|
|
* 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). */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_gadget_draw(Epplet_gadget gadget, int un_only,
|
2013-07-13 12:07:12 -07:00
|
|
|
int force);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-12-16 13:17:27 -08:00
|
|
|
/* Redraw all gadgets. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_redraw(void);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* change the popup a popbutton brings up and destroy the popup it currently */
|
|
|
|
/* brings up */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_change_popbutton_popup(Epplet_gadget gadget,
|
2000-01-14 18:30:43 -08:00
|
|
|
Epplet_gadget popup);
|
|
|
|
|
2000-06-29 16:54:24 -07:00
|
|
|
/* change the label string contents of the gadget popbutton */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_change_popbutton_label(Epplet_gadget gadget,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *label);
|
2000-06-29 16:54:24 -07:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* 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 */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_pop_popup(Epplet_gadget gadget, Window ww);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* change the image file and widht & height of the image gadget */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_change_image(Epplet_gadget gadget, int w, int h,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *image);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-12-16 13:17:27 -08:00
|
|
|
/* change the x and y coordinates of the image gadget and change the image */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_move_change_image(Epplet_gadget gadget, int x, int y,
|
2013-07-13 12:07:12 -07:00
|
|
|
int w, int h, const char *image);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* change the label string contents of the gadget label */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_change_label(Epplet_gadget gadget,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *label);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-12-16 13:17:27 -08:00
|
|
|
/* move the label to a new x/y and change the text too */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_move_change_label(Epplet_gadget gadget, int x, int y,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *label);
|
1999-10-13 08:14:42 -07:00
|
|
|
|
Wed Dec 01 23:05:13 GMT 1999
(gilbertt)
api changes.
Ok. I have added some functions to the api, they are not yet perfect, but
they compile cleanly and don't create any problems. Don't use them yet
though, the api may change.
Window Epplet_create_window(int w,int h,int x,int y,char *title);
void Epplet_window_show(Window win);
void Epplet_window_hide(Window win);
void Epplet_window_destroy(Window win);
void Epplet_window_switch_context(Window newwin);
void Epplet_window_reset_context(void);
All of these functions are in place and work. I have yet to add code to
handle delete_events. At the moment, if you close the dialog window, the
epplet exits. This is clearly not intended ;) I'll fix it tomorrow, its late
here now.
You can even switch context and add widgets to your new window with no
problems ;)
Other things to fix tomorrow is the event handling stuff which assumes only
one window will be around...
I am currently using E-ScreenSave as my test epplet for this code, as I know
only about 2 people use it ;) Try it to see the code working.
SVN revision: 1472
1999-12-01 11:12:33 -08:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Some window creation functions for configs, questions, external displays */
|
|
|
|
/* or other such things */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
Sat Dec 04 01:05:38 GMT 1999
(gilbertt)
So, say hello to Epplet_create_window_config.
It rules ;)
Here's the definition:
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);
You can picture what it does, and check it out in E-ScreenSave. (Press the
"Lock" button).
The cool thing is that if you supply NULL for any of the callbacks, that
button won't be added to the dialog. So, for an Ok, Cancel dialog, just
supply NULL for apply_func.
I have added explanation to the epplet.h file, and would like people to bang
at this now? I will set my epplets up to use the new functions fully over
the weekend. This will help me find any problems, as I haven't tested adding
every type of gadget to config windows yet, there may still be redraw issues
I missed.
Its pretty nice now though, and I have checked for memory leaks and bad
handling, please point out anything dubious you see. The api will become
more rich over the next few days, then it should stabilise.
Any feature suggestions, send 'em now :)
SVN revision: 1493
1999-12-03 12:56:49 -08:00
|
|
|
/* Create a window of width w, height h, with title title, using the themes
|
|
|
|
* vertical (1), or horizontal (0) background */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Window Epplet_create_window(int w, int h, const char *title,
|
2013-07-13 12:07:12 -07:00
|
|
|
char vertical);
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Window Epplet_create_window_borderless(int w, int h,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *title,
|
|
|
|
char vertical);
|
Sat Dec 04 01:05:38 GMT 1999
(gilbertt)
So, say hello to Epplet_create_window_config.
It rules ;)
Here's the definition:
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);
You can picture what it does, and check it out in E-ScreenSave. (Press the
"Lock" button).
The cool thing is that if you supply NULL for any of the callbacks, that
button won't be added to the dialog. So, for an Ok, Cancel dialog, just
supply NULL for apply_func.
I have added explanation to the epplet.h file, and would like people to bang
at this now? I will set my epplets up to use the new functions fully over
the weekend. This will help me find any problems, as I haven't tested adding
every type of gadget to config windows yet, there may still be redraw issues
I missed.
Its pretty nice now though, and I have checked for memory leaks and bad
handling, please point out anything dubious you see. The api will become
more rich over the next few days, then it should stabilise.
Any feature suggestions, send 'em now :)
SVN revision: 1493
1999-12-03 12:56:49 -08:00
|
|
|
|
|
|
|
/* 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. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI Window Epplet_create_window_config(int w, int h, const char *title,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*ok_func)(void *data),
|
2013-07-13 12:07:12 -07:00
|
|
|
void *ok_data,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*apply_func)(void *data),
|
2013-07-13 12:07:12 -07:00
|
|
|
void *apply_data,
|
2021-08-26 11:13:56 -07:00
|
|
|
void (*cancel_func)(void *data),
|
2013-07-13 12:07:12 -07:00
|
|
|
void *cancel_data);
|
Sat Dec 04 01:05:38 GMT 1999
(gilbertt)
So, say hello to Epplet_create_window_config.
It rules ;)
Here's the definition:
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);
You can picture what it does, and check it out in E-ScreenSave. (Press the
"Lock" button).
The cool thing is that if you supply NULL for any of the callbacks, that
button won't be added to the dialog. So, for an Ok, Cancel dialog, just
supply NULL for apply_func.
I have added explanation to the epplet.h file, and would like people to bang
at this now? I will set my epplets up to use the new functions fully over
the weekend. This will help me find any problems, as I haven't tested adding
every type of gadget to config windows yet, there may still be redraw issues
I missed.
Its pretty nice now though, and I have checked for memory leaks and bad
handling, please point out anything dubious you see. The api will become
more rich over the next few days, then it should stabilise.
Any feature suggestions, send 'em now :)
SVN revision: 1493
1999-12-03 12:56:49 -08:00
|
|
|
|
|
|
|
/* This is how you add gadgets to specific windows. When you create a
|
|
|
|
* window, its context is automatically pushed for you. This means any
|
|
|
|
* gadgets created with this window in context will go onto this window. In
|
|
|
|
* fact, until you either push another window onto the context, or pop this
|
|
|
|
* one back off, all created gadgets will go on here. A create_window should
|
|
|
|
* always be followed by a pop_context (after gadgets have been added). */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_window_push_context(Window newwin);
|
|
|
|
EAPI Window Epplet_window_pop_context(void);
|
Sat Dec 04 01:05:38 GMT 1999
(gilbertt)
So, say hello to Epplet_create_window_config.
It rules ;)
Here's the definition:
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);
You can picture what it does, and check it out in E-ScreenSave. (Press the
"Lock" button).
The cool thing is that if you supply NULL for any of the callbacks, that
button won't be added to the dialog. So, for an Ok, Cancel dialog, just
supply NULL for apply_func.
I have added explanation to the epplet.h file, and would like people to bang
at this now? I will set my epplets up to use the new functions fully over
the weekend. This will help me find any problems, as I haven't tested adding
every type of gadget to config windows yet, there may still be redraw issues
I missed.
Its pretty nice now though, and I have checked for memory leaks and bad
handling, please point out anything dubious you see. The api will become
more rich over the next few days, then it should stabilise.
Any feature suggestions, send 'em now :)
SVN revision: 1493
1999-12-03 12:56:49 -08:00
|
|
|
|
|
|
|
/* Show and hide an already created Window win. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_window_show(Window win);
|
|
|
|
EAPI void Epplet_window_hide(Window win);
|
Sat Dec 04 01:05:38 GMT 1999
(gilbertt)
So, say hello to Epplet_create_window_config.
It rules ;)
Here's the definition:
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);
You can picture what it does, and check it out in E-ScreenSave. (Press the
"Lock" button).
The cool thing is that if you supply NULL for any of the callbacks, that
button won't be added to the dialog. So, for an Ok, Cancel dialog, just
supply NULL for apply_func.
I have added explanation to the epplet.h file, and would like people to bang
at this now? I will set my epplets up to use the new functions fully over
the weekend. This will help me find any problems, as I haven't tested adding
every type of gadget to config windows yet, there may still be redraw issues
I missed.
Its pretty nice now though, and I have checked for memory leaks and bad
handling, please point out anything dubious you see. The api will become
more rich over the next few days, then it should stabilise.
Any feature suggestions, send 'em now :)
SVN revision: 1493
1999-12-03 12:56:49 -08:00
|
|
|
|
|
|
|
/* Destroy Window win. Any gadgets you have added to the window are
|
|
|
|
* destroyed also */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_window_destroy(Window win);
|
1999-10-13 08:14:42 -07:00
|
|
|
|
|
|
|
/****************************************************************************/
|
Sat Dec 04 01:05:38 GMT 1999
(gilbertt)
So, say hello to Epplet_create_window_config.
It rules ;)
Here's the definition:
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);
You can picture what it does, and check it out in E-ScreenSave. (Press the
"Lock" button).
The cool thing is that if you supply NULL for any of the callbacks, that
button won't be added to the dialog. So, for an Ok, Cancel dialog, just
supply NULL for apply_func.
I have added explanation to the epplet.h file, and would like people to bang
at this now? I will set my epplets up to use the new functions fully over
the weekend. This will help me find any problems, as I haven't tested adding
every type of gadget to config windows yet, there may still be redraw issues
I missed.
Its pretty nice now though, and I have checked for memory leaks and bad
handling, please point out anything dubious you see. The api will become
more rich over the next few days, then it should stabilise.
Any feature suggestions, send 'em now :)
SVN revision: 1493
1999-12-03 12:56:49 -08:00
|
|
|
/* basic line, filled rectangle and box outline drawing functions to make */
|
1999-10-13 08:14:42 -07:00
|
|
|
/* life easy */
|
|
|
|
/****************************************************************************/
|
|
|
|
/* draw a line from (x1, y1) to (x2, y2) in window win, in color (r, g, b) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_draw_line(Window win, int x1, int y1, int x2, int y2,
|
2000-01-14 18:30:43 -08:00
|
|
|
int r, int g, int b);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* draw a box at (x, y) of size (w x h) in window win, in color (r, g, b) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_draw_box(Window win, int x, int y, int w, int h,
|
1999-10-13 08:14:42 -07:00
|
|
|
int r, int g, int b);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
|
|
|
/* draw a box outline at (x, y) of size (w, h) in window win, in color (r, g, b) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_draw_outline(Window win, int x, int y, int w, int h,
|
2000-01-14 18:30:43 -08:00
|
|
|
int r, int g, int b);
|
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* get the pixel value for the RGB value (r, g, b) and return it */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI int Epplet_get_color(int r, int g, int b);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* pasye the image file image onto window ww, at its original size at (x,y) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_paste_image(const char *image, Window ww,
|
2013-07-13 12:07:12 -07:00
|
|
|
int x, int y);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* paste the image file image onto window ww at (x,y), at size (w x h) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_paste_image_size(const char *image, Window ww,
|
2013-07-13 12:07:12 -07:00
|
|
|
int x, int y, int w, int h);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* syncronize all draws (guarantees they are done) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Esync(void);
|
1999-10-13 08:14:42 -07:00
|
|
|
|
|
|
|
/****************************************************************************/
|
2000-01-14 18:30:43 -08:00
|
|
|
/* RGB buffer - for people who want to write raw RGB image data to a drawing */
|
1999-10-13 08:14:42 -07:00
|
|
|
/* area and want it rendered/dithered etc. for them */
|
|
|
|
/****************************************************************************/
|
|
|
|
/* create an RGB buffer of size (w x h) */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI RGB_buf Epplet_make_rgb_buf(int w, int h);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* get a pointer to the RGB data int he RGB buffer */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI unsigned char *Epplet_get_rgb_pointer(RGB_buf buf);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-10-13 08:14:42 -07:00
|
|
|
/* render & paste the RGB buffer to a window at x, y */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_paste_buf(RGB_buf buf, Window win, int x, int y);
|
2000-01-14 18:30:43 -08:00
|
|
|
|
1999-12-20 07:41:23 -08:00
|
|
|
/* free an RGB buffer */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_free_rgb_buf(RGB_buf buf);
|
1999-10-13 08:14:42 -07:00
|
|
|
|
2007-03-17 21:49:48 -07:00
|
|
|
#ifdef HAVE_GLX
|
2000-01-14 16:42:59 -08:00
|
|
|
/****************************************************************************/
|
|
|
|
/* OpenGL (GLX) calls. Use these functions to setup and destroy a OpenGL */
|
|
|
|
/* context for epplets. All glx contexts are linked to an epplet drawing */
|
2000-01-14 19:07:11 -08:00
|
|
|
/* area. You must have one set up first. Double buffer and a single front */
|
|
|
|
/* front buffer is available. You must also remember to glXSwapBuffers */
|
|
|
|
/* at the end of your Drawing cycle if you use the double buffer. */
|
2000-01-14 16:42:59 -08:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Create an Epplet glx context, pick the default visual, and bind it to a
|
2000-01-25 13:07:05 -08:00
|
|
|
window (obtained from drawingarea_window) with a double buffer.
|
|
|
|
You ONLY can request an RGBA space; color indexed is not available.
|
|
|
|
It sucks anyways :P. red, greem, blue are the minimum bit depths you
|
|
|
|
need. aux_buffers are the number of auxiliary buffers you need.
|
|
|
|
Normally this is 0. alpha is the minumum alpha depth you need. Used
|
|
|
|
for blending, ect. depth is the minimum DEPTH buffer you need. You
|
|
|
|
really do not want to ignore this, otherwise you'll end up with
|
|
|
|
really odd results. 8 is a very conservative number. Most modern
|
|
|
|
cards can do at least 16 bit, most can do 32 bits. stencil is the
|
|
|
|
number of stencil bitplanes needed. Defaults to 0. accum_red
|
|
|
|
accum_green and accum_blue are the individual accumultion buffers
|
|
|
|
for each color. Defaults to 0. accum_alpha is the accumulation buffer
|
|
|
|
for the alpha channel. defaults to 0. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI GLXContext Epplet_bind_double_GL(Epplet_gadget da, int red,
|
2013-07-13 12:07:12 -07:00
|
|
|
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);
|
2000-01-25 13:07:05 -08:00
|
|
|
|
|
|
|
/* The same as double buffer, except if this call succedes you are
|
|
|
|
returned a single buffered context. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI GLXContext Epplet_bind_single_GL(Epplet_gadget da, int red,
|
2013-07-13 12:07:12 -07:00
|
|
|
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);
|
2000-01-25 13:07:05 -08:00
|
|
|
|
2000-01-25 13:51:46 -08:00
|
|
|
/* 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. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI GLXContext Epplet_default_bind_GL(Epplet_gadget da);
|
2000-01-25 13:51:46 -08:00
|
|
|
|
2000-01-14 16:42:59 -08:00
|
|
|
/* Destroy (unbind) a glx context. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_unbind_GL(GLXContext cx);
|
1999-10-13 10:34:12 -07:00
|
|
|
|
2000-01-14 18:30:43 -08:00
|
|
|
#endif
|
1999-10-13 10:34:12 -07:00
|
|
|
|
|
|
|
/* command execution/spawing wrappers to make life easy */
|
1999-11-04 07:43:04 -08:00
|
|
|
|
|
|
|
/* This runs the command passed to it and returns its exit code: */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI int Epplet_run_command(const char *cmd);
|
|
|
|
EAPI const char *Epplet_read_run_command(const char *cmd);
|
|
|
|
EAPI int Epplet_spawn_command(const char *cmd);
|
|
|
|
EAPI void Epplet_pause_spawned_command(int pid);
|
|
|
|
EAPI void Epplet_unpause_spawned_command(int pid);
|
|
|
|
EAPI void Epplet_kill_spawned_command(int pid);
|
|
|
|
EAPI void Epplet_destroy_spawned_command(int pid);
|
|
|
|
EAPI void Epplet_register_child_handler(void (*func)
|
2013-07-13 12:07:12 -07:00
|
|
|
(void *data, int pid,
|
|
|
|
int exit_code), void *data);
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_change_button_label(Epplet_gadget gadget,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *label);
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_change_button_image(Epplet_gadget gadget,
|
2013-07-13 12:07:12 -07:00
|
|
|
const char *image);
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_clear_window(Window ww);
|
|
|
|
EAPI void Epplet_show_about(const char *name);
|
|
|
|
EAPI void Epplet_dialog_ok(const char *fmt, ...);
|
|
|
|
EAPI int Epplet_get_hslider_clicked(Epplet_gadget gadget);
|
|
|
|
EAPI int Epplet_get_vslider_clicked(Epplet_gadget gadget);
|
1999-10-13 10:34:12 -07:00
|
|
|
|
1999-10-18 08:50:58 -07:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Config file handling stuff */
|
|
|
|
/****************************************************************************/
|
1999-10-26 08:48:35 -07:00
|
|
|
/* Load the config file (initializes the config data). */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_load_config(void);
|
2013-07-13 12:07:12 -07:00
|
|
|
|
2000-04-30 16:19:22 -07:00
|
|
|
/* Load config data from a specific file, overriding any previous data. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_load_config_file(const char *);
|
2013-07-13 12:07:12 -07:00
|
|
|
|
2000-01-14 18:30:43 -08:00
|
|
|
/* This returns the instance of this epplet. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI int Epplet_get_instance(void);
|
1999-10-22 09:43:22 -07:00
|
|
|
|
|
|
|
/* Here you can query a config setting. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI const char *Epplet_query_config(const char *key);
|
1999-10-22 09:43:22 -07:00
|
|
|
|
1999-10-24 06:10:22 -07:00
|
|
|
/* Same as above, but returns the value of default instead of NULL if no */
|
|
|
|
/* match is found. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI const char *Epplet_query_config_def(const char *key, const char *def);
|
1999-10-24 06:10:22 -07:00
|
|
|
|
1999-10-22 09:43:22 -07:00
|
|
|
/* Use this to change or add a config setting. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_modify_config(const char *key, const char *value);
|
1999-10-22 09:43:22 -07:00
|
|
|
|
1999-10-22 16:12:12 -07:00
|
|
|
/* If you *know* a key doesn't exist, use this to add it. It takes less */
|
|
|
|
/* time than the above function. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_add_config(const char *key, const char *value);
|
1999-10-22 16:12:12 -07:00
|
|
|
|
1999-12-13 09:38:52 -08:00
|
|
|
/* 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. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_modify_multi_config(const char *key, char **values,
|
2013-07-13 12:07:12 -07:00
|
|
|
int num);
|
1999-12-13 09:38:52 -08:00
|
|
|
|
|
|
|
/* 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. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI char **Epplet_query_multi_config(const char *key, int *num);
|
1999-12-13 09:38:52 -08:00
|
|
|
|
1999-10-22 09:43:22 -07:00
|
|
|
/* 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. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_save_config(void);
|
2013-07-13 12:07:12 -07:00
|
|
|
|
2000-04-30 16:19:22 -07:00
|
|
|
/* Delete the config information. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI void Epplet_clear_config(void);
|
2006-04-12 12:22:45 -07:00
|
|
|
|
|
|
|
/* Return epplet data directory. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI const char *Epplet_data_dir(void);
|
2006-04-12 12:22:45 -07:00
|
|
|
|
|
|
|
/* Return e16 user configuration directory. */
|
2019-03-12 08:53:14 -07:00
|
|
|
EAPI const char *Epplet_e16_user_dir(void);
|