TruthTableCanvas Class Reference

Class which draws a truth table. More...

#include <truthTableCanvas.hpp>

Collaboration diagram for TruthTableCanvas:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TruthTableCanvas (wxWindow *parent, wxWindowID id, TruthTable initialTable)
 Constructor.
void setNewTable (TruthTable newTable)
 Sets a truth table.
TruthTable getTable ()
 Returns the table being drawn.
virtual ~TruthTableCanvas ()
 Destructor.
void setEditable (bool editable)
 Sets the editable property.

Private Member Functions

void setTable ()
 Initializes the grid.
vector< wxString > getInputsString (int i)
 Returns the string outputs for a given table index.
vector< bool > getInputsVector (int i)
 Returns the vector outputs for a given table index.
void OnCellChanged (wxGridEvent &ev)
 Cell click event.
vector< bool > getOutputs (int i)
 Returns the outputs for a given index.
void initColours ()
 Color value initialization.

Private Attributes

wxColour * colourInputTrue
wxColour * colourInputFalse
wxColour * colourOutputTrue
wxColour * colourOutputFalse
TruthTable table
 The truth table.
bool editable
 If the table is read only.

Detailed Description

Class which draws a truth table.

This class is a wxWindows widget which draws a truth table on the screen. It has an event which is triggered when clicking on a cell of the table to allow the modification of it.

Author:
Bernat Rāfales Mulet <the_bell@users.sourceforge.net>
Version:
Revision
1.6

Definition at line 40 of file truthTableCanvas.hpp.


Constructor & Destructor Documentation

TruthTableCanvas::TruthTableCanvas wxWindow *  parent,
wxWindowID  id,
TruthTable  initialTable
 

Constructor.

Parameters:
parent the parent window.
id the window identifier.
initialTable the truth table to paint.

Definition at line 90 of file truthTableCanvas.cpp.

TruthTableCanvas::~TruthTableCanvas  )  [virtual]
 

Destructor.

Definition at line 135 of file truthTableCanvas.cpp.


Member Function Documentation

vector< wxString > TruthTableCanvas::getInputsString int  i  )  [private]
 

Returns the string outputs for a given table index.

Parameters:
i the table index. The table input combination can be recreated with this value, converting it to binary.
Returns:
The output combination of the table index, in string form.
See also:
getInputsVector(int i)

Definition at line 193 of file truthTableCanvas.cpp.

References TruthTable::getInputs(), and table.

Referenced by setTable().

Here is the call graph for this function:

vector< bool > TruthTableCanvas::getInputsVector int  i  )  [private]
 

Returns the vector outputs for a given table index.

Parameters:
i the table index. The table input combination can be recreated with this value, converting it to binary.
Returns:
The output combination of the table index, in vector form.
See also:
getInputsString(int i)

Definition at line 220 of file truthTableCanvas.cpp.

References TruthTable::getInputs(), and table.

Referenced by OnCellChanged(), and setTable().

Here is the call graph for this function:

vector< bool > TruthTableCanvas::getOutputs int  i  )  [private]
 

Returns the outputs for a given index.

Parameters:
i the table index.
Returns:
The outputs of the table index.

Definition at line 245 of file truthTableCanvas.cpp.

References TruthTable::getInputs(), TruthTable::getOutputs(), and table.

Here is the call graph for this function:

TruthTable TruthTableCanvas::getTable  ) 
 

Returns the table being drawn.

Returns:
The table being drawn.

Definition at line 318 of file truthTableCanvas.cpp.

References table.

void TruthTableCanvas::initColours  )  [private]
 

Color value initialization.

Definition at line 305 of file truthTableCanvas.cpp.

References colourInputFalse, colourInputTrue, colourOutputFalse, and colourOutputTrue.

void TruthTableCanvas::OnCellChanged wxGridEvent &  ev  )  [private]
 

Cell click event.

Parameters:
ev the event.

Definition at line 269 of file truthTableCanvas.cpp.

References colourOutputFalse, colourOutputTrue, editable, TruthTable::getInputs(), getInputsVector(), and table.

Here is the call graph for this function:

void TruthTableCanvas::setEditable bool  editable  ) 
 

Sets the editable property.

Parameters:
editable if true, the table will be editable by the user, if false, it won't.

Definition at line 329 of file truthTableCanvas.cpp.

Referenced by ResultsView::initControls().

void TruthTableCanvas::setNewTable TruthTable  newTable  ) 
 

Sets a truth table.

Parameters:
newTable the new table to set.

Definition at line 114 of file truthTableCanvas.cpp.

References TruthTable::copyTable(), TruthTable::getInputs(), TruthTable::getOutputs(), setTable(), and table.

Referenced by ResultsView::setTable(), and TruthTableView::updateTable().

Here is the call graph for this function:

void TruthTableCanvas::setTable  )  [private]
 

Initializes the grid.

This method is called to initialize all the grid values and properties such as column names, strings and background colours of the cells.

Definition at line 145 of file truthTableCanvas.cpp.

References colourInputFalse, colourInputTrue, TruthTable::getInputs(), getInputsString(), getInputsVector(), TruthTable::getOutput(), and table.

Referenced by setNewTable().

Here is the call graph for this function:


Member Data Documentation

wxColour* TruthTableCanvas::colourInputFalse [private]
 

Definition at line 58 of file truthTableCanvas.hpp.

Referenced by initColours(), and setTable().

wxColour* TruthTableCanvas::colourInputTrue [private]
 

Definition at line 57 of file truthTableCanvas.hpp.

Referenced by initColours(), and setTable().

wxColour* TruthTableCanvas::colourOutputFalse [private]
 

Definition at line 60 of file truthTableCanvas.hpp.

Referenced by initColours(), and OnCellChanged().

wxColour* TruthTableCanvas::colourOutputTrue [private]
 

Definition at line 59 of file truthTableCanvas.hpp.

Referenced by initColours(), and OnCellChanged().

bool TruthTableCanvas::editable [private]
 

If the table is read only.

Definition at line 64 of file truthTableCanvas.hpp.

Referenced by OnCellChanged().

TruthTable TruthTableCanvas::table [private]
 

The truth table.

Definition at line 62 of file truthTableCanvas.hpp.

Referenced by getInputsString(), getInputsVector(), getOutputs(), getTable(), OnCellChanged(), setNewTable(), and setTable().


The documentation for this class was generated from the following files:
Generated on Sat Sep 2 00:01:12 2006 for NanoComp by  doxygen 1.4.6