gtkmm: Gtk::Constraint Class Reference

The description of a constraint. More...

#include <gtkmm/constraint.h>

Inheritance diagram for Gtk::Constraint:

Classes

class  Strength_Wrapper
 Wrapper for enum Strength. More...

 

Public Types

enum  Attribute {

  Attribute::NONE,

  Attribute::LEFT,

  Attribute::RIGHT,

  Attribute::TOP,

  Attribute::BOTTOM,

  Attribute::START,

  Attribute::END,

  Attribute::WIDTH,

  Attribute::HEIGHT,

  Attribute::CENTER_X,

  Attribute::CENTER_Y,

  Attribute::BASELINE

}
 The widget attributes that can be used when creating a Gtk::Constraint. More...

 
enum  Relation {

  Relation::LE = -1,

  Relation::EQ,

  Relation::GE

}
 The relation between two terms of a constraint. More...

 
using Strength = Strength_Wrapper::Strength
 Strength enumerators are scoped by the wrapper class and can be implicitly converted to int. More...

 
- Public Types inherited from Glib::Object
typedef void(*)(gpointer data DestroyNotify)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 

Public Member Functions

 Constraint (Constraint&& src) noexcept
 
Constraintoperator= (Constraint&& src) noexcept
 
 ~Constraint () noexcept override
 
GtkConstraint* gobj ()
 Provides access to the underlying C GObject. More...

 
const GtkConstraint* gobj () const
 Provides access to the underlying C GObject. More...

 
GtkConstraint* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
Glib::RefPtr< ConstraintTargetget_target ()
 Retrieves the Gtk::ConstraintTarget used as the target for constraint. More...

 
Glib::RefPtr< const ConstraintTargetget_target () const
 Retrieves the Gtk::ConstraintTarget used as the target for constraint. More...

 
Attribute get_target_attribute () const
 Retrieves the attribute of the target to be set by the constraint. More...

 
Glib::RefPtr< ConstraintTargetget_source ()
 Retrieves the Gtk::ConstraintTarget used as the source for constraint. More...

 
Glib::RefPtr< const ConstraintTargetget_source () const
 Retrieves the Gtk::ConstraintTarget used as the source for constraint. More...

 
Attribute get_source_attribute () const
 Retrieves the attribute of the source to be read by the constraint. More...

 
Relation get_relation () const
 The order relation between the terms of the constraint. More...

 
double get_multiplier () const
 Retrieves the multiplication factor applied to the source attribute's value. More...

 
double get_constant () const
 Retrieves the constant factor added to the source attributes' value. More...

 
int get_strength () const
 Retrieves the strength of the constraint. More...

 
bool is_required () const
 Checks whether the constraint is a required relation for solving the constraint layout. More...

 
bool is_attached () const
 Checks whether the constraint is attached to a Gtk::ConstraintLayout, and it is contributing to the layout. More...

 
bool is_constant () const
 Checks whether the constraint describes a relation between an attribute on the Gtk::Constraint::property_target() and a constant value. More...

 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ConstraintTarget > > property_target () const
 The target of the constraint. More...

 
Glib::PropertyProxy_ReadOnly< Attributeproperty_target_attribute () const
 The attribute of the Gtk::Constraint::property_target() set by the constraint. More...

 
Glib::PropertyProxy_ReadOnly< Relationproperty_relation () const
 The order relation between the terms of the constraint. More...

 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ConstraintTarget > > property_source () const
 The source of the constraint. More...

 
Glib::PropertyProxy_ReadOnly< Attributeproperty_source_attribute () const
 The attribute of the Gtk::Constraint::property_source() read by the constraint. More...

 
Glib::PropertyProxy_ReadOnly< double > property_multiplier () const
 The multiplication factor to be applied to the Gtk::Constraint::property_source_attribute(). More...

 
Glib::PropertyProxy_ReadOnly< double > property_constant () const
 The constant value to be added to the Gtk::Constraint::property_source_attribute(). More...

 
Glib::PropertyProxy_ReadOnly< int > property_strength () const
 The strength of the constraint. More...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

 
static Glib::RefPtr< Constraintcreate (const Glib::RefPtr< ConstraintTarget >& target, Attribute target_attribute, Relation relation, const Glib::RefPtr< ConstraintTarget >& source, Attribute source_attribute, double multiplier, double constant, int strength)
 Creates a new Gtk::Constraint representing a relation between a layout attribute on a source and a layout attribute on a target. More...

 
static Glib::RefPtr< Constraintcreate (const Glib::RefPtr< ConstraintTarget >& target, Attribute target_attribute, Relation relation, double constant, int strength)
 Creates a new Gtk::Constraint representing a relation between a layout attribute on a target and a constant value. More...

 

Protected Member Functions

 Constraint (const Glib::RefPtr< ConstraintTarget >& target, Attribute target_attribute, Relation relation, const Glib::RefPtr< ConstraintTarget >& source, Attribute source_attribute, double multiplier, double constant, int strength)
 
 Constraint (const Glib::RefPtr< ConstraintTarget >& target, Attribute target_attribute, Relation relation, double constant, int strength)
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
 ~Object () noexcept override
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::Constraintwrap (GtkConstraint* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Detailed Description

The description of a constraint.

Gtk::Constraint describes a constraint between an attribute on a widget and another attribute on another widget, expressed as a linear equation like:

target.attr1 = source.attr2 × multiplier + constant

Each Constraint is part of a system that will be solved by a Gtk::ConstraintLayout in order to allocate and position each child widget.

A Constraint is immutable once it's created.

Since gtkmm 3.96:

Constructor & Destructor Documentation

Gtk::Constraint::Constraint ( Constraint&&  src)
noexcept
Gtk::Constraint::~Constraint ( )
overridenoexcept
Gtk::Constraint::Constraint ( const Glib::RefPtr< ConstraintTarget >&  target,
Attribute  target_attribute,
Relation  relation,
const Glib::RefPtr< ConstraintTarget >&  source,
Attribute  source_attribute,
double  multiplier,
double  constant,
int  strength 
)
explicitprotected
Gtk::Constraint::Constraint ( const Glib::RefPtr< ConstraintTarget >&  target,
Attribute  target_attribute,
Relation  relation,
double  constant,
int  strength 
)
explicitprotected

Member Function Documentation

static Glib::RefPtr<Constraint> Gtk::Constraint::create ( const Glib::RefPtr< ConstraintTarget >&  target,
Attribute  target_attribute,
Relation  relation,
const Glib::RefPtr< ConstraintTarget >&  source,
Attribute  source_attribute,
double  multiplier,
double  constant,
int  strength 
)
static

Creates a new Gtk::Constraint representing a relation between a layout attribute on a source and a layout attribute on a target.

Parameters
targetA Gtk::ConstraintTarget or an empty Glib::RefPtr.
target_attributeThe attribute of target to be set.
relationThe relation equivalence between target_attribute and source_attribute.
sourceA Gtk::ConstraintTarget or an empty Glib::RefPtr.
source_attributeThe attribute of source to be read.
multiplierA multiplication factor to be applied to source_attribute.
constantA constant to be added to source_attribute.
strengthThe strength of the constraint.
Returns
The newly created Gtk::Constraint.
static Glib::RefPtr<Constraint> Gtk::Constraint::create ( const Glib::RefPtr< ConstraintTarget >&  target,
Attribute  target_attribute,
Relation  relation,
double  constant,
int  strength 
)
static

Creates a new Gtk::Constraint representing a relation between a layout attribute on a target and a constant value.

Parameters
targetA Gtk::ConstraintTarget or an empty Glib::RefPtr.
target_attributeThe attribute of target to be set.
relationThe relation equivalence between target_attribute and constant.
constantA constant to be set on target_attribute.
strengthThe strength of the constraint.
Returns
The newly created Gtk::Constraint.
double Gtk::Constraint::get_constant ( ) const

Retrieves the constant factor added to the source attributes' value.

Returns
A constant factor.
double Gtk::Constraint::get_multiplier ( ) const

Retrieves the multiplication factor applied to the source attribute's value.

Returns
A multiplication factor.
Relation Gtk::Constraint::get_relation ( ) const

The order relation between the terms of the constraint.

Returns
A Gtk::ConstraintRelation value.
Glib::RefPtr<ConstraintTarget> Gtk::Constraint::get_source ( )

Retrieves the Gtk::ConstraintTarget used as the source for constraint.

If the Gtk::Constraint::property_source() property is set to nullptr, the constraint will use the Gtk::ConstraintLayout's widget.

Returns
A Gtk::ConstraintTarget.
Glib::RefPtr<const ConstraintTarget> Gtk::Constraint::get_source ( ) const

Retrieves the Gtk::ConstraintTarget used as the source for constraint.

If the Gtk::Constraint::property_source() property is set to nullptr, the constraint will use the Gtk::ConstraintLayout's widget.

Returns
A Gtk::ConstraintTarget.
Attribute Gtk::Constraint::get_source_attribute ( ) const

Retrieves the attribute of the source to be read by the constraint.

Returns
The target's attribute.
int Gtk::Constraint::get_strength ( ) const

Retrieves the strength of the constraint.

Returns
The strength of the constraint.
Glib::RefPtr<ConstraintTarget> Gtk::Constraint::get_target ( )

Retrieves the Gtk::ConstraintTarget used as the target for constraint.

If the Gtk::Constraint::property_target() property is set to nullptr, the constraint will use the Gtk::ConstraintLayout's widget.

Returns
A Gtk::ConstraintTarget.
Glib::RefPtr<const ConstraintTarget> Gtk::Constraint::get_target ( ) const

Retrieves the Gtk::ConstraintTarget used as the target for constraint.

If the Gtk::Constraint::property_target() property is set to nullptr, the constraint will use the Gtk::ConstraintLayout's widget.

Returns
A Gtk::ConstraintTarget.
Attribute Gtk::Constraint::get_target_attribute ( ) const

Retrieves the attribute of the target to be set by the constraint.

Returns
The target's attribute.
static GType Gtk::Constraint::get_type ( )
static

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

GtkConstraint* Gtk::Constraint::gobj ( )
inline

Provides access to the underlying C GObject.

const GtkConstraint* Gtk::Constraint::gobj ( ) const
inline

Provides access to the underlying C GObject.

GtkConstraint* Gtk::Constraint::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gtk::Constraint::is_attached ( ) const

Checks whether the constraint is attached to a Gtk::ConstraintLayout, and it is contributing to the layout.

Returns
true if the constraint is attached.
bool Gtk::Constraint::is_constant ( ) const

Checks whether the constraint describes a relation between an attribute on the Gtk::Constraint::property_target() and a constant value.

Returns
true if the constraint is a constant relation.
bool Gtk::Constraint::is_required ( ) const

Checks whether the constraint is a required relation for solving the constraint layout.

Returns
true if the constraint is required.
Constraint& Gtk::Constraint::operator= ( Constraint&&  src)
noexcept
Glib::PropertyProxy_ReadOnly< double > Gtk::Constraint::property_constant ( ) const

The constant value to be added to the Gtk::Constraint::property_source_attribute().

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< double > Gtk::Constraint::property_multiplier ( ) const

The multiplication factor to be applied to the Gtk::Constraint::property_source_attribute().

Default value: 1

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Relation > Gtk::Constraint::property_relation ( ) const

The order relation between the terms of the constraint.

Default value: Gtk::Constraint::Relation::EQ

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<ConstraintTarget> > Gtk::Constraint::property_source ( ) const

The source of the constraint.

The constraint will set the Gtk::Constraint::property_target_attribute() of the target using the Gtk::Constraint::property_source_attribute() of the source.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Attribute > Gtk::Constraint::property_source_attribute ( ) const

The attribute of the Gtk::Constraint::property_source() read by the constraint.

Default value: Gtk::Constraint::Attribute::NONE

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< int > Gtk::Constraint::property_strength ( ) const

The strength of the constraint.

The strength can be expressed either using one of the symbolic values of the Gtk::ConstraintStrength enumeration, or any positive integer value.

Default value: 1001001000

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<ConstraintTarget> > Gtk::Constraint::property_target ( ) const

The target of the constraint.

The constraint will set the Gtk::Constraint::property_target_attribute() of the target using the Gtk::Constraint::property_source_attribute() of the source widget.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Attribute > Gtk::Constraint::property_target_attribute ( ) const

The attribute of the Gtk::Constraint::property_target() set by the constraint.

Default value: Gtk::Constraint::Attribute::NONE

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Friends And Related Function Documentation

Glib::RefPtr< Gtk::Constraint > wrap ( GtkConstraint *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.