translator.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 PAPYRUSTRANSLATOR_H
00020 #define PAPYRUSTRANSLATOR_H
00021 
00022 #include <papyrus/selector.h>
00023 
00024 namespace Papyrus
00025 {
00026 
00030   class Translator : public Selector
00031   {
00032     public:
00033       typedef PapyrusSmartPointer<Translator> pointer;
00034 
00035     Translator(Group::pointer selection_group = Group::pointer(),
00036                SelectionMode mode = SELECT_PRESS,
00037                int selection_depth = 1,
00038                unsigned transforms = TRANSLATE_X|TRANSLATE_Y );
00039 
00040     Translator(Group::pointer select_from_group,
00041                Group::pointer selection_group,
00042                SelectionMode mode = SELECT_PRESS,
00043                int selection_depth = 1,
00044                unsigned transforms = TRANSLATE_X|TRANSLATE_Y );
00045 
00046     static Translator::pointer create(Group::pointer selection_group = Group::pointer(),
00047                                       SelectionMode mode = SELECT_PRESS,
00048                                       int selection_depth = 1,
00049                                       unsigned transforms = TRANSLATE_X|TRANSLATE_Y );
00050 
00051     static Translator::pointer create(Group::pointer select_from_group,
00052                                       Group::pointer selection_group,
00053                                       SelectionMode mode = SELECT_PRESS,
00054                                       int selection_depth = 1,
00055                                       unsigned transforms = TRANSLATE_X|TRANSLATE_Y );
00056 
00057     ~Translator();
00058 
00059     unsigned transforms();
00060 
00061     void set_transforms( unsigned transforms );
00062 
00063     void enable_transforms( unsigned transforms );
00064 
00065     void disable_transforms( unsigned transforms );
00066 
00068     void grid( double& x, double& y );
00069 
00074     void set_grid( double x, double y );
00075 
00076     void set_grid_x( double x );
00077 
00078     void set_grid_y( double y );
00079 
00080   protected:
00081     double m_original_position[2];
00082     unsigned m_transforms;
00083     double m_grid[2];
00084 
00085     virtual bool on_motion(const Event::Motion& event);
00086     virtual bool on_button_press(const Event::ButtonPress& event);
00087 
00088   };
00089 
00090 }
00091 
00092 #endif

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