00001 /*********************************************************************** 00002 filename: CEGUIButtonBase.h 00003 created: 13/4/2004 00004 author: Paul D Turner 00005 00006 purpose: Interface to base class for ButtonBase widget 00007 *************************************************************************/ 00008 /*************************************************************************** 00009 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining 00012 * a copy of this software and associated documentation files (the 00013 * "Software"), to deal in the Software without restriction, including 00014 * without limitation the rights to use, copy, modify, merge, publish, 00015 * distribute, sublicense, and/or sell copies of the Software, and to 00016 * permit persons to whom the Software is furnished to do so, subject to 00017 * the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be 00020 * included in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00023 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00024 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00025 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00026 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00027 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00028 * OTHER DEALINGS IN THE SOFTWARE. 00029 ***************************************************************************/ 00030 #ifndef _CEGUIButtonBase_h_ 00031 #define _CEGUIButtonBase_h_ 00032 00033 #include "CEGUIBase.h" 00034 #include "CEGUIWindow.h" 00035 00036 00037 #if defined(_MSC_VER) 00038 # pragma warning(push) 00039 # pragma warning(disable : 4251) 00040 #endif 00041 00042 00043 // Start of CEGUI namespace section 00044 namespace CEGUI 00045 { 00046 00051 class CEGUIEXPORT ButtonBase : public Window 00052 { 00053 public: 00054 /************************************************************************* 00055 Accessor type functions 00056 *************************************************************************/ 00064 bool isHovering(void) const {return d_hovering;} 00065 00066 00074 bool isPushed(void) const {return d_pushed;} 00075 00076 00077 /************************************************************************* 00078 Construction and Destruction 00079 *************************************************************************/ 00084 ButtonBase(const String& type, const String& name); 00085 00086 00091 virtual ~ButtonBase(void); 00092 00093 00094 protected: 00095 /************************************************************************* 00096 Overridden event handlers 00097 *************************************************************************/ 00098 virtual void onMouseMove(MouseEventArgs& e); 00099 virtual void onMouseButtonDown(MouseEventArgs& e); 00100 virtual void onMouseButtonUp(MouseEventArgs& e); 00101 virtual void onCaptureLost(WindowEventArgs& e); 00102 virtual void onMouseLeaves(MouseEventArgs& e); 00103 00104 00105 /************************************************************************* 00106 Implementation Functions 00107 *************************************************************************/ 00118 void updateInternalState(const Point& mouse_pos); 00119 00120 00131 virtual bool testClassName_impl(const String& class_name) const 00132 { 00133 if (class_name=="ButtonBase") return true; 00134 return Window::testClassName_impl(class_name); 00135 } 00136 00137 00138 /************************************************************************* 00139 Implementation Data 00140 *************************************************************************/ 00141 bool d_pushed; 00142 bool d_hovering; 00143 }; 00144 00145 } // End of CEGUI namespace section 00146 00147 #if defined(_MSC_VER) 00148 # pragma warning(pop) 00149 #endif 00150 00151 #endif // end of guard _CEGUIButtonBase_h_