papyrus logo

selector.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 PAPYRUSSELECTOR_H
00021 #define PAPYRUSSELECTOR_H
00022 
00023 #include <papyrus/drawablecontroller.h>
00024 #include <papyrus/group.h>
00025 
00026 namespace Papyrus
00027 {
00028 
00044   class Selector : public DrawableController
00045   {
00046     protected:
00047       
00048       Selector( const Glib::ustring& id,
00049                 DrawableSet::pointer drawables,
00050                 Group::pointer select_from_group = Group::pointer(),
00051                 SelectionMode mode = SELECT_PRESS,
00052                 int selection_depth = 1 );
00053 
00054     public:
00055 
00056       typedef PapyrusPointer<Selector> pointer;
00057 
00058       static pointer create( Group::pointer select_from_group = Group::pointer(),
00059                              SelectionMode mode = SELECT_PRESS,
00060                              int selection_depth = 1 );
00061 
00062       static pointer create( const Glib::ustring& id,
00063                              DrawableSet::pointer selected,
00064                              Group::pointer select_from_group = Group::pointer(),
00065                              SelectionMode mode = SELECT_PRESS,
00066                              int selection_depth = 1 );
00067 
00068       static pointer create( const Glib::ustring& id,
00069                              Group::pointer select_from_group = Group::pointer(),
00070                              SelectionMode mode = SELECT_PRESS,
00071                              int selection_depth = 1 );
00072 
00073       static pointer create( DrawableSet::pointer selected,
00074                              Group::pointer select_from_group,
00075                              SelectionMode mode = SELECT_PRESS,
00076                              int selection_depth = 1 );
00077 
00078       virtual ~Selector();
00079 
00080       Group::pointer select_from_group();
00081 
00082       void set_select_from_group( Group::pointer select_from_group );
00083 
00084       void set_select_mode( unsigned mode );
00085 
00086       void enable_select_mode( unsigned mode );
00087 
00088       void disable_select_mode( unsigned mode );
00089 
00090       unsigned select_mode();
00091 
00092       int selection_depth();
00093 
00094       void set_selection_depth( int selection_depth );
00095 
00096       const Drawables& selection();
00097 
00098     protected:
00099       unsigned m_select_mode;
00100       int m_selection_depth;
00101       Group::pointer m_select_from_group;
00102       bool m_add_drawable_only;
00103       Drawable::pointer m_picked;
00104       double m_last_position[ 2 ];
00105 
00106       virtual bool on_button_press( const Event::ButtonPress& event );
00107       virtual bool on_button_release( const Event::ButtonRelease& event );
00108       virtual bool on_motion( const Event::Motion& event );
00109 
00110   };
00111 
00112 }
00113 
00114 #endif

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