Class Efl.Ui.Widget
Base class for all Efl.Ui.* widgets The class here is designed in a way that widgets can be expressed as a tree. The parent relation in the tree can be fetched via Efl.Ui.Widget.WidgetParent . The parent relation should never be modified directly, instead you should use the APIs of the widgets (Typically Efl.IPackLinear, Efl.IPackTable or Efl.IContent).
Properties implemented here should be treated with extra care, some are defined for the sub-tree, others are defined for the widget itself, additional information for this can be fetched from the documentation in the implements section. (Since EFL 1.22)
Inheritance
Syntax
public abstract class Widget : Group, IPointer, IColor, IEntity, IHint, IMapping, IStack, IInterface, IPart, IPropertyBind, IView, IObject, IWrapper, IDisposable
Constructors
Widget(EoWrapper.ConstructingHandle)
Subclasses should override this constructor if they are expected to be instantiated from native code. Do not call this constructor directly.
Declaration
protected Widget(EoWrapper.ConstructingHandle ch)
Parameters
Type | Name | Description |
---|---|---|
Efl.Eo.EoWrapper.ConstructingHandle | ch | Tag struct storing the native handle of the object being constructed. |
Widget(Object, String)
Initializes a new instance of the Efl.Ui.Widget class.
Declaration
public Widget(Object parent, string style = null)
Parameters
Type | Name | Description |
---|---|---|
Efl.Object | parent | Parent instance. |
System.String | style | The widget style to use. See Efl.Ui.Widget.SetStyle(System.String) |
Widget(IntPtr, Object)
Initializes a new instance of the Efl.Ui.Widget class. Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.
Declaration
protected Widget(IntPtr baseKlass, Object parent)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | baseKlass | The pointer to the base native Eo class. |
Efl.Object | parent | The Efl.Object parent of this instance. |
Properties
BackgroundPart
Declaration
public WidgetPartBg BackgroundPart { get; }
Property Value
Type | Description |
---|---|
Efl.Ui.WidgetPartBg |
ChildFocus
Indicates if a child of this object has focus set to true. (Since EFL 1.22)
Declaration
protected bool ChildFocus { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Disabled
Whether the widget is enabled (accepts and reacts to user inputs).
Each widget may handle the disabled state differently, but overall disabled widgets shall not respond to any input events. This is false
by default, meaning the widget is enabled.
(Since EFL 1.22)
Declaration
public bool Disabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Focus
Whether the widget is currently focused or not. (Since EFL 1.22)
Declaration
public bool Focus { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean | The focused state of the object. |
FocusAllow
The ability for a widget to be focused. Unfocusable objects do nothing when programmatically focused. The nearest focusable parent object the one really getting focus. Also, when they receive mouse input, they will get the event, but not take away the focus from where it was previously.
Note: Objects which are meant to be interacted with by input events are created able to be focused, by default. All the others are not.
This property's default value depends on the widget (e.g. a box is not focusable, but a button is). (Since EFL 1.22)
Declaration
public bool FocusAllow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Whether the object is focusable. |
FocusGeometry
The geometry (that is, the bounding rectangle) used to calculate the relationship with other objects. (Since EFL 1.22)
Declaration
public Rect FocusGeometry { get; }
Property Value
Type | Description |
---|---|
Eina.Rect | The geometry to use. |
FocusHighlightGeometry
The rectangle region to be highlighted on focus. This is a rectangle region where the focus highlight should be displayed. (Since EFL 1.22)
Declaration
protected Rect FocusHighlightGeometry { get; }
Property Value
Type | Description |
---|---|
Eina.Rect | The rectangle area. |
FocusManager
This is the focus manager where this focus object is registered in. The element which is the root
of an Efl.Ui.Focus.IManager will not have this focus manager as this object, but rather the focus manager where that is registered in.
(Since EFL 1.22)
Declaration
public IManager FocusManager { get; }
Property Value
Type | Description |
---|---|
Efl.Ui.Focus.IManager | The manager object. |
FocusParent
The logical parent used by this object. (Since EFL 1.22)
Declaration
public IObject FocusParent { get; }
Property Value
Type | Description |
---|---|
Efl.Ui.Focus.IObject | The focus parent. |
InterestRegion
Region of interest inside this widget, that should be given priority to be visible inside a scroller. When this widget or one of its subwidgets is given focus, this region should be shown, which means any parent scroller should attempt to display the given area of this widget. For instance, an entry given focus should scroll to show the text cursor if that cursor moves. In this example, this region defines the relative geometry of the cursor within the widget.
Note: The region is relative to the top-left corner of the widget, i.e. X,Y start from 0,0 to indicate the top-left corner of the widget. W,H must be greater or equal to 1 for this region to be taken into account, otherwise it is ignored. (Since EFL 1.22)
Declaration
protected Rect InterestRegion { get; }
Property Value
Type | Description |
---|---|
Eina.Rect | The relative region to show. If width or height is <= 0 it will be ignored, and no action will be taken. |
Model
Model that is/will be
Declaration
public IModel Model { get; set; }
Property Value
Type | Description |
---|---|
Efl.IModel | Efl model |
ResizeObject
This is the internal canvas object managed by a widget. This property is protected as it is meant for widget implementations only, to set and access the internal canvas object. Do use this function unless you're implementing a widget. (Since EFL 1.22)
Declaration
protected Object ResizeObject { set; }
Property Value
Type | Description |
---|---|
Efl.Canvas.Object | A canvas object (often a Efl.Canvas.Layout (object still in beta stage) object). |
ShadowPart
Declaration
public WidgetPartShadow ShadowPart { get; }
Property Value
Type | Description |
---|---|
Efl.Ui.WidgetPartShadow |
Style
The widget style to use. Styles define different look and feel for widgets, and may provide different parts for layout-based widgets. Styles vary from widget to widget and may be defined by other themes by means of extensions and overlays.
The style can only be set before Efl.Object.FinalizeAdd(), which means at construction time of the object (inside efl_add
in C).
(Since EFL 1.22)
Declaration
public string Style { get; set; }
Property Value
Type | Description |
---|---|
System.String | Name of the style to use. Refer to each widget's documentation for the available style names, or to the themes in use. |
WidgetParent
The internal parent of this widget. Efl.Ui.Widget objects have a parent hierarchy that may differ slightly from their Efl.Object or Efl.Canvas.Object hierarchy. This is meant for internal handling. (Since EFL 1.22)
Declaration
protected Widget WidgetParent { get; set; }
Property Value
Type | Description |
---|---|
Efl.Ui.Widget | Widget parent object |
Methods
AddWidgetSubObject(Object)
Virtual function customizing sub objects being added. When a widget is added as a sub-object of another widget (like list elements inside a list container, for example) some of its properties are automatically adapted to the parent's current values (like focus, access, theme, scale, mirror, scrollable child get, translate, display mode set, tree dump). Override this method if you want to customize differently sub-objects being added to this object.
Sub objects can be any canvas object, not necessarily widgets.
See also Efl.Ui.Widget.WidgetParent. (Since EFL 1.22)
Declaration
protected virtual bool AddWidgetSubObject(Object sub_obj)
Parameters
Type | Name | Description |
---|---|---|
Efl.Canvas.Object | sub_obj | Sub object to be added. Not necessarily a widget itself. |
Returns
Type | Description |
---|---|
System.Boolean | Indicates if the operation succeeded. |
ApplyFocusState(WidgetFocusState, ref WidgetFocusState, Widget)
Apply a new focus state on the widget.
This method is called internally by Efl.Ui.Widget. Override it to change how a widget interacts with its focus manager. If a widget desires to change the applied configuration, it has to modify configured_state
in addition to any internal changes.
The default implementation (when this method is not overridden) applies configured_state
using the manager
contained inside.
(Since EFL 1.22)
Declaration
protected virtual bool ApplyFocusState(WidgetFocusState current_state, ref WidgetFocusState configured_state, Widget redirect)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.WidgetFocusState | current_state | The current focus configuration of the widget. |
Efl.Ui.WidgetFocusState | configured_state | The new configuration being set on the widget. |
Efl.Ui.Widget | redirect | A redirect object if there is any |
Returns
Type | Description |
---|---|
System.Boolean | Returns |
ApplyTheme()
Virtual function called when the widget needs to re-apply its theme. This may be called when the object is first created, or whenever the widget is modified in any way that may require a reload of the theme. This may include but is not limited to scale, theme, or mirrored mode changes.
Note: even widgets not based on layouts may override this method to handle widget updates (scale, mirrored mode, etc...). (Since EFL 1.22)
Declaration
protected virtual Error ApplyTheme()
Returns
Type | Description |
---|---|
Eina.Error | Indicates success, and if the current theme or default theme was used. |
BindProperty(String, String)
bind property data with the given key string. when the data is ready or changed, bind the data to the key action and process promised work.
Declaration
public virtual Error BindProperty(string key, string property)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | key string for bind model property data |
System.String | property | Model property name |
Returns
Type | Description |
---|---|
Eina.Error | 0 when it succeed, an error code otherwise. |
DelWidgetSubObject(Object)
Virtual function customizing sub objects being removed. When a widget is removed as a sub-object from another widget (Efl.IPack.Unpack(Efl.Gfx.IEntity), Efl.IContent.UnsetContent(), for example) some of its properties are automatically adjusted.(like focus, access, tree dump) Override this method if you want to customize differently sub-objects being removed to this object.
Sub objects can be any canvas object, not necessarily widgets.
See also Efl.Ui.Widget.WidgetParent and Efl.Ui.Widget.AddWidgetSubObject(Efl.Canvas.Object). (Since EFL 1.22)
Declaration
protected virtual bool DelWidgetSubObject(Object sub_obj)
Parameters
Type | Name | Description |
---|---|---|
Efl.Canvas.Object | sub_obj | Sub object to be removed. Should be a child of this widget. |
Returns
Type | Description |
---|---|
System.Boolean | Indicates if the operation succeeded. |
GetChildFocus()
Indicates if a child of this object has focus set to true. (Since EFL 1.22)
Declaration
protected virtual bool GetChildFocus()
Returns
Type | Description |
---|---|
System.Boolean |
|
GetDisabled()
Returns whether the widget is disabled.
This will return true
if any widget in the parent hierarchy is disabled. Re-enabling that parent may in turn change the disabled state of this widget.
(Since EFL 1.22)
Declaration
public virtual bool GetDisabled()
Returns
Type | Description |
---|---|
System.Boolean |
|
GetFocus()
Whether the widget is currently focused or not. (Since EFL 1.22)
Declaration
public virtual bool GetFocus()
Returns
Type | Description |
---|---|
System.Boolean | The focused state of the object. |
GetFocusAllow()
The ability for a widget to be focused. Unfocusable objects do nothing when programmatically focused. The nearest focusable parent object the one really getting focus. Also, when they receive mouse input, they will get the event, but not take away the focus from where it was previously.
Note: Objects which are meant to be interacted with by input events are created able to be focused, by default. All the others are not.
This property's default value depends on the widget (e.g. a box is not focusable, but a button is). (Since EFL 1.22)
Declaration
public virtual bool GetFocusAllow()
Returns
Type | Description |
---|---|
System.Boolean | Whether the object is focusable. |
GetFocusGeometry()
The geometry (that is, the bounding rectangle) used to calculate the relationship with other objects. (Since EFL 1.22)
Declaration
public virtual Rect GetFocusGeometry()
Returns
Type | Description |
---|---|
Eina.Rect | The geometry to use. |
GetFocusHighlightGeometry()
This is a read-only property. (Since EFL 1.22)
Declaration
protected virtual Rect GetFocusHighlightGeometry()
Returns
Type | Description |
---|---|
Eina.Rect | The rectangle area. |
GetFocusManager()
This is the focus manager where this focus object is registered in. The element which is the root
of an Efl.Ui.Focus.IManager will not have this focus manager as this object, but rather the focus manager where that is registered in.
(Since EFL 1.22)
Declaration
public virtual IManager GetFocusManager()
Returns
Type | Description |
---|---|
Efl.Ui.Focus.IManager | The manager object. |
GetFocusParent()
The logical parent used by this object. (Since EFL 1.22)
Declaration
public virtual IObject GetFocusParent()
Returns
Type | Description |
---|---|
Efl.Ui.Focus.IObject | The focus parent. |
GetInterestRegion()
Region of interest inside this widget, that should be given priority to be visible inside a scroller. When this widget or one of its subwidgets is given focus, this region should be shown, which means any parent scroller should attempt to display the given area of this widget. For instance, an entry given focus should scroll to show the text cursor if that cursor moves. In this example, this region defines the relative geometry of the cursor within the widget.
Note: The region is relative to the top-left corner of the widget, i.e. X,Y start from 0,0 to indicate the top-left corner of the widget. W,H must be greater or equal to 1 for this region to be taken into account, otherwise it is ignored. (Since EFL 1.22)
Declaration
protected virtual Rect GetInterestRegion()
Returns
Type | Description |
---|---|
Eina.Rect | The relative region to show. If width or height is <= 0 it will be ignored, and no action will be taken. |
GetModel()
Model that is/will be
Declaration
public virtual IModel GetModel()
Returns
Type | Description |
---|---|
Efl.IModel | Efl model |
GetPart(String)
Get a proxy object referring to a part of an object. (Since EFL 1.22)
Declaration
protected virtual Object GetPart(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The part name. |
Returns
Type | Description |
---|---|
Efl.Object | A (proxy) object, valid for a single call. |
GetStyle()
Returns the current style of a widget. (Since EFL 1.22)
Declaration
public virtual string GetStyle()
Returns
Type | Description |
---|---|
System.String | Name of the style to use. Refer to each widget's documentation for the available style names, or to the themes in use. |
GetWidgetParent()
The internal parent of this widget. Efl.Ui.Widget objects have a parent hierarchy that may differ slightly from their Efl.Object or Efl.Canvas.Object hierarchy. This is meant for internal handling. (Since EFL 1.22)
Declaration
protected virtual Widget GetWidgetParent()
Returns
Type | Description |
---|---|
Efl.Ui.Widget | Widget parent object |
OnChildFocusChangedEvent(ObjectChildFocusChangedEventArgs)
Method to raise event ChildFocusChangedEvent.
Declaration
public void OnChildFocusChangedEvent(ObjectChildFocusChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.Focus.ObjectChildFocusChangedEventArgs | e | Event to raise. |
OnFocusChangedEvent(ObjectFocusChangedEventArgs)
Method to raise event FocusChangedEvent.
Declaration
public void OnFocusChangedEvent(ObjectFocusChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.Focus.ObjectFocusChangedEventArgs | e | Event to raise. |
OnFocusGeometryChangedEvent(ObjectFocusGeometryChangedEventArgs)
Method to raise event FocusGeometryChangedEvent.
Declaration
public void OnFocusGeometryChangedEvent(ObjectFocusGeometryChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.Focus.ObjectFocusGeometryChangedEventArgs | e | Event to raise. |
OnFocusManagerChangedEvent(ObjectFocusManagerChangedEventArgs)
Method to raise event FocusManagerChangedEvent.
Declaration
public void OnFocusManagerChangedEvent(ObjectFocusManagerChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.Focus.ObjectFocusManagerChangedEventArgs | e | Event to raise. |
OnFocusParentChangedEvent(ObjectFocusParentChangedEventArgs)
Method to raise event FocusParentChangedEvent.
Declaration
public void OnFocusParentChangedEvent(ObjectFocusParentChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.Focus.ObjectFocusParentChangedEventArgs | e | Event to raise. |
OnModelChangedEvent(ViewModelChangedEventArgs)
Method to raise event ModelChangedEvent.
Declaration
public void OnModelChangedEvent(ViewModelChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.ViewModelChangedEventArgs | e | Event to raise. |
OnPropertiesChangedEvent(PropertyBindPropertiesChangedEventArgs)
Method to raise event PropertiesChangedEvent.
Declaration
public void OnPropertiesChangedEvent(PropertyBindPropertiesChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.PropertyBindPropertiesChangedEventArgs | e | Event to raise. |
OnPropertyBoundEvent(PropertyBindPropertyBoundEventArgs)
Method to raise event PropertyBoundEvent.
Declaration
public void OnPropertyBoundEvent(PropertyBindPropertyBoundEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.PropertyBindPropertyBoundEventArgs | e | Event to raise. |
SetChildFocus(Boolean)
Indicates if a child of this object has focus set to true. (Since EFL 1.22)
Declaration
protected virtual void SetChildFocus(bool child_focus)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | child_focus |
|
SetDisabled(Boolean)
Enables or disables this widget. Disabling a widget will disable all its children recursively, but only this widget will be marked as disabled internally. (Since EFL 1.22)
Declaration
public virtual void SetDisabled(bool disabled)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disabled |
|
SetFocus(Boolean)
This is called by the manager and should never be called by anyone else. The function emits the focus state events, if focus is different to the previous state. (Since EFL 1.22)
Declaration
protected virtual void SetFocus(bool focus)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | focus | The focused state of the object. |
SetFocusAllow(Boolean)
The ability for a widget to be focused. Unfocusable objects do nothing when programmatically focused. The nearest focusable parent object the one really getting focus. Also, when they receive mouse input, they will get the event, but not take away the focus from where it was previously.
Note: Objects which are meant to be interacted with by input events are created able to be focused, by default. All the others are not.
This property's default value depends on the widget (e.g. a box is not focusable, but a button is). (Since EFL 1.22)
Declaration
public virtual void SetFocusAllow(bool can_focus)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | can_focus | Whether the object is focusable. |
SetModel(IModel)
Model that is/will be
Declaration
public virtual void SetModel(IModel model)
Parameters
Type | Name | Description |
---|---|---|
Efl.IModel | model | Efl model |
SetResizeObject(Object)
Sets the new resize object for this widget. (Since EFL 1.22)
Declaration
protected virtual void SetResizeObject(Object sobj)
Parameters
Type | Name | Description |
---|---|---|
Efl.Canvas.Object | sobj | A canvas object (often a Efl.Canvas.Layout (object still in beta stage) object). |
SetStyle(String)
Can only be called during construction, before finalize. (Since EFL 1.22)
Declaration
public virtual Error SetStyle(string style)
Parameters
Type | Name | Description |
---|---|---|
System.String | style | Name of the style to use. Refer to each widget's documentation for the available style names, or to the themes in use. |
Returns
Type | Description |
---|---|
Eina.Error | Whether the style was successfully applied or not, see the Efl.Ui.Theme.Apply_Error subset of Eina.Error for more information. |
SetupOrder()
Tells the object that its children will be queried soon by the focus manager. Overwrite this to have a chance to update the order of the children. Deleting items in this call will result in undefined behaviour and may cause your system to crash. (Since EFL 1.22)
Declaration
public virtual void SetupOrder()
SetupOrderNonRecursive()
This is called when Efl.Ui.Focus.IObject.SetupOrder() is called, but only on the first call, additional recursive calls to Efl.Ui.Focus.IObject.SetupOrder() will not call this function again. (Since EFL 1.22)
Declaration
protected virtual void SetupOrderNonRecursive()
SetWidgetParent(Widget)
The internal parent of this widget. Efl.Ui.Widget objects have a parent hierarchy that may differ slightly from their Efl.Object or Efl.Canvas.Object hierarchy. This is meant for internal handling. (Since EFL 1.22)
Declaration
protected virtual void SetWidgetParent(Widget parent)
Parameters
Type | Name | Description |
---|---|---|
Efl.Ui.Widget | parent | Widget parent object |
UpdateOnFocus()
Virtual function handling focus in/out events on the widget. (Since EFL 1.22)
Declaration
protected virtual bool UpdateOnFocus()
Returns
Type | Description |
---|---|
System.Boolean |
|
WidgetInputEventHandler(Event, Object)
Virtual function handling input events on the widget.
This method should return true
if the event has been processed. Only key down, key up and pointer wheel events will be propagated through this function.
It is common for the event to be also marked as processed as in Efl.Input.IEvent.Processed, if this operation was successful. This makes sure other widgets will not also process this input event. (Since EFL 1.22)
Declaration
protected virtual bool WidgetInputEventHandler(Event eo_event, Object source)
Parameters
Type | Name | Description |
---|---|---|
Efl.Event | eo_event | EO event struct with an Efl.Input.Event as info. |
Efl.Canvas.Object | source | Source object where the event originated. Often same as this. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Events
ChildFocusChangedEvent
Emitted if child_focus has changed. (Since EFL 1.22)
Declaration
public event EventHandler<ObjectChildFocusChangedEventArgs> ChildFocusChangedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<Efl.Ui.Focus.ObjectChildFocusChangedEventArgs> |
FocusChangedEvent
Emitted if the focus state has changed. (Since EFL 1.22)
Declaration
public event EventHandler<ObjectFocusChangedEventArgs> FocusChangedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<Efl.Ui.Focus.ObjectFocusChangedEventArgs> |
FocusGeometryChangedEvent
Emitted if focus geometry of this object has changed. (Since EFL 1.22)
Declaration
public event EventHandler<ObjectFocusGeometryChangedEventArgs> FocusGeometryChangedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<Efl.Ui.Focus.ObjectFocusGeometryChangedEventArgs> |
FocusManagerChangedEvent
Emitted when a new manager is the parent for this object. (Since EFL 1.22)
Declaration
public event EventHandler<ObjectFocusManagerChangedEventArgs> FocusManagerChangedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<Efl.Ui.Focus.ObjectFocusManagerChangedEventArgs> |
FocusParentChangedEvent
Emitted when a new logical parent should be used. (Since EFL 1.22)
Declaration
public event EventHandler<ObjectFocusParentChangedEventArgs> FocusParentChangedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<Efl.Ui.Focus.ObjectFocusParentChangedEventArgs> |
ModelChangedEvent
Event dispatched when a new model is set.
Declaration
public event EventHandler<ViewModelChangedEventArgs> ModelChangedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<Efl.Ui.ViewModelChangedEventArgs> |
PropertiesChangedEvent
Event dispatched when a property on the object has changed due to a user interaction on the object that a model could be interested in.
Declaration
public event EventHandler<PropertyBindPropertiesChangedEventArgs> PropertiesChangedEvent
Event Type
Type | Description |
---|---|
System.EventHandler<Efl.Ui.PropertyBindPropertiesChangedEventArgs> |
PropertyBoundEvent
Event dispatched when a property on the object is bound to a model. This is useful to avoid generating too many events.
Declaration
public event EventHandler<PropertyBindPropertyBoundEventArgs> PropertyBoundEvent
Event Type
Type | Description |
---|---|
System.EventHandler<Efl.Ui.PropertyBindPropertyBoundEventArgs> |