Etk
Main Page Object Hierarchy Data Structures Related Pages
Etk

Etk_Embed


Detailed Description

The Etk_Embed widget is a toplevel widget that can be embedded in an existing Evas and can be manipulated as a normal Evas object.

embed.png

The embed widget allows you to add Etk widgets in your Evas programs, without having to create an Etk_Window.
The embed widget is created with etk_embed_new() which only requires the Evas where to create the embed object. You can then get the corresponding Evas object with etk_embed_object_get(). This object can be manipulated as any other Evas objects, with evas_object_move(), evas_object_resize(), evas_object_show(), ...

If the embed widget contains widgets that makes popup-windows pop up (such as a combobox or a menubar), you should also call etk_embed_position_method_set() to set the function to call to get the position of the Evas where the embed object belongs. Without this function, the menus and the combobox-windows will pop up at an incorrect position.
Also, if the embed widget contains widgets that may change the mouse pointer (such as an entry or a tree), you have to call etk_embed_pointer_method_set() to set the function to call to change the current mouse pointer. Otherwise, the mouse pointer will not be changed.

Here is an example that adds a colorpicker in an existing Ecore_Evas:

 //This function gets the position of the window containing the embed object.
 //This is needed only if the embed widget uses popup-windows so this is unused in this example since
 //the embed widget only contains a colorpicker
 static void window_position_get(void *window_data, int *x, int *y)
 {
    ecore_evas_geometry_get(window_data, x, y, NULL, NULL);
 }

 //This function creates a colorpicker in the given Ecore_Evas
 void create_colorpicker(Ecore_Evas *ee)
 {
    Evas *evas;
    Etk_Widget *embed, *colorpicker;
    Evas_Object *embed_object;

    //Create the embed widget
    evas = ecore_evas_get(ee);
    embed = etk_embed_new(evas);
    etk_embed_position_method_set(ETK_EMBED(embed, window_position_get, ee);
 
    //Pack a colorpicker into the embed widget
    colorpicker = etk_colorpicker_new();
    etk_container_add(ETK_CONTAINER(embed), colorpicker);
    etk_widget_show_all(embed);

    //Get the Evas object corresponding to the embed widget.
    //Then, we place it at (10,10) and resize it to 250x150
    embed_object = etk_embed_object_get(ETK_EMBED(embed));
    evas_object_move(embed_object, 10, 10);
    evas_object_resize(embed_object, 250, 150);
    //Note: evas_object_show(embed) is not required here since
    //etk_widget_show_all(embed) shows automatically the embed object
 }

Object Hierarchy:
  • Etk_Object
    • Etk_Widget
      • Etk_Container
        • Etk_Bin
          • Etk_Toplevel
            • Etk_Embed


Data Structures

struct  Etk_Embed
 [Widget] A toplevel widget that can be embedded in an existing Evas and be manipulated as a normal Evas object. More...

Defines

#define ETK_EMBED_TYPE   (etk_embed_type_get())
#define ETK_EMBED(obj)   (ETK_OBJECT_CAST((obj), ETK_EMBED_TYPE, Etk_Embed))
#define ETK_IS_EMBED(obj)   (ETK_OBJECT_CHECK_TYPE((obj), ETK_EMBED_TYPE))

Functions

Etk_Widget * etk_embed_new (Evas *evas)
 Creates a new embed widget.
Evas_Object * etk_embed_object_get (Etk_Embed *embed)
 Gets the smart-object of the embed widget. This object can be manipulated like the other Evas objects, with evas_object_move(), evas_object_resize(), evas_object_clip_set(), ...
void etk_embed_position_method_set (Etk_Embed *embed, void(*position_get)(void *position_data, int *x, int *y), void *position_data)
 Sets the function to call to get the position of the Evas where the embed widget belongs, relative to the screen. This is used to place correctly the menus and the combobox windows in the embed widget, so if the embed widget does not contain a menu bar or a combobox, you don't need to call this function.
void etk_embed_pointer_method_set (Etk_Embed *embed, void(*pointer_set)(void *pointer_data, Etk_Pointer_Type pointer_type), void *pointer_data)
 Sets the function to call to set the current mouse pointer used by the Embed. This is used to change the pointer when the mouse is over an entry for example, so if the embed widget does not contain a widget that makes the pointer change (such as an entry or a tree), you don't need to call this function.


Define Documentation

#define ETK_EMBED_TYPE   (etk_embed_type_get())

Gets the type of an embed widget

#define ETK_EMBED ( obj   )     (ETK_OBJECT_CAST((obj), ETK_EMBED_TYPE, Etk_Embed))

Casts the object to an Etk_Embed

#define ETK_IS_EMBED ( obj   )     (ETK_OBJECT_CHECK_TYPE((obj), ETK_EMBED_TYPE))

Check if the object is an Etk_Embed


Function Documentation

Etk_Widget * etk_embed_new ( Evas *  evas  ) 

Creates a new embed widget.

Parameters:
evas the Evas where the embed object should belong
Returns:
Returns the new embed widget, or NULL on failure (most probably because the Evas is invalid)

Evas_Object * etk_embed_object_get ( Etk_Embed *  embed  ) 

Gets the smart-object of the embed widget. This object can be manipulated like the other Evas objects, with evas_object_move(), evas_object_resize(), evas_object_clip_set(), ...

Parameters:
embed an embed widget
Returns:
Returns the smart-object of the embed widget

void etk_embed_position_method_set ( Etk_Embed *  embed,
void(*)(void *position_data, int *x, int *y)  position_get,
void *  position_data 
)

Sets the function to call to get the position of the Evas where the embed widget belongs, relative to the screen. This is used to place correctly the menus and the combobox windows in the embed widget, so if the embed widget does not contain a menu bar or a combobox, you don't need to call this function.

Parameters:
embed an embed widget
position_get the function to call to get the position of top-left corner of the Evas. The returned position should be relative to the top-left corner of the screen
position_data the data to pass as the first param when position_get is called. It can be set to NULL

void etk_embed_pointer_method_set ( Etk_Embed *  embed,
void(*)(void *pointer_data, Etk_Pointer_Type pointer_type)  pointer_set,
void *  pointer_data 
)

Sets the function to call to set the current mouse pointer used by the Embed. This is used to change the pointer when the mouse is over an entry for example, so if the embed widget does not contain a widget that makes the pointer change (such as an entry or a tree), you don't need to call this function.

Parameters:
embed an embed widget
pointer_set the function to call to set the current mouse pointer
pointer_data the data to pass as the first param when pointer_set is called. It can be set to NULL