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       typedef enum HANDLE {
00032         HANDLE_TOP_CENTER,
00033         HANDLE_TOP_RIGHT,
00034         HANDLE_CENTER_RIGHT,
00035         HANDLE_BOTTOM_RIGHT,
00036         HANDLE_BOTTOM_CENTER,
00037         HANDLE_BOTTOM_LEFT,
00038         HANDLE_CENTER_LEFT,
00039         HANDLE_TOP_LEFT
00040     } HANDLE;
00041 
00042       typedef PapyrusSmartPointer<Handlebox> pointer;
00043 
00044       Handlebox(Handles handles=CORNER_HANDLES);
00045 
00046       static Handlebox::pointer create(Handles handles=CORNER_HANDLES);
00047 
00048       virtual ~Handlebox();
00049 
00050       void set_handle_shape( Drawable::pointer );
00051       void set_handle_shape( unsigned short int which, Drawable::pointer );
00052       void set_corner_handle_shape( Drawable::pointer );
00053       Drawable::pointer get_handle_shape( unsigned short int which );
00054 
00055       void clear_handles();
00056       void clear_handle( unsigned int which );
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 
00067       virtual void draw( Cairo::RefPtr< Cairo :: Context > cairo );
00068 
00073       virtual void update_extents();
00074 
00075       virtual void position_handle( Drawable::pointer, double x, double y );
00076 
00077   };
00078 
00079 }
00080 
00081 #endif

Generated on Sun Jan 7 22:53:57 2007 by  doxygen 1.5.1