Add missing files, thanks Sachiel :)

SVN revision: 44983
This commit is contained in:
Christopher Michael 2010-01-08 18:00:33 +00:00
parent 914243deb8
commit bf4e3b6719
2 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH
void
test_conformant(void *data, Evas_Object *obj, void *event)
{
Evas_Object *win, *bg, *conform;
Evas_Object *box, *btn;
Ecore_X_Window xwin;
win = elm_win_add(NULL, "conformant", ELM_WIN_BASIC);
elm_win_title_set(win, "Conformant");
elm_win_autodel_set(win, 1);
xwin = elm_win_xwindow_get(win);
ecore_x_e_illume_conformant_set(xwin, 1);
bg = elm_bg_add(win);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
conform = elm_conformant_add(win);
elm_win_resize_object_add(win, conform);
evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(conform);
btn = elm_button_add(win);
elm_button_label_set(btn, "Test Conformant");
evas_object_show(btn);
elm_conformant_content_set(conform, btn);
evas_object_resize(win, 200, 200);
evas_object_show(win);
}
#endif

View File

@ -0,0 +1,96 @@
#include <Elementary.h>
#include "elm_priv.h"
typedef struct _Widget_Data Widget_Data;
struct _Widget_Data
{
Evas_Object *base;
Evas_Object *shelf;
Evas_Object *content;
};
/* local function prototypes */
static void _del_hook(Evas_Object *obj);
static void _theme_hook(Evas_Object *obj);
static void _sizing_eval(Evas_Object *obj);
/* local functions */
static void
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
free(wd);
}
static void
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
_elm_theme_set(wd->base, "conformant", "base", elm_widget_style_get(obj));
if (wd->content)
edje_object_part_swallow(wd->base, "elm.swallow.content", wd->content);
edje_object_scale_set(wd->base, elm_widget_scale_get(obj) * _elm_config->scale);
_sizing_eval(obj);
}
static void
_sizing_eval(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord mw = -1, mh = -1;
edje_object_size_min_calc(wd->base, &mw, &mh);
evas_object_size_hint_min_set(obj, mw, mh);
evas_object_size_hint_max_set(obj, -1, -1);
}
EAPI Evas_Object *
elm_conformant_add(Evas_Object *parent)
{
Evas_Object *obj;
Evas *evas;
Widget_Data *wd;
int sh = -1;
wd = ELM_NEW(Widget_Data);
evas = evas_object_evas_get(parent);
obj = elm_widget_add(evas);
elm_widget_type_set(obj, "conformant");
elm_widget_sub_object_add(parent, obj);
elm_widget_data_set(obj, wd);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_theme_hook_set(obj, _theme_hook);
wd->base = edje_object_add(evas);
_elm_theme_set(wd->base, "conformant", "base", "default");
elm_widget_resize_object_set(obj, wd->base);
ecore_x_e_illume_top_shelf_geometry_get(ecore_x_window_root_first_get(),
NULL, NULL, NULL, &sh);
if (sh < 0) sh = 32;
wd->shelf = evas_object_rectangle_add(evas);
evas_object_color_set(wd->shelf, 0, 0, 0, 0);
evas_object_size_hint_min_set(wd->shelf, -1, sh);
evas_object_size_hint_max_set(wd->shelf, -1, sh);
edje_object_part_swallow(wd->base, "elm.swallow.shelf", wd->shelf);
_sizing_eval(obj);
return obj;
}
EAPI void
elm_conformant_content_set(Evas_Object *obj, Evas_Object *content)
{
Widget_Data *wd = elm_widget_data_get(obj);
if ((wd->content != content) && (wd->content))
elm_widget_sub_object_del(obj, wd->content);
wd->content = content;
if (content)
{
elm_widget_sub_object_add(obj, content);
edje_object_part_swallow(wd->base, "elm.swallow.content", content);
_sizing_eval(obj);
}
}