![]() |
00001 00002 // This code is part of the MaiaProject free software 00003 // 00004 // Keyboard and Mouse Emulator - Virtual keyboard Engine 00005 // 00006 // Copyright (c) 2002-2003 Luca Clivio <luca.clivio@maiaproject.org> 00007 // Tel. +39-347-2538040 00008 // via B.Croce 2, 20037 Paderno Dugnano (Milano) - Italy 00009 // 00010 // Developers: 00011 // Simone Mangano <simone.mangano@maiaproject.org> 00012 // Andrea Tosato <andrea.tosato@maiaproject.org> 00013 // 00014 // ----------------------------------------------------------------------------- 00015 // This program is free software; This program is free software; 00016 // you can redistribute it and/or modify it under the terms of the 00017 // GNU General Public License as published by the Free Software Foundation; 00018 // either version 2 of the License, or (at your option) any later version. 00019 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 // GNU General Public License for more details. 00022 // You should have received a copy of the GNU General Public License 00023 // along with this program; if not, write to the Free Software 00024 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00026 00027 00028 #ifndef _omUIButton_ 00029 #define _omUIButton_ 00030 00031 00032 #include <iostream> 00033 #include <vector> 00034 #include <string> 00035 #include <wx/wx.h> 00036 #include <wx/wave.h> 00037 00038 #include <openmaia/omObject.h> 00039 #include <openmaia/omUIApplication.h> 00040 00041 00064 class omUIButton: public wxFrame, public omObject { 00065 private: 00066 // ------------------------------------ PRIVATE FUNCTIONS ------------------------ 00067 00068 // --------- Event Handlers 00069 void OnMouseButtonUp(wxCommandEvent &event) ; 00070 void OnPaint(wxPaintEvent &event) ; 00071 void OnSetFocus(wxFocusEvent &event) ; 00072 00073 // ----------- System dependent functions --- 00074 void SDPutOnTop() ; 00075 bool SDIsYourWindow( void *) ; 00076 void PlaySoundSD(wxString, bool); 00077 00078 // ------------------------------------ PRIVATE VARIABLES ---------------------------- 00079 00080 bool isOnTop ; 00081 00082 std::vector<wxString> image_paths ; 00083 std::vector<wxBitmap *> images ; 00084 std::vector<wxString> sounds ; 00085 00086 int nsounds; 00087 int nimages ; 00088 00089 // declare event table to catch events 00090 DECLARE_EVENT_TABLE() 00091 00092 protected: 00093 // ------------------------------ PROTECTED VARIABLES AND FUNCTIONS -------------------- 00094 00095 int curImage ; 00096 00097 int AddSound( wxString); 00098 int AddImage(wxString); 00099 void PlaySound(int ); 00100 void RenderImage(int); 00101 00102 // virtual functions used to handle events on the buttons 00103 virtual void OnClick(); 00104 virtual void OnScratch(); 00105 virtual void OnFocus() ; 00106 00107 public: 00108 // --------------------------------- PUBLIC FUNCTIONS ------------------------------------- 00109 00110 int x; 00111 int y; 00112 int w; 00113 int h; 00114 00115 //Pointers needed for manual navigation 00116 omObject *upper; 00117 omObject *lower; 00118 omObject *left; 00119 omObject *right; 00120 00121 00122 // The constructor. 00123 omUIButton( bool, wxWindow *, int, int, int, int) ; 00124 // The wx destructor. 00125 virtual bool Destroy() ; 00126 00127 // public methods 00128 void Show(); 00129 void Hide(); 00130 void PutOnTop(); 00131 00132 bool IsYourWindow( void *) ; // query for window handler 00133 00134 // -------- public virtual functions 00135 virtual void PaintDefaultPicture() ; 00136 virtual void LightOn() ; 00137 virtual void LightOnSingle(); 00138 virtual void LightOff() ; 00139 virtual void Execute() ; 00140 00141 } ; 00142 00143 #endif //_omUIButton_
Copyright © by Luca Clivio |