home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Linux
/
Enlightenment
/
enl14.tgz
/
enl14.tar
/
enl14
/
enl.h
< prev
next >
Wrap
C/C++ Source or Header
|
1997-11-21
|
13KB
|
452 lines
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xproto.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/XTest.h>
#include <X11/extensions/XShm.h>
#include <X11/imlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <fcntl.h>
#include <dirent.h>
#include <signal.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#define EERR_NONE 0
#define EERR_OUT_OF_MEMORY 1
#define EERR_FILE_NOT_EXIST 2
#define EERR_PERMISSION_DENIED 3
#define EERR_FILING_SYSTEM_FULL 4
#define ENLIGHTENMENT_ROOT "/usr/local/enlightenment"
#define ENLIGHTENMENT_SYSTEM_CONFIG ENLIGHTENMENT_ROOT"/system_config"
#define ENLIGHTENMENT_SYSTEM_THEMES ENLIGHTENMENT_ROOT"/themes"
#define CFG_CONTEXT_NONE 0
#define CFG_CONTEXT_IMAGES 1
#define CFG_CONTEXT_CLASS 2
#define CFG_CONTEXT_BUTTONS 3
#define CFG_CONTEXT_STRIP 4
#define CFG_CONTEXT_BUTTON 5
#define CFG_CONTEXT_GEOMETRY 6
#define CFG_CONTEXT_ACTIONS 7
#define CFG_CONTEXT_SLIDERS 8
#define STRIP_LOCATION_START 0
#define STRIP_LOCATION_END 1
#define STRIP_ORIENTATION_VERTICAL 0
#define STRIP_ORIENTATION_HORIZONTAL 1
#define EVENT_MOUSE_DOWN 0
#define EVENT_MOUSE_UP 1
#define EVENT_MOUSE_ENTER 2
#define EVENT_MOUSE_LEAVE 3
#define EVENT_KEY_DOWN 4
#define EVENT_KEY_UP 5
#define ACTION_NONE 0
#define ACTION_EXEC 1
#define ACTION_ALERT 2
#define ACTION_ROTATE_STRIP 3
#define ACTION_MOVE_STRIP 4
#define ACTION_SAVE_STRIP 5
#define ACTION_JUSTIFY_STRIP 6
#define ACTION_DELETE_STRIP 7
#define ACTION_SHOW_STRIP 8
#define ACTION_HIDE_STRIP 9
#define ACTION_SHOW_STRIP_TOGGLE 10
#define ACTION_LOCATE_STRIP 11
#define ACTION_DISABLE_BUTTON 12
#define ACTION_ENABLE_BUTTON 13
#define ACTION_DISABLE_BUTTON_TOGGLE 14
#define ACTION_MOVE_BUTTON 15
#define ACTION_SAVE_BUTTON 16
#define ACTION_SHOW_BUTTON 17
#define ACTION_HIDE_BUTTON 18
#define ACTION_DELETE_BUTTON 19
#define ACTION_SHOW_BUTTON_TOGGLE 20
#define ACTION_LOCATE_BUTTON 21
#define ACTION_CALLBACK 22
#define ACTION_SLIDER_STRIP_JUSTIFY 23
#define ACTION_FLIP_STRIP 24
#define STATE_NORMAL 0
#define STATE_HILITED 1
#define STATE_CLICKED 2
#define STATE_DISABLED 3
#define COORD_MACRO_CUSTOM 0
#define COORD_MACRO_TOPLEFT 1
#define COORD_MACRO_TOPRIGHT 2
#define COORD_MACRO_BOTTOMLEFT 3
#define COORD_MACRO_BOTTOMRIGHT 4
#define COORD_MACRO_MIDDLE 5
#define LIST_TYPE_ANY 0
#define LIST_TYPE_ROOT 1
#define LIST_TYPE_IMAGECLASS 2
#define LIST_TYPE_BUTTON 3
#define LIST_TYPE_STRIP 4
#define LIST_TYPE_SLIDERCLASS 5
#define LIST_TYPE_SLIDER 6
#define MODE_NONE 0
#define MODE_MOVE_STRIP 1
#define MODE_MOVE_BUTTON 2
#define MODE_MOVE_SLIDER 3
typedef struct _list
{
int type;
char *name;
void *item;
struct _list *next;
} List;
typedef struct _size
{
int x,x_at;
int y,y_at;
} Size;
typedef struct _coord
{
char handle_macro;
int x_handle,x_handle_at;
int y_handle,y_handle_at;
char from_macro;
int x_from,x_from_at;
int y_from,y_from_at;
int x,y;
} Coord;
typedef struct _constrain
{
int min;
int max;
} Constrain;
typedef struct _imageentry
{
char *name;
Image *im;
ImColor *icl;
Border *bd;
int width,height;
Pixmap pmap;
Pixmap mask;
} ImageEntry;
typedef struct _imageclass
{
char *name;
char unloadable;
ImageEntry *normal;
ImageEntry *hilited;
ImageEntry *clicked;
ImageEntry *disabled;
} ImageClass;
typedef struct _action
{
int id;
char *params;
} Action;
typedef struct _actioninit
{
char event;
char any;
char anykey;
int modifiers;
int button;
KeyCode key;
Action action;
} ActionInit;
typedef struct _scrbit
{
Window win;
int x,y;
int width,height;
Pixmap pmap,mask;
} ScrBit;
typedef struct _button
{
Coord loc;
Size size;
Constrain width,height;
char *name;
ImageClass *iclass;
char state,pstate;
struct _strip *strip;
char strip_loc;
char visible;
int num;
ActionInit *actions;
ScrBit X,pX;
} Button;
typedef struct _item
{
int type;
void *item;
} Item;
typedef struct _strip
{
Coord loc;
char *name;
char orientation;
int justification;
char visible;
struct _strip *strip;
int strip_loc;
int num;
Item *list;
ScrBit X;
} Strip;
typedef struct _sliderbase
{
ImageClass *iclass;
int thickness;
int start_inset;
int end_inset;
} SliderBase;
typedef struct _sliderknob
{
ImageClass *iclass;
int x,y;
int width,height;
} SliderKnob;
typedef struct _sliderorient
{
SliderBase base;
SliderKnob knob;
} SliderOrient;
typedef struct _sliderclass
{
char *name;
SliderOrient horizontal,vertical;
} SliderClass;
typedef struct _slider
{
char *name;
SliderClass *sclass;
char orientation;
int length;
int divisions;
int value;
char state,pstate;
char visible;
ScrBit baseX,pbaseX;
ScrBit knobX,pknobX;
Action action;
} Slider;
typedef struct _mode
{
int mode;
Strip *strip;
Button *button;
Slider *slider;
int px,py;
} Mode;
typedef struct _root
{
char *name;
Display *display;
char *displayname;
Window win;
Visual *visual;
int width;
int height;
int depth;
} Root;
void md(char *s);
int exists(char *s);
int isfile(char *s);
int isdir(char *s);
char **ls(char *dir, int *num);
void freestrlist(char **l, int num);
void rm(char *s);
void mv(char *s, char *ss);
void cp(char *s, char *ss);
time_t moddate(char *s);
int filesize(char *s);
void cd(char *s);
char *cwd(void);
int permissions(char *s);
int owner(char *s);
int group(char *s);
char *username(int uid);
char *homedir(int uid);
char *usershell(int uid);
char *duplicate(char *s);
char *atword(char *s, int num);
char *atchar(char *s, char c);
void word(char *s, int num, char *wd);
int canread(char *s);
int canwrite(char *s);
int canexec(char *s);
void Alert(char *fmt,...);
void ShowAlert(char *text);
void AlertHandleClick(int button);
void ErrAlert(int erno);
void CfgLoad(char *file);
char *CfgGetLine(char *file);
void EExit(int code);
void *Emalloc(int size);
void *Erealloc(void *ptr, int size);
void Efree(void *ptr);
Image *LoadImage(char *file);
void FreeImageClass(ImageClass *item);
void GetPixmaps(ImageClass *ic, char state, int width, int height, Pixmap *pmap, Pixmap *mask);
void FreeImageEntry(ImageEntry *item);
ImageEntry *CfgReadImageEntry(char *type);
void CfgLoadImageClass();
void FreeStrip(Strip *item);
Strip *CfgReadStrip();
void CfgLoadStrip();
void FreeButton(Button *item);
Button *MakeButton(char *name, char *iclass, int x, int y, int width, int height);
Button *CfgReadButton();
void CfgLoadButton();
void CfgReadGeometry(Button *b);
void CfgReadActions(ActionInit **a, int *num);
void AddButtonAction(Button *b, char *line);
void AddButtonActionCallback(Button *b, char *line, void (*cb)());
void CfgParseMouseAction(char *lin, ActionInit *a);
void CfgParseKeyAction(char *lin, ActionInit *a);
void AddButtonToStrip(Button *b, Strip *s, int loc);
void DelButtonFromStrip(Button *b, Strip *s);
void AddStripToStrip(Strip *b, Strip *s, int loc);
void DelStripFromStrip(Strip *b, Strip *s);
void CalculateSize(Size *size, ScrBit *X, Constrain *width, Constrain *height);
void CalculateLoc(Coord *loc, int width, int height, ScrBit *X);
void CalcButton(Button *b);
void DrawButton(Button *b);
void ShowButton(Button *b);
void HideButton(Button *b);
void MoveButtonTo(Button *b, int x, int y);
void MoveButtonBy(Button *b, int x, int y);
void ButtonHilite(Button *b, char onoff);
void ButtonClick(Button *b, char onoff);
void ButtonDisable(Button *b, char onoff);
void SetButtonImageClass(Button *b, char *name);
void SetButtonLocation(Button *b, Coord *loc);
void SetButtonSize(Button *b, Size *siz);
void DrawStrip(Strip *s);
void HideStrip(Strip *s);
void ShowStrip(Strip *s);
void RotateStrip(Strip *s);
void FlipStrip(Strip *s);
void SetStripJustification(Strip *s, int just);
void MoveStripTo(Strip *s, int x, int y);
void MoveStripBy(Strip *s, int x, int y);
void SetStripLocation(Strip *s, Coord *loc);
void CfgParseLocLine(char *line, Coord *loc);
void CfgParseSizeLine(char *line, Size *size);
void CfgParseConstrain(char *line, Constrain *c);
void *FindItem(char *name, int type);
void AddItem(void *item, char *name, int type);
void *DelItem(char *name, int type);
char **ListItems(int *num, int type);
void *FindWindowID(Window win, int type, int *type_ret);
void HandleEvent(XEvent *ev);
void HandlePress(XEvent *ev);
void HandleRelease(XEvent *ev);
void HandleIn(XEvent *ev);
void HandleOut(XEvent *ev);
void HandleMotion(XEvent *ev);
void DoSimpleAction(Action *a);
void DoAction(XEvent *ev, ActionInit *a, int num);
void ActionExec(char *p);
void ActionAlert(char *p);
void ActionRotateStrip(char *p);
void ActionMoveStrip(char *p);
void ActionSaveStrip(char *p);
void ActionJustifyStrip(char *p);
void ActionDeleteStrip(char *p);
void ActionShowStrip(char *p);
void ActionHideStrip(char *p);
void ActionShowStripToggle(char *p);
void ActionLocateStrip(char *p);
void ActionDisableButton(char *p);
void ActionEnableButton(char *p);
void ActionDisableButtonToggle(char *p);
void ActionMoveButton(char *p);
void ActionSaveButton(char *p);
void ActionShowButton(char *p);
void ActionHideButton(char *p);
void ActionDeleteButton(char *p);
void ActionShowButtonToggle(char *p);
void ActionLocateButton(char *p);
void ActionCallback(char *p);
void ActionSliderJustiyStrip(char *p);
void ActionFlipStrip(char *p);
void FreeSliderClass(SliderClass *item);
void CfgReadSliderOrient();
void CfgLoadSliderClass();
Slider *CreateSlider(char *name, char *classname, char orientation, int len, int divisions);
void DrawSlider(Slider *s);
void FreeSlider(Slider *item);
void MoveSliderBy(Slider *s, int x, int y);
void MoveSliderTo(Slider *s, int x, int y);
void SetSliderValue(Slider *s, int value);
void SetSliderAction(Slider *s, Action *a);
int GetSliderValue(Slider *s);
void HandleSliderMouse(Slider *s, int dx, int dy);
void ShowSlider(Slider *s);
void HideSlider(Slider *s);
void SliderClick(Slider *s, int onoff);
void SliderHilite(Slider *s, int onoff);
void SliderDisable(Slider *s, int onoff);
Root *SetupRoot();
void SetupVars();
void SetupSignals();
void SetupX();
void HandleSigChild(int num);
void HandleXError(Display *d, XErrorEvent *ev);
void HandleXIOError(Display *d);
extern Display *disp;
extern FILE *cfgfile;
extern ImlibData *imd;
extern int Eerr;
extern char ThemeIsTmp;
extern char *ThemeDir;
extern List lists;
extern char line[2048];
extern Mode mode;
extern int event_base_shape;