efl/src/lib/elementary/efl_ui_view_model.eo

145 lines
6.1 KiB
Plaintext

function @beta EflUiViewModelPropertyGet {
[[Function called when a property is get.]]
params {
@in view_model: const(Efl.Ui.View_Model); [[The ViewModel object the @.property.get is issued on.]]
@in property: stringshare; [[The property name the @.property.get is issued on.]]
}
return: any_value_ref; [[The property value.]]
};
function @beta EflUiViewModelPropertySet {
[[Function called when a property is set.]]
params {
@in view_model: Efl.Ui.View_Model; [[The ViewModel object the @.property.set is issued on.]]
@in property: stringshare; [[The property name the @.property.set is issued on.]]
@in value: any_value_ref @move; [[The new value to set.]]
}
return: future<any_value_ref>; [[The value that was finally set.]]
};
class Efl.Ui.View_Model extends Efl.Composite_Model
{
[[Efl model providing helpers for custom properties used when linking a model to a view and you need to
generate/adapt values for display.
There is two ways to use this class, you can either inherit from it and have a custom constructor for example.
Or you can just instantiate it and manually define your property on it via callbacks.
@since 1.23
]]
methods {
property_string_add {
[[Adds a synthetic string property, generated from a $definition string and other properties in the model.
The $definition string, similar to how $printf works, contains ${} placeholders that are replaced by the
actual value of the property inside the placeholder tags when the synthetic property is retrieved.
For example, a numeric property $length might be strange to use as a label, since it will only display a
number. However, a synthetic string can be generated with the definition "Length ${length}." which renders
more nicely and does not require any more code by the user of the property.
$not_ready and $on_error strings can be given to be used when the data is not ready or there is some error,
respectively. These strings do accept placeholder tags.
See @.property_string_del
]]
params {
name: string; [[The name for the new synthetic property.]]
definition: string; [[The definition string for the new synthetic property.]]
not_ready: string; [[The text to be used if any of the properties used in $definition is not ready yet.
If set to $null, no check against EAGAIN will be done.]]
on_error: string; [[The text to be used if any of the properties used in $definition is in error. It takes
precedence over $not_ready. If set to $null, no error checks are performed.]]
}
return: Eina.Error;
}
property_string_del {
[[Delete a synthetic property previously defined by @.property_string_add.
See @.property_string_add
]]
params {
name: string; [[The name of the synthetic property to delete.]]
}
return: Eina.Error;
}
property_logic_add @beta {
[[Add callbacks that will be triggered when someone ask for the specified property name when getting or
setting a property.
A get or set should at least be provided for this call to succeed.
See @.property_logic_del
]]
params {
property: string; [[The property to bind on to.]]
get: EflUiViewModelPropertyGet; [[Define the get callback called when the @Efl.Model.property.get is called
with the above property name.]]
set: EflUiViewModelPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called
with the above property name.]]
bound: iterator<string> @move; [[Iterator of property name to bind with this defined property see
@.property_bind.]]
}
return: Eina.Error;
}
property_logic_del @beta {
[[Delete previously added callbacks that were triggered when someone asked for the specified property name
when getting or setting a property.
A get or set should at least be provided for this call to succeed.
See @.property_logic_add
]]
params {
property: string; [[The property to bind on to.]]
}
return: Eina.Error;
}
property_bind {
[[Automatically update the field for the event @[Efl.Model.properties,changed] to include property
that are impacted with change in a property from the composited model.
The source doesn't have to be provided at this point by the composited model.
]]
params {
@in source: string; [[Property name in the composited model.]]
@in destination: string; [[Property name in the @Efl.Ui.View_Model]]
}
}
property_unbind {
[[Stop automatically updating the field for the event @[Efl.Model.properties,changed] to
include property that are impacted with change in a property from the
composited model.
]]
params {
@in source: string; [[Property name in the composited model.]]
@in destination: string; [[Property name in the @Efl.Ui.View_Model]]
}
}
@property children_bind {
[[Define if we will intercept all children object reference and
bind them through the ViewModel with the same property logic as this
one. Be careful of recursivity.
This can only be applied at construction time.]]
get {
}
set {
}
values {
enable: bool; [[Do you automatically bind children. Default to true.]]
}
}
}
implements {
Efl.Object.constructor;
Efl.Object.finalize;
Efl.Object.destructor;
Efl.Model.children_slice_get;
Efl.Model.properties { get; }
Efl.Model.property { set; get; }
}
constructors {
Efl.Ui.View_Model.children_bind @optional;
}
}