scriptwidget.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 // scriptwidget.h: the ScriptWidget class
00021 
00022 #ifndef SCRIPTWIDGET_H
00023 #define SCRIPTWIDGET_H
00024 
00025 #include <gtkmm/box.h>
00026 #include <gtkmm/comboboxtext.h>
00027 #include <gtkmm/label.h>
00028 #include <gtkmm/notebook.h>
00029 #include <gtkmm/paned.h>
00030 #include <gtkmm/scrolledwindow.h>
00031 #include <gtkmm/textview.h>
00032 
00033 #include "clistview.h"
00034 
00040 class ScriptWidget: public Gtk::VBox {
00041         public:
00045                 ScriptWidget(Case::LawSystem system=Case::TWO_DAY);
00046                 
00048                 ~ScriptWidget();
00049                 
00053                 void clear(Case::LawSystem system);
00054                 
00058                 void activate_trial_notebook_tab(bool trial);
00059                 
00067                 void add_character(int day, int stage, const Glib::ustring &name, const Glib::ustring &internal);
00068                 
00072                 void remove_character(const Glib::ustring &name);
00073                 
00082                 void add_text_block(int day, int stage, const Glib::ustring &parent,
00083                                     const Glib::ustring &blockName, const Glib::ustring &desc,
00084                                     const Glib::RefPtr<Gtk::TextBuffer> &buffer);
00085                 
00091                 CListView* find_block(const Glib::ustring &id, int &index);
00092                 
00096                 void set_trial_notebook_list(int index);
00097                 
00101                 void insert_text_at_cursor(const Glib::ustring &str);
00102                 
00106                 BufferMap get_buffers() const;
00107                 
00111                 std::map<Glib::ustring, Glib::ustring> get_buffer_descriptions();
00112                 
00116                 Glib::RefPtr<Gtk::TextBuffer> get_current_buffer() { return m_TextView->get_buffer(); }
00117         
00118         private:
00120                 void construct();
00121                 
00125                 CListView* get_current_list();
00126                 
00131                 Glib::ustring unique_id(const Glib::ustring &rootString);
00132                 
00138                 void on_list_add_text_block(const Glib::ustring &root, bool isCharacter, CListView *list);
00139                 
00141                 void reset_combo_box();
00142                 
00144                 void on_combo_box_changed();
00145                 
00150                 void on_display_buffer(Glib::ustring id, Glib::RefPtr<Gtk::TextBuffer> buffer);
00151                 
00155                 void on_select_row(Gtk::TreeModel::iterator it);
00156                 
00157                 // combo box
00158                 Gtk::ComboBoxText *m_DayCB;
00159                 
00160                 // labels
00161                 Gtk::Label *m_CurBlockLabel;
00162                 
00163                 // container widgets
00164                 Gtk::Notebook *m_StageNB;
00165                 Gtk::ScrolledWindow *m_TextSWindow;
00166                 Gtk::ScrolledWindow *m_TreeSWindow;
00167                 Gtk::HPaned *m_HPane;
00168                 
00169                 // the text view for editing the script
00170                 Gtk::TextView *m_TextView;
00171                 
00173                 std::vector<CListView*> m_TreeViews;
00174                 
00176                 Case::LawSystem m_LawSystem;
00177 };
00178 
00179 #endif

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