gtkmm: Gtk::ClosureExpression< T > Class Template Reference

gtkmm 4.18.0

Static Public Member Functions | List of all members
Gtk::ClosureExpression< T > Class Template Referencefinal

`#include <gtkmm/expression.h>`

Inheritance diagram for Gtk::ClosureExpression< T >:
[legend]

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
template<class S, class... ATs>
static Glib::RefPtr< ClosureExpression< T > > | create (S slot, const Glib::RefPtr< ATs > &... params)
| Creates a Gtk::Expression that calls slot when it is evaluated.

## Additional Inherited Members
Public Types inherited from Gtk::Expression< T >
using | ValueType = T
Public Types inherited from Gtk::ExpressionBase
using | SlotNotify = sigc::slot<void()>
| For instance: void on_notify();.
Public Member Functions inherited from Gtk::Expression< T >
std::optional< T > | evaluate (const Glib::RefPtr< Glib::ObjectBase > & this_)
| Evaluates the given expression and on success returns the result.
Glib::RefPtr< ExpressionWatch< T > > | watch (const Glib::RefPtr< Glib::ObjectBase > & this_, const SlotNotify & notify)
| Installs a watch for the expression that calls the notify function whenever the evaluation of the expression may have changed.
template<class T2>
Glib::RefPtr< ExpressionWatch< T > > | bind (const Glib::PropertyProxy< T2 > & property, const Glib::RefPtr< Glib::ObjectBase > & this_=nullptr)
| Bind a target's property to the expression.
template<class T2>
Glib::RefPtr< ExpressionWatch< T > > | bind (const Glib::PropertyProxy_WriteOnly< T2 > & property, const Glib::RefPtr< Glib::ObjectBase > & this_=nullptr)
| Bind a target's property to the expression.
Public Member Functions inherited from Gtk::ExpressionBase
void | reference () const
| Increment the reference count for this object.
void | unreference () const
| Decrement the reference count for this object.
GtkExpression * | gobj ()
| Provides access to the underlying C instance.
const GtkExpression * | gobj () const
| Provides access to the underlying C instance.
GtkExpression * | gobj_copy () const
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
| ExpressionBase ()=delete
| ExpressionBase (const ExpressionBase &)=delete
ExpressionBase & | operator= (const ExpressionBase &)=delete
GType | get_value_type () const
| Gets the `GType` that this expression evaluates to.
bool | is_static () const
| Checks if the expression is static.
Protected Member Functions inherited from Gtk::ExpressionBase
void | operator delete (void *, std::size_t)
Related Symbols inherited from Gtk::ExpressionBase
Glib::RefPtr< Gtk::ExpressionBase > | wrap (GtkExpression * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Member Function Documentation

## ◆ create()

template <class T>
template <class S, class... ATs>

static Glib::RefPtr< ClosureExpression< T > > Gtk::ClosureExpression< T >::create | ( | S | slot,
|  | const Glib::RefPtr< ATs > &... | params )
| static

Creates a Gtk::Expression that calls slot when it is evaluated.

slot is called with the this object and the results of evaluating the params expressions.

Example:

Glib::ustring get_string(Glib::RefPtr<Glib::ObjectBase> this_, double a, int b)
{
return Glib::ustring::sprintf("a is %f, b is %d", a, b);
}
Glib::RefPtr<Gtk::Expression<double>> expr1 = ...
Glib::RefPtr<Gtk::Expression<int>> expr2 = ...
Glib::RefPtr<Gtk::Expression<Glib::ustring>> expr3 =
Gtk::ClosureExpression<Glib::ustring>::create(
sigc::ptr_fun(get_string), expr1, expr2);
Glib::ustring
Glib::ustring::sprintf
static ustring sprintf(const ustring &fmt, const Ts &... args)
Gtk::ClosureExpression::create
static Glib::RefPtr< ClosureExpression< T > > create(S slot, const Glib::RefPtr< ATs > &... params)
Creates a Gtk::Expression that calls slot when it is evaluated.
Gtk::Expression
Expressions to values.
Definition expression.h:173
Glib::RefPtr
std::shared_ptr< T_CppObject > RefPtr
sigc::ptr_fun
decltype(auto) ptr_fun(T_return(*func)(T_args...))

Parameters

  slot | Slot to call when evaluating this expression.
  params | Expressions for each parameter.

Returns
  A new Gtk::Expression.

## ◆ get_type()

template <class T>

static GType Gtk::ClosureExpression< T >::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.