00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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
00158 Gtk::ComboBoxText *m_DayCB;
00159
00160
00161 Gtk::Label *m_CurBlockLabel;
00162
00163
00164 Gtk::Notebook *m_StageNB;
00165 Gtk::ScrolledWindow *m_TextSWindow;
00166 Gtk::ScrolledWindow *m_TreeSWindow;
00167 Gtk::HPaned *m_HPane;
00168
00169
00170 Gtk::TextView *m_TextView;
00171
00173 std::vector<CListView*> m_TreeViews;
00174
00176 Case::LawSystem m_LawSystem;
00177 };
00178
00179 #endif