#include <FormManager.h>
Collaboration diagram for FormManager:
Public Methods | |
void | suicide () FORM_SECTION2 |
instructs the FormManger to destroy its instance immidiately if possible or when all forms have been de-registred. More... | |
void | registerForm (UInt16 form_id, Form *form) FORM_SECTION2 |
this function adds the details given by the paramaters to the forms array. More... | |
void | deregisterForm (UInt16 form_id) FORM_SECTION2 |
removes a form from the forms array containing registred forms. More... | |
void | bringToFront (UInt16 form_id, Form *form) FORM_SECTION2 |
rearanges the forms array in such a way that the given form always receives the events first. More... | |
Boolean | dispatchEvent (EventPtr event) FORM_SECTION2 |
dispatches event to the right form (if registred). More... | |
Boolean | dispatchLoadEvent (UInt16 form_id) FORM_SECTION2 |
dispatches a load event to a given form. More... | |
Boolean | dispatchCloseEvent (UInt16 form_id) FORM_SECTION2 |
dispatches a close event to a given form. More... | |
Static Public Methods | |
FormManager * | instance () |
returns a reference to FormManager. More... | |
void | destroyInstance () FORM_SECTION2 |
destroys the instance (if no forms are still registred). More... | |
Private Methods | |
FormManager () FORM_SECTION2 | |
constructor; initialises the forms array (private to prevent accidental duplication). More... | |
Private Attributes | |
form_info | forms [max_forms] |
information on all forms. More... | |
Static Private Attributes | |
const UInt8 | max_forms = 25 |
maximum number of forms that can be handled (active at the same time). More... | |
FormManager * | _instance |
singleton reference to this class. More... | |
Boolean | _destroy_requested |
flag indicating whether the FormManager is required to kill itself. this cannot be accomplished while forms are still registred. More... | |
UInt8 | _form_count |
number of forms currently registred with the FormManager. More... |
The current implementation is jusr a hack, but it seems to work rather well.
The idea behind this is to keep a dictionary of form_id's and the associated form pointers. This way any kind of events can be dispatched to the right form, provided the form registered with the manager (i.e. the manager know what form handles the form_id which is targeted by the incoming event.
Please note that this class is a Singleton. Ummm sort of that is. more like a singleton hack. Point is that you are only meant to access it via the frm_mngr pointer, which in turn is automatically initialised at the first call to registerForm (so *DO NOT* calll any other method before register form)
Definition at line 41 of file FormManager.h.
|
constructor; initialises the forms array (private to prevent accidental duplication).
|
|
rearanges the forms array in such a way that the given form always receives the events first. This is useful when a given form has more than one instance, all active at the same time and they are all sharing the same form_id
|
|
removes a form from the forms array containing registred forms.
|
|
destroys the instance (if no forms are still registred).
|
|
dispatches a close event to a given form.
|
|
dispatches event to the right form (if registred).
|
|
dispatches a load event to a given form.
|
|
returns a reference to FormManager. This is the only allowed way to access this class |
|
this function adds the details given by the paramaters to the forms array.
|
|
instructs the FormManger to destroy its instance immidiately if possible or when all forms have been de-registred.
|
|
flag indicating whether the FormManager is required to kill itself. this cannot be accomplished while forms are still registred.
Definition at line 92 of file FormManager.h. |
|
number of forms currently registred with the FormManager.
Definition at line 94 of file FormManager.h. |
|
singleton reference to this class.
Definition at line 90 of file FormManager.h. |
|
information on all forms.
Definition at line 87 of file FormManager.h. |
|
maximum number of forms that can be handled (active at the same time).
Definition at line 84 of file FormManager.h. |