Mcalc  0.1
a machinist's calculator
Public Member Functions | List of all members
mc::Slider Class Reference

#include <slider.hpp>

Inheritance diagram for mc::Slider:
Inheritance graph
[legend]
Collaboration diagram for mc::Slider:
Collaboration graph
[legend]

Public Member Functions

 Slider (BaseObjectType *cobject, const Glib::RefPtr< Gtk::Builder > &refGlade)
 
 ~Slider ()
 
void notify (Event *e)
 
void on_value_changed ()
 
void populate ()
 
void set_marks ()
 
void set_marks (std::map< double, std::string > m)
 
void set_scaler (mc::Interface *i)
 
void set_references (std::vector< mc::Interface * > s, std::vector< mc::Interface * > e)
 
void set_columns (std::vector< std::string > c)
 
void block (bool b)
 
std::string get_value ()
 
void fix ()
 
void unfix ()
 
void set_value (double max, double min, double val)
 
void set_value (std::string s)
 
- Public Member Functions inherited from mc::Interface
 Interface ()
 
virtual ~Interface ()
 
void set_column (std::string n)
 
std::string get_column ()
 
- Public Member Functions inherited from mc::Subscriber
 Subscriber ()
 
virtual ~Subscriber ()
 

Additional Inherited Members

- Protected Attributes inherited from mc::Interface
Broadcasterbroadcaster
 
DataStoredata
 
std::string column_name
 

Detailed Description

A Slider wraps a Gtk::Scale widget in the UI and manages flexible max/min values, responding to broadcast events.

Constructor & Destructor Documentation

mc::Slider::Slider ( BaseObjectType *  cobject,
const Glib::RefPtr< Gtk::Builder > &  refGlade 
)

Constructor for the Gtk::Builder

Parameters
cobjectA base object typedef
refGladeA reference to the builder.
mc::Slider::~Slider ( )

Destructor

Member Function Documentation

void mc::Slider::block ( bool  b)

Stop/start broadcasting events

Parameters
bTrue allows broadcasts, false dis-allows.
void mc::Slider::fix ( )

Freezes the slider at the current value.

std::string mc::Slider::get_value ( )
virtual

Returns a string representation of the current value of the Interface.

Implements mc::Interface.

void mc::Slider::notify ( Event e)
virtual

Update the Interface about change events. Used by broadcaster.

Parameters
eThe event object

Implements mc::Subscriber.

void mc::Slider::on_value_changed ( )

Generates a change event and sends it to Broadcaster.

void mc::Slider::populate ( )

Populates the UI with values from the datastore.

void mc::Slider::set_columns ( std::vector< std::string >  c)

The columns to use for setting max and min values.

Parameters
cColumn names ('max_sfpm' etc.)
void mc::Slider::set_marks ( )

Sets any marks that this Slider contains in the UI.

void mc::Slider::set_marks ( std::map< double, std::string >  m)

Overloaded set_marks is used to provide constant mark values to add to the Gtk::Scale.

Parameters
mA map of double (position) and string (label) values.
void mc::Slider::set_references ( std::vector< mc::Interface * >  s,
std::vector< mc::Interface * >  e 
)

Add references to the interface that will trigger the Slider to update. Slider uses two sets of references and a scaler value to move the available range of values between the two.

Parameters
sA vector of Interfaces to use as a reference
eA vector of Interfaces to use as a reference
void mc::Slider::set_scaler ( mc::Interface i)

The scaler is an Interface that is expected to be a value between 0-100 and is used to change the max and min values of this slider.

Parameters
iThe Interface to use as a scaler.
void mc::Slider::set_value ( double  max,
double  min,
double  val 
)

Sets the max, min and current position of the Slider.

void mc::Slider::set_value ( std::string  s)
virtual

Sets a value from a string (converts to double).

Implements mc::Interface.

void mc::Slider::unfix ( )

Unfreezes the slider.


The documentation for this class was generated from the following files: