ScriptWidget Class Reference

Widget that implements the text editor and other relevant widgets. More...

#include <scriptwidget.h>

List of all members.

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.
CListViewfind_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.
CListViewget_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.


Detailed Description

Widget that implements the text editor and other relevant widgets.

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.


Constructor & Destructor Documentation

ScriptWidget::ScriptWidget ( Case::LawSystem  system = Case::TWO_DAY  ) 

Constructor.

Parameters:
system The type of LawSystem in this case


Member Function Documentation

void ScriptWidget::clear ( Case::LawSystem  system  ) 

Completely reset the entire widget.

Parameters:
system The new LawSystem to use

void ScriptWidget::activate_trial_notebook_tab ( bool  trial  ) 

Switch between the Investigation and Trial notebook tabs.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
id ID of the block
index 0 based index of the lists
Returns:
Pointer to a list where the block was found, null if not found

void ScriptWidget::set_trial_notebook_list ( int  index  ) 

Set a list to display in a notebook tab.

Parameters:
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.

Parameters:
str The text

BufferMap ScriptWidget::get_buffers (  )  const

Get all of the buffers in this widget.

Returns:
A map of all buffers

std::map< Glib::ustring, Glib::ustring > ScriptWidget::get_buffer_descriptions (  ) 

Get the buffer descriptions.

Returns:
A map of block IDs and descriptions

Glib::RefPtr<Gtk::TextBuffer> ScriptWidget::get_current_buffer (  )  [inline]

Get the currently displayed block.

Returns:
The text of the current block

CListView * ScriptWidget::get_current_list (  )  [private]

Get the currently displayed list.

Returns:
Pointer to current list

Glib::ustring ScriptWidget::unique_id ( const Glib::ustring &  rootString  )  [private]

Get a unique ID for a text block.

Parameters:
rootString The text to preprend to the ID
Returns:
An ID that is unique for this block

void ScriptWidget::on_list_add_text_block ( const Glib::ustring &  root,
bool  isCharacter,
CListView list 
) [private]

Handler to add a new text block.

Parameters:
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.

Parameters:
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.

Parameters:
it Iterator pointing to the node


The documentation for this class was generated from the following files:
Generated on Fri Feb 22 22:34:18 2008 for Phoenix Wright Case Editor API by  doxygen 1.5.3