controller.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
00018  ***************************************************************************/
00019 #ifndef PAPYRUSCONTROLLER_H
00020 #define PAPYRUSCONTROLLER_H
00021 
00022 #include <sigc++/sigc++.h>
00023 
00024 #include <papyrus/smart_pointer.h>
00025 #include <papyrus/event.h>
00026 
00027 namespace Papyrus {
00028 
00032 class Controller {
00033 public:
00034 
00035   typedef PapyrusSmartPointer<Controller> pointer;
00036 
00037     Controller();
00038 
00039     virtual ~Controller();
00040 
00041     virtual bool is_disabled();
00042 
00043     virtual bool disable(bool value=true);
00044 
00045     virtual bool enable(bool value=true);
00046 
00047     sigc::signal<void,bool> signal_disabled();
00048 
00049     virtual bool handle(const Event::Event& event);
00050     virtual bool handle(const Event::Button& event);
00051     virtual bool handle(const Event::ButtonPress& event);
00052     virtual bool handle(const Event::ButtonDoublePress& event);
00053     virtual bool handle(const Event::ButtonTriplePress& event);
00054     virtual bool handle(const Event::ButtonRelease& event);
00055     virtual bool handle(const Event::Key& event);
00056     virtual bool handle(const Event::KeyPress& event);
00057     virtual bool handle(const Event::KeyRelease& event);
00058     virtual bool handle(const Event::Motion& event);
00059     virtual bool handle(const Event::Scroll& event);
00060 
00061 protected:
00062   bool m_disabled;
00063 
00064   sigc::signal<void,bool> m_signal_disabled;
00065 
00066   virtual bool on_button_press(const Event::ButtonPress& event);
00067   virtual bool on_button_double_press(const Event::ButtonDoublePress& event);
00068   virtual bool on_button_triple_press(const Event::ButtonTriplePress& event);
00069   virtual bool on_button_release(const Event::ButtonRelease& event);
00070   virtual bool on_key_press(const Event::KeyPress& event);
00071   virtual bool on_key_release(const Event::KeyRelease& event);
00072   virtual bool on_motion(const Event::Motion& event);
00073   virtual bool on_scroll(const Event::Scroll& event);
00074 
00075 };
00076 
00077 }
00078 
00079 #endif

Generated on Sun Mar 11 10:01:28 2007 by  doxygen 1.5.1