View

Declaration

class enamlnative.widgets.view.View(parent=None, **kwargs)[source]

Bases: enaml.widgets.toolkit_object.ToolkitObject

View is a view group that displays child views in relative positions.

enabled

Widget is enabled

visible

Show or hide

clickable

Observe click events

long_clickable

Set whether the view can be long clicked

focusable

Set whether the view can be focused

key_events

Observe key events

touch_events

Observe touch events

clicked

Called when view is clicked

long_clicked

Called when view is clicked

key_event

Called when a key event occurs

touch_event

Called when a touch event occurs

deactivated

Called when the view is about to be destroyed

animations

Animations

alpha

Foreground alpha

style

Initial widget style

background_style

Background style

background_color

Background color

width

Width and height or a string “match_parent” or “fill_parent”

gravity

Layout gravity

position

The Position property tells Flexbox how you want your item to be positioned within its parent.

align_self

How to align children along the cross axis of their container

flex_basis

The FlexBasis property is an axis-independent way of providing the default size of an item on the main axis. Setting the FlexBasis of a child is similar to setting the Width of that child if its parent is a container with FlexDirection = row or setting the Height of a child if its parent is a container with FlexDirection = column. The FlexBasis of an item is the default size of that item, the size of the item before any FlexGrow and FlexShrink calculations are performed.

proxy

A reference to the ProxyLabel object.

destroy()[source]

Trigger the deactivated event

Android Implementation

class enamlnative.android.android_view.AndroidView[source]

Bases: enamlnative.android.android_toolkit_object.AndroidToolkitObject, enamlnative.widgets.view.ProxyView

An Android implementation of an Enaml ProxyView.

widget

A reference to the widget created by the proxy.

dp

Display metrics density

layout_param_type

Layout type

layout_params

Layout params

default_layout

Default layout params

create_widget()[source]

Create the underlying label widget.

init_widget()[source]

Initialize the underlying widget.

This reads all items declared in the enamldef block for this node and sets only the values that have been specified. All other values will be left as default. Doing it this way makes atom to only create the properties that need to be overridden from defaults thus greatly reducing the number of initialization checks, saving time and memory.

If you don’t want this to happen override get_declared_keys to return an empty list.

get_declared_items()[source]

Get the members that were set in the enamldef block for this Declaration. Layout keys are grouped together until the end so as to avoid triggering multiple updates.

Returns

result – List of keys and values

Return type

List of (k,v) pairs that were defined for this widget in enaml

on_click(view)[source]

Trigger the click

on_long_click(view)[source]

Trigger the click

on_key(view, key, event)[source]

Trigger the key event

Parameters
  • view (int) – The ID of the view that sent this event

  • key (int) – The code of the key that was pressed

  • data (bytes) – The msgpack encoded key event

on_touch(view, event)[source]

Trigger the touch event

Parameters
  • view (int) – The ID of the view that sent this event

  • data (bytes) – The msgpack encoded key event

set_enabled(enabled)[source]

Set the enabled state of the widget.

set_visible(visible)[source]

Set the visibility of the widget.

set_background_style(style)[source]

Sets the background resources.

set_background_color(color)[source]

Set the background color of the widget.

set_alpha(alpha)[source]

Sets the alpha or opacity of the widget.

set_layout(layout)[source]

Sets the LayoutParams of this widget.

Since the available properties that may be set for the layout params depends on the parent, actual creation of the params is delegated to the parent

Parameters

layout (Dict) – A dict of layout parameters the parent should used to layout this child. The widget defaults are updated with user passed values.

update_layout(**params)[source]

Updates the LayoutParams of this widget.

This delegates to the parent and expects the parent to update the existing layout without recreating it.

Parameters

params (Dict) – A dict of layout parameters the parent should used to layout this child. The widget defaults are updated with user passed values.

create_layout_params(child, layout)[source]

Create the LayoutParams for a child with it’s requested layout parameters. Subclasses should override this as needed to handle layout specific needs.

Parameters
  • child (AndroidView) – A view to create layout params for.

  • layout (Dict) – A dict of layout parameters to use to create the layout.

Returns

layout_params – A LayoutParams bridge object with the requested layout options.

Return type

LayoutParams

apply_layout(child, layout)[source]

Apply a layout to a child. This sets the layout_params of the child which is later used during the init_layout pass. Subclasses should override this as needed to handle layout specific needs of the ViewGroup.

Parameters
  • child (AndroidView) – A view to create layout params for.

  • layout (Dict) – A dict of layout parameters to use to create the layout.

No iOS implementation found.