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 PAPYRUSZOOMER_H 00021 #define PAPYRUSZOOMER_H 00022 00023 #include <papyrus/affinecontroller.h> 00024 00025 namespace Papyrus 00026 { 00027 00031 class Zoomer : public AffineController 00032 { 00033 protected: 00034 00035 Zoomer ( const Glib::ustring& id, DrawableSet::pointer drawables, double zoom_step=1.0 ); 00036 00037 public: 00038 00039 typedef PapyrusPointer<Zoomer> pointer; 00040 00041 static Zoomer::pointer create ( double zoom_step=0.25 ); 00042 00043 static Zoomer::pointer create ( const Glib::ustring& id, DrawableSet::pointer drawables, double zoom_step=1.0 ); 00044 00045 static Zoomer::pointer create ( const Glib::ustring& id, double zoom_step=1.0 ); 00046 00047 static Zoomer::pointer create ( DrawableSet::pointer drawables, double zoom_step=1.0 ); 00048 00049 virtual ~Zoomer(); 00050 00051 void zoom_in(); 00052 00053 void zoom_out(); 00054 00055 double zoom_step(); 00056 00057 void set_zoom_step( double zs ); 00058 00059 unsigned zoom_in_buttons(); 00060 00061 unsigned zoom_out_buttons(); 00062 00063 void set_zoom_in_buttons( unsigned b ); 00064 00065 void set_zoom_out_buttons( unsigned b ); 00066 00067 void set_zoom_buttons( unsigned in, unsigned out ); 00068 00069 void set_zoom_buttons( unsigned set ); 00070 00071 void add_zoom_buttons( unsigned in, unsigned out ); 00072 00073 void add_zoom_buttons( unsigned set ); 00074 00075 void perform_button_action( Event::ButtonID b ); 00076 00077 protected: 00078 00079 double m_zoom_step; 00080 00081 unsigned m_zoom_in_buttons; 00082 00083 unsigned m_zoom_out_buttons; 00084 00085 virtual bool on_button_press ( const Event::ButtonPress& event ); 00086 00087 virtual bool on_scroll ( const Event::Scroll& event ); 00088 00089 }; 00090 00091 } 00092 00093 #endif