#include <scriptwidget.h>
Public Member Functions | |
ScriptWidget (Case::LawSystem system=Case::TWO_DAY) | |
Constructor. | |
~ScriptWidget () | |
Destructor. | |
void | clear (Case::LawSystem system) |
Completely reset the entire widget. | |
void | activate_trial_notebook_tab (bool trial) |
Switch between the Investigation and Trial notebook tabs. | |
void | add_character (int day, int stage, const Glib::ustring &name, const Glib::ustring &internal) |
Add a character to a text block list Passing -1 for both day and stage will add this character to all lists. | |
void | remove_character (const Glib::ustring &name) |
Remove a character from the lists. | |
void | add_text_block (int day, int stage, const Glib::ustring &parent, const Glib::ustring &blockName, const Glib::ustring &desc, const Glib::RefPtr< Gtk::TextBuffer > &buffer) |
Add a text block under an exiting top-level node. | |
CListView * | find_block (const Glib::ustring &id, int &index) |
Locate a block within the tree views and returns the top-level tree view. | |
void | set_trial_notebook_list (int index) |
Set a list to display in a notebook tab. | |
void | insert_text_at_cursor (const Glib::ustring &str) |
Insert text at the cursor in current block. | |
BufferMap | get_buffers () const |
Get all of the buffers in this widget. | |
std::map < Glib::ustring, Glib::ustring > | get_buffer_descriptions () |
Get the buffer descriptions. | |
Glib::RefPtr < Gtk::TextBuffer > | get_current_buffer () |
Get the currently displayed block. | |
Private Member Functions | |
void | construct () |
Build the widget's UI. | |
CListView * | get_current_list () |
Get the currently displayed list. | |
Glib::ustring | unique_id (const Glib::ustring &rootString) |
Get a unique ID for a text block. | |
void | on_list_add_text_block (const Glib::ustring &root, bool isCharacter, CListView *list) |
Handler to add a new text block. | |
void | reset_combo_box () |
Reset the combo box with the case days. | |
void | on_combo_box_changed () |
Handler for day combo box selection changes. | |
void | on_display_buffer (Glib::ustring id, Glib::RefPtr< Gtk::TextBuffer > buffer) |
Handler to display a buffer in the editor. | |
void | on_select_row (Gtk::TreeModel::iterator it) |
Handler to select a row of the current list. | |
Private Attributes | |
Gtk::ComboBoxText * | m_DayCB |
Gtk::Label * | m_CurBlockLabel |
Gtk::Notebook * | m_StageNB |
Gtk::ScrolledWindow * | m_TextSWindow |
Gtk::ScrolledWindow * | m_TreeSWindow |
Gtk::HPaned * | m_HPane |
Gtk::TextView * | m_TextView |
std::vector < CListView * > | m_TreeViews |
Vector of lists. | |
Case::LawSystem | m_LawSystem |
Internal record of LawSystem. |
The body of a MainWindow class consists primarily of this widget. It implements the text editor where the text blocks are displayed, along with the series of lists where the blocks themselves are organized.
ScriptWidget::ScriptWidget | ( | Case::LawSystem | system = Case::TWO_DAY |
) |
Constructor.
system | The type of LawSystem in this case |
void ScriptWidget::clear | ( | Case::LawSystem | system | ) |
Completely reset the entire widget.
system | The new LawSystem to use |
void ScriptWidget::activate_trial_notebook_tab | ( | bool | trial | ) |
Switch between the Investigation and Trial notebook tabs.
trial | true for Trial, false for Investigation |
void ScriptWidget::add_character | ( | int | day, | |
int | stage, | |||
const Glib::ustring & | name, | |||
const Glib::ustring & | internal | |||
) |
Add a character to a text block list Passing -1 for both day and stage will add this character to all lists.
day | The day (based on LawSystem), 0 based index | |
stage | 0 for Investigation, 1 for Trial | |
name | The display name for the character | |
internal | The internal name for the character |
void ScriptWidget::remove_character | ( | const Glib::ustring & | name | ) |
Remove a character from the lists.
name | Either internal or display name of character to remove |
void ScriptWidget::add_text_block | ( | int | day, | |
int | stage, | |||
const Glib::ustring & | parent, | |||
const Glib::ustring & | blockName, | |||
const Glib::ustring & | desc, | |||
const Glib::RefPtr< Gtk::TextBuffer > & | buffer | |||
) |
Add a text block under an exiting top-level node.
day | The day of the case (based on LawSystem), 0 based index | |
stage | 0 for Investigation, 1 for Trial | |
parent | The name of the parent node | |
blockName | The name of the block | |
desc | Brief description of the block | |
buffer | The text of the block |
CListView * ScriptWidget::find_block | ( | const Glib::ustring & | id, | |
int & | index | |||
) |
Locate a block within the tree views and returns the top-level tree view.
id | ID of the block | |
index | 0 based index of the lists |
void ScriptWidget::set_trial_notebook_list | ( | int | index | ) |
Set a list to display in a notebook tab.
index | 0 based index of the list |
void ScriptWidget::insert_text_at_cursor | ( | const Glib::ustring & | str | ) |
Insert text at the cursor in current block.
str | The text |
BufferMap ScriptWidget::get_buffers | ( | ) | const |
Get all of the buffers in this widget.
std::map< Glib::ustring, Glib::ustring > ScriptWidget::get_buffer_descriptions | ( | ) |
Get the buffer descriptions.
Glib::RefPtr<Gtk::TextBuffer> ScriptWidget::get_current_buffer | ( | ) | [inline] |
Get the currently displayed block.
CListView * ScriptWidget::get_current_list | ( | ) | [private] |
Get the currently displayed list.
Glib::ustring ScriptWidget::unique_id | ( | const Glib::ustring & | rootString | ) | [private] |
Get a unique ID for a text block.
rootString | The text to preprend to the ID |
void ScriptWidget::on_list_add_text_block | ( | const Glib::ustring & | root, | |
bool | isCharacter, | |||
CListView * | list | |||
) | [private] |
Handler to add a new text block.
root | The root node | |
isCharacter | Whether or not this is a character's text block | |
list | The list to add the block to |
void ScriptWidget::on_display_buffer | ( | Glib::ustring | id, | |
Glib::RefPtr< Gtk::TextBuffer > | buffer | |||
) | [private] |
Handler to display a buffer in the editor.
id | The ID of the block | |
buffer | The text of the buffer |
void ScriptWidget::on_select_row | ( | Gtk::TreeModel::iterator | it | ) | [private] |
Handler to select a row of the current list.
it | Iterator pointing to the node |