Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cinder::params::InterfaceGl Class Reference

Interface for adding params to your window. Wraps AntTweakBar. More...

#include <Params.h>

Classes

class  Options
 Provides chainable options, returned from addParam(). More...
 
class  OptionsBase
 Base class for chainable options. More...
 

Public Member Functions

 InterfaceGl ()
 
 InterfaceGl (const std::string &title, const Vec2i &size, const ColorA &color=ColorA(0.3f, 0.3f, 0.3f, 0.4f))
 
 InterfaceGl (const cinder::app::WindowRef &window, const std::string &title, const Vec2i &size, const ColorA &color=ColorA(0.3f, 0.3f, 0.3f, 0.4f))
 
void draw ()
 Draw the interface. More...
 
void show (bool visible=true)
 Shows the interface. If visible is false, hides the interface. More...
 
void hide ()
 Hides the interface. More...
 
bool isVisible () const
 Returns whether the interface is visible or not. More...
 
void maximize (bool maximized=true)
 Maximizes the interface, making it visible in its default presentation mode. If maximized is false, minimizes the interface. More...
 
void minimize ()
 Minimizes the interface face to the bottom left corner of the window. More...
 
bool isMaximized () const
 Returns whether the interface is maximized or not. More...
 
void setPosition (const ci::Vec2i &pos)
 Sets the position of this interface instance. More...
 
template<typename T >
Options< T > addParam (const std::string &name, T *target, bool readOnly=false)
 Adds target as a param to the interface, referring to it with name. More...
 
template<typename T >
Options< T > 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. More...
 
void addParam (const std::string &name, const std::vector< std::string > &enumNames, int *param, const std::string &optionsStr="", bool readOnly=false)
 Adds enumerated parameter. The value corresponds to the indices of enumNames. More...
 
void addSeparator (const std::string &name="", const std::string &optionsStr="")
 Adds a separator to the interface. More...
 
void addText (const std::string &name="", const std::string &optionsStr="")
 Adds text to the interface. More...
 
void addButton (const std::string &name, const std::function< void()> &callback, const std::string &optionsStr="")
 Adds a button that fires callback when clicked. More...
 
void removeParam (const std::string &name)
 Removes the param referred to by name. More...
 
void setOptions (const std::string &name="", const std::string &optionsStr="")
 Sets runtime options on the param referred to by name. More...
 
void clear ()
 Removes all the variables, buttons and separators previously added. More...
 
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, Vec3f *vectorParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, Vec3f *vectorParam, const char *optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, Quatf *quatParam, const std::string &optionsStr, bool readOnly=false)
 
void addParam (const std::string &name, Quatf *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)
 
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< stringaddParam (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< QuatfaddParam (const std::string &name, Quatf *param, bool readOnly)
 
template<>
InterfaceGl::Options< QuatdaddParam (const std::string &name, Quatd *param, bool readOnly)
 
template<>
InterfaceGl::Options< Vec3faddParam (const std::string &name, Vec3f *param, bool readOnly)
 
template<>
InterfaceGl::Options< Vec3daddParam (const std::string &name, Vec3d *param, bool readOnly)
 

Static Public Member Functions

static InterfaceGlRef create (const std::string &title, const Vec2i &size, const ColorA &color=ColorA(0.3f, 0.3f, 0.3f, 0.4f))
 Creates and returns an InterfaceGl referenced by title and with size dimensions. Optionally takes color. More...
 
static InterfaceGlRef create (const cinder::app::WindowRef &window, const std::string &title, const Vec2i &size, const ColorA &color=ColorA(0.3f, 0.3f, 0.3f, 0.4f))
 Creates and returns an InterfaceGl referenced by title that belongs to window, and with size dimensions. Optionally takes color. More...
 

Protected Member Functions

void init (app::WindowRef window, const std::string &title, const Vec2i &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 Vec2i 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 Vec2i 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 Vec2i 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 Vec2i 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()
void cinder::params::InterfaceGl::setPosition ( const ci::Vec2i pos)

Sets the position 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.
void cinder::params::InterfaceGl::addParam ( const std::string name,
const std::vector< std::string > &  enumNames,
int param,
const std::string optionsStr = "",
bool  readOnly = false 
)

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

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,
Vec3f vectorParam,
const std::string optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string name,
Vec3f vectorParam,
const char *  optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string name,
Quatf quatParam,
const std::string optionsStr,
bool  readOnly = false 
)
void cinder::params::InterfaceGl::addParam ( const std::string name,
Quatf 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::init ( app::WindowRef  window,
const std::string title,
const Vec2i 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<Quatf> cinder::params::InterfaceGl::addParam ( const std::string name,
Quatf param,
bool  readOnly 
)
template<>
InterfaceGl::Options<Quatd> cinder::params::InterfaceGl::addParam ( const std::string name,
Quatd param,
bool  readOnly 
)
template<>
InterfaceGl::Options<Vec3f> cinder::params::InterfaceGl::addParam ( const std::string name,
Vec3f param,
bool  readOnly 
)
template<>
InterfaceGl::Options<Vec3d> cinder::params::InterfaceGl::addParam ( const std::string name,
Vec3d 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: