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_BUTTON_H 00024 #define INCLUDE_BUTTON_H 00025 00026 #include "control.h" 00027 00028 class EventButton 00029 { 00030 public: 00031 signal0<> click; // call: void Click(); 00032 signal1<BOOL> checked; // call: void Checked(BOOL isPush); 00033 }; 00034 00040 class Button : public Control 00041 { 00042 private: 00043 // config des modes 00044 BOOL pushLikeMode; 00045 BOOL allButtonMode; 00046 00047 int OnTimerPushDown(Timer *timer); 00048 00049 public: 00050 // varaible membre 00051 MyString caption; 00052 double depth_max,depth_min,depth_cur; 00053 double timeOut; 00054 BOOL isPushed; 00055 Material materialOnUp; 00056 Material materialOnDown; 00057 Material *materialCurrent; 00058 Text3D text; 00059 00060 // evenements 00061 EventButton onButton; 00062 Timer timerPushDown; 00063 00064 Button(); 00065 ~Button(); 00066 00067 virtual void Create() { Create(DEFAULT_DEPTH_MAX_BUTTON); } // Createur pour container 00068 void Create(double depth); 00069 void operator=(char *newCaption); 00070 void SetText(char *newCaption); 00071 void ToString(MyString &str); 00072 void PushUp(); 00073 00074 void SetPush(BOOL enable); 00075 void SetPushToogle(); 00076 BOOL GetPush(); 00077 00078 void ModePushLike(BOOL enable); 00079 void ModeAllButtons(BOOL enable); 00080 00081 int OnPushDown(StateMouse *mouse,int face); 00082 int OnPushUp(StateMouse *mouse,int face); 00083 int OnOverOut(Control *newControl,int face); 00084 int OnOverIn(Control *oldControl,int face); 00085 }; 00086 00087 #endif