papyrus logo

controller.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
00019  ***************************************************************************/
00020 #ifndef PAPYRUSCONTROLLER_H
00021 #define PAPYRUSCONTROLLER_H
00022 
00023 #include <stdint.h>
00024 
00025 #include <sigc++/sigc++.h>
00026 
00027 #include <papyrus/object.h>
00028 #include <papyrus/pointer.h>
00029 #include <papyrus/event.h>
00030 #include <papyrus/utility.h>
00031 
00032 namespace Papyrus
00033 {
00034 
00099   class Controller: public Object
00100   {
00101     protected:
00102       
00103       Controller(const Glib::ustring& id=Glib::ustring());
00104 
00105     public:
00106 
00107       typedef PapyrusPointer<Controller> pointer;
00108       typedef PapyrusWeakPointer<Controller> weak_pointer;
00109 
00110       static pointer create( const Glib::ustring& id=Glib::ustring() );
00111 
00112       virtual ~Controller();
00113 
00114       virtual bool is_disabled();
00115 
00116       virtual bool disable ( bool value=true );
00117 
00118       virtual bool enable ( bool value=true );
00119 
00120       sigc::signal<void,bool> signal_disabled();
00121 
00122       bool handle_event( const Event::Event& event );
00123       
00124       virtual bool handle ( const Event::Event& event );
00125       virtual bool handle ( const Event::Button& event );
00126       virtual bool handle ( const Event::ButtonPress& event );
00127       virtual bool handle ( const Event::ButtonDoublePress& event );
00128       virtual bool handle ( const Event::ButtonTriplePress& event );
00129       virtual bool handle ( const Event::ButtonRelease& event );
00130       virtual bool handle ( const Event::Key& event );
00131       virtual bool handle ( const Event::KeyPress& event );
00132       virtual bool handle ( const Event::KeyRelease& event );
00133       virtual bool handle ( const Event::Motion& event );
00134       virtual bool handle ( const Event::Scroll& event );
00135 
00136     protected:
00137       bool m_disabled;
00138 
00139       weak_pointer m_self;
00140 
00141       sigc::signal<void,bool> m_signal_disabled;
00142 
00143       virtual bool on_button_press ( const Event::ButtonPress& event );
00144       virtual bool on_button_double_press ( const Event::ButtonDoublePress& event );
00145       virtual bool on_button_triple_press ( const Event::ButtonTriplePress& event );
00146       virtual bool on_button_release ( const Event::ButtonRelease& event );
00147       virtual bool on_key_press ( const Event::KeyPress& event );
00148       virtual bool on_key_release ( const Event::KeyRelease& event );
00149       virtual bool on_motion ( const Event::Motion& event );
00150       virtual bool on_scroll ( const Event::Scroll& event );
00151 
00152   };
00153 
00154 }
00155 
00156 #endif

Generated on Fri Apr 16 12:40:10 2010 for papyrus by doxygen 1.6.1