Clipped Smart Object

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Data Structures | Typedefs | Functions
Clipped Smart Object
Evas » Smart Object Functions

Clipped smart object is a base to construct other smart objects based on the concept of having an internal clipper that is applied to all children objects. More...

## Data Structures
struct | _Evas_Object_Smart_Clipped_Data

## Typedefs
typedef struct _Evas_Object_Smart_Clipped_Data | Evas_Object_Smart_Clipped_Data
| Every subclass should provide this at the beginning of their own data set with evas_object_smart_data_set().

## Functions
EVAS_API void | evas_object_smart_clipped_smart_set (Evas_Smart_Class *sc)
| Set a given smart class' callbacks so it implements the clipped smart object"'s interface.
EVAS_API const Evas_Smart_Class * | evas_object_smart_clipped_class_get (void)
| Get a pointer to the clipped smart object's class, to use for proper inheritance.

## Detailed Description

Clipped smart object is a base to construct other smart objects based on the concept of having an internal clipper that is applied to all children objects.

This clipper will control the visibility, clipping and color of sibling objects (remember that the clipping is recursive, and clipper color modulates the color of its clippees). By default, this base will also move children relative to the parent, and delete them when parent is deleted. In other words, it is the base for simple object grouping.

See some examples of this group of functions.

See also
  evas_object_smart_clipped_smart_set()

## Function Documentation

## ◆ evas_object_smart_clipped_smart_set()

EVAS_API void evas_object_smart_clipped_smart_set | ( | Evas_Smart_Class * | sc | ) |

Set a given smart class' callbacks so it implements the clipped smart object"'s interface.

Parameters

  sc | The smart class handle to operate on

This call will assign all the required methods of the `sc` Evas_Smart_Class instance to the implementations set for clipped smart objects. If one wants to "subclass" it, call this function and then override desired values. If one wants to call any original method, save it somewhere. Example:

static Evas_Smart_Class parent_sc = EVAS_SMART_CLASS_INIT_NULL;
static void my_class_smart_add(Evas_Object *o)
{
parent_sc.add(o);
evas_object_color_set(evas_object_smart_clipped_clipper_get(o),
255, 0, 0, 255);
}
Evas_Smart_Class *my_class_new(void)
{
static Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NAME_VERSION("MyClass");
if (!parent_sc.name)
{
evas_object_smart_clipped_smart_set(&sc);
parent_sc = sc;
sc.add = my_class_smart_add;
}
return &sc;
}
evas_object_color_set
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition: evas_object_main.c:2024
Evas_Object
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition: Evas_Common.h:185
EVAS_SMART_CLASS_INIT_NULL
#define EVAS_SMART_CLASS_INIT_NULL
Initialize to zero a whole Evas_Smart_Class structure.
Definition: Evas_Common.h:2050
EVAS_SMART_CLASS_INIT_NAME_VERSION
#define EVAS_SMART_CLASS_INIT_NAME_VERSION(name)
Initialize to zero a whole Evas_Smart_Class structure and set name and version.
Definition: Evas_Common.h:2085
evas_object_smart_clipped_smart_set
EVAS_API void evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc)
Set a given smart class' callbacks so it implements the clipped smart object"'s interface.
Definition: evas_object_smart_clipped.c:102
evas_object_smart_clipped_clipper_get
EVAS_API Evas_Object * evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj)
Get the clipper object for the given clipped smart object.
Definition: evas_object_smart_clipped.c:14
_Evas_Smart_Class
A smart object's base class definition.
Definition: Evas_Common.h:1948
_Evas_Smart_Class::add
void(* add)(Evas_Object *o)
code to be run when adding object to a canvas
Definition: Evas_Common.h:1951
_Evas_Smart_Class::name
const char * name
the name string of the class
Definition: Evas_Common.h:1949

Default behavior for each of Evas_Smart_Class functions on a clipped smart object are:

- `add:` creates a hidden clipper with "infinite" size, to clip any incoming members;
- `del:` delete all children objects;
- `move:` move all objects relative relatively;
- `resize:` not defined;
- `show:` if there are children objects, show clipper;
- `hide:` hides clipper;
- `color_set:` set the color of clipper;
- `clip_set:` set clipper of clipper;
- `clip_unset:` unset the clipper of clipper;

Note
  There are other means of assigning parent smart classes to child ones, like the EVAS_SMART_SUBCLASS_NEW macro or the evas_smart_class_inherit_full() function.

References _Evas_Smart_Class::add, _Evas_Smart_Class::calculate, _Evas_Smart_Class::clip_set, _Evas_Smart_Class::clip_unset, _Evas_Smart_Class::color_set, _Evas_Smart_Class::del, _Evas_Smart_Class::hide, _Evas_Smart_Class::member_add, _Evas_Smart_Class::member_del, _Evas_Smart_Class::move, and _Evas_Smart_Class::show.

Referenced by evas_object_smart_clipped_class_get().

## ◆ evas_object_smart_clipped_class_get()

EVAS_API const Evas_Smart_Class * evas_object_smart_clipped_class_get | ( | void |  | ) |

Get a pointer to the clipped smart object's class, to use for proper inheritance.

See also
  Clipped Smart Object for more information on this smart class

References evas_object_smart_clipped_smart_set(), and EVAS_SMART_CLASS_INIT_NAME_VERSION.