\r
\r
#define MAX_STR 256 \r
+#define MAX_W_BTN 200 \r
\r
\r
typedef enum _Multibuttonentry_Pos\r
_set_label(Evas_Object *obj, const char* str)\r
{\r
Widget_Data *wd = elm_widget_data_get(obj);\r
- if(!wd) return;\r
+ if(!wd || !str) return;\r
\r
if(!wd->label){\r
if(!(wd->label = elm_label_add(obj))) return;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
Eina_List *l;\r
Elm_Multibuttonentry_Item *item;\r
- Evas_Object *label;\r
if (!wd) return;\r
\r
// change the state of previous button to "default"\r
item->label = label;\r
item->data = data;\r
item->rw = w_btn;\r
- item->vw =(wd->w_box < w_btn) ? wd->w_box : w_btn; \r
+ item->vw =(MAX_W_BTN < w_btn) ? MAX_W_BTN : w_btn; \r
wd->items = eina_list_append(wd->items, item);\r
}\r
\r
+ //resize btn and label\r
evas_object_resize(btn, item->vw, h_btn);\r
-\r
- if(item->rw != item->vw){\r
+ evas_object_size_hint_min_set(btn, item->vw, h_btn);\r
+ if((item->rw != item->vw) && (item->vw - 2*padding_outer - 4*padding_inner >=0)){\r
evas_object_resize(label, item->vw - 2*padding_outer - 2*padding_inner, h_label); \r
elm_label_wrap_width_set(label, item->vw - 2*padding_outer - 4*padding_inner ); \r
}\r
\r
- evas_object_size_hint_min_set(btn, item->vw, h_btn);\r
-\r
evas_object_smart_callback_call(obj, "added", item);\r
\r
return item;\r
Evas_Object *obj;\r
Evas *e;\r
Widget_Data *wd;\r
+ if (!parent) return NULL;\r
\r
wd = ELM_NEW(Widget_Data);\r
e = evas_object_evas_get(parent);\r
+ if (!e) return NULL; \r
obj = elm_widget_add(e);\r
ELM_SET_WIDTYPE(widtype, "multibuttonentry");\r
elm_widget_type_set(obj, "multibuttonentry");\r
EAPI const char *\r
elm_multibuttonentry_label_get(Evas_Object *obj)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
if (!wd) return NULL;\r
\r
{\r
ELM_CHECK_WIDTYPE(obj, widtype);\r
Widget_Data *wd = elm_widget_data_get(obj);\r
- if (!wd) return;\r
+ if (!wd || !label) return;\r
\r
_set_label(obj, label); \r
}\r
EAPI Evas_Object *\r
elm_multibuttonentry_entry_get(Evas_Object *obj)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
if (!wd) return NULL;\r
\r
EAPI Elm_Multibuttonentry_Item *\r
elm_multibuttonentry_item_add_start(Evas_Object *obj, const char *label, void *data)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
Elm_Multibuttonentry_Item *item;\r
- if (!wd) return NULL;\r
+ if (!wd || !label) return NULL;\r
\r
item = _add_button_item(obj, label, MULTIBUTONENTRY_POS_START, NULL, data);\r
return item; \r
EAPI Elm_Multibuttonentry_Item *\r
elm_multibuttonentry_item_add_end(Evas_Object *obj, const char *label, void *data)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
Elm_Multibuttonentry_Item *item;\r
- if (!wd) return NULL;\r
+ if (!wd || !label) return NULL;\r
\r
item = _add_button_item(obj, label, MULTIBUTONENTRY_POS_END, NULL, data);\r
return item; \r
EAPI Elm_Multibuttonentry_Item *\r
elm_multibuttonentry_item_add_before(Evas_Object *obj, const char *label, Elm_Multibuttonentry_Item *before, void *data)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
Elm_Multibuttonentry_Item *item;\r
- if (!wd) return NULL;\r
+ if (!wd || !label) return NULL;\r
\r
item = _add_button_item(obj, label, MULTIBUTONENTRY_POS_BEFORE, before, data);\r
return item; \r
EAPI Elm_Multibuttonentry_Item *\r
elm_multibuttonentry_item_add_after(Evas_Object *obj, const char *label, Elm_Multibuttonentry_Item *after, void *data)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
Elm_Multibuttonentry_Item *item;\r
- if (!wd) return NULL;\r
+ if (!wd || !label) return NULL;\r
\r
item = _add_button_item(obj, label, MULTIBUTONENTRY_POS_AFTER, after, data);\r
return item; \r
EAPI const Eina_List *\r
elm_multibuttonentry_items_get(Evas_Object *obj)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
if (!wd) return NULL;\r
return wd->items;\r
EAPI Elm_Multibuttonentry_Item *\r
elm_multibuttonentry_item_first_get(Evas_Object *obj)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
if (!wd || !wd->items) return NULL;\r
return eina_list_data_get(wd->items);\r
EAPI Elm_Multibuttonentry_Item *\r
elm_multibuttonentry_item_last_get(Evas_Object *obj)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
if (!wd || !wd->items) return NULL;\r
return eina_list_data_get(eina_list_last(wd->items));\r
EAPI Elm_Multibuttonentry_Item *\r
elm_multibuttonentry_item_selected_get(Evas_Object *obj)\r
{\r
- ELM_CHECK_WIDTYPE(obj, widtype);\r
+ ELM_CHECK_WIDTYPE(obj, widtype) NULL;\r
Widget_Data *wd = elm_widget_data_get(obj);\r
if (!wd || !wd->current) return NULL;\r
return eina_list_data_get(wd->current);\r
Elm_Multibuttonentry_Item *_item;\r
\r
if (!item) return NULL;\r
- ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype);\r
+ ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;\r
wd = elm_widget_data_get(item->multibuttonentry);\r
if (!wd || !wd->items) return NULL;\r
\r
Elm_Multibuttonentry_Item *_item;\r
\r
if (!item) return NULL;\r
- ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype);\r
+ ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;\r
wd = elm_widget_data_get(item->multibuttonentry);\r
if (!wd || !wd->items) return NULL;\r
\r
Elm_Multibuttonentry_Item *_item;\r
\r
if (!item) return NULL;\r
- ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype);\r
+ ELM_CHECK_WIDTYPE(item->multibuttonentry, widtype) NULL;\r
wd = elm_widget_data_get(item->multibuttonentry);\r
if (!wd || !wd->items) return NULL;\r
\r