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

calculator.h

Go to the documentation of this file.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2003-2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006         
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016         http://www.gnu.org/copyleft/gpl.html
00017 *********************************************************************************** */
00018 
00023 #ifndef INCLUDE_CALCULATOR_H
00024 #define INCLUDE_CALCULATOR_H
00025 
00026 #include "window.h"
00027 
00028 typedef enum
00029 {
00030         Op_Null,Op_Add,Op_Sub,Op_Div,Op_Mult
00031 } TOpperation;
00032 
00033 class Opperation
00034 {
00035 public:
00036         double number;
00037         TOpperation op;
00038 
00039         Opperation();
00040         void operator=(Opperation &src);
00041         void GetText(MyString &result);
00042         static double Compute(double param1,TOpperation op,double param2);
00043 };
00044 
00050 class Calculator : public Window
00051 {
00052 private:
00053         Button btnNumbers[10];
00054         Button btnAdd;
00055         Button btnSub;
00056         Button btnDiv;
00057         Button btnMult;
00058         Button btnEqual;
00059         Button btnDot;
00060         Button btnClear;
00061         TextBox txtResult;
00062         TextBox txtResultBase;
00063         MyList<Opperation> lOpperation;
00064 
00065         Texture textureIcon;
00066         MyString lineCur;
00067 
00068         void MajResult();
00069         void Compute();
00070 
00071 public:
00072         Calculator();   
00073         void Create();
00074 
00075         int OnKey(StateKey *key,int face);
00076         void OnNum(int num);
00077         int OnNum0();
00078         int OnNum1(); 
00079         int OnNum2();
00080         int OnNum3();
00081         int OnNum4(); 
00082         int OnNum5();
00083         int OnNum6(); 
00084         int OnNum7(); 
00085         int OnNum8();
00086         int OnNum9();
00087         int OnDot();
00088         int OnClear();
00089         int OnEqual();
00090         int OnAdd();
00091         int OnSub();
00092         int OnMult();   
00093         int OnDiv();
00094         int OnOk();
00095 };
00096 
00097 #endif

Generated on Fri Aug 20 19:19:43 2004 for 3d Controls by doxygen 1.3.6