Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

HotButton.cpp

Go to the documentation of this file.
00001 00006 /* 00007 Copyright (C) 2004 Anders Hedstrom 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License 00011 as published by the Free Software Foundation; either version 2 00012 of the License, or (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program; if not, write to the Free Software 00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 */ 00023 #include <SDL.h> 00024 #include "guitypedefs.h" 00025 #include "guicolors.h" 00026 #ifdef _WIN32 00027 #pragma warning(push) 00028 00029 #include <yvals.h> // warning numbers get enabled in yvals.h 00030 00031 #pragma warning(disable: 4251) 00032 #pragma warning(disable: 4786) // identifier was truncated to 'number' characters in the debug information 00033 00034 // BUG: C4786 Warning Is Not Disabled with #pragma Warning 00035 // STATUS: Microsoft has confirmed this to be a bug in the Microsoft product. This warning can be ignored. 00036 // This occured only in the <map> container. 00037 00038 #include <sge.h> 00039 00040 #pragma warning(pop) 00041 #else 00042 #include <sge.h> 00043 #endif 00044 //#include <iotm/Mutex.h> 00045 #include "SDL_prim.h" 00046 00047 #include "TTFont.h" 00048 #include "SDLControl.h" 00049 #include "Surface.h" 00050 #include "Static.h" 00051 #include "Button.h" 00052 #include "HotButton.h" 00053 00054 00055 namespace gui 00056 { 00057 00058 00059 HotButton::HotButton(Surface *s,coord_t x,coord_t y,buttonstyle_t style,SurfaceHelper *sh) 00060 :Button(s,x,y,style,sh) 00061 { 00062 SetClickable(true); 00063 } 00064 00065 00066 HotButton::~HotButton() 00067 { 00068 } 00069 00070 00071 void HotButton::OnMouseIn() 00072 { 00073 Surface *pclParent = GetParent(); 00074 if (IsClickable()) 00075 { 00076 SetInverted(true); 00077 while (pclParent) 00078 { 00079 if (pclParent -> UseTemporaryScreen()) 00080 { 00081 pclParent -> DrawTemporaryScreen(); 00082 break; 00083 } 00084 pclParent = pclParent -> GetParent(); 00085 } 00086 InvalidateEv(); 00087 } 00088 } 00089 00090 00091 void HotButton::OnMouseOut() 00092 { 00093 Surface *pclParent = GetParent(); 00094 if (IsClickable()) 00095 { 00096 SetInverted(false); 00097 while (pclParent) 00098 { 00099 if (pclParent -> UseTemporaryScreen()) 00100 { 00101 pclParent -> DrawTemporaryScreen(); 00102 break; 00103 } 00104 pclParent = pclParent -> GetParent(); 00105 } 00106 InvalidateEv(); 00107 } 00108 } 00109 00110 00111 void HotButton::OnClick(coord_t x,coord_t y) 00112 { 00113 // printf("HotButton::OnClick()\n"); 00114 OnButton(); 00115 SetTimer(250); 00116 } 00117 00118 00119 void HotButton::OnTimer(long id) 00120 { 00121 //printf("HotButton::OnTimer()\n"); 00122 if (IsInverted()) 00123 { 00124 OnButton(); 00125 SetTimer(90); 00126 } 00127 } 00128 00129 00130 } // namespace gui 00131 00132

Generated for My SDL C++ Gui by doxygen 1.3.6

www.TV-friendship.com
The matchmaking service with an all new twist.

Quantum 'Teleportation'
Some thoughts
Page, code, and content Copyright (C) 2004 by Anders Hedström