00001 /*************************************************************************** 00002 * Copyright (C) 2007 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_GTKDRAWABLETREEVIEW_H 00021 #define PAPYRUS_GTKDRAWABLETREEVIEW_H 00022 00023 #include <gtkmm.h> 00024 #include <papyrus/drawable.h> 00025 #include <papyrus/group.h> 00026 00027 namespace Papyrus { 00028 00029 namespace Gtk { 00030 00034 class DrawableModelColumnRecord : public ::Gtk::TreeModelColumnRecord 00035 { 00036 public: 00037 DrawableModelColumnRecord() 00038 { 00039 this->add(pixbuf); 00040 this->add(type); 00041 this->add(id); 00042 } 00043 00044 ::Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > pixbuf; 00045 ::Gtk::TreeModelColumn<Glib::ustring> type; 00046 ::Gtk::TreeModelColumn<Glib::ustring> id; 00047 }; 00048 00052 class DrawableTreeView : public ::Gtk::TreeView 00053 { 00054 public: 00055 DrawableTreeView( Drawable::pointer d = Drawable::pointer() ); 00056 00057 ~DrawableTreeView(); 00058 00059 void set_drawable( Drawable::pointer d ); 00060 00061 void set_show_layers( bool set=true ); 00062 00063 bool is_show_layers_set(); 00064 00065 protected: 00066 Drawable::pointer m_drawable; 00067 00068 Glib::RefPtr< ::Gtk::TreeStore > m_store; 00069 DrawableModelColumnRecord m_column_record; 00070 00071 void add_group( const ::Gtk::TreeRow& row, Group::pointer group ); 00072 00073 void add_drawable( const ::Gtk::TreeRow& row, Drawable::pointer d ); 00074 00075 bool m_show_layers; 00076 00077 }; 00078 00079 } 00080 00081 } 00082 00083 #endif