clistview.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Mike Polan                                      *
00003  *   kanadakid@gmail.com                                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 // clistview.h: customized TreeView class
00021 
00022 #ifndef CLISTVIEW_H
00023 #define CLISTVIEW_H
00024 
00025 #include <gtkmm/menu.h>
00026 #include <gtkmm/treestore.h>
00027 #include <gtkmm/treeview.h>
00028 
00029 #include "case.h"
00030 
00037 class CListView: public Gtk::TreeView {
00038         public:
00040                 CListView();
00041                 
00047                 static Glib::RefPtr<Gtk::TextBuffer> create_buffer();
00048                 
00050                 void clear();
00051                 
00055                 void append_toplevel_text(const Glib::ustring &text);
00056                 
00063                 void append_child_text(const Glib::ustring &parent, const Glib::ustring &id, 
00064                                        const Glib::ustring &text, const Glib::RefPtr<Gtk::TextBuffer> &buffer);
00065                 
00069                 void delete_toplevel_text(const Glib::ustring &text);
00070                 
00075                 void select_block(const Glib::ustring &block, Gtk::TreeRow *row);
00076                 
00080                 BufferMap get_buffers() const { return m_Buffers; }
00081                 
00086                 std::map<Glib::ustring, Glib::ustring> get_buffer_descriptions();
00087                 
00089                 sigc::signal<void, Glib::ustring, Glib::RefPtr<Gtk::TextBuffer> > 
00090                                 signal_display_buffer() const { return m_DisplayBufferSignal; }
00091                 
00093                 sigc::signal<void, Glib::ustring, bool, CListView*> signal_add_text_block() const { return m_AddBlockSignal; }
00094                 
00096                 sigc::signal<void, Gtk::TreeModel::iterator> signal_select() const { return m_SelectSignal; }
00097                 
00098         private:
00100                 sigc::signal<void, Glib::ustring, Glib::RefPtr<Gtk::TextBuffer> > m_DisplayBufferSignal;
00101                 
00103                 sigc::signal<void, Gtk::TreeModel::iterator> m_SelectSignal;
00104                 
00106                 sigc::signal<void, Glib::ustring, bool, CListView*> m_AddBlockSignal;
00107                 
00108                 // handle selection changes
00109                 void on_selection_changed();
00110                 
00111                 // add a text block handler
00112                 void on_add_text_block();
00113                 
00114                 // delete a text block handler
00115                 void on_delete_text_block();
00116                 
00117                 // edit a text block's description
00118                 void on_edit_description();
00119                 
00120                 // follow a block's GOTO trigger to its target block
00121                 void on_follow_goto();
00122                 
00123                 // button press handler
00124                 virtual bool on_button_press_event(GdkEventButton *e);
00125                 
00126                 // context menu
00127                 Gtk::Menu m_ContextMenu;
00128                 
00129                 // model
00130                 Glib::RefPtr<Gtk::TreeStore> m_Model;
00131                 
00132                 // column record
00133                 // column record for tree view
00134                 class ColumnRec: public Gtk::TreeModel::ColumnRecord {
00135                         public:
00136                                 // constructor
00137                                 ColumnRec() {
00138                                         add(m_Column);
00139                                 }
00140                                 
00141                                 // columns
00142                                 Gtk::TreeModelColumn<Glib::ustring> m_Column;
00143                 };
00144                 
00145                 // column record instance
00146                 ColumnRec m_ColumnRec;
00147                 
00149                 BufferMap m_Buffers;
00150 };
00151 
00152 #endif

Generated on Fri Feb 22 22:34:17 2008 for Phoenix Wright Case Editor API by  doxygen 1.5.3