Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Form Class Reference

Generic form All you need to do is derive a class from this one and override the main handle event methods There are several ways in which forms can be used. More...

#include <Form.h>

Inheritance diagram for Form:

AccountsForm CalculatorForm ChooseAccountForm CurrencyListForm EditAccountForm EditCurrencyForm EditRateForm EditScheduledTransForm EditSplitForm EditTransactionForm GenericInputForm NoteForm PreferencesForm PurgeTransForm SplitsForm TransactionsForm List of all members.

Public Methods

 Form (UInt16 id) FORM_SECTION2
 The form constructor. More...

virtual ~Form () FORM_SECTION2
 destructor- unregisters the form. More...

Boolean getSaved ()
 returns the saved attribute. More...

void setSaved (Boolean b)
 sets the saved attribute. More...

void setCallerFormId (UInt16 t)
 sets the caller id attribute. More...

virtual FormPtr getFormPointer ()
 use this to obtail the form pointer (to the actual form, not to the object. More...

virtual void popup () FORM_SECTION2
 executes popup for the current form. More...

virtual void popup (Form *form) FORM_SECTION2
 executes popup for another form, setting the caller_form_id for the popedup form to the id of the current form. More...

UInt16 doDialog (FormPtr parent_form=NULL) FORM_SECTION2
 executes the form as a dialog. More...

virtual Boolean handleEvent (EventPtr) FORM_SECTION2
 event handler for the form; this function calls automatically the other handle* functions. More...

UInt16 getObjectIndex (UInt16 object_id) FORM_SECTION2
 wrapper for FrmGetObjectIndex. More...

virtual Boolean handleLoadEvent () FORM_SECTION2
 this function is called when the form is loaded. More...

virtual Boolean handleCloseEvent () FORM_SECTION2
 this function is called when the form is closed. More...


Protected Methods

virtual Boolean handleKeyDownEvent (WChar key_id, UInt16 modifiers) FORM_SECTION2
 called when key down event occurs. More...

virtual Boolean handleOpenEvent () FORM_SECTION2
 called when form open event occurs. More...

virtual Boolean handleCtlSelectEvent (UInt16 control_id) FORM_SECTION2
 called when ctl select event occurs. More...

virtual Boolean handleTblSelectEvent (tblSelect &tbl_select) FORM_SECTION2
 called when a table select event occurs. More...

virtual Boolean handleLstSelectEvent (UInt16 item) FORM_SECTION2
 called when a list select event occurs. More...

virtual Boolean handleMenuEvent (UInt16 menu_item_id) FORM_SECTION2
 called when a menu event occurs. More...

virtual Boolean handleUpdateEvent (UInt16 update_code) FORM_SECTION2
 called when a form update event occurs. More...

virtual Boolean handlePenDownEvent (Int16 x_coord, Int16 y_coord) FORM_SECTION2
 handles events generated by the pen up. More...

virtual Boolean handlePopSelect (popSelect &pop_select) FORM_SECTION2
 handles events generated by item selection in popup. More...

virtual Boolean handleFldChangedEvent () FORM_SECTION2
 handles events generated when field are changed. More...

virtual Boolean handleSclRepeatEvent (UInt16 new_value, UInt16 value) FORM_SECTION2
 handles events generated by the scrollbar. More...


Protected Attributes

FormPtr frm
 pointer to the form. More...

Boolean saved
 true if the form was saved, false otherwise. More...

UInt16 caller_form_id
 the id of the caller form; can be used to enable returning to the correct caller after finishing. More...

UInt16 form_id
 the id of the form resource. More...


Detailed Description

Generic form All you need to do is derive a class from this one and override the main handle event methods There are several ways in which forms can be used.

If the same form is used in several other forms (with no changes) then it may be best to implement that form as a singleton and use the reference from other forms. If the form (say A) is used only once in another form (say B), that an A object can be created inside B. Note that if you use forms with popup() the A has to be alive for roughly the same amount of time as B.

However, if you use a dialog form (i.e. form closes and returns as soon as a button is pressed) you can define the form object local to the section it is needed in.

When defining a new form you need to make sure that the Form constructor is called with your form's resource id as a parameter. This registers the form with the FormManager. If you overload the destructor, you need to call FormManager::instance()->deregisterForm(form_id);

Todo:
some of the handle functions will need parameters, they will appear as they will get used

Definition at line 40 of file Form.h.


Constructor & Destructor Documentation

Form::Form UInt16    id
 

The form constructor.

Todo:
remove the default =0 as soon as all the form classes have been ported
Parameters:
id  the identifier of the form resource this form is to serve. make sure you set this

virtual Form::~Form   [virtual]
 

destructor- unregisters the form.


Member Function Documentation

UInt16 Form::doDialog FormPtr    parent_form = NULL
 

executes the form as a dialog.

Parameters:
parent_form  if set it will set the active form to the given form pointer

Reimplemented in GenericInputForm.

virtual FormPtr Form::getFormPointer   [inline, virtual]
 

use this to obtail the form pointer (to the actual form, not to the object.

Returns:
pointer to form managed by class

Definition at line 81 of file Form.h.

References frm.

UInt16 Form::getObjectIndex UInt16    object_id
 

wrapper for FrmGetObjectIndex.

Parameters:
object_id  id of the object (in the current form) to obtain the index for
Returns:
index of the given object

Boolean Form::getSaved   [inline]
 

returns the saved attribute.

Definition at line 69 of file Form.h.

References saved.

virtual Boolean Form::handleCloseEvent   [virtual]
 

this function is called when the form is closed.

Reimplemented in AccountsForm.

virtual Boolean Form::handleCtlSelectEvent UInt16    control_id [protected, virtual]
 

called when ctl select event occurs.

Parameters:
control_id  id of the control for which the event was generated

Reimplemented in AccountsForm.

virtual Boolean Form::handleEvent EventPtr    [virtual]
 

event handler for the form; this function calls automatically the other handle* functions.

Parameters:
EventPtr  pointer to the incoming event
Returns:
true if event was handled, false othewise

virtual Boolean Form::handleFldChangedEvent   [protected, virtual]
 

handles events generated when field are changed.

Reimplemented in NoteForm.

virtual Boolean Form::handleKeyDownEvent WChar    key_id,
UInt16    modifiers
[protected, virtual]
 

called when key down event occurs.

Reimplemented in AccountsForm.

virtual Boolean Form::handleLoadEvent   [virtual]
 

this function is called when the form is loaded.

virtual Boolean Form::handleLstSelectEvent UInt16    item [protected, virtual]
 

called when a list select event occurs.

Parameters:
item  item in the list that has been selected (0 based)

Reimplemented in CurrencyListForm.

virtual Boolean Form::handleMenuEvent UInt16    menu_item_id [protected, virtual]
 

called when a menu event occurs.

Reimplemented in AccountsForm.

virtual Boolean Form::handleOpenEvent   [protected, virtual]
 

called when form open event occurs.

Reimplemented in AccountsForm.

virtual Boolean Form::handlePenDownEvent Int16    x_coord,
Int16    y_coord
[protected, virtual]
 

handles events generated by the pen up.

Reimplemented in AccountsForm.

virtual Boolean Form::handlePopSelect popSelect   pop_select [protected, virtual]
 

handles events generated by item selection in popup.

Parameters:
pop_select  forwarded popSelect event data

Reimplemented in AccountsForm.

virtual Boolean Form::handleSclRepeatEvent UInt16    new_value,
UInt16    value
[protected, virtual]
 

handles events generated by the scrollbar.

Reimplemented in NoteForm.

virtual Boolean Form::handleTblSelectEvent tblSelect   tbl_select [protected, virtual]
 

called when a table select event occurs.

Parameters:
tbl_select  forwarded tblSelect event data

Reimplemented in AccountsForm.

virtual Boolean Form::handleUpdateEvent UInt16    update_code [protected, virtual]
 

called when a form update event occurs.

Parameters:
update_code  the update code signalled

Reimplemented in AccountsForm.

virtual void Form::popup Form *    form [virtual]
 

executes popup for another form, setting the caller_form_id for the popedup form to the id of the current form.

Parameters:
form  pointer to the form to execute popup for

virtual void Form::popup   [virtual]
 

executes popup for the current form.

void Form::setCallerFormId UInt16    t [inline]
 

sets the caller id attribute.

Parameters:
t  the id of the caller

Definition at line 77 of file Form.h.

References caller_form_id.

void Form::setSaved Boolean    b [inline]
 

sets the saved attribute.

Parameters:
b  the saved state

Definition at line 73 of file Form.h.

References saved.


Member Data Documentation

UInt16 Form::caller_form_id [protected]
 

the id of the caller form; can be used to enable returning to the correct caller after finishing.

Definition at line 116 of file Form.h.

Referenced by setCallerFormId.

UInt16 Form::form_id [protected]
 

the id of the form resource.

Definition at line 118 of file Form.h.

FormPtr Form::frm [protected]
 

pointer to the form.

Definition at line 112 of file Form.h.

Referenced by getFormPointer.

Boolean Form::saved [protected]
 

true if the form was saved, false otherwise.

Definition at line 114 of file Form.h.

Referenced by getSaved, and setSaved.


The documentation for this class was generated from the following file:
Generated on Thu Jan 16 23:11:15 2003 for FreeCoins by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002