handlebox.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 PAPYRUSHANDLEBOX_H
00020 #define PAPYRUSHANDLEBOX_H
00021 
00022 #include <papyrus/boxed.h>
00023 
00024 namespace Papyrus {
00025 
00029   class Handlebox : public Boxed {
00030     public:
00031 
00032       typedef PapyrusSmartPointer<Handlebox> pointer;
00033 
00034       Handlebox(Handles handles=CORNER_HANDLES);
00035 
00036       static Handlebox::pointer create(Handles handles=CORNER_HANDLES);
00037 
00038       virtual ~Handlebox();
00039 
00040       void set_handle_shape( Position p, Drawable::pointer shape, bool activate=true );
00041 
00042       void set_handle_shape( Handles h, Drawable::pointer shape, bool activate=true );
00043 
00044       Drawable::pointer get_handle_shape( Position p );
00045 
00046       void activate_handle( Position p, bool activate=true );
00047 
00048       void activate_handle( Handles h, bool activate=true );
00049 
00050       void deactivate_handle( Position p );
00051 
00052       void deactivate_handle( Handles h );
00053 
00054       bool is_active( Position p );
00055 
00056       bool is_active( Handles h );
00057 
00058       int inside_handle( double x, double y );
00059 
00060       PAPYRUS_CLASS_NAME("Handle Box");
00061 
00062       PAPYRUS_CLONE_METHOD( Handlebox );
00063 
00064     protected:
00065       Drawable::pointer m_handle_shape[ 8 ];
00066       bool m_handle_active[8];
00067       bool m_initializing;
00068 
00073       virtual void rebuild_extents();
00074 
00075       virtual void position_handle( Drawable::pointer, double x, double y );
00076 
00077       virtual void on_child_added( Drawable::pointer child );
00078 
00079       virtual void on_child_removed( Drawable::pointer child );
00080 
00081   };
00082 
00083 }
00084 
00085 #endif

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