gui.h File Reference

Define gui parts. More...

#include "cliprect.h"
#include "ctl/state.h"

Include dependency graph for gui.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GUI_Control
 Basic constant control definition. More...
struct  GUI
 Basic GUI definition. More...
struct  GUI_Control_State
 Control state shared by all controls. More...
struct  GUI_Button_State
 Button state. More...
struct  GUI_Checkbox_State
 Checkbox state. More...
struct  GUI_Animation_State
 Animation state. More...
struct  GUI_Scrollbar_State
 Scrollbar state. More...
struct  GUI_Ticker_State
 Ticker tape state Scrolls text/help/art across some bit of GUI. More...
struct  GUI_Tumbler_State
 Tumbler state When focused, cycles through pieces of text and/or art each time user deflects left/right Displays, art, text or both, but if both, both tables must match up. More...

Defines

#define GUI_CHAR   char
 Define character/string type for remaining definitions and functions char, wchar_t, etc. It's all good.
#define EDEF_GUIMESSAGES(def)
 GUI Messages Messages passed between GUI handlers, control handlers, etc.
#define GUICS_DEFAULT   0
#define GUICS_INVISIBLE   1
#define GUICS_NOFOCUS   2
#define GUICS_NOTIFY   16
#define GUI_Control_Get_Data(gui, index)   GUI_Control_Data( (gui), GUI_Control_Get( (gui), (index) ) )
 Get control data from index.
#define GUI_Control_Dirty(gui, control)   _GUI_Control_Dirty( (GUI*)(gui), (control) )
 Mark a control within GUI dirty.
#define GUI_Control_Bound(gui, control, bound)   _GUI_Control_Bound( (GUI*)(gui), (control), (bound) )
 Mark a control in GUI dirty.
#define GUI_Control_Offset(gui, control, px, py)   { GUI_Control_State* state = GUI_Control_Data( ((GUI*)(gui)), (control)); *(px) = state->offx; *(py) = state->offy; }
 Get default mask common in most controls.
#define GUI_Control_Set_Offset(gui, index, x, y)   _GUI_Control_Set_Offset( (GUI*)(gui), (index), (x),(y) )
 Move control's relative position.
#define GUI_Control_Get_Offset(gui, index, px, py)   { GUI_Control_State* state = GUI_Control_Get_Data( ((GUI*)(gui)), (index)); *(px) = state->offx; *(py) = state->offy; }
 Get control offset position.
#define GUI_Control_GetText(gui, index)   (GUI_Control_Get_Data( (gui), (index) )->text)
 Set text to be drawn.
#define GUI_Control_SetText(gui, index, szText)   _GUI_Control_SetText((GUI*)(gui), (index), (szText) )
 Set text to be drawn.
#define GUI_Control_SetJustify(gui, index, just)   _GUI_Control_SetJustify((GUI*)(gui), (index), (just) )
 Set text alignment/justification/effects to be drawn.
#define GUI_Control_SetupText(gui, index, szText, just)   _GUI_Control_SetupText((GUI*)(gui), (index), (szText), (just) )
 Set multiple text attributes to be drawn.
#define GUI_Control_GetFrames(gui, index)   (((const GUI_Control_State*)GUI_Control_Get_Data( (gui), (index) ))->frames)
 Get Button frame data.
#define GUI_Control_GetFrameCount(gui, index)   (((const GUI_Control_State*)GUI_Control_Get_Data( (gui), (index) ))->cFrames)
 Get Button frame data.
#define GUI_Control_SetFrames(gui, index, newframes, newcount)   _GUI_Control_SetFrames( (GUI*)(gui), (index), (newframes), (newcount) )
 Set Control frame data.
#define GUI_Control_Get_Mask(gui, control)   (GUI_Control_Get_Data( ((GUI*)(gui)), (control))->mask)
 Get default mask common in most controls.
#define GUI_Control_IsFocused(gui, control)   _GUI_Control_IsFocused( (const GUI*)(gui), (const GUI_Control*)(control) )
 Find out if a control is focused.
#define GUI_Control_IsHidden(gui, index)   _GUI_Control_IsHidden( (const GUI*)(gui), (index) )
 See if a control is invisible.
#define GUI_Control_Hide(gui, index)   _GUI_Control_Hide( (GUI*)(gui), (index) )
 Hide a control.
#define GUI_Control_Show(gui, index)   _GUI_Control_Show( (GUI*)(gui), (index) )
 Show a control.
#define GUI_Control_IsDisabled(gui, index)   _GUI_Control_IsDisabled( (const GUI*)(gui), (index) )
 See if a control is invisible.
#define GUI_Control_Disable(gui, index)   _GUI_Control_Disable( (GUI*)(gui), (index) )
 Disable a control.
#define GUI_Control_Enable(gui, index)   _GUI_Control_Enable( (GUI*)(gui), (index) )
 Enable a control.
#define GUI_Control_SetNotify(gui, index)   (GUI_Control_Get_Data( ((GUI*)(gui)), (index))->mask |= GUICS_NOTIFY)
 Set notify flag on a control - useful initializing things that change state based on notifies.
#define GUI_Control_Get_Bound(gui, index, bound)   { GUI* pgui = (GUI*)(gui); _GUI_Control_Bound( pgui, GUI_Control_Get( pgui, (index) ), (bound) ); }
 Get bounding box from index.
#define GUI_Control_Get_Type(gui, index)   ( GUI_Control_Get( (gui), (index) )->type )
 Get enum GUIHandlers enumeration describing control type.
#define GUI_Control_Get_Shape(gui, index, cel)   ( GUI_Control_Get( (gui), (index) )->state[(cel)] )
 Get art from a control.
#define GUI_Control_Set_Dirty(gui, index)   { GUI* pgui = (GUI*)(gui); _GUI_Control_Dirty( pgui, GUI_Control_Get( pgui, (index) ) ); }
 Mark a control in GUI dirty.
#define EDEF_BUTTON(def)
 Button states Buttons generate an event when focused and selected.
#define EDEF_CHECKBOX(def)
 Checkbox states Checkboxes toggle a state and generate an event when focused and selected.
#define GUI_Checkbox_GetCheck(gui, index)   (((const GUI_Checkbox_State*)GUI_Control_Get_Data( (gui), (index) ))->bCheck)
 Get checkbox state.
#define GUI_Checkbox_SetCheck(gui, index, bCheck)   _GUI_Checkbox_SetCheck((GUI*)(gui),(index),(bCheck))
 Set checkbox state.
#define GUI_Animation_SetAnim(gui, index, animdir, startframe, msframe)   _GUI_Animation_SetAnim((GUI*)(gui),(index),(animdir), (startframe),(msframe))
 Set animation direction.
#define GUI_Animation_SetSpeed(gui, idControl, msperframe)   (((GUI_Animation_State*)GUI_Control_Get_Data( (gui), (index) ))->msframe = (msperframe))
 Set rate at which animation changes frames (millisconds per frame movement).
#define GUI_Animation_SetFrame(gui, index, frame)   _GUI_Animation_SetFrame((GUI*)(gui),(index),(frame))
 Change animation art.
#define GUI_Animation_GetFrame(gui, index)   (((const GUI_Animation_State*)GUI_Control_Get_Data( (gui), (index) ))->iFrame )
 Get animation frame.
#define EDEF_SCROLLBAR(def)
 Scrollbar parts Scrollbars scale a value and generate an event when focused and moved.
#define GUI_Scrollbar_GetFrames(gui, index)   (((const GUI_Scrollbar_State*)GUI_Control_Get_Data( (gui), (index) ))->frames)
 Get scrollbar frame data.
#define GUI_Scrollbar_SetFrames(gui, index, newframes)   _GUI_Scrollbar_SetFrames( (GUI*)(gui), (index), (newframes) )
 Set scrollbar frame data.
#define GUI_Scrollbar_GetValue(gui, index)   (((const GUI_Scrollbar_State*)GUI_Control_Get_Data( (gui), (index) ))->value)
 Get scrollbar value.
#define GUI_Scrollbar_SetValue(gui, index, newValue, minValue, maxValue)   _GUI_Scrollbar_SetValue( (GUI*)gui, idControl, newValue, minValue, maxValue )
 Setup scrollbar.
#define GUI_Scrollbar_GetRepeatRate(gui, index)   (((const GUI_Scrollbar_State*)GUI_Control_Get_Data( (gui), (index) ))->msRepeat)
 Get key repeat value.
#define GUI_Scrollbar_SetRepeatRate(gui, index, msval)   (((GUI_Scrollbar_State*)GUI_Control_Get_Data( (gui), (index) ))->msRepeat = (msval))
 Set key repeat value.
#define GUI_Ticker_SetText(gui, idControl, sz)   _GUI_Ticker_SetText( (GUI*)(gui), (idControl), (sz) )
 Set (or clear) text.
#define GUI_Ticker_SetNextText(gui, idControl, sz)   (((GUI_Ticker_State*)GUI_Control_Get_Data( (gui), (index) ))->szNext = (sz))
 Set (or clear) text that follows current text; set at callback, or before text would otherwise wrap.
#define GUI_Ticker_SetSpeed(gui, idControl, msDelay, msframe)   _GUI_Ticker_SetSpeed( (GUI*)(gui), (idControl), (msDelay), (msframe) )
 Set rate at which ticker scrolls (millisconds per pixel movement).
#define GUI_Ticker_GetOffset(gui, index)   (((const GUI_Ticker_State*)GUI_Control_Get_Data( (gui), (index) ))->offset)
 Get current scroll offset for ticker so it can be resumed with same text/image, later.
#define GUI_Ticker_SetOffset(gui, index, newOff)   (((GUI_Ticker_State*)GUI_Control_Get_Data( (gui), (index) ))->offset = (newOff))
 Set ticker scroll offset saved from GUI_Ticker_GetOffset.
#define EDEF_TUMBLER(def)
 Tumbler parts.
#define GUI_Tumbler_Setup(gui, id, shapes, shapeAlign, szz, szzAlign, count, transition, curr)   _GUI_Tumbler_Setup( (GUI*)(gui), (id), (shapes), (shapeAlign), (szz), (szzAlign), (count), (transition), (curr) )
 Setup tumbler shapes, text, etc.
#define GUI_Tumbler_SetFrame(gui, id, curr)   _GUI_Tumbler_SetFrame( (GUI*)(gui), (id), (curr) )
 Set current tumbler selection.
#define GUI_Tumbler_GetFrame(gui, id)   (((const GUI_Tumbler_State*)GUI_Control_Get_Data( (gui), (id) ))->stateCurr)
 Get current tumbler selection.
#define GUI_Tumbler_GetRepeatRate(gui, index)   (((const GUI_Tumbler_State*)GUI_Control_Get_Data( (gui), (index) ))->msRepeat)
 Get key repeat value.
#define GUI_Tumbler_SetRepeatRate(gui, index, msval)   (((GUI_Tumbler_State*)GUI_Control_Get_Data( (gui), (index) ))->msRepeat = (msval))
 Set key repeat value.
#define GUI_Tumbler_GetTransitions(gui, index)   (((const GUI_Tumbler_State*)GUI_Control_Get_Data( (gui), (index) ))->cTransition)
 Get transition count.
#define GUI_Tumbler_SetTransitions(gui, index, frames)   (((GUI_Tumbler_State*)GUI_Control_Get_Data( (gui), (index) ))->cTransition = (frames))
 Set transition count.
#define GUI_Tumbler_GetAlign(gui, index)   (((const GUI_Tumbler_State*)GUI_Control_Get_Data( (gui), (index) ))->ialign)
 Get transition count.
#define GUI_Tumbler_SetAlign(gui, index, how)   (((GUI_Tumbler_State*)GUI_Control_Get_Data( (gui), (index) ))->ialign = (how))
 Set transition count.
#define GUI_GUI_GetGUI(gui, index)   ((GUI*)(GUI_Control_Get_Data((gui), (index))+1))
 Get the GUI pointer from an embedded GUI.
#define GUI_IsOpen(gui)   _GUI_IsOpen( (GUI*)(gui) )
 See if there are any controls in a GUI; destroying one clears this value.
#define GUI_Param(gui)   (((GUI*)(gui))->param)
 Get 'void* param' parameter passed to _init functions.
#define GUI_ParamAuto(gui, type, label)   type* label = (type*)(((GUI*)(gui))->param)
 Get Get 'void* param' parameter passed to _init functions, casting it to something useful.
#define GUI_User(gui)   ((void*)((GUI*)(gui) + 1))
 Get pointer to 'user' (-u) data.
#define GUI_UserAuto(gui, type, label)   type* label = (type*)((GUI*)(gui) + 1)
 Get pointer to 'user' (-u) data.
#define GUI_GetFocus(gui)   ( ((GUI*)(gui))->focus )
 Get control that has focus.
#define GUI_SetFocus(gui, ifocus)   _GUI_SetFocus( (GUI*)(gui), (ifocus) )
 Set focus.
#define GUI_GetNotify(gui)   GUI_Control_Get( ((GUI*)(gui)), ((GUI*)(gui))->iControl )
 Get control that sent notification.
#define GUI_GetFocusID(gui)   (((GUI*)(gui))->focus)
 Get control that has focus.
#define GUI_GetNotifyID(gui)   (((GUI*)(gui))->iControl)
 Get control that sent notification.
#define GUI_Handle(gui, msg)   { GUI* pgui = (GUI*)(gui); pgui->handler( pgui, msg ); }
 Pass a message to GUI.
#define GUI_Heartbeat(gui)   _GUI_Heartbeat( (GUI*)(gui) )
 Call single GUI's heartbeat.
#define GUI_CallCycle(gui)   GUI_Handle(gui,GUI_Cycle)
 Call GUI cycler.
#define GUI_CallPaint(gui)   GUI_Handle(gui,GUI_Paint)
 Call GUI render.
#define GUI_CallNotifies(gui)   _GUI_CallNotifies( (GUI*)(gui) )
 Call GUI notifies.
#define GUI_CallDestroy(gui)   GUI_Handle(gui,GUI_Destroy)
 Call GUI destruction.
#define GUI_Implode(gui, times, divide)   _GUI_Explode( (GUI*)(gui), (times), (divide) )
 Move controls from wherever they are to their normal positions, decelerating.
#define GUI_Implode_Set(gui, times, divide, first, last)   _GUI_Explode_Set( (GUI*)(gui), (times), (divide), (first), (last) )
 Move controls from wherever they are to their normal positions, decelerating.
#define GUI_Explode(gui, times, divide)   _GUI_Explode( (GUI*)(gui), (times), (divide) )
 Move non-zero offset controls away from their initial positions, accelerating.
#define GUI_Explode_Set(gui, times, divide, first, last)   _GUI_Explode_Set( (GUI*)(gui), (times), (divide), (first), (last) )
 Move non-zero offset controls away from their initial positions, accelerating.
#define GUI_Sweep_Set(gui, x, y, times, divide, first, last)   _GUI_Sweep_Set((GUI*)(gui),(x),(y),(times),(divide),(first),(last))
 Set a rolling offset on a set of controls.
#define GUI_Offset_Group(gui, from, to, byx, byy)   _GUI_Offset_Group( (GUI*)(gui), (from), (to), (byx), (byy) )
 Move controls from wherever they are to their normal positions.
#define GUI_Offset_Control(gui, control, x, y)   _GUI_Offset_Control( (GUI*)(gui), (control), (x),(y) )
 Change GUI control position, mark appropriate dirty regions.
#define GUI_Move(gui, x, y)   _GUI_Move( (GUI*)(gui), x, y )
 Change GUI position, mark whole GUI dirty.
#define GUI_Motion(gui, tx, ty)   _GUI_Motion( (GUI*)(gui), tx,ty )
 Move GUI towards tx,ty.
#define GUI_Control_Index(gui, control)   ( (control) - ((GUI*)(gui))->list )
 Translate a control pointer to a control index.
#define GUI_Dirty_Rect(gui, prc)   _GUI_Dirty_Rect( (GUI*)(gui), (prc) )
 Mark a region of GUI dirty.
#define GUI_Dirty(gui)   GUI_Dirty_Rect( (gui), &((GUI*)(gui))->opc.clip )
 Mark whole GUI dirty.
#define GUI_SetBG(gui, sbg)   { GUI* pgui = (GUI*)(gui); pgui->bg = (sbg); GUI_Dirty_Rect( pgui, &pgui->opc.clip.rect ); }
 Set GUI background, or use NULL for none.
#define GUI_SetOV(gui, sov)   { GUI* pgui = (GUI*)(gui); pgui->ov = (sov); GUI_Dirty_Rect( pgui, &pgui->opc.clip.rect ); }
 Set GUI overlay, or use NULL for none.
#define GUI_Control_Mask(gui, control)   (GUI_Control_Data( ((GUI*)(gui)), (control))->mask)
 Get default mask common in most controls.
#define GUI_Control_Notify(gui, control)   { GUI_Control_Data( (gui), (control) )->mask |= GUICS_NOTIFY; }
 Invoke GUI notification handler.
#define offsetof(s, m)   ((size_t)&(((s *)0)->m))
 Get offset of member 'm' in class or struct 's'.
#define gui_notified(gui)
 This will poll and not proceed to next state until a 'Notify' happens. Code following this should check 'gui->iControl', just as GUI_Notify does. This is a convenience function to trap Notify events in the state machine instead of in the GUI_Notify handler, which can be used without the state machine, and which would otherwise have to 'signal' the state machine, not even knowing what 'handlers' should be doing for a given state.

Typedefs

typedef void(* GUI_handler )(struct GUI *gui, GUI_Message msg)
 Function type to dispatch GUI messages Every GUI message is passed to the interface's handler, and then to the control If the handler doesn't handle it, it should invoke GUI_default. If the handler does handle it, eat the message without invoking GUI_default.

Enumerations

enum  GUI_Message
 Enumeration of possible GUI commands.

Functions

void GUI_Def_State (GUI *gui, const GUI_Control *control, unsigned initmask, unsigned align)
 Default control state setup.
void _GUI_Control_Dirty (GUI *gui, const GUI_Control *control)
 Mark a control's bounding box dirty.
void _GUI_Control_Bound (GUI *gui, const GUI_Control *control, Rect *bound)
 Work out where a control's bounding box is.
void _GUI_Control_Set_Offset (GUI *gui, int index, int x, int y)
 Move control's relative position.
void _GUI_Control_SetText (GUI *gui, int index, const char *szText)
 Set Control text.
void _GUI_Control_SetJustify (GUI *gui, int index, unsigned just)
 Set Control text justify.
void _GUI_Control_SetupText (GUI *gui, int index, const char *szText, unsigned just)
 Set Control text and justify.
void _GUI_Control_SetFrames (GUI *gui, int index, const OPCShape *const *frames, size_t cFrames)
 Set Control art data.
bool _GUI_Control_IsFocused (const GUI *gui, const GUI_Control *control)
bool _GUI_Control_IsHidden (const GUI *gui, int index)
void _GUI_Control_Hide (GUI *gui, int index)
void _GUI_Control_Show (GUI *gui, int index)
bool _GUI_Control_IsDisabled (const GUI *gui, int index)
void _GUI_Control_Disable (GUI *gui, int index)
void _GUI_Control_Enable (GUI *gui, int index)
bool _GUI_Checkbox_SetCheck (GUI *gui, int index, bool bCheck)
 Set checkbox state.
void _GUI_Animation_SetAnim (GUI *gui, int index, GUI_AnimDir animdir, int startFrame, unsigned msFrameTime)
 Set animation type, resetting animation.
int _GUI_Animation_SetFrame (GUI *gui, int index, int frame)
 Set frame on animation, stopping animation.
int _GUI_Scrollbar_SetValue (struct GUI *gui, int idControl, int newValue, int minValue, int maxValue)
 Setup scrollbar attributes.
void _GUI_Ticker_SetText (struct GUI *gui, int idControl, const char *sz)
 Set text on GUI display.
void _GUI_Ticker_SetSpeed (struct GUI *gui, int idControl, unsigned msDelay, unsigned msframe)
 Set rate at which ticker scrolls (millisconds per pixel movement).
void _GUI_Tumbler_Setup (GUI *gui, int id, const OPCShape *const *shapes, unsigned shapeAlign, const char *const *szz, unsigned szzAlign, size_t count, int transition, int curr)
 Setup tumbler shapes, text, etc.
void _GUI_Tumbler_SetFrame (GUI *gui, int id, int curr)
 Set current tumbler selection.
bool _GUI_IsOpen (GUI *gui)
 Detect if a GUI is 'alive' or not.
int _GUI_SetFocus (GUI *gui, int ifocus)
 Change the focus.
void _GUI_Heartbeat (GUI *gui)
 GUI Heartbeat function.
void _GUI_CallNotifies (GUI *gui)
 Process and deliver GUI_Notify messages.
bool _GUI_Explode_Set (GUI *gui, int times, int divide, int first, int last)
 Move all offsetted controls away from or towards their original positions, until all are 'off-screen' Call from GUI_Cycle to swoop in controls Generally used where controls are swooped on/off-screen at beginning/end of interface Set offx/offy on controls to get them moving with this. Set offx/offy to some small offset and set times>divide to get them moving off Set offy to some off-screen offset and set times<divide to get them moving on.
void _GUI_Sweep_Set (GUI *gui, int x, int y, int times, int divide, int from, int to)
 Move controls by a relative, progrssively increasing amount Typically before using GUI_Explode.
void _GUI_Offset_Group (GUI *gui, int from, int to, int byx, int byy)
 Move controls by a relative amount.
void _GUI_Offset_Control (GUI *gui, const GUI_Control *control, int x, int y)
 Move control by a relative amount.
void _GUI_Move (GUI *gui, int x, int y)
 Set GUI position to x,y.
bool _GUI_Motion (GUI *gui, int tx, int ty)
 Move a GUI toward tx,ty.
GUI_Control_State_GUI_Control_Data (const GUI *gui, const GUI_Control *control)
 Get data from a control pointer.
const GUI_Control_GUI_Control_Get (const GUI *gui, int index)
 Convert a focus index to a control pointer.
void _GUI_Dirty_Rect (GUI *gui, const Rect *prc)
 Mark a region of GUI dirty.
bool GUI_Control_Paint (const struct GUI *gui, const GUI_Control *control, OPC *opc)
 Get clipped drawing context for dirty refresh of controls.
void _GUI_Default (struct GUI *gui, GUI_Message msg)
 The default GUI handler.
bool GUI_tableft (GUI *gui)
 Work out next tab position going left.
bool GUI_tabright (GUI *gui)
 Work out next tab position going right.
bool GUI_tabup (GUI *gui)
 Work out next tab position going up.
bool GUI_tabdown (GUI *gui)
 Work out next tab position going down.
size_t GUI_BlibNeeds (const void *pData, size_t size, size_t myExtra)
 From an image loaded into memory, determine how big the mutable GUI struct must be.
GUIGUI_BlibInit (const void *pData, size_t size, size_t myExtra, void *pguiBuff, GUI_handler handler, void *param, const OPC *opc, ClipRect *cliprect)
 Initialize an anonymous GUI class without specializations.


Detailed Description

Define gui parts.

Author:
David Mace

Definition in file gui.h.


Define Documentation

#define gui_notified ( gui   ) 

Value:

gen_yield(((GUI*)gui)->state)\
    for( btmp = 0, ((GUI*)gui)->iControl = 0; ((GUI*)gui)->iControl < ((GUI*)gui)->cControl; GUI_Control_Get_Data( (GUI*)gui, ((GUI*)gui)->iControl++ )->mask &= ~GUICS_NOTIFY )\
    if( !(GUI_Control_Get_Data( (GUI*)gui, ((GUI*)gui)->iControl )->mask & GUICS_NOTIFY) || !++btmp )\
    {\
        if( !btmp && ((GUI*)gui)->iControl == ((GUI*)gui)->cControl-1 )\
            state_repeat(((GUI*)gui)->state);\
        continue;\
    }\
    else
This will poll and not proceed to next state until a 'Notify' happens. Code following this should check 'gui->iControl', just as GUI_Notify does. This is a convenience function to trap Notify events in the state machine instead of in the GUI_Notify handler, which can be used without the state machine, and which would otherwise have to 'signal' the state machine, not even knowing what 'handlers' should be doing for a given state.

Next body of code will be invoked for every Notify set

Generally, you could use the GUI_Notify message to trap notifications, and then use GUI_signal (to the signal handlers using the same enum), and that would also work. This just makes it possible to handle controls in different ways, according to what state the state machine code is run.

May only appear in state machine body between GUI_begin and GUI_end

Can not be part of a conditional.

Definition at line 712 of file gui.h.

#define GUICS_DEFAULT   0

Just setup 'normal' control

Definition at line 158 of file gui.h.

#define GUICS_INVISIBLE   1

#define GUICS_NOFOCUS   2

#define GUICS_NOTIFY   16

Raise GUI_Notify on this control

Definition at line 161 of file gui.h.

Referenced by _GUI_CallNotifies(), _GUI_Checkbox_SetCheck(), _GUI_Default(), _GUI_Scrollbar_SetValue(), _GUI_Tumbler_SetFrame(), and _GUI_Tumbler_Setup().

#define offsetof ( s,
 )     ((size_t)&(((s *)0)->m))

Get offset of member 'm' in class or struct 's'.

Parameters:
s Structure to perform offsetof operation on
m Member to find offset of
Returns:
Count of bytes between start of structure and 'm'

Definition at line 688 of file gui.h.


Function Documentation

void _GUI_Animation_SetAnim ( GUI gui,
int  index,
GUI_AnimDir  animdir,
int  startFrame,
unsigned  msFrameTime 
)

Set animation type, resetting animation.

Parameters:
gui Instance of GUI this is for
index Control ID of control we want to operate on
animdir Animation type
startFrame Initial starting frame for animation
msFrameTime Animation speed as milliseconds per frame

Definition at line 1468 of file gui.temp.h.

References _GUI_Animation_SetAnim(), GUI_Animation_State::aDir, GUI_Animation_State::basic, GUI_Control_State::cFrames, GUI_Control_Dirty, GUI_Animation_State::iFrame, GUI_Animation_State::msframe, and GUI_Animation_State::msprev.

Referenced by _GUI_Animation_SetAnim().

01469 {
01470     const GUI_Control* control = GUI_Control_Get( gui, index );
01471     GUI_Animation_State* state = (GUI_Animation_State*)GUI_Control_Data( gui, control );
01472     GUI_Assert_Type( gui, index, guih_Animation );
01473     state->iFrame = max(0,min(startFrame,(int)state->basic.cFrames));
01474     state->msframe = msFrameTime;
01475     state->msprev = (unsigned)GUI_MSTime();
01476     state->aDir = animdir;
01477     GUI_Control_Dirty( gui, control );
01478 }

Here is the call graph for this function:

int _GUI_Animation_SetFrame ( GUI gui,
int  index,
int  frame 
)

Set frame on animation, stopping animation.

Parameters:
gui Instance of GUI this is for
index Control ID of control we want to operate on
frame Frame to set

Definition at line 1444 of file gui.temp.h.

References _GUI_Animation_SetFrame(), GUI_Animation_State::aDir, GUI_Animation_State::basic, GUI_Control_State::cFrames, GUI_Control_Dirty, and GUI_Animation_State::iFrame.

Referenced by _GUI_Animation_SetFrame().

01445 {
01446     const GUI_Control* control = GUI_Control_Get( gui, index );
01447     GUI_Animation_State* state = (GUI_Animation_State*)GUI_Control_Data( gui, control );
01448     int frPrev = state->iFrame;
01449     GUI_Assert_Type( gui, index, guih_Animation );
01450     if( state->basic.cFrames > 0 )
01451         state->iFrame = (frame + state->basic.cFrames) % state->basic.cFrames;
01452     else
01453         state->iFrame = 0;
01454     state->aDir = gad_Stop;
01455     if( frPrev != state->iFrame )
01456         GUI_Control_Dirty( gui, control );
01457     return frPrev;
01458 }

Here is the call graph for this function:

void _GUI_CallNotifies ( GUI gui  ) 

Process and deliver GUI_Notify messages.

Parameters:
gui GUI we're working with

< Raise GUI_Notify on this control

< Raise GUI_Notify on this control

Definition at line 540 of file gui.temp.h.

References _GUI_CallNotifies(), assert, GUI::cControl, GUI_Control_Get_Data, GUICS_NOTIFY, GUI::handler, GUI::iControl, and GUI_Control_State::mask.

Referenced by _GUI_CallNotifies(), and _GUI_Heartbeat().

00541 {
00542     /* Now deliver any notifications that were raised */
00543     assert(gui);
00544     for( gui->iControl = 0; gui->iControl < gui->cControl; ++gui->iControl )
00545     {
00546         GUI_Control_State* data = GUI_Control_Get_Data( gui, gui->iControl );
00547         if( data->mask & GUICS_NOTIFY )
00548         {
00549             gui->handler(gui, GUI_Notify);
00550             data->mask &= ~GUICS_NOTIFY;
00551         }
00552     }
00553 }

Here is the call graph for this function:

bool _GUI_Checkbox_SetCheck ( GUI gui,
int  index,
bool  bCheck 
)

Set checkbox state.

Parameters:
gui Instance of GUI this is for
index Control ID of control we want to operate on
bCheck Check state to assume
Returns:
Previous check state

< Set to make control invisible

< Set to prevent focus and disable control

< Raise GUI_Notify on this control

Definition at line 1303 of file gui.temp.h.

References _GUI_Checkbox_SetCheck(), GUI_Checkbox_State::basic, GUI_Checkbox_State::bCheck, GUI_Control_Dirty, GUICS_INVISIBLE, GUICS_NOFOCUS, GUICS_NOTIFY, and GUI_Control_State::mask.

Referenced by _GUI_Checkbox_SetCheck().

01304 {
01305     bool bOld;
01306     const GUI_Control* control = GUI_Control_Get( gui, index );
01307     GUI_Checkbox_State* state = (GUI_Checkbox_State*)GUI_Control_Data( gui, control );
01308     GUI_Assert_Type( gui, index, guih_Checkbox );
01309     bOld = state->bCheck;
01310     state->bCheck = 0 != (bCheck);
01311     if( !(state->basic.mask & (GUICS_INVISIBLE|GUICS_NOFOCUS)) )
01312         state->basic.mask |= GUICS_NOTIFY;
01313     GUI_Control_Dirty( gui, control );
01314     return bOld;
01315 }

Here is the call graph for this function:

void _GUI_Control_Bound ( GUI gui,
const GUI_Control control,
Rect bound 
)

Work out where a control's bounding box is.

Parameters:
gui GUI we're working with
control Control we want to invoke handler for
bound Rectangle to receive position

Definition at line 936 of file gui.temp.h.

References _GUI_Control_Bound(), GUI_Control_State::offx, GUI::offx, GUI_Control_State::offy, GUI::offy, and RectMoveBy.

Referenced by _GUI_Control_Bound().

00937 {
00938     GUI_Control_State* state = GUI_Control_Data( gui, control );
00939     *bound = (control)->bound;
00940     RectMoveBy(*bound,gui->offx+state->offx,gui->offy+state->offy);
00941 }

Here is the call graph for this function:

GUI_Control_State* _GUI_Control_Data ( const GUI gui,
const GUI_Control control 
)

Get data from a control pointer.

Parameters:
gui GUI we're working with
control Control we want mutable data for

Definition at line 831 of file gui.temp.h.

References _GUI_Control_Data(), assert, assertobjptr, and GUI_Control::offData.

Referenced by _GUI_Control_Data().

00832 {
00833     assertobjptr(gui);
00834     assertobjptr(control);
00835     /* The control data shouldn't be inside GUI base record */
00836     assert( control->offData >= sizeof(GUI) );
00837     return (GUI_Control_State*)((uint8*)gui + control->offData);
00838 }

Here is the call graph for this function:

void _GUI_Control_Dirty ( GUI gui,
const GUI_Control control 
)

Mark a control's bounding box dirty.

Parameters:
gui GUI we're working with
control Control we want to invoke handler for

< Set to make control invisible

Definition at line 919 of file gui.temp.h.

References _GUI_Control_Dirty(), GUI_Dirty_Rect, GUICS_INVISIBLE, GUI_Control_State::mask, GUI_Control_State::offx, GUI::offx, GUI_Control_State::offy, GUI::offy, and RectMoveBy.

Referenced by _GUI_Control_Dirty().

00920 {
00921     GUI_Control_State* state = GUI_Control_Data( gui, control );
00922     if( !(state->mask & GUICS_INVISIBLE) )
00923     {
00924         Rect bound = (control)->bound;
00925         RectMoveBy(bound,gui->offx+state->offx,gui->offy+state->offy);
00926         GUI_Dirty_Rect( gui, &bound );
00927     }
00928 }

Here is the call graph for this function:

void _GUI_Control_Disable ( GUI gui,
int  index 
)

< Set to prevent focus and disable control

Definition at line 634 of file gui.temp.h.

References _GUI_Control_Disable(), GUI::focus, GUI_Control_IsDisabled, GUI_Control_Set_Dirty, GUI_tabright(), and GUICS_NOFOCUS.

Referenced by _GUI_Control_Disable().

00635 {
00636     if( !GUI_Control_IsDisabled( gui, index ) )
00637     {
00638         if( gui->focus == index )
00639             GUI_tabright( gui );
00640         GUI_Control_Data( gui, GUI_Control_Get( gui, index ) )->mask |= GUICS_NOFOCUS;
00641         GUI_Control_Set_Dirty( gui, index );
00642     }
00643 }

Here is the call graph for this function:

void _GUI_Control_Enable ( GUI gui,
int  index 
)

< Set to prevent focus and disable control

Definition at line 624 of file gui.temp.h.

References _GUI_Control_Enable(), GUI::focus, GUI_Control_IsDisabled, GUI_Control_Set_Dirty, GUI_tabright(), and GUICS_NOFOCUS.

Referenced by _GUI_Control_Enable().

00625 {
00626     if( GUI_Control_IsDisabled( gui, index ) )
00627     {
00628         GUI_Control_Data( gui, GUI_Control_Get( gui, index ) )->mask &= ~GUICS_NOFOCUS;
00629         GUI_Control_Set_Dirty( gui, index );
00630         if( gui->focus == index )
00631             GUI_tabright( gui );
00632     }
00633 }

Here is the call graph for this function:

const GUI_Control* _GUI_Control_Get ( const GUI gui,
int  index 
)

Convert a focus index to a control pointer.

Parameters:
gui GUI we're working with
index Current focus/list position

Definition at line 818 of file gui.temp.h.

References _GUI_Control_Get(), assert, assertobjptr, and GUI::list.

Referenced by _GUI_Control_Get().

00819 {
00820     /* Assert we're looking at a valid index */
00821     assertobjptr(gui);
00822     assert( index >= 0 && index < gui->cControl );
00823     return gui->list + index;
00824 }

Here is the call graph for this function:

void _GUI_Control_Hide ( GUI gui,
int  index 
)

< Set to make control invisible

Definition at line 598 of file gui.temp.h.

References _GUI_Control_Hide(), GUI::focus, GUI_Control_IsHidden, GUI_Control_Set_Dirty, GUI_tabright(), and GUICS_INVISIBLE.

Referenced by _GUI_Control_Hide().

00599 {
00600     if( !GUI_Control_IsHidden( gui, index ) )
00601     {
00602         if( gui->focus == index )
00603             GUI_tabright( gui );
00604         GUI_Control_Set_Dirty( gui, index );
00605         GUI_Control_Data( gui, GUI_Control_Get( gui, index ) )->mask |= GUICS_INVISIBLE;
00606     }
00607 }

Here is the call graph for this function:

bool _GUI_Control_IsDisabled ( const GUI gui,
int  index 
)

< Set to prevent focus and disable control

Definition at line 620 of file gui.temp.h.

References _GUI_Control_IsDisabled(), and GUICS_NOFOCUS.

Referenced by _GUI_Control_IsDisabled().

00621 {
00622     return 0 != (GUI_Control_Data( gui, GUI_Control_Get( gui, index ) )->mask & GUICS_NOFOCUS);
00623 }

Here is the call graph for this function:

bool _GUI_Control_IsFocused ( const GUI gui,
const GUI_Control control 
)

< Set to make control invisible

< Set to prevent focus and disable control

Definition at line 588 of file gui.temp.h.

References _GUI_Control_IsFocused(), GUI::focus, GUI_Control_Mask, GUICS_INVISIBLE, GUICS_NOFOCUS, and GUI::list.

Referenced by _GUI_Control_IsFocused().

00589 {
00590     return (gui->list + gui->focus) == control && !(GUI_Control_Mask( gui, control ) & (GUICS_INVISIBLE|GUICS_NOFOCUS));
00591 }

Here is the call graph for this function:

bool _GUI_Control_IsHidden ( const GUI gui,
int  index 
)

< Set to make control invisible

Definition at line 593 of file gui.temp.h.

References _GUI_Control_IsHidden(), and GUICS_INVISIBLE.

Referenced by _GUI_Control_IsHidden().

00594 {
00595     return 0 != (GUI_Control_Data( gui, GUI_Control_Get( gui, index ) )->mask & GUICS_INVISIBLE);
00596 }

Here is the call graph for this function:

void _GUI_Control_Set_Offset ( GUI gui,
int  index,
int  px,
int  py 
)

Move control's relative position.

Parameters:
gui GUI we're zooping in
index Index of GUI control we're moving
px,py How much to move it

Definition at line 763 of file gui.temp.h.

References _GUI_Control_Set_Offset(), GUI_Control_Dirty, GUI_Control_State::offx, and GUI_Control_State::offy.

Referenced by _GUI_Control_Set_Offset().

00764 {
00765     const GUI_Control* control = GUI_Control_Get( gui, index );
00766     GUI_Control_State* state = GUI_Control_Data( gui, control );
00767     GUI_Control_Dirty( gui, control );
00768     state->offx = (int16)px;
00769     state->offy = (int16)py;
00770     GUI_Control_Dirty( gui, control );
00771 }

Here is the call graph for this function:

void _GUI_Control_SetFrames ( GUI gui,
int  index,
const OPCShape *const *  frames,
size_t  cFrames 
)

Set Control art data.

Parameters:
gui GUI instance control is in
index Control index
frames Pointer to array of OPCShape objects
cFrames Count of frames

Definition at line 867 of file gui.temp.h.

References _GUI_Control_SetFrames(), GUI_Control_State::cFrames, GUI_Control_State::frames, GUI_Control_Get_Data, and GUI_Control_Set_Dirty.

Referenced by _GUI_Control_SetFrames().

00868 {
00869     GUI_Control_State* state = (GUI_Control_State*)GUI_Control_Get_Data( gui, index ); 
00870     state->frames = frames;
00871     state->cFrames = cFrames;
00872     GUI_Control_Set_Dirty( gui,index ); 
00873 }

Here is the call graph for this function:

void _GUI_Control_SetJustify ( GUI gui,
int  index,
unsigned  just 
)

Set Control text justify.

Parameters:
gui GUI instance control is in
index Control index
just Left/right/etc. justify text

Definition at line 893 of file gui.temp.h.

References _GUI_Control_SetJustify(), GUI_Control_Get_Data, and GUI_Control_Set_Dirty.

Referenced by _GUI_Control_SetJustify().

00894 {
00895     GUI_Control_Get_Data( gui,index )->align = just; 
00896     GUI_Control_Set_Dirty( gui,index );
00897 }

Here is the call graph for this function:

void _GUI_Control_SetText ( GUI gui,
int  index,
const char *  szText 
)

Set Control text.

Parameters:
gui GUI instance control is in
index Control index
szText Text to display

Definition at line 881 of file gui.temp.h.

References _GUI_Control_SetText(), GUI_Control_Get_Data, and GUI_Control_Set_Dirty.

Referenced by _GUI_Control_SetText().

00882 { 
00883     GUI_Control_Get_Data( gui,index )->text = szText; 
00884     GUI_Control_Set_Dirty( gui,index ); 
00885 }

Here is the call graph for this function:

void _GUI_Control_SetupText ( GUI gui,
int  index,
const char *  szText,
unsigned  just 
)

Set Control text and justify.

Parameters:
gui GUI instance control is in
index Control index
szText Text to display
just Left/right/etc. justify text

Definition at line 906 of file gui.temp.h.

References _GUI_Control_SetupText(), GUI_Control_State::align, GUI_Control_Get_Data, GUI_Control_Set_Dirty, and GUI_Control_State::text.

Referenced by _GUI_Control_SetupText().

00907 { 
00908     GUI_Control_State* state = (GUI_Control_State*)GUI_Control_Get_Data( gui, index ); 
00909     state->text = szText; 
00910     state->align = just;
00911     GUI_Control_Set_Dirty( gui, index ); 
00912 }

Here is the call graph for this function:

void _GUI_Control_Show ( GUI gui,
int  index 
)

< Set to make control invisible

Definition at line 609 of file gui.temp.h.

References _GUI_Control_Show(), GUI::focus, GUI_Control_IsHidden, GUI_Control_Set_Dirty, GUI_tabright(), and GUICS_INVISIBLE.

Referenced by _GUI_Control_Show().

00610 {
00611     if( GUI_Control_IsHidden( gui, index ) )
00612     {
00613         GUI_Control_Data( gui, GUI_Control_Get( gui, index ) )->mask &= ~GUICS_INVISIBLE;
00614         GUI_Control_Set_Dirty( gui, index );
00615         if( gui->focus == index )
00616             GUI_tabright( gui );
00617     }
00618 }

Here is the call graph for this function:

void _GUI_Default ( struct GUI gui,
GUI_Message  msg 
)

The default GUI handler.

Parameters:
gui Instance of GUI this is for
msg What to do
Returns:
true if message handled

< Raise GUI_Notify on this control

< Set to make control invisible

Definition at line 2576 of file gui.temp.h.

References _GUI_Default(), GUI::bg, GUI::cControl, ClipRect::cDirty, GUI::cdirty, OPC::clip, GUI::control, ClipRect::dirty, GUI::dirty, GUI::focus, GUI_Control_Bound, GUI_Control_Dirty, GUI_Control_Get_Mask, GUI_Control_IsFocused, GUI_Dirty, GUI_Dirty_Rect, GUI_SetFocus, GUICS_INVISIBLE, GUICS_NOFOCUS, GUICS_NOTIFY, GUI::handler, GUI::iControl, GUI::list, GUI::mask, GUI_Control_State::mask, GUI::offx, GUI::offy, GUI::opc, GUI::ov, GUI::parent, pointer_foreach_const, pointer_foreach_const_reverse, RectClear, RectEmpty, and RectPtInRect.

Referenced by _GUI_Default(), and GUI_BlibInit().

02577 {
02578     switch( msg )
02579     {
02580 
02581     case GUI_CycleCtrl:
02582         /*
02583             Cycle a control:
02584                 Control ID is in iControl
02585                 Call default before/after your hook to control (or never) how your handling is mixed with the control
02586         */
02587         GUI_Control_handle( gui, GUI_Control_Get( gui, gui->iControl ), GUI_Cycle );
02588         break;
02589 
02590     case GUI_PaintCtrl:
02591         /*
02592             Paint a control:
02593                 Control ID is in iControl
02594                 Call default before/after your hook to control (or never) how your content is mixed with the control
02595         */
02596         GUI_Control_handle( gui, GUI_Control_Get( gui, gui->iControl ), GUI_Paint );
02597         break;
02598 
02599     case GUI_Cycle:
02600         {
02601             /* Clear notifies */
02602             pointer_foreach_const( GUI_Control, gui->list, gui->cControl, control )
02603             {
02604                 GUI_Control_State* state = GUI_Control_Data( gui, control );
02605                 state->mask &= ~GUICS_NOTIFY;
02606             }
02607         }
02608 #ifdef GUI_GetPointer
02609         /* Do pointer/mouse/finger focus magic */
02610         if( !gui->parent || GUI_Control_IsFocused( gui->parent, gui->control ) )
02611         {
02612             int x, y;
02613             Rect bound;
02614             GUI_GetPointer( x, y );
02615             {
02616                 pointer_foreach_const_reverse( GUI_Control, gui->list, gui->cControl, control )
02617                 {
02618                     GUI_Control_Bound( gui, control, &bound );
02619                     if( !(GUI_Control_Data( gui, control )->mask & (GUICS_INVISIBLE|GUICS_NOFOCUS)) && RectPtInRect( bound, x, y ) )
02620                     {
02621                         if( gui->focus >= 0 )
02622                         {
02623                             const GUI_Control* oldFocus = GUI_Control_Get( gui, gui->focus );
02624                             if( oldFocus != control )
02625                             {
02626                                 GUI_Control_Dirty( gui, oldFocus );
02627                                 GUI_Control_Dirty( gui, control );
02628                                 gui->focus = control - gui->list;
02629                                 gui->mask |= GUIM_FOCUSCHANGED;
02630                             }
02631                         }
02632                         else
02633                         {
02634                             gui->focus = control - gui->list;
02635                             GUI_Control_Dirty( gui, control );
02636                             gui->mask |= GUIM_FOCUSCHANGED;
02637                         }
02638                         break;
02639                     }
02640                 }
02641             }
02642         }
02643 #endif
02644         /* Now cycle the controls */
02645         for( gui->iControl = 0; gui->iControl < gui->cControl; ++gui->iControl )
02646             gui->handler(gui, GUI_CycleCtrl);
02647         break;
02648 
02649     case GUI_Paint: 
02650         /*
02651             Redraw the GUI, if it's dirty
02652             Hook and call GUI_Default afterwards to draw things behind under application control
02653             Hook and call GUI_Default before to draw things on top under application control
02654             Use GUI_PaintCtrl, or define a sf_, if you have something specific to do in the middle
02655         */
02656         {
02657             OPC opc;
02658             const Rect* curr;
02659 #ifdef SIMPLE_DIRTY
02660             if( RectEmpty(gui->dirty) )
02661             {
02662                 return;
02663             }
02664             else
02665             {
02666                 curr = &gui->dirty;
02667             }
02668             gui->mask |= GUIM_INPAINT;
02669 #else
02670             int cDirty;
02671             if( gui->parent )
02672             {
02673                 /* Child windows don't iterate the dirty list recursively */
02674                 curr = &gui->parent->dirty;
02675                 cDirty = 1;
02676             }
02677             else
02678             {
02679                 /* Top-level windows need to iterate whole list */
02680                 curr = gui->cdirty->dirty;
02681                 cDirty = gui->cdirty->cDirty;
02682             }
02683             /* Let external code know that paint is going on */
02684             gui->mask |= GUIM_INPAINT;
02685             while( cDirty-- )
02686 #endif  
02687             {
02688                 /* Set our 'dirty' rectangle */
02689                 gui->dirty = *curr;
02690                 OPC_NAMING(Clip)( &opc, &gui->opc, curr );
02691                 /* Render background */
02692                 OPC_NAMING(Shape)( &opc, gui->bg, gui->offx,gui->offy );
02693                 /* Render controls in order */
02694                 for( gui->iControl = 0; gui->iControl < gui->cControl; ++gui->iControl )
02695                 {
02696 
02697                     if( !( GUI_Control_Get_Mask( gui, gui->iControl ) & GUICS_INVISIBLE) )
02698                     {
02699                         gui->handler(gui, GUI_PaintCtrl);
02700                     }
02701                 }
02702                 /* Render overlay */
02703                 OPC_NAMING(Shape)( &opc, gui->ov, gui->offx,gui->offy );
02704                 curr++;
02705             }
02706             /* Let external code know that paint is finished */
02707             gui->mask &= ~GUIM_INPAINT;
02708             /* It's up to external code to clear the dirty list */
02709         }
02710         RectClear(gui->dirty);
02711         break;
02712 
02713     case GUI_Init:  /* Do initializations, if it's dirty */
02714         {
02715             /* Initialize trivial dirty rectangle handler */
02716             GUI_Dirty( gui );
02717             {
02718                 /* Initialize controls */
02719                 pointer_foreach_const( GUI_Control, gui->list, gui->cControl, control )
02720                     GUI_Control_handle( gui, control, GUI_Init );
02721             }
02722             /* Set focus at earliest enabled, visible control */
02723             GUI_SetFocus( gui, 0 );
02724             gui->mask = GUIM_ALIVE;
02725         }
02726         break;
02727 
02728     case GUI_Destroy: /* If anything grabbed up a resource, release it. */
02729         {
02730             pointer_foreach_const( GUI_Control, gui->list, gui->cControl, control )
02731                 GUI_Control_handle( gui, control, GUI_Destroy );
02732             GUI_Dirty_Rect( gui, &gui->opc.clip );
02733             gui->cControl = 0; /* Note, if we were in Cycle, Notify, Paint, etc. loops, this stops it. */
02734             gui->mask = 0;
02735         }
02736         break;
02737 
02738     /* Eatme events */
02739     case GUI_Focus:
02740     case GUI_Notify:
02741     default:
02742         break;
02743     }
02744 }

Here is the call graph for this function:

bool _GUI_Explode_Set ( GUI gui,
int  times,
int  divide,
int  first,
int  last 
)

Move all offsetted controls away from or towards their original positions, until all are 'off-screen' Call from GUI_Cycle to swoop in controls Generally used where controls are swooped on/off-screen at beginning/end of interface Set offx/offy on controls to get them moving with this. Set offx/offy to some small offset and set times>divide to get them moving off Set offy to some off-screen offset and set times<divide to get them moving on.

Parameters:
gui GUI we're zooping out
times Value to multiply by, greater than divide
divide Value to divide by, less than times
first,last Range of controls to do this operation on
Returns:
true when all controls are finished moving

Definition at line 659 of file gui.temp.h.

References _GUI_Explode_Set(), assert, assertobjptr, OPC::clip, GUI_Control_Bound, GUI_Control_Dirty, GUI::list, GUI_Control_State::offx, GUI_Control_State::offy, GUI::opc, pointer_foreach_const, and RectOutside.

Referenced by _GUI_Explode_Set().

00660 {
00661     bool alldone = true;
00662     assertobjptr(gui);
00663     assert( first >= 0 && first < gui->cControl );
00664     assert( last >= first && last < gui->cControl );
00665     {
00666         pointer_foreach_const( GUI_Control, gui->list+first, (1+last-first), control )
00667         {
00668             GUI_Control_State* state = GUI_Control_Data( gui, control );
00669             if( state->offx || state->offy )
00670             {
00671                 Rect bound;
00672                 GUI_Control_Bound( gui, control, &bound );
00673                 if( 
00674                     (( times > divide ) && !RectOutside(bound,gui->opc.clip)) ||
00675                     (( times < divide ) && (state->offx || state->offy) ) )
00676                 {
00677                     GUI_Control_Dirty( gui, control );
00678                     state->offx = (int16)(state->offx * times / divide);
00679                     state->offy = (int16)(state->offy * times / divide);
00680                     GUI_Control_Dirty( gui, control );
00681                     alldone = false;
00682                 }
00683             }
00684         }
00685     }
00686     return alldone;
00687 }

Here is the call graph for this function:

void _GUI_Heartbeat ( GUI gui  ) 

GUI Heartbeat function.

Parameters:
gui GUI we're working with

Definition at line 559 of file gui.temp.h.

References _GUI_CallNotifies(), _GUI_Heartbeat(), assert, GUI::cdirty, GUI_IsOpen, GUI::handler, and GUI::mask.

Referenced by _GUI_Heartbeat().

00560 {
00561     /*
00562      * When layering multiple GUIs...
00563      * 1. Cycle all GUIs.
00564      * 2. Do any focus-change notifications
00565      * 3. Accumulate 'dirty' regions and make all GUI dirty regions the same
00566      * 4. Paint all GUIs
00567      * 5. Invoke notifies
00568      */
00569     assert(gui);
00570     if( GUI_IsOpen( gui ) )
00571         gui->handler( gui, GUI_Cycle );
00572     if( GUI_IsOpen( gui ) && (gui->mask & GUIM_FOCUSCHANGED) )
00573     {
00574         gui->mask &= ~GUIM_FOCUSCHANGED;
00575         gui->handler( gui, GUI_Focus );
00576     }
00577     if( GUI_IsOpen( gui ) )
00578     {
00579         gui->handler( gui, GUI_Paint );
00580 #ifndef SIMPLE_DIRTY
00581         ClipRect_clear( gui->cdirty );
00582 #endif
00583         _GUI_CallNotifies( gui );
00584     }
00585 }

Here is the call graph for this function:

bool _GUI_IsOpen ( GUI gui  ) 

Detect if a GUI is 'alive' or not.

Parameters:
gui GUI we're working with
Returns:
true if GUI appears to be valid and running

Definition at line 495 of file gui.temp.h.

References _GUI_IsOpen(), and GUI::mask.

Referenced by _GUI_IsOpen().

00496 {
00497     return gui && (gui->mask & GUIM_ALIVE);
00498 }

Here is the call graph for this function:

bool _GUI_Motion ( GUI gui,
int  tx,
int  ty 
)

Move a GUI toward tx,ty.

Parameters:
gui GUI we're working with
tx,ty Target coordinates
Returns:
true when GUI is at target position

Definition at line 796 of file gui.temp.h.

References _GUI_Motion(), GUI_Dirty, GUI::offx, and GUI::offy.

Referenced by _GUI_Motion().

00797 {
00798     if( gui->offx == tx && gui->offy == ty )
00799         return true;
00800     GUI_Dirty( gui );
00801     gui->offx = (tx + gui->offx) / 2;
00802     gui->offy = (ty + gui->offy) / 2;
00803     if( abs(gui->offx - tx) <= 8 && abs(gui->offy - ty) <= 8 )
00804     {
00805         gui->offx = tx;
00806         gui->offy = ty;
00807     }
00808     GUI_Dirty( gui );
00809     return false;
00810 }

Here is the call graph for this function:

void _GUI_Move ( GUI gui,
int  x,
int  y 
)

Set GUI position to x,y.

Parameters:
gui GUI we're working with
x,y Target coordinates
Returns:
true when GUI is at target position

Definition at line 779 of file gui.temp.h.

References _GUI_Move(), OPC::clip, GUI_Dirty_Rect, GUI::offx, GUI::offy, and GUI::opc.

Referenced by _GUI_Move().

00780 { 
00781     if( gui->offx != x || gui->offy != y )
00782     {
00783         gui->offx = x; 
00784         gui->offy = y; 
00785         GUI_Dirty_Rect( gui, &gui->opc.clip ); 
00786     }
00787 }

Here is the call graph for this function:

void _GUI_Offset_Control ( GUI gui,
const GUI_Control control,
int  x,
int  y 
)

Move control by a relative amount.

Parameters:
gui GUI we're zooping in
control Control we're moving
x Amount to move X by
y Amount to move Y by

Definition at line 748 of file gui.temp.h.

References _GUI_Offset_Control(), GUI_Control_Dirty, GUI_Control_State::offx, and GUI_Control_State::offy.

Referenced by _GUI_Offset_Control(), _GUI_Offset_Group(), and _GUI_Sweep_Set().

00749 {
00750     GUI_Control_State* state = GUI_Control_Data( gui, control );
00751     GUI_Control_Dirty( gui, control );
00752     state->offx = (int16)x;
00753     state->offy = (int16)y;
00754     GUI_Control_Dirty( gui, control );
00755 }

Here is the call graph for this function:

void _GUI_Offset_Group ( GUI gui,
int  from,
int  to,
int  x,
int  y 
)

Move controls by a relative amount.

Parameters:
gui GUI we're zooping in
from First control in group to move
to Last control in group to move
x Amount to move X by
y Amount to move Y by

Definition at line 731 of file gui.temp.h.

References _GUI_Offset_Control(), _GUI_Offset_Group(), assert, GUI::list, and pointer_foreach_const.

Referenced by _GUI_Offset_Group().

00732 {
00733     assert( from >= 0 && from < gui->cControl );
00734     assert( to >= from && to < gui->cControl );
00735     {
00736         pointer_foreach_const( GUI_Control, gui->list + from, 1+to-from, control )
00737             _GUI_Offset_Control( gui, control, x, y );
00738     }
00739 }

Here is the call graph for this function:

int _GUI_Scrollbar_SetValue ( struct GUI gui,
int  idControl,
int  newValue,
int  minValue,
int  maxValue 
)

Setup scrollbar attributes.

Parameters:
gui GUI scrollbar is in
idControl Control we're modifying
newValue New scroll setting
minValue Minimum value we should assume
maxValue Maximum value we should assume
Returns:
Previous value

< Set to make control invisible

< Set to prevent focus and disable control

< Raise GUI_Notify on this control

Definition at line 1836 of file gui.temp.h.

References _GUI_Scrollbar_SetValue(), GUI_Scrollbar_State::basic, GUI_Control_Get_Data, GUICS_INVISIBLE, GUICS_NOFOCUS, GUICS_NOTIFY, GUI_Control_State::mask, GUI_Scrollbar_State::oldValue, GUI_Scrollbar_State::value, GUI_Scrollbar_State::vmax, and GUI_Scrollbar_State::vmin.

Referenced by _GUI_Scrollbar_SetValue().

01837 {
01838     int oldvalue;
01839     GUI_Scrollbar_State* tmpScrollbarState = (GUI_Scrollbar_State*)GUI_Control_Get_Data( (gui), (idControl) );
01840     GUI_Assert_Type( (gui), (idControl), guih_Scrollbar );
01841     tmpScrollbarState->vmin = (minValue);
01842     tmpScrollbarState->vmax = (maxValue);
01843     tmpScrollbarState->oldValue = -1-newValue;
01844     oldvalue = tmpScrollbarState->value;
01845     tmpScrollbarState->value = newValue;
01846     if( !(tmpScrollbarState->basic.mask & (GUICS_INVISIBLE|GUICS_NOFOCUS)) )
01847         tmpScrollbarState->basic.mask |= GUICS_NOTIFY;
01848     return oldvalue;
01849 }

Here is the call graph for this function:

int _GUI_SetFocus ( GUI gui,
int  ifocus 
)

Change the focus.

Parameters:
gui GUI we're working with
ifocus New focus ID
Returns:
Previous focus

Definition at line 506 of file gui.temp.h.

References _GUI_SetFocus(), assert, GUI::cControl, GUI::focus, GUI_Control_Dirty, GUI_Control_IsFocused, GUI_tabright(), GUI::list, and GUI::mask.

Referenced by _GUI_SetFocus(), GUI_tabdown(), GUI_tableft(), GUI_tabright(), and GUI_tabup().

00507 {
00508     int focusPrev;
00509     assert(gui);
00510     focusPrev = gui->focus;
00511     gui->focus = ifocus;
00512     if( gui->focus >= 0 && gui->focus < gui->cControl )
00513     {
00514         if( GUI_Control_IsFocused( gui, gui->list + gui->focus ) )
00515         {
00516             if( focusPrev != gui->focus )
00517             {
00518                 GUI_Control_Dirty( gui, gui->list + gui->focus );
00519                 gui->mask |= GUIM_FOCUSCHANGED;
00520             }
00521         }
00522         else
00523             GUI_tabright( gui );
00524     }
00525     if( focusPrev != gui->focus )
00526     {
00527         if( focusPrev >= 0 && focusPrev < gui->cControl )
00528         {
00529             GUI_Control_Dirty( gui, gui->list + focusPrev );
00530             gui->mask |= GUIM_FOCUSCHANGED;
00531         }
00532     }
00533     return focusPrev;
00534 }

Here is the call graph for this function:

void _GUI_Sweep_Set ( GUI gui,
int  x,
int  y,
int  times,
int  divide,
int  from,
int  to 
)

Move controls by a relative, progrssively increasing amount Typically before using GUI_Explode.

Parameters:
gui GUI we're zooping in
from First control in group to move
to Last control in group to move
times Value to multiply by, greater than divide
divide Value to divide by, less than times
x Amount to move X by
y Amount to move Y by

Definition at line 704 of file gui.temp.h.

References _GUI_Offset_Control(), _GUI_Sweep_Set(), assert, assertobjptr, GUI::list, and pointer_foreach_const.

Referenced by _GUI_Sweep_Set().

00705 {
00706     assertobjptr(gui);
00707     assert( from >= 0 && from < gui->cControl );
00708     assert( to >= from && to < gui->cControl );
00709     {
00710         pointer_foreach_const( GUI_Control, gui->list + from, 1+to-from, control )
00711         {
00712             _GUI_Offset_Control( gui, control, x, y );
00713             x = x * times / divide;
00714             y = y * times / divide;
00715         }
00716     }
00717 }

Here is the call graph for this function:

void _GUI_Ticker_SetText ( struct GUI gui,
int  idControl,
const char *  sz 
)

Set text on GUI display.

Parameters:
gui Instance of GUI this is for
idControl Control ID of control we want to set text on
sz What to say; "" for blank, or NULL if you want to revert back to original

Definition at line 1965 of file gui.temp.h.

References _GUI_Ticker_SetText(), GUI_Ticker_State::basic, GUI_Control::cState, GUI_Control_State::frames, GUI_Ticker_State::offset, pointer_foreach_const, RectAutoClear, RectWide, GUI_Control_State::text, and GUI_Ticker_State::tWide.

Referenced by _GUI_Ticker_SetText().

01966 {
01967     const GUI_Control* control = GUI_Control_Get( gui, idControl );
01968     GUI_Ticker_State* state = (GUI_Ticker_State*)GUI_Control_Data( gui, control );
01969     GUI_Assert_Type( gui, idControl, guih_Ticker );
01970     if( sz )
01971     {
01972         Rect bounds = RectAutoClear();
01973         GUI_MeasureText( &bounds, GUI_ONELINE, sz, ~0u );
01974         state->basic.text = sz;
01975         state->offset = 0;
01976         state->tWide = RectWide(bounds);
01977     }
01978     else
01979     {
01980         state->basic.text = NULL;
01981         state->offset = 0;
01982         state->tWide = 0;
01983         {
01984             pointer_foreach_const( OPCShape*, state->basic.frames, control->cState, curr )
01985                 state->tWide += (*curr)->wide;
01986         }
01987     }
01988 }

Here is the call graph for this function:

void _GUI_Tumbler_SetFrame ( GUI gui,
int  id,
int  curr 
)

Set current tumbler selection.

Parameters:
gui GUI tumbler is in
id Control identifier
curr Currently selected item

< Raise GUI_Notify on this control

Definition at line 2477 of file gui.temp.h.

References _GUI_Tumbler_SetFrame(), GUI_Tumbler_State::basic, GUI_Control_Dirty, GUICS_NOTIFY, GUI_Control_State::mask, GUI_Tumbler_State::offPrev, and GUI_Tumbler_State::stateCurr.

Referenced by _GUI_Tumbler_SetFrame().

02478 {
02479     const GUI_Control* control = GUI_Control_Get( gui, id );
02480     GUI_Tumbler_State* state = (GUI_Tumbler_State*)GUI_Control_Data( gui, control );
02481     GUI_Assert_Type( gui, id, guih_Tumbler );
02482     state->offPrev = 0;
02483     state->stateCurr = curr;
02484     state->basic.mask |= GUICS_NOTIFY;
02485     GUI_Control_Dirty( gui, control );
02486 }

Here is the call graph for this function:

void _GUI_Tumbler_Setup ( GUI gui,
int  id,
const OPCShape *const *  shapes,
unsigned  shapeAlign,
const char *const *  szz,
unsigned  szzAlign,
size_t  count,
int  transition,
int  curr 
)

Setup tumbler shapes, text, etc.

Parameters:
gui GUI tumbler is in
id Control identifier
shapes Array of shapes to cycle through
shapeAlign Alignment for shape (GUI_LEFT,GUI_CENTER, etc. mask)
szz Array of strings to cycle through
szzAlign Alignment for text
count Count of shapes/strings
transition How many frames to play out transitions (0 for instant)
curr Currently selected item

< Set to make control invisible

< Set to prevent focus and disable control

< Raise GUI_Notify on this control

Definition at line 2452 of file gui.temp.h.

References _GUI_Tumbler_Setup(), GUI_Control_State::align, GUI_Tumbler_State::basic, GUI_Tumbler_State::cStates, GUI_Tumbler_State::cTransition, GUI_Control_Dirty, GUICS_INVISIBLE, GUICS_NOFOCUS, GUICS_NOTIFY, GUI_Tumbler_State::ialign, GUI_Control_State::mask, GUI_Tumbler_State::msRepeat, GUI_Tumbler_State::offPrev, GUI_Tumbler_State::stateCurr, GUI_Tumbler_State::statePrev, GUI_Tumbler_State::states, and GUI_Tumbler_State::tstates.

Referenced by _GUI_Tumbler_Setup().

02453 {
02454     const GUI_Control* control = GUI_Control_Get( gui, id );
02455     GUI_Tumbler_State* state = (GUI_Tumbler_State*)GUI_Control_Data( gui, control );
02456     GUI_Assert_Type( gui, id, guih_Tumbler );
02457     state->basic.align = szzAlign;
02458     state->offPrev = 0;
02459     state->states = shapes;
02460     state->tstates = szz;
02461     state->cStates = (int)count;
02462     state->cTransition = transition;
02463     state->ialign = shapeAlign;
02464     state->stateCurr = state->statePrev = curr;
02465     state->msRepeat = GUI_DefaultRepeat;
02466     if( count && !(state->basic.mask & (GUICS_INVISIBLE|GUICS_NOFOCUS)) )
02467         state->basic.mask |= GUICS_NOTIFY;
02468     GUI_Control_Dirty( gui, control );
02469 }

Here is the call graph for this function:

GUI* GUI_BlibInit ( const void *  pData,
size_t  size,
size_t  myExtra,
void *  pguiBuff,
GUI_handler  handler,
void *  param,
const OPC opc,
ClipRect cliprect 
)

Initialize an anonymous GUI class without specializations.

Parameters:
pData Pointer to loaded image
size Size of loaded image
myExtra Extra bytes reserved for your own GUI data (at GUI+1) A non-zero myExtra will invalidate the structure from your GUI's include file, unless it's sizeof() is the same type as '-u' into guify, and offsets/alignments are compatible.
pguiBuff A buffer containing at least GUI_Needs( pData, size ) bytes
handler A user supplied handler that possibly has a clue (NULL to invoke default)
param User parameter
opc OPC used to manage drawing/clipping
cliprect For dirty rectangle tracking, common place to add/track dirty rects.
Returns:
Pointer to GUI we built, or NULL if GUI data is invalid
pData must hang around as long as the interface does. The read-only memory it's pointing at is referenced directly for the life of the GUI.

Keep in mind that this is NATIVE binary data; what's compiled for big- endian architecture will not work with a little-endian machine, and even build settings affecting structure alignment may mess up the data.

If you have a 'different' target from the platform the tool's running on, build with the exported C data instead. That version is relatively insensitive to differences in platform.

'myExtra' is a convenience to allocate some extra stuff the GUI needs in one wrapper. If you generated this GUI with guify, and '-uBlah', then myExtra should be sizeof(Blah) to have structure members line up. Normally, just use the GUI_Control_Get_Data functions to retrieve control data.

Definition at line 2880 of file gui.temp.h.

References _GUI_Default(), array_qsort, assert, GUI::bg, BLIB_COUNT, BLIB_ELEMENT_PTR, BLIB_ELEMENT_SIZE, BLIB_foreach, BLIB_SIZE, BLIB_User(), BLIB_Valid(), GUI_Control::bound, GUI::cControl, GUI::cdirty, GUI_Control::cState, GUI::dirty, GUI::focus, GUI_BlibInit(), GUI::handler, GUI::htab, GUI::list, GUI_Control::offData, GUI::offx, GUI::offy, GUI::opc, GUI::ov, GUI::param, GUI_Control::params, GUI::parent, GUI_Control::state, GUI::state, state_init, GUI_Control::type, and GUI::vtab.

Referenced by GUI_BlibInit().

02886 {
02887     GUI* gui = (GUI*)pguiBuff;
02888     const BLIB* blib = pData;
02889     myExtra = (myExtra + 7) & ~7;
02890     if( BLIB_Valid( blib, size ) && BLIB_User(blib) == *((uint32*)"GUI") )
02891     {
02892         /*
02893          * Pass 1: Work out where things begin and end
02894          */
02895         GUI_Control* list;          /* Main control table */
02896         GUI_Control** htab;         /* Main control table */
02897         GUI_Control** vtab;         /* Vertical tab table */
02898         const OPCShape** sptab;     /* Sprite lookup table */
02899         {
02900             size_t offset = (sizeof(GUI) + myExtra + 7) & ~7u;
02901             size_t count = 0;
02902             size_t cControl = 0;
02903             BLIB_foreach(blib,curr)
02904             {
02905                 const BLIB* blibCurr = (const BLIB*)curr;
02906                 GUIHandlers user = (GUIHandlers)BLIB_User( blibCurr );
02907                 if( user >= GUIHandlers_COUNT )
02908                     return 0;
02909                 switch( user )
02910                 {
02911                 case guih_Invalid: default:
02912                     return NULL;
02913 
02914                 case guih_Background:
02915                     gui->bg = (const OPCShape*)(BLIB_SIZE( blib ) ? BLIB_ELEMENT_PTR( blibCurr, 0 ) : NULL);
02916                     break;
02917                 case guih_Overlay:
02918                     gui->ov = (const OPCShape*)(BLIB_SIZE( blib ) ? BLIB_ELEMENT_PTR( blibCurr, 0 ) : NULL);
02919                     break;
02920 
02921                 case guih_ArtResource:
02922                     count++;
02923                     break;
02924                 case guih_GUI:
02925                     user = guih_StaticFrame;
02926                 case guih_StaticFrame:
02927                 case guih_Button:
02928                 case guih_Checkbox:
02929                 case guih_Animation:
02930                 case guih_Scrollbar:
02931                 case guih_Ticker:
02932                 case guih_Tumbler:
02933                     offset += lutRequirements[user];
02934                     count++;
02935                     cControl++;
02936                     break;
02937                 }
02938             }
02939             /* Work out beginnings of various tables */
02940             gui->parent = NULL;
02941             gui->list = list = (GUI_Control*)((uint8*)pguiBuff + offset);
02942             gui->htab = htab = (GUI_Control**)(list + count);
02943             gui->vtab = vtab = (GUI_Control**)(htab + count);
02944             sptab = (const OPCShape**)(vtab + count);
02945             gui->bg = gui->ov = NULL;
02946             gui->cControl = cControl;
02947             gui->focus = 0;
02948             gui->offx = gui->offy = 0;
02949             gui->opc = *opc;
02950             gui->param = param;
02951 #ifndef GUI_NO_GENERATOR
02952             state_init( gui->state );
02953 #endif
02954             gui->dirty = opc->clip;
02955 #ifndef SIMPLE_DIRTY
02956             gui->cdirty = cliprect;
02957 #endif
02958             gui->handler = handler ? handler : _GUI_Default;
02959         }
02960         /*
02961          * Pass 2: Now that we know where things go, put things in it
02962          */
02963         {
02964             size_t offset = sizeof(GUI);
02965             BLIB_foreach(blib,curr)
02966             {
02967                 const BLIB* blibCurr = (const BLIB*)curr;
02968                 GUIHandlers user = (GUIHandlers)BLIB_User( blibCurr );
02969                 switch( user )
02970                 {
02971                 case guih_Invalid: default:
02972                     return NULL;
02973 
02974                 case guih_Background:
02975                     gui->bg = (const OPCShape*)(BLIB_SIZE( blib ) ? BLIB_ELEMENT_PTR( blibCurr, 0 ) : NULL);
02976                     break;
02977                 case guih_Overlay:
02978                     gui->ov = (const OPCShape*)(BLIB_SIZE( blib ) ? BLIB_ELEMENT_PTR( blibCurr, 0 ) : NULL);
02979                     break;
02980 
02981                 case guih_GUI:
02982                     user = guih_StaticFrame;
02983                 case guih_ArtResource:
02984                 case guih_StaticFrame:
02985                 case guih_Button:
02986                 case guih_Checkbox:
02987                 case guih_Animation:
02988                 case guih_Scrollbar:
02989                 case guih_Ticker:
02990                 case guih_Tumbler:
02991                     list->type = user;
02992                     list->offData = offset;
02993                     /*
02994                      * Element 0 of the BLIB is the bounding box for the control
02995                      * Element 1~BLIB_COUNT( blib ) are sprites
02996                      */     
02997                     assert( BLIB_COUNT( blibCurr ) >= 1 );
02998                     list->cState = BLIB_COUNT( blibCurr )-1;
02999                     list->state = list->cState ? sptab : NULL;
03000                     assert( BLIB_ELEMENT_SIZE( blibCurr, 0 ) == sizeof(Rect) );
03001                     list->bound = *((const Rect*)BLIB_ELEMENT_PTR( blibCurr, 0 ));
03002                     list->params = NULL;
03003                     {
03004                         size_t ishape;
03005                         for( ishape = 1; ishape <= list->cState; ++ishape )
03006                         {
03007                             const OPCShape* shape = (const OPCShape*)(BLIB_ELEMENT_SIZE( blibCurr, ishape ) ? BLIB_ELEMENT_PTR( blibCurr, ishape ) : NULL);
03008                             *sptab++ = shape;
03009                         }
03010                     }
03011                     offset += lutRequirements[user];
03012                     *htab++ = list;
03013                     *vtab++ = list++;
03014                     break;
03015                 }
03016             }
03017         }
03018         /* Sort tabbing arrays */
03019         array_qsort( GUI_Control*, (GUI_Control**)gui->htab, gui->cControl, qsGCA_htab );
03020         array_qsort( GUI_Control*, (GUI_Control**)gui->vtab, gui->cControl, qsGCA_vtab );
03021 
03022         /* We built it, so initialize it & run with it */
03023         gui->handler(gui,GUI_Init);
03024         return gui;
03025     }
03026     return NULL;
03027 }

Here is the call graph for this function:

size_t GUI_BlibNeeds ( const void *  pData,
size_t  size,
size_t  myExtra 
)

From an image loaded into memory, determine how big the mutable GUI struct must be.

Parameters:
pData Pointer to loaded image
size Size of loaded image
myExtra Extra bytes reserved for your own GUI data (at GUI+1) A non-zero myExtra will invalidate the structure from your GUI's include file, unless it's sizeof() is the same type as '-u' into guify, and offsets/alignments are compatible.
Returns:
Size of buffer to allocate to contain GUI data; 0 if invalid
Use for dynamic allocation or to assert a static buffer is big enough.

'myExtra' is a convenience to allocate some extra stuff the GUI needs in one wrapper. If you generated this GUI with guify, and '-uBlah', then myExtra should be sizeof(Blah) to have structure members line up. Normally, just use the GUI_Control_Get_Data functions to retrieve control data.

Definition at line 2776 of file gui.temp.h.

References BLIB_Count(), BLIB_foreach, BLIB_User(), BLIB_Valid(), and GUI_BlibNeeds().

Referenced by GUI_BlibNeeds().

02777 {
02778     /*
02779      * Data is BLIB of BLIBs.
02780      * Tally what each control needs for a total, either so you can allocate
02781      * or so you can assert some static buffer has enough.
02782      */
02783     const BLIB* blib = pData;
02784     if( BLIB_Valid( blib, size ) && BLIB_User(blib) == *((uint32*)"GUI") )
02785     {
02786         size_t ret = (sizeof(GUI) + myExtra + 7) & ~7u;
02787         BLIB_foreach(blib,curr)
02788         {
02789             const BLIB* blibCurr = (const BLIB*)curr;
02790             uint32 user = BLIB_User( blibCurr );
02791             if( user >= GUIHandlers_COUNT )
02792                 return 0;
02793             /* That's size of control data, sizeof control struct in list, sizeof vtab entry, sizeof sprite table */
02794             switch( user )
02795             {
02796             case guih_Invalid: default:
02797                 return 0;
02798 
02799             case guih_Background:
02800             case guih_Overlay:
02801                 break;
02802 
02803             case guih_GUI:
02804             case guih_ArtResource:
02805             case guih_StaticFrame:
02806             case guih_Button:
02807             case guih_Checkbox:
02808             case guih_Animation:
02809             case guih_Scrollbar:
02810             case guih_Ticker:
02811             case guih_Tumbler:
02812                 ret += lutRequirements[user] + sizeof(GUI_Control) + sizeof(GUI_Control*) + sizeof(GUI_Control*) + (BLIB_Count( blibCurr ) * sizeof(OPCShape*));
02813                 break;
02814 
02815             }
02816         }
02817         return ret;
02818     }
02819     return 0;
02820 }

Here is the call graph for this function:

bool GUI_Control_Paint ( const struct GUI gui,
const GUI_Control control,
OPC opc 
)

Get clipped drawing context for dirty refresh of controls.

Parameters:
gui GUI we're working with
control Control we want to invoke handler for
opc Drawing context to fill in
Returns:
false if dirty region is outside control bounds, true if something needs to be rendered

< Set to make control invisible

Definition at line 470 of file gui.temp.h.

References GUI::dirty, GUI_Control_Bound, GUI_Control_Paint(), GUICS_INVISIBLE, GUI_Control_State::mask, GUI::opc, RectEmpty, and RectIntRect.

Referenced by GUI_Control_Paint().

00471 {
00472     GUI_Control_State* state = GUI_Control_Data( gui, control );
00473     if( state->mask & GUICS_INVISIBLE )
00474     {
00475         return false;
00476     }
00477     else
00478     {
00479         Rect bound;
00480         GUI_Control_Bound( gui, control, &bound );
00481         /* Just take intersection of dirty region and this control, and paint that */
00482         RectIntRect( bound, gui->dirty );
00483         if( RectEmpty( bound ) )
00484             return false;
00485         OPC_NAMING(Clip)( opc, &gui->opc, &bound );
00486     }
00487     return true;
00488 }

Here is the call graph for this function:

void GUI_Def_State ( GUI gui,
const GUI_Control control,
unsigned  initmask,
unsigned  align 
)

Default control state setup.

Parameters:
gui Default state to initialize
control Control we're initializing
initmask Initial hidden/tabbable state
align Initial text alignment state

Definition at line 849 of file gui.temp.h.

References GUI_Control_State::align, GUI_Control_State::cFrames, GUI_Control::cState, GUI_Control_State::frames, GUI_Def_State(), GUI_Control_State::mask, GUI_Control_State::offx, GUI_Control_State::offy, GUI_Control::state, and GUI_Control_State::text.

Referenced by GUI_Def_State().

00850 {
00851     GUI_Control_State* state = GUI_Control_Data( gui, control );
00852     state->mask = initmask;
00853     state->offx = state->offy = 0;
00854     state->text = NULL;
00855     state->align = align;
00856     state->frames = control->state;
00857     state->cFrames = control->cState;
00858 }

Here is the call graph for this function:

bool GUI_tabdown ( GUI gui  ) 

Work out next tab position going down.

Parameters:
gui GUI we're working with
Returns:
true if we wrapped tab list looking for tab

< Set to make control invisible

< Set to prevent focus and disable control

Definition at line 326 of file gui.temp.h.

References _GUI_SetFocus(), assert, GUI::cControl, GUI::focus, GUI_Control_Mask, GUI_tabdown(), GUICS_INVISIBLE, GUICS_NOFOCUS, GUI::list, pointer_foreach_const, and GUI::vtab.

Referenced by GUI_tabdown().

00327 {
00328     int tabPrev = gui->focus < 0 ? 0 : gui->focus;
00329     bool bWrap = false;
00330     unsigned mask;
00331     int tab = -1;
00332     const GUI_Control* control = GUI_Control_Get( gui, tabPrev );
00333     /* Convert control index to vtab index */
00334     pointer_foreach_const(GUI_Control* const,gui->vtab,gui->cControl, curr )
00335     {
00336         if( *curr == control )
00337         {
00338             tab = tabPrev = (int)(curr - gui->vtab);
00339             break;
00340         }
00341     }
00342     /* We should have found the value */
00343     assert( tab != -1 );
00344     /* Search vtab for control */
00345     do
00346     {
00347         if( ++tab >= gui->cControl )
00348         {
00349             tab = 0;
00350             bWrap = true;
00351         }
00352         control = gui->vtab[tab];
00353         mask = GUI_Control_Mask( gui, control );
00354         if( !(mask & (GUICS_INVISIBLE|GUICS_NOFOCUS)) )
00355             break;
00356     }
00357     while( tab != tabPrev );
00358     /* Convert vtab index to control index */
00359     if( tab != tabPrev )
00360         _GUI_SetFocus( gui, (int)(control-gui->list) );
00361     return bWrap;
00362 }

Here is the call graph for this function:

bool GUI_tableft ( GUI gui  ) 

Work out next tab position going left.

Parameters:
gui GUI we're working with
Returns:
true if we wrapped tab list looking for tab

< Set to make control invisible

< Set to prevent focus and disable control

Definition at line 197 of file gui.temp.h.

References _GUI_SetFocus(), assert, GUI::cControl, GUI::focus, GUI_Control_Mask, GUI_tableft(), GUICS_INVISIBLE, GUICS_NOFOCUS, GUI::htab, GUI::list, and pointer_foreach_const.

Referenced by GUI_tableft().

00198 {
00199     int tabPrev = gui->focus < 0 ? 0 : gui->focus;
00200     bool bWrap = false;
00201     unsigned mask;
00202     int tab = -1;
00203     const GUI_Control* control = GUI_Control_Get( gui, tabPrev );
00204     /* Convert control index to htab index */
00205     pointer_foreach_const(GUI_Control* const,gui->htab,gui->cControl, curr )
00206     {
00207         if( *curr == control )
00208         {
00209             tab = tabPrev = (int)(curr - gui->htab);
00210             break;
00211         }
00212     }
00213     /* We should have found the value */
00214     assert( tab != -1 );
00215     /* Search htab for control */
00216     do
00217     {
00218         if( --tab < 0 )
00219         {
00220             tab = gui->cControl-1;
00221             bWrap = true;
00222         }
00223         control = gui->htab[tab];
00224         mask = GUI_Control_Mask( gui, control );
00225         if( !(mask & (GUICS_INVISIBLE|GUICS_NOFOCUS)) )
00226             break;
00227     }
00228     while( tab != tabPrev );
00229     /* Convert htab index to control index */
00230     if( tab != tabPrev )
00231         _GUI_SetFocus( gui, (int)(control-gui->list) );
00232     return bWrap;
00233 }

Here is the call graph for this function:

bool GUI_tabright ( GUI gui  ) 

Work out next tab position going right.

Parameters:
gui GUI we're working with
Returns:
true if we wrapped tab list looking for tab

< Set to make control invisible

< Set to prevent focus and disable control

Definition at line 240 of file gui.temp.h.

References _GUI_SetFocus(), assert, GUI::cControl, GUI::focus, GUI_Control_Mask, GUI_tabright(), GUICS_INVISIBLE, GUICS_NOFOCUS, GUI::htab, GUI::list, and pointer_foreach_const.

Referenced by _GUI_Control_Disable(), _GUI_Control_Enable(), _GUI_Control_Hide(), _GUI_Control_Show(), _GUI_SetFocus(), and GUI_tabright().

00241 {
00242     int tabPrev = gui->focus < 0 ? 0 : gui->focus;
00243     bool bWrap = false;
00244     unsigned mask;
00245     int tab = -1;
00246     const GUI_Control* control = GUI_Control_Get( gui, tabPrev );
00247     /* Convert control index to htab index */
00248     pointer_foreach_const(GUI_Control* const,gui->htab,gui->cControl, curr )
00249     {
00250         if( *curr == control )
00251         {
00252             tab = tabPrev = (int)(curr - gui->htab);
00253             break;
00254         }
00255     }
00256     /* We should have found the value */
00257     assert( tab != -1 );
00258     /* Search htab for control */
00259     do
00260     {
00261         if( ++tab >= gui->cControl )
00262         {
00263             tab = 0;
00264             bWrap = true;
00265         }
00266         control = gui->htab[tab];
00267         mask = GUI_Control_Mask( gui, control );
00268         if( !(mask & (GUICS_INVISIBLE|GUICS_NOFOCUS)) )
00269             break;
00270     }
00271     while( tab != tabPrev );
00272     /* Convert htab index to control index */
00273     if( tab != tabPrev )
00274         _GUI_SetFocus( gui, (int)(control-gui->list) );
00275     return bWrap;
00276 }

Here is the call graph for this function:

bool GUI_tabup ( GUI gui  ) 

Work out next tab position going up.

Parameters:
gui GUI we're working with
Returns:
true if we wrapped tab list looking for tab

< Set to make control invisible

< Set to prevent focus and disable control

Definition at line 283 of file gui.temp.h.

References _GUI_SetFocus(), assert, GUI::cControl, GUI::focus, GUI_Control_Mask, GUI_tabup(), GUICS_INVISIBLE, GUICS_NOFOCUS, GUI::list, pointer_foreach_const, and GUI::vtab.

Referenced by GUI_tabup().

00284 {
00285     int tabPrev = gui->focus < 0 ? 0 : gui->focus;
00286     bool bWrap = false;
00287     unsigned mask;
00288     int tab = -1;
00289     const GUI_Control* control = GUI_Control_Get( gui, tabPrev );
00290     /* Convert control index to vtab index */
00291     pointer_foreach_const(GUI_Control* const,gui->vtab,gui->cControl, curr )
00292     {
00293         if( *curr == control )
00294         {
00295             tab = tabPrev = (int)(curr - gui->vtab);
00296             break;
00297         }
00298     }
00299     /* We should have found the value */
00300     assert( tab != -1 );
00301     /* Search vtab for control */
00302     do
00303     {
00304         if( --tab < 0 )
00305         {
00306             tab = gui->cControl-1;
00307             bWrap = true;
00308         }
00309         control = gui->vtab[tab];
00310         mask = GUI_Control_Mask( gui, control );
00311         if( !(mask & (GUICS_INVISIBLE|GUICS_NOFOCUS)) )
00312             break;
00313     }
00314     while( tab != tabPrev );
00315     /* Convert vtab index to control index */
00316     if( tab != tabPrev )
00317         _GUI_SetFocus( gui, (int)(control-gui->list) );
00318     return bWrap;
00319 }

Here is the call graph for this function:


Generated on Fri Jan 2 15:28:35 2009 for Squat by  doxygen 1.5.6