00001 /** $Revision: 1.3 $ 00002 Last updated: $Date: 2002/09/20 12:21:31 $ 00003 00004 Copyright (C) 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 __EDIT_RATE_FORM__ 00021 #define __EDIT_RATE_FORM__ 00022 00023 #include <PalmOS.h> 00024 00025 #include "Form.h" 00026 00027 /** Form used to edit the content of a split */ 00028 class EditRateForm : public Form 00029 { 00030 public: 00031 ///structure in which data is returned 00032 typedef struct { 00033 ///amount in pence of source currency 00034 Int32 src_amount; 00035 ///original sign of the source amount 00036 bool is_src_negative; 00037 ///amount in pence of destination currency 00038 Int32 dest_amount; 00039 ///original sign of the destination amount 00040 bool is_dest_negative; 00041 ///exchange rate of the transaction 00042 double exchange_rate; 00043 ///if true the other values of the structure should be read and the dirty bit should be set to false 00044 bool dirty; 00045 } Results; 00046 00047 ///holds current working data and is accessible from outside the class for reading other data 00048 Results results; 00049 00050 ///constructor; initializes form 00051 EditRateForm() FORM_SECTION1; 00052 /** initializes the form data to start a new session 00053 @param src UID of source currency record 00054 @param dest UID of destination currency record 00055 @note you also need to set the fields of the results structure directly, before poping up this form */ 00056 void initForm (UInt32 src, UInt32 dest) FORM_SECTION1; 00057 00058 private: 00059 ///text for exchange rate display 00060 char _rate_buffer[30]; 00061 ///text for code label of source currency 00062 char* _src_currency_label; 00063 ///text for code label of destination currency 00064 char* _dest_currency_label; 00065 ///UID of source currency record 00066 UInt32 _src_currency; 00067 ///UID of destination currency record 00068 UInt32 _dest_currency; 00069 00070 ///checks validity of user data 00071 Boolean checkData() FORM_SECTION1; 00072 ///saves the data introduced 00073 void saveData() FORM_SECTION1; 00074 ///sets up form, fills in fields (if edit mode) 00075 Boolean handleOpenEvent() FORM_SECTION1; 00076 ///handles all control actions 00077 Boolean handleCtlSelectEvent (UInt16 control_id) FORM_SECTION1; 00078 }; 00079 00080 #endif