Cinder  0.9.1
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cinder::params::InterfaceGl Class Reference

#include <Params.h>

Classes

class  Options
 
class  OptionsBase
 

Public Member Functions

 InterfaceGl ()
 
 InterfaceGl (const std::string &title, const ivec2 &size, const ColorA &color=ColorA(0.3f, 0.3f, 0.3f, 0.4f))
 
 InterfaceGl (const cinder::app::WindowRef &window, const std::string &title, const ivec2 &size, const ColorA &color=ColorA(0.3f, 0.3f, 0.3f, 0.4f))
 
void draw ()
 
void show (bool visible=true)
 
void hide ()
 
bool isVisible () const
 
void maximize (bool maximized=true)
 
void minimize ()
 
bool isMaximized () const
 
ivec2 getPosition () const
 
void setPosition (const ci::ivec2 &pos)
 
int getWidth () const
 
int getHeight () const
 
ivec2 getSize () const
 
void setSize (const ci::ivec2 &size)
 
template<typename T >
Options< T > addParam (const std::string &name, T *target, bool readOnly=false)
 
template<typename T >
Options< T > addParam (const std::string &name, const std::function< void(T)> &setterFn, const std::function< T()> &getterFn)
 
Options< int > addParam (const std::string &name, const std::vector< std::string > &enumNames, int *param, bool readOnly=false)
 
Options< int > addParam (const std::string &name, const std::vector< std::string > &enumNames, const std::function< void(int)> &setterFn, const std::function< int()> &getterFn)
 
void addSeparator (const std::string &name="", const std::string &optionsStr="")
 
void addText (const std::string &name="", const std::string &optionsStr="")
 
void addButton (const std::string &name, const std::function< void()> &callback, const std::string &optionsStr="")
 
void removeParam (const std::string &name)
 
void setOptions (const std::string &name="", const std::string &optionsStr="")
 
void clear ()
 
void addParam (const std::string &name, bool *boolParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, bool *boolParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, float *floatParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, float *floatParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, double *doubleParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, double *doubleParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, int32_t *intParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, int32_t *intParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, vec3 *vectorParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, vec3 *vectorParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, quat *quatParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, quat *quatParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, Color *colorParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, Color *colorParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, ColorA *colorParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, ColorA *colorParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, std::string *strParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, std::string *strParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, const std::vector< std::string > &enumNames, int *param, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, const std::vector< std::string > &enumNames, int *param, const char *optionsStr, bool readOnly=false)
 
template<typename T >
void addParamCallbackImpl (const function< void(T)> &setter, const function< T()> &getter, const Options< T > &options)
 
template<>
InterfaceGl::Options< bool > addParam (const std::string &name, bool *param, bool readOnly)
 
template<>
InterfaceGl::Options< char > addParam (const std::string &name, char *param, bool readOnly)
 
template<>
InterfaceGl::Options< int8_t > addParam (const std::string &name, int8_t *param, bool readOnly)
 
template<>
InterfaceGl::Options< uint8_t > addParam (const std::string &name, uint8_t *param, bool readOnly)
 
template<>
InterfaceGl::Options< int16_t > addParam (const std::string &name, int16_t *param, bool readOnly)
 
template<>
InterfaceGl::Options< uint16_t > addParam (const std::string &name, uint16_t *param, bool readOnly)
 
template<>
InterfaceGl::Options< int32_t > addParam (const std::string &name, int32_t *param, bool readOnly)
 
template<>
InterfaceGl::Options< uint32_t > addParam (const std::string &name, uint32_t *param, bool readOnly)
 
template<>
InterfaceGl::Options< float > addParam (const std::string &name, float *param, bool readOnly)
 
template<>
InterfaceGl::Options< double > addParam (const std::string &name, double *param, bool readOnly)
 
template<>
InterfaceGl::Options< string > addParam (const std::string &name, string *param, bool readOnly)
 
template<>
InterfaceGl::Options< ColoraddParam (const std::string &name, Color *param, bool readOnly)
 
template<>
InterfaceGl::Options< ColorAaddParam (const std::string &name, ColorA *param, bool readOnly)
 
template<>
InterfaceGl::Options< quat > addParam (const std::string &name, quat *param, bool readOnly)
 
template<>
InterfaceGl::Options< dquat > addParam (const std::string &name, dquat *param, bool readOnly)
 
template<>
InterfaceGl::Options< vec3 > addParam (const std::string &name, vec3 *param, bool readOnly)
 
template<>
InterfaceGl::Options< dvec3 > addParam (const std::string &name, dvec3 *param, bool readOnly)
 

Static Public Member Functions

static InterfaceGlRef create (const std::string &title, const ivec2 &size, const ColorA &color=ColorA(0.3f, 0.3f, 0.3f, 0.4f))
 
static InterfaceGlRef create (const cinder::app::WindowRef &window, const std::string &title, const ivec2 &size, const ColorA &color=ColorA(0.3f, 0.3f, 0.3f, 0.4f))
 

Protected Member Functions

void init (app::WindowRef window, const std::string &title, const ivec2 &size, const ColorA color)
 
void implAddParamDeprecated (const std::string &name, void *param, int type, const std::string &optionsStr, bool readOnly)
 
template<typename T >
Options< T > addParamImpl (const std::string &name, T *param, int type, bool readOnly)
 
template<class T >
void addParamCallbackImpl (const std::function< void(T)> &setter, const std::function< T()> &getter, const Options< T > &options)
 

Protected Attributes

std::weak_ptr< app::WindowmWindow
 
std::shared_ptr< TwBarmBar
 
int mTwWindowId
 
std::map< std::string, std::shared_ptr< void > > mStoredCallbacks
 

Detailed Description

Interface for adding params to your window. Wraps AntTweakBar.

Constructor & Destructor Documentation

cinder::params::InterfaceGl::InterfaceGl ( )
cinder::params::InterfaceGl::InterfaceGl ( const std::string &  title,
const ivec2 &  size,
const ColorA color = ColorA( 0.3f, 0.3f, 0.3f, 0.4f ) 
)
cinder::params::InterfaceGl::InterfaceGl ( const cinder::app::WindowRef window,
const std::string &  title,
const ivec2 &  size,
const ColorA color = ColorA( 0.3f, 0.3f, 0.3f, 0.4f ) 
)

Member Function Documentation

InterfaceGlRef cinder::params::InterfaceGl::create ( const std::string &  title,
const ivec2 &  size,
const ColorA color = ColorA( 0.3f, 0.3f, 0.3f, 0.4f ) 
)
static

Creates and returns an InterfaceGl referenced by title and with size dimensions. Optionally takes color.

InterfaceGlRef cinder::params::InterfaceGl::create ( const cinder::app::WindowRef window,
const std::string &  title,
const ivec2 &  size,
const ColorA color = ColorA( 0.3f, 0.3f, 0.3f, 0.4f ) 
)
static

Creates and returns an InterfaceGl referenced by title that belongs to window, and with size dimensions. Optionally takes color.

void cinder::params::InterfaceGl::draw ( )

Draw the interface.

void cinder::params::InterfaceGl::show ( bool  visible = true)

Shows the interface. If visible is false, hides the interface.

void cinder::params::InterfaceGl::hide ( )

Hides the interface.

bool cinder::params::InterfaceGl::isVisible ( ) const

Returns whether the interface is visible or not.

See also
show(), hide().
void cinder::params::InterfaceGl::maximize ( bool  maximized = true)

Maximizes the interface, making it visible in its default presentation mode. If maximized is false, minimizes the interface.

See also
minimize()
void cinder::params::InterfaceGl::minimize ( )

Minimizes the interface face to the bottom left corner of the window.

bool cinder::params::InterfaceGl::isMaximized ( ) const

Returns whether the interface is maximized or not.

See also
maximize(), minimize()
ivec2 cinder::params::InterfaceGl::getPosition ( ) const

Gets the position of this interface instance.

void cinder::params::InterfaceGl::setPosition ( const ci::ivec2 &  pos)

Sets the position of this interface instance.

int cinder::params::InterfaceGl::getWidth ( ) const

Gets the width of this interface instance.

int cinder::params::InterfaceGl::getHeight ( ) const

Gets the height of this interface instance.

ivec2 cinder::params::InterfaceGl::getSize ( ) const

Gets the size of this interface instance.

void cinder::params::InterfaceGl::setSize ( const ci::ivec2 &  size)

Sets the size of this interface instance.

template<typename T >
Options<T> cinder::params::InterfaceGl::addParam ( const std::string &  name,
T *  target,
bool  readOnly = false 
)

Adds target as a param to the interface, referring to it with name.

Returns
Options<T> for chaining options to the param.
template<typename T >
InterfaceGl::Options< T > cinder::params::InterfaceGl::addParam ( const std::string &  name,
const std::function< void(T)> &  setterFn,
const std::function< T()> &  getterFn 
)

Adds a param to the interface with no target, but is instead accessed with setterFn and getterFn.

Returns
Options<T> for chaining options to the param.
InterfaceGl::Options< int > cinder::params::InterfaceGl::addParam ( const std::string &  name,
const std::vector< std::string > &  enumNames,
int *  param,
bool  readOnly = false 
)

Adds enumerated parameter. The value corresponds to the indices of enumNames.

InterfaceGl::Options< int > cinder::params::InterfaceGl::addParam ( const std::string &  name,
const std::vector< std::string > &  enumNames,
const std::function< void(int)> &  setterFn,
const std::function< int()> &  getterFn 
)

Adds an enumerated param to the interface with no target, but is instead accessed with setterFn and getterFn. The input parameter of setterFn and the return value of getterFn correspond to the indices of enumNames.

Returns
Options<T> for chaining options to the param.
void cinder::params::InterfaceGl::addSeparator ( const std::string &  name = "",
const std::string &  optionsStr = "" 
)

Adds a separator to the interface.

void cinder::params::InterfaceGl::addText ( const std::string &  name = "",
const std::string &  optionsStr = "" 
)

Adds text to the interface.

void cinder::params::InterfaceGl::addButton ( const std::string &  name,
const std::function< void()> &  callback,
const std::string &  optionsStr = "" 
)

Adds a button that fires callback when clicked.

void cinder::params::InterfaceGl::removeParam ( const std::string &  name)

Removes the param referred to by name.

void cinder::params::InterfaceGl::setOptions ( const std::string &  name = "",
const std::string &  optionsStr = "" 
)

Sets runtime options on the param referred to by name.

void cinder::params::InterfaceGl::clear ( )

Removes all the variables, buttons and separators previously added.

void cinder::params::InterfaceGl::addParam ( const std::string &  name,
bool *  boolParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
bool *  boolParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
float *  floatParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
float *  floatParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
double *  doubleParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
double *  doubleParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
int32_t *  intParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
int32_t *  intParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
vec3 *  vectorParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
vec3 *  vectorParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
quat *  quatParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
quat *  quatParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
Color colorParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
Color colorParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
ColorA colorParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
ColorA colorParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
std::string *  strParam,
const std::string &  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
std::string *  strParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
const std::vector< std::string > &  enumNames,
int *  param,
const std::string &  optionsStr,
bool  readOnly = false 
)
Deprecated:
use addParam() variant that returns Options<int> instead.
void cinder::params::InterfaceGl::addParam ( const std::string &  name,
const std::vector< std::string > &  enumNames,
int *  param,
const char *  optionsStr,
bool  readOnly = false 
)
Deprecated:
use addParam() variant that returns Options<int> instead.
void cinder::params::InterfaceGl::init ( app::WindowRef  window,
const std::string &  title,
const ivec2 &  size,
const ColorA  color 
)
protected
void cinder::params::InterfaceGl::implAddParamDeprecated ( const std::string &  name,
void *  param,
int  type,
const std::string &  optionsStr,
bool  readOnly 
)
protected
template<typename T >
InterfaceGl::Options< T > cinder::params::InterfaceGl::addParamImpl ( const std::string &  name,
T *  param,
int  type,
bool  readOnly 
)
protected
template<class T >
void cinder::params::InterfaceGl::addParamCallbackImpl ( const std::function< void(T)> &  setter,
const std::function< T()> &  getter,
const Options< T > &  options 
)
protected
template<typename T >
void cinder::params::InterfaceGl::addParamCallbackImpl ( const function< void(T)> &  setter,
const function< T()> &  getter,
const Options< T > &  options 
)
template<>
InterfaceGl::Options<bool> cinder::params::InterfaceGl::addParam ( const std::string &  name,
bool *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<char> cinder::params::InterfaceGl::addParam ( const std::string &  name,
char *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<int8_t> cinder::params::InterfaceGl::addParam ( const std::string &  name,
int8_t *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<uint8_t> cinder::params::InterfaceGl::addParam ( const std::string &  name,
uint8_t *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<int16_t> cinder::params::InterfaceGl::addParam ( const std::string &  name,
int16_t *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<uint16_t> cinder::params::InterfaceGl::addParam ( const std::string &  name,
uint16_t *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<int32_t> cinder::params::InterfaceGl::addParam ( const std::string &  name,
int32_t *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<uint32_t> cinder::params::InterfaceGl::addParam ( const std::string &  name,
uint32_t *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<float> cinder::params::InterfaceGl::addParam ( const std::string &  name,
float *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<double> cinder::params::InterfaceGl::addParam ( const std::string &  name,
double *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<string> cinder::params::InterfaceGl::addParam ( const std::string &  name,
string *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<Color> cinder::params::InterfaceGl::addParam ( const std::string &  name,
Color param,
bool  readOnly 
)
template<>
InterfaceGl::Options<ColorA> cinder::params::InterfaceGl::addParam ( const std::string &  name,
ColorA param,
bool  readOnly 
)
template<>
InterfaceGl::Options<quat> cinder::params::InterfaceGl::addParam ( const std::string &  name,
quat *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<dquat> cinder::params::InterfaceGl::addParam ( const std::string &  name,
dquat *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<vec3> cinder::params::InterfaceGl::addParam ( const std::string &  name,
vec3 *  param,
bool  readOnly 
)
template<>
InterfaceGl::Options<dvec3> cinder::params::InterfaceGl::addParam ( const std::string &  name,
dvec3 *  param,
bool  readOnly 
)

Member Data Documentation

std::weak_ptr<app::Window> cinder::params::InterfaceGl::mWindow
protected
std::shared_ptr<TwBar> cinder::params::InterfaceGl::mBar
protected
int cinder::params::InterfaceGl::mTwWindowId
protected
std::map<std::string, std::shared_ptr<void> > cinder::params::InterfaceGl::mStoredCallbacks
protected

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