Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: 13/4/2004 00003 author: Paul D Turner 00004 00005 purpose: Interface to base class for ButtonBase widget 00006 *************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject to 00016 * the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00025 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00026 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00027 * OTHER DEALINGS IN THE SOFTWARE. 00028 ***************************************************************************/ 00029 #ifndef _CEGUIButtonBase_h_ 00030 #define _CEGUIButtonBase_h_ 00031 00032 #include "../Base.h" 00033 #include "../Window.h" 00034 00035 00036 #if defined(_MSC_VER) 00037 # pragma warning(push) 00038 # pragma warning(disable : 4251) 00039 #endif 00040 00041 00042 // Start of CEGUI namespace section 00043 namespace CEGUI 00044 { 00045 00050 class CEGUIEXPORT ButtonBase : public Window 00051 { 00052 public: 00053 /************************************************************************* 00054 Accessor type functions 00055 *************************************************************************/ 00063 bool isHovering(void) const {return d_hovering;} 00064 00065 00073 bool isPushed(void) const {return d_pushed;} 00074 00078 void setPushedState(const bool pushed); 00079 00080 /************************************************************************* 00081 Construction and Destruction 00082 *************************************************************************/ 00087 ButtonBase(const String& type, const String& name); 00088 00089 00094 virtual ~ButtonBase(void); 00095 00096 00097 protected: 00098 /************************************************************************* 00099 Overridden event handlers 00100 *************************************************************************/ 00101 virtual void onMouseMove(MouseEventArgs& e); 00102 virtual void onMouseButtonDown(MouseEventArgs& e); 00103 virtual void onMouseButtonUp(MouseEventArgs& e); 00104 virtual void onCaptureLost(WindowEventArgs& e); 00105 virtual void onMouseLeaves(MouseEventArgs& e); 00106 00107 00108 /************************************************************************* 00109 Implementation Functions 00110 *************************************************************************/ 00121 void updateInternalState(const Vector2f& mouse_pos); 00122 00123 bool calculateCurrentHoverState(const Vector2f& mouse_pos); 00124 00125 /************************************************************************* 00126 Implementation Data 00127 *************************************************************************/ 00128 bool d_pushed; 00129 bool d_hovering; 00130 }; 00131 00132 } // End of CEGUI namespace section 00133 00134 #if defined(_MSC_VER) 00135 # pragma warning(pop) 00136 #endif 00137 00138 #endif // end of guard _CEGUIButtonBase_h_