View

A View is a rectangle within the View hierarchy.

Categoryrefcounted
Typehime_view_t
Inheritshime_object_t

Constructors

hime_view_t hime_view_create()

Create a new View.

Return

hime_view_t

Methods

void hime_view_set_visible(self, visible)

Show/Hide the view.

Parameters

Return

void

bool hime_view_is_visible(self)

Return whether the view is visible.

Parameters

Return

bool

void hime_view_set_enabled(self, enabled)

Set whether the view is enabled.

Parameters

Return

void

bool hime_view_is_enabled(self)

Return whether the view is enabled.

Parameters

Return

bool

hime_rect_t hime_view_get_bounds(self)

Return the bounds of the view in its parent's coordinates.

Parameters

Return

hime_rect_t

void hime_view_set_preferred_size(self, size)

Sets or unsets the size that this View will request during layout.

Parameters

Return

void

hime_size_t hime_view_get_preferred_size(self)

Return the size the view would like to be under the current bounds.

Parameters

Return

hime_size_t

void hime_view_set_style(self, name, value)

Change the styles of the view.

Note that calling this method does not changes the bounds immediately, the bounds will change when the view hierarchy re-calculates the layout, such as when resizing window or when adding/removing child views. To make the new styles apply immediately you can call Layout method.

Parameters

Return

void

void hime_view_set_style_number(self, name, value)

Change the styles of the view.

Note that calling this method does not changes the bounds immediately, the bounds will change when the view hierarchy re-calculates the layout, such as when resizing window or when adding/removing child views. To make the new styles apply immediately you can call Layout method.

Parameters

Return

void

void hime_view_layout(self)

Re-calculate the layout in view hierarchy.

Parameters

Return

void

void hime_view_set_background(self, background)

Set the background of the view.

Parameters

Return

void

void hime_view_set_border(self, border)

Set the border of the view.

Note that it is also possible to set border via the SetStyle API, but it only serves as layout property rather than actually drawin a border, while the SetBorder API actually draws the border.

The two types of borders do not know each other and setting both might cause weird visual effects, this will change in future and please be prepared for it.

Parameters

Return

void

void hime_view_add_child_view(self, view)

Append a child view to this view.

Parameters

Return

void

void hime_view_add_child_view_at(self, view, index)

Add a child view to this view at index.

Parameters

Return

void

void hime_view_remove_child_view(self, view)

Remove a child view from this view.

Parameters

Return

void

size_t hime_view_child_count(self)

Return the count of children in this view.

Parameters

Return

size_t

hime_view_t hime_view_child_at(self, index)

Return the child View at index.

Parameters

Return

hime_view_t

void hime_view_set_accessible_name(self, name)

Set the accessible name.

The value of the accessible name is a localized, end-user-consumable string which may be derived from visible information (e.g. the text on a button) or invisible information (e.g. the alternative text describing an icon). In the case of focusable objects, the name will be presented by the screen reader when that object gains focus and is critical to understanding the purpose of that object non-visually.

Parameters

Return

void

const char16_t* hime_view_get_accessible_name(self)

Get the accessible name.

Parameters

Return

const char16_t*

void hime_view_set_group(self, group)

Set the group id of this view.

Some view subclasses use this id to find other views of the same group. For example radio button uses this information to find other radio buttons.

Parameters

Return

void

void hime_view_get_group(self)

Get the group id of this view.

Parameters

Return

void

Events

void hime_view_on_draw(view, painter)

Emitted when the drawing of view is done.

Parameters

Preventable

No.

bool hime_view_on_will_draw(view, painter)

Emitted when the drawing of view is going to start.

Returning true will prevent the default paint routine of view.

Parameters

Preventable

Yes.