GG
|
00001 // -*- C++ -*- 00002 /* GG is a GUI for SDL and OpenGL. 00003 Copyright (C) 2003-2008 T. Zachary Laine 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public License 00007 as published by the Free Software Foundation; either version 2.1 00008 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 00018 02111-1307 USA 00019 00020 If you do not wish to comply with the terms of the LGPL please 00021 contact the author as other terms are available for a fee. 00022 00023 Zach Laine 00024 whatwasthataddress@gmail.com */ 00025 00029 #ifndef _GG_Control_h_ 00030 #define _GG_Control_h_ 00031 00032 #include <GG/Wnd.h> 00033 00034 00035 namespace GG { 00036 00048 class GG_API Control : public Wnd 00049 { 00050 public: 00052 virtual void DropsAcceptable(DropsAcceptableIter first, 00053 DropsAcceptableIter last, 00054 const Pt& pt) const; 00055 00056 Clr Color() const; 00057 bool Disabled() const; 00058 00059 00061 virtual void AcceptDrops(const std::vector<Wnd*>& wnds, const Pt& pt); 00062 virtual void Render() = 0; 00063 00064 virtual void SetColor(Clr c); 00065 virtual void Disable(bool b = true); 00066 00067 virtual void DefineAttributes(WndEditor* editor); 00069 00070 protected: 00072 Control(); 00073 Control(X x, Y y, X w, Y h, Flags<WndFlag> flags = INTERACTIVE); 00074 00075 00076 virtual void MouseWheel(const Pt& pt, int move, Flags<ModKey> mod_keys); 00077 virtual void KeyPress(Key key, boost::uint32_t key_code_point, Flags<ModKey> mod_keys); 00078 virtual void KeyRelease(Key key, boost::uint32_t key_code_point, Flags<ModKey> mod_keys); 00079 00080 Clr m_color; 00081 bool m_disabled; 00082 00083 private: 00084 friend class boost::serialization::access; 00085 template <class Archive> 00086 void serialize(Archive& ar, const unsigned int version); 00087 }; 00088 00089 } // namespace GG 00090 00091 // template implementations 00092 template <class Archive> 00093 void GG::Control::serialize(Archive& ar, const unsigned int version) 00094 { 00095 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Wnd) 00096 & BOOST_SERIALIZATION_NVP(m_color) 00097 & BOOST_SERIALIZATION_NVP(m_disabled); 00098 } 00099 00100 #endif // _GG_Control_h_