123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- typedef struct Jayconfig Jayconfig;
- typedef struct Widget Widget;
- typedef struct WListElement WListElement;
- typedef struct Panel Panel;
- typedef struct Label Label;
- typedef struct Border Border;
- typedef enum wtype wtype;
- enum wtype{
- PANEL,
- LABEL
- };
- struct Jayconfig{
- // Task Panel Config
- u32 taskPanelColor;
- // Main Menu Config
- u32 mainMenuColor;
- u32 mainMenuHooverColor;
- // Window Config
- u32 windowTitleColor;
- u32 windowTitleFontColor;
- u32 windowBackgroundColor;
- u32 windowInTopBorder;
- u32 windowInBottomBorder;
- u32 windowSelectedColor;
- u32 windowScrollBarFrontColor;
- u32 windowTextCursorColor;
- u32 windowBackTextColor;
- u32 windowFrontTextColor;
- //Background
- u32 backgroundColor;
- char *backgroundimgpath;
- //Menu
- u32 menuBackColor;
- u32 menuHighColor;
- u32 menuBorderColor;
- u32 menuTextColor;
- u32 menuSelTextColor;
- //Widgets
- u32 mainBackColor;
- u32 mainTextColor;
- char *fontPath;
- unsigned int doubleclickTime;
- };
- struct Widget {
- char *id;
- //Methods
- int (*addWidget)(Widget *me, Widget *new, Point pos);
- Widget *(*getWidget)(Widget *me, char *id);
- Widget *(*extractWidget)(Widget *me, char *id);
- int (*listWidgets)(Widget *me, char ***list);
- void (*deleteWidget)(Widget *me, char *id);
- void (*setVisible)(Widget *w, int visible);
- void (*freeWidget)(Widget *w);
- //User Events:
- void (*hover)(Widget *w);
- void (*unhover)(Widget *w);
- void (*draw)(Widget *w);
- void (*resize)(Widget *w);
- void (*click)(Widget *w, Mouse *);
- void (*dclick)(Widget *w, Mouse *);
- void (*mpressdown)(Widget *w, Mouse *);
- void (*mpressup)(Widget *w, Mouse *);
- void (*change)(Widget *w);
- //For internal use
- void (*_hover)(Widget *w, Mouse *m);
- void (*_unhover)(Widget *w);
- void (*_draw)(Widget *w, Image *dst);
- void (*_redraw)(Widget *w);
- void (*_resize)(Widget *w, Point d); //d is the vector that represents the displacement
- void (*_click)(Widget *w, Mouse *);
- void (*_dclick)(Widget *w, Mouse *);
- void (*_mpressdown)(Widget *w, Mouse *);
- void (*_mpressup)(Widget *w, Mouse *);
- void (*_change)(Widget *w);
- int width; //ancho
- int height;//alto
- int hovered;
- int autosize;
- Rectangle r;
- Point p; //Real position
- Point pos; //Relative position
- wtype t; //widget type
- void *w; //The widget
- Widget *father; //Container
- Image *i;
- int visible;
- Widget *lh; //last hover
- };
- struct WListElement {
- WListElement *next;
- WListElement *prev;
- Widget *w;
- };
- struct Border{
- int size;
- int _3d; // True if border is 3D
- int up; // Up or Down 3D effect
- };
- struct Panel {
- Widget *w;
- u32 backColor;
- WListElement *l;
- };
- struct Label {
- Widget *w;
- char *t;
- Font *f;
- Border border;
- u32 backColor;
- u32 textColor;
- void (*setText)(Label *l, const char *text);
- char * (*gettext)(Label *l);
- };
- Widget *initjayapp(char *name);
- void startjayapp(Widget * w);
- void initdefaultconfig();
- Border createBorder(int size, int _3D, int up);
- Widget *createPanel(char *id, int height, int width, Point p);
- Widget *createLabel(char *id, int height, int width);
|