00001 /*************************************************************************** 00002 * Copyright (C) 2009 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 PAPYRUS_GTKGRADIENTSTOPWIDGET_H 00021 #define PAPYRUS_GTKGRADIENTSTOPWIDGET_H 00022 00023 #include <vector> 00024 00025 #include <gtkmm/table.h> 00026 #include <gtkmm/colorbutton.h> 00027 #include <gtkmm/label.h> 00028 #include <gtkmm/spinbutton.h> 00029 00030 #include <papyrus/gradient.h> 00031 00032 namespace Papyrus 00033 { 00034 00035 namespace Gtk 00036 { 00037 00041 class GradientStopWidget : public ::Gtk::Table 00042 { 00043 public: 00044 GradientStopWidget ( unsigned num_stops=1, 00045 bool show_header=false, 00046 bool show_stop_num=false 00047 ); 00048 00049 ~GradientStopWidget(); 00050 00051 unsigned num_stops(); 00052 00053 void set_num_stops ( unsigned num_stops ); 00054 00055 void show_header ( bool show=false ); 00056 00057 void show_stop_num ( bool show=false ); 00058 00059 sigc::signal<void> signal_stops_changed(); 00060 00061 Gradient::Stops stops(); 00062 00063 protected: 00064 00065 unsigned m_num_stops; 00066 bool m_show_header; 00067 bool m_show_stop_num; 00068 00069 sigc::signal<void> m_signal_stops_changed; 00070 00071 std::vector< ::Gtk::Label* > m_headers; 00072 std::vector< ::Gtk::Label* > m_stop_nums; 00073 std::vector< ::Gtk::ColorButton* > m_colorbuttons; 00074 std::vector< ::Gtk::SpinButton* > m_offsets; 00075 std::vector< ::Gtk::SpinButton* > m_alphas; 00076 00077 Gradient::Stops m_stops; 00078 00079 void on_color_changed ( int which ); 00080 00081 void on_offset_changed ( int which ); 00082 00083 void on_alpha_changed ( int which ); 00084 00085 }; 00086 00087 } 00088 00089 } 00090 00091 #endif