Control.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /* GG is a GUI for SDL and OpenGL.
00003    Copyright (C) 2003 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@hotmail.com */
00025 
00029 #ifndef _GG_Control_h_
00030 #define _GG_Control_h_
00031 
00032 #include <GG/Wnd.h>
00033 
00034 #include <boost/serialization/is_abstract.hpp>
00035 
00036 
00037 namespace GG {
00038 
00044 class GG_API Control : public Wnd
00045 {
00046 public: 
00048     Clr            Color() const;    
00049     bool           Disabled() const; 
00050 
00051  
00053     virtual void   AcceptDrops(std::list<Wnd*>& wnds, const Pt& pt);
00054     virtual void   Render() = 0;
00055     virtual void   MouseWheel(const Pt& pt, int move, Flags<ModKey> mod_keys);
00056     virtual void   KeyPress(Key key, Flags<ModKey> mod_keys);
00057     virtual void   KeyRelease(Key key, Flags<ModKey> mod_keys);
00058 
00059     virtual void   SetColor(Clr c);        
00060     virtual void   Disable(bool b = true); 
00061 
00062     virtual void   DefineAttributes(WndEditor* editor);
00064 
00065 protected: 
00067     Control(); 
00068     Control(int x, int y, int w, int h, Flags<WndFlag> flags = CLICKABLE); 
00069 
00070 
00071     Clr      m_color;    
00072     bool     m_disabled; 
00073 
00074 private:
00075     friend class boost::serialization::access;
00076     template <class Archive>
00077     void serialize(Archive& ar, const unsigned int version);
00078 };
00079 
00080 } // namespace GG
00081 
00082 BOOST_IS_ABSTRACT(GG::Control);
00083 
00084 // template implementations
00085 template <class Archive>
00086 void GG::Control::serialize(Archive& ar, const unsigned int version)
00087 {
00088     ar  & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Wnd)
00089         & BOOST_SERIALIZATION_NVP(m_color)
00090         & BOOST_SERIALIZATION_NVP(m_disabled);
00091 }
00092 
00093 #endif // _GG_Control_h_

Generated on Wed Mar 26 14:35:41 2008 for GG by  doxygen 1.5.2