View
| Category | refcounted |
| Type | hime_view_t |
| Inherits | Object |
A View is a rectangle within the View hierarchy.
Constructors
hime_view_t hime_view_create()
Create a new View.
Return
hime_view_tMethods
void hime_view_set_visible(self, visible)
Show/Hide the view.
Parameters
hime_view_tselfboolvisible
Return
voidbool hime_view_is_visible(self)
Return whether the view is visible.
Parameters
hime_view_const_tself
Return
boolbool hime_view_is_drawn(self)
Return true if this view is drawn on screen.
Parameters
hime_view_const_tself
Return
boolvoid hime_view_set_enabled(self, enabled)
Set whether the view is enabled.
Parameters
hime_view_tselfboolenabled
Return
voidbool hime_view_is_enabled(self)
Return whether the view is enabled.
Parameters
hime_view_const_tself
Return
boolvoid hime_view_focus(self)
Request keyboard focus.
Parameters
hime_view_tself
Return
voidbool hime_view_has_focus(self)
Return whether this view currently has the focus.
Parameters
hime_view_const_tself
Return
boolvoid hime_view_set_focus_behavior(self, behavior)
Set whether this view can receive keyboard focus.
Parameters
hime_view_tselfhime_view_focus_behavior_tbehavior
Return
voidhime_view_focus_behavior_t hime_view_get_focus_behavior(self)
Return whether this view can receive keyboard focus.
Parameters
hime_view_const_tself
Return
hime_view_focus_behavior_tvoid hime_view_set_bounds(self, bounds)
Change the bounds of view directly.
This method should only be used when using custom layout engines, normal
users should use SetStyle instead.
Parameters
hime_view_tselfhime_rect_tbounds
Return
voidhime_rect_t hime_view_get_bounds(self)
Return the bounds of the view in its parent's coordinates.
Parameters
hime_view_const_tself
Return
hime_rect_thime_rect_t hime_view_get_bounds_in_screen(self)
Return the bounds of the View in screen coordinate system.
Parameters
hime_view_const_tself
Return
hime_rect_tvoid hime_view_set_preferred_size(self, size)
Set or unset the size that this View will request during layout.
Parameters
hime_view_tselfhime_size_t*size
Return
voidhime_size_t hime_view_get_preferred_size(self)
Return the size the view would like to be under the current bounds.
If the View is never laid out before, assume it to be laid out in an unbounded space.
Parameters
hime_view_const_tself
Return
hime_size_tvoid 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
hime_view_tselfconst char16_t*nameconst char16_t*value
Return
voidvoid 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
hime_view_tselfconst char16_t*namefloatvalue
Return
voidvoid hime_view_layout(self)
Re-calculate the layout in view hierarchy.
Parameters
hime_view_tself
Return
voidvoid hime_view_schedule_paint(self)
Mark all of the view's bounds as dirty (needing repaint).
Parameters
hime_view_tself
Return
voidvoid hime_view_schedule_paint_in_rect(self, bounds)
Mark view's bounds as dirty.
Parameters
hime_view_tselfhime_rect_tbounds
Return
voidvoid hime_view_set_background(self, background)
Set the background of the view.
Parameters
hime_view_tselfhime_background_tbackground
Return
voidvoid 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
hime_view_tselfhime_border_tborder
Return
voidvoid hime_view_add_child_view(self, view)
Append a child view to this view.
Parameters
hime_view_tselfhime_view_tview
Return
voidvoid hime_view_add_child_view_at(self, view, index)
Add a child view to this view at index.
Parameters
hime_view_tselfhime_view_tviewsize_tindex
Return
voidvoid hime_view_remove_child_view(self, view)
Remove a child view from this view.
Parameters
hime_view_tselfhime_view_tview
Return
voidsize_t hime_view_child_count(self)
Return the count of children in this view.
Parameters
hime_view_const_tself
Return
size_thime_view_t hime_view_child_at(self, index)
Return the child View at index.
Parameters
hime_view_const_tselfsize_tindex
Return
hime_view_tvoid 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
hime_view_tselfconst char16_t*name
Return
voidconst char16_t* hime_view_get_accessible_name(self)
Get the accessible name.
Parameters
hime_view_const_tself
Return
const char16_t*void hime_view_set_id(self, id)
Get the ID for this view.
ID should be unique within the subtree that you intend to search for it. 0 is the default ID for views.
Parameters
hime_view_tselfintid
Return
voidint hime_view_get_id(self)
Get the ID of this view.
Parameters
hime_view_const_tself
Return
inthime_view_t hime_view_get_view_by_id(self, id)
Recursively descend the view tree starting at this view, and return the first child that it encounters that has the given ID.
Return NULL if no matching child view is found.
Parameters
hime_view_tselfintid
Return
hime_view_tvoid 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
hime_view_tselfintgroup
Return
voidint hime_view_get_group(self)
Get the group id of this view.
Parameters
hime_view_const_tself
Return
intsize_t hime_view_get_views_in_group(self, group, out, out_size)
Get all the available views which belong to the group.
Parameters
hime_view_tselfintgrouphime_view_t*out - Output pointer.size_tout_size - Size of out.
Return
size_tEvents
void hime_view_on_draw(view, painter)
Emitted when the drawing of view is done.
Parameters
hime_view_tviewhime_painter_tpainter
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
hime_view_tviewhime_painter_tpainter
Preventable
Yes.
bool hime_view_on_mouse_down(view, event)
Emitted when pressing mouse buttons.
Parameters
hime_view_tviewhime_mouse_event_const_tevent
Preventable
Yes.
bool hime_view_on_mouse_up(view, event)
Emitted when releasing mouse buttons.
Parameters
hime_view_tviewhime_mouse_event_const_tevent
Preventable
Yes.
bool hime_view_on_mouse_move(view, event)
Emitted when user moves mouse in the view.
Parameters
hime_view_tviewhime_mouse_event_const_tevent
Preventable
Yes.
bool hime_view_on_mouse_enter(view, event)
Emitted when mouse enters the view.
Parameters
hime_view_tviewhime_mouse_event_const_tevent
Preventable
Yes.
bool hime_view_on_mouse_leave(view, event)
Emitted when mouse leaves the view.
Parameters
hime_view_tviewhime_mouse_event_const_tevent
Preventable
Yes.
bool hime_view_on_key_down(view, event)
Emitted when pressing keyboard.
Parameters
hime_view_tviewhime_key_event_const_tevent
Preventable
Yes.
bool hime_view_on_key_up(view, event)
Emitted when releasing keyboard.
Parameters
hime_view_tviewhime_key_event_const_tevent
Preventable
Yes.