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
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) */
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);
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
*)
);
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);
Plik z chomika:
mikdor
Inne pliki z tego folderu:
mevents.odg
(2285 KB)
mevents.pdf
(4165 KB)
Widgets_inheriting_tree.pdf
(59 KB)
classes.odg
(25 KB)
classes.odt
(42 KB)
Inne foldery tego chomika:
SDL_Widgets_cpp_current_snapshots
wersje nierozwijane
Zgłoś jeśli
naruszono regulamin