Mcalc
0.1
a machinist's calculator
|
#include <output.hpp>
Public Member Functions | |
Output (BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > &refGlade) | |
~Output () | |
void | notify (Event *e) |
void | broadcast () |
void | set_references (std::vector< mc::Interface * > r) |
void | set_calculator (std::function< double(std::vector< mc::Interface * >)> f) |
std::string | get_value () |
void | set_value (double v) |
void | set_value (std::string s) |
![]() | |
Interface () | |
virtual | ~Interface () |
void | set_column (std::string n) |
std::string | get_column () |
![]() | |
Subscriber () | |
virtual | ~Subscriber () |
Additional Inherited Members | |
![]() | |
Broadcaster * | broadcaster |
DataStore * | data |
std::string | column_name |
The Output class wraps a Gtk::Label in the UI and uses a provided lambda function to calculate a display value.
mc::Output::Output | ( | BaseObjectType * | cobject, |
const Glib::RefPtr< Gtk::Builder > & | refGlade | ||
) |
Constructor for the Gtk::Builder
cobject | A base object typedef |
refGlade | A reference to the builder. |
mc::Output::~Output | ( | ) |
Destructor
void mc::Output::broadcast | ( | ) |
Generates a change event and sends it to Broadcaster.
|
virtual |
Returns a string representation of the current value of the Interface.
Implements mc::Interface.
|
virtual |
Update the Interface about change events. Used by broadcaster.
e | The event object |
Implements mc::Subscriber.
void mc::Output::set_calculator | ( | std::function< double(std::vector< mc::Interface * >)> | f | ) |
Set the calculating function that will be used to generate output given the current state of the references.
f | A function that will be used to calculate output. |
void mc::Output::set_references | ( | std::vector< mc::Interface * > | r | ) |
Add references to the interface that will trigger the Output to update when they change.
r | A vector of Interfaces to use as a reference |
void mc::Output::set_value | ( | double | v | ) |
Sets the value of the output.
v | A double value to set in the ui. |
|
virtual |
Sets the current value of the interface.
s | The string value to set. |
Implements mc::Interface.