Package evas :: Module c_evas :: Class SmartObject
[hide private]
[frames] | no frames]

Class SmartObject

object --+    
         |    
    Object --+
             |
            SmartObject
Known Subclasses:

Smart Evas Objects.

Smart objects are user-defined Evas components, often used to group multiple basic elements, associate an object with a clip and deal with them as an unit. See evas documentation for more details.

Recommended use is to create an clipper object and clip every other member to it, then you can have all your other members to be always visible and implement hide(), show(), color_set(), clip_set() and clip_unset() to just affect the clipper. See ClippedSmartObject.

Pay attention that just creating an object within the SmartObject doesn't make it a member! You must do member_add() or use one of the provided factories to ensure that. Failing to do so will leave created objects on different layer and no stacking will be done for you.

Behavior is defined by defining the following methods:


Notes:

See Also: ClippedSmartObject

Instance Methods [hide private]
Textblock
Textblock(...)
Factory of children evas.Textblock.
 
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
 
changed(...)
Mark object as changed, so it's calculate() will be called.
 
move_children_relative(...)
Move all children relatively.
 
need_recalculate_get(...)
Get the current value of need_recalculate flag.
 
need_recalculate_set(...)
Set need_recalculate flag.

Inherited from Object: __repr__, __str__, bottom_center_get, bottom_center_set, clipees_get, evas_get, left_center_get, left_center_set, name_get, name_set, on_changed_size_hints_add, on_changed_size_hints_del, on_del_add, on_del_del, parent_get, right_center_get, right_center_set, size_hint_align_get, size_hint_align_set, size_hint_aspect_get, size_hint_aspect_set, size_hint_max_get, size_hint_max_set, size_hint_min_get, size_hint_min_set, size_hint_padding_get, size_hint_padding_set, size_hint_request_get, size_hint_request_set, size_hint_weight_get, size_hint_weight_set, top_center_get, top_center_set, type_get

Inherited from Object (private): _set_common_params, _set_evas

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

    Children manipulation
 
member_add(...)
Set an evas object as a member of this object.
 
member_del(...)
Removes a member object from a smart object.
tuple of Object
members_get(...)
    Factories
FilledImage
FilledImage(...)
Factory of evas.FilledImage associated with this canvas.
Gradient
Gradient(...)
Factory of children evas.Gradient.
Image
Image(...)
Factory of children evas.Image.
Line
Line(...)
Factory of children evas.Line.
Polygon
Polygon(...)
Factory of children evas.Polygon.
Rectangle
Rectangle(...)
Factory of children evas.Rectangle.
Text
Text(...)
Factory of children evas.Text.
    Default implementations
 
calculate(...)
Request object to recalculate it's internal state.
 
delete(...)
Default implementation to delete all children.
 
move(...)
Default implementation to move all children.
    Missing implementations
 
clip_set(...)
Virtual method clip(object) of SmartObject
 
clip_unset(...)
Virtual method clip_unset() of SmartObject
 
color_set(...)
Virtual method color_set(r, g, b, a) of SmartObject
 
hide(...)
Virtual method hide() of SmartObject
 
resize(...)
Virtual method resize(w, h) of SmartObject
 
show(...)
Virtual method show() of SmartObject
    Event system
 
callback_add(...)
Add a callback for the smart event specified by event.
 
callback_call(...)
Call any smart callbacks for event.
 
callback_del(...)
Remove a smart callback.
    State manipulation

Inherited from Object: clip_get, color_get, is_deleted, visible_get, visible_set

    Positioning

Inherited from Object: bottom_left_get, bottom_left_set, bottom_right_get, bottom_right_set, center_get, center_set, geometry_get, geometry_set, move_relative, pos_get, pos_set, size_get, size_set, top_left_get, top_left_set, top_right_get, top_right_set

    Layer & Stack manipulation

Inherited from Object: above_get, below_get, bottom_get, layer_get, layer_set, lower, raise_, stack_above, stack_below, top_get

    Event processing control

Inherited from Object: focus_get, focus_set, pass_events_get, pass_events_set, propagate_events_get, propagate_events_set, repeat_events_get, repeat_events_set

    Event callbacks

Inherited from Object: event_callback_add, event_callback_del, on_focus_in_add, on_focus_in_del, on_focus_out_add, on_focus_out_del, on_free_add, on_free_del, on_hide_add, on_hide_del, on_hold_add, on_hold_del, on_key_down_add, on_key_down_del, on_key_up_add, on_key_up_del, on_mouse_down_add, on_mouse_down_del, on_mouse_in_add, on_mouse_in_del, on_mouse_move_add, on_mouse_move_del, on_mouse_out_add, on_mouse_out_del, on_mouse_up_add, on_mouse_up_del, on_mouse_wheel_add, on_mouse_wheel_del, on_move_add, on_move_del, on_resize_add, on_resize_del, on_restack_add, on_restack_del, on_show_add, on_show_del

    Often unused

Inherited from Object: anti_alias_get, anti_alias_set, color_interpolation_get, color_interpolation_set, pointer_mode_get, pointer_mode_set, render_op_get, render_op_set

Instance Variables [hide private]

Inherited from Object: clipees, data, evas, name, parent, rect, type

    State manipulation

Inherited from Object: clip, color, visible

    Positioning

Inherited from Object: bottom_left, bottom_right, center, geometry, pos, size, top_left, top_right

    Layer & Stack manipulation

Inherited from Object: above, below, layer

    Event processing control

Inherited from Object: focus, pass_events, propagate_events, repeat_events

    Often unused

Inherited from Object: anti_alias, color_interpolation, pointer_mode, render_op

Properties [hide private]
  need_recalculate

Inherited from Object: bottom_center, left_center, right_center, size_hint_align, size_hint_aspect, size_hint_max, size_hint_min, size_hint_padding, size_hint_request, size_hint_weight, top_center

Inherited from object: __class__

    Children manipulation
  members
Method Details [hide private]

__init__(...)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

callback_add(...)

 

Add a callback for the smart event specified by event.

Raises:
  • TypeError - if func is not callable.

Warning: event_info will always be a python object, if the signal is provided by a C-only class, it will crash.

callback_call(...)

 

Call any smart callbacks for event.

Attention: event_info will always be a python object.

callback_del(...)

 

Remove a smart callback.

Removes a callback that was added by callback_add().

Raises:
  • ValueError - if there was no func connected with this event.

Precondition: event and func must be used as parameter for callback_add().

changed(...)

 

Mark object as changed, so it's calculate() will be called.

If an object is changed and it provides a calculate() method, it will be called from Canvas.render(), what we call pre-render calculate.

This can be used to postpone heavy calculations until you need to display the object, example: layout calculations.

clip_set(...)

 

Virtual method clip(object) of SmartObject

Overrides: Object.clip_set

clip_unset(...)

 

Virtual method clip_unset() of SmartObject

Overrides: Object.clip_unset

color_set(...)

 

Virtual method color_set(r, g, b, a) of SmartObject

Overrides: Object.color_set

delete(...)

 

Default implementation to delete all children.

Raises:
  • ValueError - if object already deleted.
Overrides: Object.delete

hide(...)

 

Virtual method hide() of SmartObject

Overrides: Object.hide

member_add(...)

 

Set an evas object as a member of this object.

Members will automatically be stacked and layered with the smart object. The various stacking function will operate on members relative to the other members instead of the entire canvas.

Non-member objects can not interleave a smart object's members.

Note: if child is already member of another SmartObject, it will be deleted from that membership and added to this object.

member_del(...)

 

Removes a member object from a smart object.

Attention: this will actually map to C API as evas_object_smart_member_del(child), so the object will loose it's parent event if the object is not part of this object.

move(...)

 

Default implementation to move all children.

Overrides: Object.move

need_recalculate_get(...)

 

Get the current value of need_recalculate flag.

Note: this flag will be unset during the render phase, after calculate() is called if one is provided. If no calculate() is provided, then the flag will be left unchanged after render phase.

need_recalculate_set(...)

 

Set need_recalculate flag.

Set the need_recalculate flag of given smart object.

If this flag is set then calculate() callback (method) of the given smart object will be called, if one is provided, during render phase usually evas_render(). After this step, this flag will be automatically unset.

If no calculate() is provided, this flag will be left unchanged.

Note: just setting this flag will not make scene dirty and evas_render() will have no effect. To do that, use evas_object_smart_changed(), that will automatically call this function with 1 as parameter.

resize(...)

 

Virtual method resize(w, h) of SmartObject

Overrides: Object.resize

show(...)

 

Virtual method show() of SmartObject

Overrides: Object.show