documentation.pdf

(135 KB) Pobierz
Widgets
Classes inheriting tree Object
Container
Image
WaveDrawBox
StackList
TextBlock
HistStretchGraph
StackListX
Label
StackListY
Button
LabelImage
Grid
ButtonImage
PixelDrawBox
Rectangle
Window
1186312353.051.png 1186312353.062.png 1186312353.072.png 1186312353.073.png 1186312353.001.png 1186312353.002.png 1186312353.003.png 1186312353.004.png 1186312353.005.png 1186312353.006.png 1186312353.007.png 1186312353.008.png 1186312353.009.png 1186312353.010.png 1186312353.011.png 1186312353.012.png 1186312353.013.png 1186312353.014.png 1186312353.015.png 1186312353.016.png 1186312353.017.png 1186312353.018.png 1186312353.019.png 1186312353.020.png 1186312353.021.png 1186312353.022.png 1186312353.023.png 1186312353.024.png 1186312353.025.png 1186312353.026.png 1186312353.027.png 1186312353.028.png 1186312353.029.png 1186312353.030.png 1186312353.031.png 1186312353.032.png 1186312353.033.png 1186312353.034.png 1186312353.035.png 1186312353.036.png 1186312353.037.png 1186312353.038.png 1186312353.039.png 1186312353.040.png 1186312353.041.png 1186312353.042.png 1186312353.043.png 1186312353.044.png 1186312353.045.png 1186312353.046.png 1186312353.047.png 1186312353.048.png 1186312353.049.png 1186312353.050.png 1186312353.052.png 1186312353.053.png 1186312353.054.png 1186312353.055.png 1186312353.056.png 1186312353.057.png 1186312353.058.png 1186312353.059.png 1186312353.060.png 1186312353.061.png 1186312353.063.png
 
Object fields
Abstract class, root of widgets inheriting tree, common fields, methods and callbacks. Object
mevent_handler user_mevent; /* user specified mouse callbacks */
mevent_handler internal_mevent; /* widget specified mouse callbacks */
bool has_user_mevents; /* whether object has any user mouse callback */
bool has_internal_mevents; /* whether object has any widget mouse callback */
SDL_Surface *surf; /* SDL surface of object */
SDL_Rect pos; /* position (minx, miny, width and height) of object */
usint maxx, maxy; /* most bottom-right point of object */
Object *parent; /* pointer to parent object in visual tree (NULL if none) */
objecttype type; /* type of object (directly inheriting from Object) */
void *child; /* pointer to child object of type described above ( downcasting )*/
void *void_parameter; /* void pointer to anything (useful if only one param. needed) */
void **cparam; /* pointer to Screen specified array of cparams */
void **vparam; /* object specified array of vparams */
usint vparam_size; /* current size of vparam array (it is dynamically growing) */
usint vparam_count; /* current count of void* parameters in vparam array ( <size ) */
usint cparam_count; /* count of void* parameters in cparam array */
bool cparam_exist; /* whether cparam array exists */
void (*refresh_method)( Object *, Screen *); /* callback method used to refresh widget (in future)*/
bool need_refresh; /* whether object needs to be refreshed (problem: Containers) */
bool visible; /* whether object is visible */
uint id; /* ID of object (sometimes much helpful to distinguish objects) */
bool draggable; /* Whether object can be dragged by mouse */
bool dragging; /* private (used while dragging) */
uchar mouse_state; /* current mouse button bit state (same as in SDL) */
/* NOTE: When using mouse_press callback which overrides also */
/* mouse_drag and mouse_release it's obvious to clear bit */
/* of pressed button at the end of callback method */
bool mouse_over; /* private (true when mouse is over object) */
1186312353.064.png 1186312353.065.png
Object methods (1/3)
Abstract class, root of widgets inheriting tree, common fields, methods and callbacks. Object
/* (private) Creates new vparam array or grow current twice */
perr Object_growVParamArray ( Object *object);
/* Adds new vparam at next free index in object->vparam array */
perr Object_addVParam ( Object * object, void *vparam);
/* Makes a request to Screen to fetch/update cparam array/count of object */
perr Object_CParamRefresh ( Object *object, Screen *screen);
/* Gets cparam from given index (returns NULL on error) */
void * Object_getCParam ( Object *object, usint ind);
/* Gets vparam from given index (returns NULL on error) */
void * Object_getVParam ( Object *object, usint ind);
/* Sets fields of object in a way to avoid memory free and object interaction */
/* used on errors in constructor and after destruction */
void Object_tryDisable ( Object *object);
/* copy constructor called by copy constructors of children classes */
/* copy_pos -- whether copy position of object: */
/* true - copies pos.x, pos.y, pos.w, pos.h, maxx, maxy */
/* false - copies only pos.w and pos.h; pos.x, pos.y, maxx and maxy leaves UNINITIALIZED */
/* copy_surf -- whether copy object surface: */
/* true - copy */
/* false - set to NULL */
perr Object_copy ( Object *object_dest, Object *object_src, bool copy_pos, bool copy_surf);
/* type constructor - initialize current object to given type and child pointer */
/* used in children classes constructors (with default=true) */
/* and children classes copy constructors (with default=false) */
perr Object_init_type ( Object *object, void *child, objecttype obj_type, bool defaults);
1186312353.066.png 1186312353.067.png
Object methods (2/3)
Abstract class, root of widgets inheriting tree, common fields, methods and callbacks. Object
/* Get real type name of current object (type name from leaf of inheriting tree) */
char * Object_getTypeString ( Object *object);
/* Returns brief description of parent object */
char * Object_toString ( Object *object);
/* Destructor called by destructors of any child class */
perr Object_destroy ( Object *object);
/* Draws object on screen (flip indicates whether to use SDL_Flip() on the end) */
perr Object_draw ( Object *object, Screen *screen, bool flip);
/* (private) Performs dragging of object */
perr Object_drag ( Object *object, Screen *screen);
/* Passes mouse event to object (if object is of Container type, mevent is passed to all of its children)*/
perr Object_mevent ( Object *object, Screen *screen);
/* Adds user mouse event callback method */
/* cb_dest is one of object->user_mevent.mouse_{press|click|release|enter|exit|drag} */
/* cb_src is user specified callback function */
perr Object_addUserMeventHandler ( Object *object,
void (**cb_dest)( struct Object *, struct Screen *),
void (*cb_src)( struct Object *, struct Screen *)
);
/* Adds widget specified mouse event callback method */
/* cb_dest is one of object->internal_mevent.mouse_{press|click|release|enter|exit|drag} */
/* cb_src is widget specified callback function */
perr Object_addInternalMeventHandler ( Object *object,
void (**cb_dest)( struct Object *, struct Screen *),
void (*cb_src)( struct Object *, struct Screen *)
);
1186312353.068.png 1186312353.069.png
Object methods (3/3)
Abstract class, root of widgets inheriting tree, common fields, methods and callbacks. Object
/* Rescale object (set smooth to 1 for best effect) */
perr Object_scale ( Object *object, double xscale, double yscale, int smooth);
/* Sets only size (width and height) of object */
perr Object_setSize ( Object *object, usint width, usint height);
/* Sets only position (minx, miny, maxx, maxy) of object */
inline perr Object_setPosition ( Object *object, usint minx, usint miny);
/* Gets center point (cx,cy) of object */
perr Object_getCenter ( Object *object, usint *cx, usint *cy);
/* Sets position of object (minx, miny, maxx, maxy) according to given center point (cx,cy) */
/* and current width and height of object */
perr Object_setCenter ( Object *object, usint cx, usint cy);
/* Whether object contains given point (x,y) */
inline bool Object_contains ( Object *object, usint x, usint y);
/* Sets position(minx, miny, maxx, maxy) and width and height of object */
perr Object_setRect ( Object *object, usint minx, usint miny, usint width, usint height);
/* Gets real size occupied by struct of widget placed on leaf of inheriting tree */
ullong Object_getSizeInBytes ( Object *object);
1186312353.070.png 1186312353.071.png
Zgłoś jeśli naruszono regulamin