00001 /** $Revision: 1.16 $ 00002 Last updated: $Date: 2002/09/25 21:18:01 $ 00003 00004 Copyright (C) 2000-2002 Vlad Mereuta <dizzy@users.sourceforge.net> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00019 00020 #ifndef __TRANSACTIONS_FORM__ 00021 #define __TRANSACTIONS_FORM__ 00022 00023 #include <PalmOS.h> 00024 #include "Form.h" 00025 #include "TransactionsTable.h" 00026 #include "EditTransactionForm.h" 00027 00028 00029 /** functions and vars that manipulate the form which deals with transactions 00030 \note the duplicate menu and button events are handled by handle* functions do eliminate code duplication 00031 */ 00032 class TransactionsForm : public Form 00033 { 00034 public: 00035 ///constructor; dows nothing 00036 TransactionsForm() FORM_SECTION2; 00037 /** creates a new transaction updating the balance in the new account */ 00038 void adjustAccBalance() FORM_SECTION2; 00039 /** updates the expected balance for the account */ 00040 void adjustClearedAccBalance() FORM_SECTION2; 00041 /** updates the totals for the current account (if necessary) and draws them on the screen */ 00042 void displayTotals() FORM_SECTION2; 00043 ///returns singleton reference to this object 00044 static TransactionsForm* instance() FORM_SECTION2; 00045 00046 /** called when a form update event occurs (public in order to be able to force updates) 00047 @param update_code the update code signalled */ 00048 Boolean handleUpdateEvent(UInt16 update_code) FORM_SECTION2; 00049 private: 00050 ///reference to this object 00051 static TransactionsForm* _instance; 00052 //pointer to the active edit transaction form 00053 EditTransactionForm* _edit_trans_form; 00054 ///used to store the current category name 00055 Char _cat_name [dmCategoryLength]; 00056 00057 ///the transactions table 00058 TransactionsTable _trans_tbl; 00059 00060 ///called when key down event occurs 00061 Boolean handleKeyDownEvent(WChar key_id, UInt16 modifiers) FORM_SECTION2; 00062 ///called when form open event occurs 00063 Boolean handleOpenEvent() FORM_SECTION2; 00064 /** called when ctl select event occurs 00065 @param control_id id of the control for which the event was generated */ 00066 Boolean handleCtlSelectEvent(UInt16 control_id) FORM_SECTION2; 00067 /** called when a table select event occurs 00068 @param tbl_select forwarded tblSelect event data */ 00069 Boolean handleTblSelectEvent(tblSelect& tbl_select) FORM_SECTION2; 00070 /** called when a menu event occurs */ 00071 Boolean handleMenuEvent(UInt16 menu_item_id) FORM_SECTION2; 00072 00073 ///this function is called when the form is closed 00074 Boolean handleCloseEvent() FORM_SECTION2; 00075 00076 /// init the category trigger 00077 void initCat() FORM_SECTION2; 00078 00079 ///handle category selection 00080 void selectCat() FORM_SECTION2; 00081 00082 /** executes the necessary operations to start creating a new transaction */ 00083 void handleNewTransaction() FORM_SECTION2; 00084 00085 /** handles transaction details */ 00086 void handleTransactionDetails() FORM_SECTION2; 00087 }; 00088 00089 #endif