2010-10-19 11:25:22 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
2019-07-28 01:27:27 -07:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
# include <evil_private.h> /* mkdir */
|
|
|
|
#endif
|
|
|
|
|
2012-03-29 12:27:13 -07:00
|
|
|
#include <Elementary.h>
|
2013-11-04 00:54:31 -08:00
|
|
|
|
2012-02-12 14:35:56 -08:00
|
|
|
#define LIST_ITEM_MAX 20
|
|
|
|
|
2010-05-27 02:03:22 -07:00
|
|
|
static void _bstatus(void *data, Evas_Object *obj, void *event_info);
|
|
|
|
static void _tstatus(void *data, Evas_Object *obj, void *event_info);
|
2011-11-30 22:15:08 -08:00
|
|
|
static char *_text_get(void *data, Evas_Object *obj, const char *source);
|
2011-10-23 19:10:35 -07:00
|
|
|
static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *source);
|
2010-09-17 09:34:59 -07:00
|
|
|
static Eina_Bool _state_get(void *data, Evas_Object *obj, const char *source);
|
|
|
|
static void _item_del(void *data, Evas_Object *obj);
|
2014-03-17 17:50:31 -07:00
|
|
|
static void _fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc);
|
2009-11-15 08:14:51 -08:00
|
|
|
static Eina_Bool _dir_has_subs(const char *path);
|
|
|
|
|
2012-02-12 14:35:56 -08:00
|
|
|
static Eina_List *dirs = NULL;
|
|
|
|
|
2010-05-27 02:03:22 -07:00
|
|
|
static void
|
2013-08-31 18:18:03 -07:00
|
|
|
_tstatus(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
2009-10-15 13:34:42 -07:00
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Object_Item *tb_it;
|
2010-10-20 10:15:14 -07:00
|
|
|
const char *status;
|
2009-11-15 08:14:51 -08:00
|
|
|
|
2010-05-27 02:03:22 -07:00
|
|
|
if (elm_panel_hidden_get((Evas_Object*)data))
|
|
|
|
status = "hidden";
|
2010-10-20 10:15:14 -07:00
|
|
|
else
|
|
|
|
status = "shown";
|
2010-05-27 02:03:22 -07:00
|
|
|
printf("The top panel is currently %s\n", status);
|
2011-11-29 21:10:23 -08:00
|
|
|
tb_it = elm_toolbar_selected_item_get(obj);
|
|
|
|
elm_toolbar_item_selected_set(tb_it, EINA_FALSE);
|
2010-05-27 02:03:22 -07:00
|
|
|
}
|
2009-11-15 08:14:51 -08:00
|
|
|
|
2010-05-27 02:03:22 -07:00
|
|
|
static void
|
2013-08-31 18:18:03 -07:00
|
|
|
_bstatus(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
2010-05-27 02:03:22 -07:00
|
|
|
{
|
2011-11-29 21:10:23 -08:00
|
|
|
Elm_Object_Item *tb_it;
|
2010-10-20 10:15:14 -07:00
|
|
|
const char *status;
|
2009-11-15 08:14:51 -08:00
|
|
|
|
2010-05-27 02:03:22 -07:00
|
|
|
if (elm_panel_hidden_get((Evas_Object*)data))
|
|
|
|
status = "hidden";
|
2010-10-20 10:15:14 -07:00
|
|
|
else
|
|
|
|
status = "shown";
|
2010-05-27 02:03:22 -07:00
|
|
|
printf("The bottom panel is currently %s\n", status);
|
2011-11-29 21:10:23 -08:00
|
|
|
tb_it = elm_toolbar_selected_item_get(obj);
|
|
|
|
elm_toolbar_item_selected_set(tb_it, EINA_FALSE);
|
2009-10-15 13:34:42 -07:00
|
|
|
}
|
|
|
|
|
2009-11-15 08:14:51 -08:00
|
|
|
static char *
|
2013-08-31 18:18:03 -07:00
|
|
|
_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *source EINA_UNUSED)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
|
|
|
return strdup(ecore_file_file_get(data));
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2011-10-23 19:10:35 -07:00
|
|
|
_content_get(void *data, Evas_Object *obj, const char *source)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
2011-04-08 07:30:48 -07:00
|
|
|
if (!strcmp(source, "elm.swallow.icon"))
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
|
|
|
Evas_Object *ic;
|
|
|
|
|
|
|
|
ic = elm_icon_add(obj);
|
|
|
|
if (ecore_file_is_dir((char *)data))
|
|
|
|
elm_icon_standard_set(ic, "folder");
|
|
|
|
else
|
|
|
|
elm_icon_standard_set(ic, "file");
|
|
|
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
|
|
|
evas_object_show(ic);
|
|
|
|
return ic;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-04-08 07:30:48 -07:00
|
|
|
static Eina_Bool
|
2013-08-31 18:18:03 -07:00
|
|
|
_state_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *source EINA_UNUSED)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2011-04-08 07:30:48 -07:00
|
|
|
static void
|
2013-08-31 18:18:03 -07:00
|
|
|
_item_del(void *data, Evas_Object *obj EINA_UNUSED)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
|
|
|
eina_stringshare_del(data);
|
|
|
|
}
|
|
|
|
|
2018-12-05 12:54:38 -08:00
|
|
|
static void
|
|
|
|
_create_dir_struct(void)
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
if (mkdir("/tmp/test_panel", S_IRWXU) < 0)
|
|
|
|
printf("make dir /tmp/test_panel failed!\n");
|
|
|
|
fp = fopen("/tmp/test_panel/a_file.txt", "w");
|
|
|
|
if (fp) fclose(fp);
|
|
|
|
fp = fopen("/tmp/test_panel/k_file.txt", "w");
|
|
|
|
if (fp) fclose(fp);
|
|
|
|
fp = fopen("/tmp/test_panel/m_file.txt", "w");
|
|
|
|
if (fp) fclose(fp);
|
|
|
|
|
|
|
|
if (mkdir("/tmp/test_panel/a_subdir", S_IRWXU) < 0)
|
|
|
|
printf("make dir /tmp/test_panel/a_subdir failed!\n");
|
|
|
|
fp = fopen("/tmp/test_panel/a_subdir/d_sub_file.txt", "w");
|
|
|
|
if (fp) fclose(fp);
|
|
|
|
fp = fopen("/tmp/test_panel/a_subdir/j_sub_file.txt", "w");
|
|
|
|
if (fp) fclose(fp);
|
|
|
|
}
|
|
|
|
|
2011-04-08 07:30:48 -07:00
|
|
|
static void
|
2014-03-17 17:50:31 -07:00
|
|
|
_fill_list(Evas_Object *obj, Elm_Genlist_Item_Class *itc)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
2012-02-12 14:35:56 -08:00
|
|
|
Eina_List *l;
|
2009-11-15 08:14:51 -08:00
|
|
|
char *real;
|
2012-02-12 14:35:56 -08:00
|
|
|
unsigned int x = 0;
|
2009-11-15 08:14:51 -08:00
|
|
|
|
2012-02-12 14:35:56 -08:00
|
|
|
if (!dirs)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
2018-01-10 22:47:19 -08:00
|
|
|
Eina_Iterator *it;
|
|
|
|
const char *name;
|
2015-02-11 05:53:40 -08:00
|
|
|
|
2018-12-05 12:54:38 -08:00
|
|
|
_create_dir_struct();
|
|
|
|
it = eina_file_ls("/tmp/test_panel");
|
2018-01-10 22:47:19 -08:00
|
|
|
EINA_ITERATOR_FOREACH(it, name)
|
|
|
|
{
|
|
|
|
if (x >= LIST_ITEM_MAX)
|
|
|
|
break;
|
|
|
|
if ((ecore_file_file_get(name)[0] != '.') &&
|
|
|
|
ecore_file_is_dir(name))
|
|
|
|
{
|
|
|
|
x++;
|
|
|
|
real = ecore_file_realpath(name);
|
|
|
|
dirs = eina_list_sorted_insert(dirs,
|
|
|
|
EINA_COMPARE_CB(strcoll),
|
|
|
|
real);
|
|
|
|
eina_stringshare_del(name);
|
|
|
|
}
|
2012-02-12 14:35:56 -08:00
|
|
|
}
|
2018-01-10 22:47:19 -08:00
|
|
|
eina_iterator_free(it);
|
2009-11-15 08:14:51 -08:00
|
|
|
}
|
2011-04-08 07:30:48 -07:00
|
|
|
EINA_LIST_FOREACH(dirs, l, real)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
|
|
|
Eina_Bool result = EINA_FALSE;
|
|
|
|
|
|
|
|
result = _dir_has_subs(real);
|
2011-04-08 07:30:48 -07:00
|
|
|
if (!result)
|
2014-03-17 17:50:31 -07:00
|
|
|
elm_genlist_item_append(obj, itc, eina_stringshare_add(real),
|
2009-11-15 08:14:51 -08:00
|
|
|
NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
2011-04-08 07:30:48 -07:00
|
|
|
else
|
2014-03-17 17:50:31 -07:00
|
|
|
elm_genlist_item_append(obj, itc, eina_stringshare_add(real),
|
2012-03-07 04:57:13 -08:00
|
|
|
NULL, ELM_GENLIST_ITEM_TREE,
|
2009-11-15 08:14:51 -08:00
|
|
|
NULL, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-08 07:30:48 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_dir_has_subs(const char *path)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
2018-01-10 22:47:19 -08:00
|
|
|
Eina_Iterator *it;
|
|
|
|
const char *name;
|
2009-11-15 08:14:51 -08:00
|
|
|
Eina_Bool result = EINA_FALSE;
|
|
|
|
|
2018-01-10 22:47:19 -08:00
|
|
|
it = eina_file_ls(path);
|
|
|
|
EINA_ITERATOR_FOREACH(it, name)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
2018-01-10 22:47:19 -08:00
|
|
|
Eina_Bool is_dir;
|
2009-11-15 08:14:51 -08:00
|
|
|
|
2018-01-10 22:47:19 -08:00
|
|
|
is_dir = ecore_file_is_dir(name);
|
|
|
|
eina_stringshare_del(name);
|
|
|
|
if (is_dir)
|
2009-11-15 08:14:51 -08:00
|
|
|
{
|
|
|
|
result = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2018-01-10 22:47:19 -08:00
|
|
|
eina_iterator_free(it);
|
2009-11-15 08:14:51 -08:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
static void
|
|
|
|
_free_dirs(void)
|
|
|
|
{
|
|
|
|
char *dir;
|
|
|
|
EINA_LIST_FREE(dirs, dir)
|
|
|
|
free(dir);
|
|
|
|
}
|
|
|
|
|
2010-05-25 20:08:10 -07:00
|
|
|
void
|
2013-08-31 18:18:03 -07:00
|
|
|
test_panel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2010-05-25 20:08:10 -07:00
|
|
|
{
|
2014-03-14 00:49:59 -07:00
|
|
|
Evas_Object *win, *panel, *tb, *vbx, *toolbar, *photo;
|
2010-05-25 20:08:10 -07:00
|
|
|
Evas_Object *list;
|
2014-03-17 17:50:31 -07:00
|
|
|
Elm_Genlist_Item_Class *itc = NULL;
|
|
|
|
char buf[PATH_MAX] = { 0 };
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2012-04-01 23:20:28 -07:00
|
|
|
win = elm_win_util_standard_add("panel", "Panel");
|
2011-07-25 07:22:19 -07:00
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
2010-05-25 20:08:10 -07:00
|
|
|
|
|
|
|
vbx = elm_box_add(win);
|
|
|
|
evas_object_size_hint_weight_set(vbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2012-11-14 02:49:45 -08:00
|
|
|
elm_win_resize_object_add(win, vbx);
|
2010-05-25 20:08:10 -07:00
|
|
|
evas_object_show(vbx);
|
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
// top panel
|
2012-03-26 23:47:07 -07:00
|
|
|
panel = elm_panel_add(vbx);
|
2010-05-27 02:03:22 -07:00
|
|
|
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_TOP);
|
|
|
|
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, 0);
|
|
|
|
evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2014-03-17 17:50:31 -07:00
|
|
|
elm_box_pack_end(vbx, panel);
|
|
|
|
evas_object_show(panel);
|
2010-05-27 02:03:22 -07:00
|
|
|
|
2012-03-26 23:47:07 -07:00
|
|
|
toolbar = elm_toolbar_add(panel);
|
2014-01-07 15:23:58 -08:00
|
|
|
elm_toolbar_homogeneous_set(toolbar, EINA_FALSE);
|
2012-01-05 22:42:10 -08:00
|
|
|
elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_NONE);
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
elm_toolbar_item_append(toolbar, "home", "Hello", _tstatus, panel);
|
2011-10-28 21:32:24 -07:00
|
|
|
elm_object_content_set(panel, toolbar);
|
2014-03-17 17:50:31 -07:00
|
|
|
evas_object_show(toolbar);
|
|
|
|
|
|
|
|
tb = elm_table_add(win);
|
|
|
|
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_box_pack_end(vbx, tb);
|
|
|
|
evas_object_show(tb);
|
2010-05-27 02:03:22 -07:00
|
|
|
|
2014-03-14 00:49:59 -07:00
|
|
|
photo = elm_photo_add(tb);
|
2014-03-17 17:50:31 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
|
|
|
|
elm_photo_file_set(photo, buf);
|
2014-03-14 00:49:59 -07:00
|
|
|
elm_photo_fill_inside_set(photo, EINA_TRUE);
|
|
|
|
elm_object_style_set(photo, "shadow");
|
|
|
|
evas_object_size_hint_weight_set(photo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(photo, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
elm_table_pack(tb, photo, 0, 0, 4, 5);
|
|
|
|
evas_object_show(photo);
|
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
// left panel
|
2014-03-14 00:49:59 -07:00
|
|
|
panel = elm_panel_add(tb);
|
2010-05-25 20:08:10 -07:00
|
|
|
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT);
|
|
|
|
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2012-06-29 23:42:18 -07:00
|
|
|
evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2014-03-17 17:50:31 -07:00
|
|
|
elm_table_pack(tb, panel, 0, 0, 2, 4);
|
|
|
|
evas_object_show(panel);
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
itc = elm_genlist_item_class_new();
|
|
|
|
itc->item_style = "default";
|
|
|
|
itc->func.text_get = _text_get;
|
|
|
|
itc->func.content_get = _content_get;
|
|
|
|
itc->func.state_get = _state_get;
|
|
|
|
itc->func.del = _item_del;
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2012-03-26 23:47:07 -07:00
|
|
|
list = elm_genlist_add(panel);
|
2010-05-25 20:08:10 -07:00
|
|
|
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2011-10-28 21:32:24 -07:00
|
|
|
elm_object_content_set(panel, list);
|
2014-03-17 17:50:31 -07:00
|
|
|
evas_object_show(list);
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
_fill_list(list, itc);
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
// right panel
|
2014-03-14 00:49:59 -07:00
|
|
|
panel = elm_panel_add(tb);
|
2010-05-25 20:08:10 -07:00
|
|
|
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_RIGHT);
|
|
|
|
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2012-06-29 23:42:18 -07:00
|
|
|
evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2010-09-27 14:13:32 -07:00
|
|
|
elm_panel_hidden_set(panel, EINA_TRUE);
|
2014-03-17 17:50:31 -07:00
|
|
|
elm_table_pack(tb, panel, 2, 0, 2, 4);
|
|
|
|
evas_object_show(panel);
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2012-03-26 23:47:07 -07:00
|
|
|
list = elm_genlist_add(panel);
|
2010-05-25 20:08:10 -07:00
|
|
|
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2011-10-28 21:32:24 -07:00
|
|
|
elm_object_content_set(panel, list);
|
2014-03-17 17:50:31 -07:00
|
|
|
evas_object_show(list);
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
_fill_list(list, itc);
|
|
|
|
elm_genlist_item_class_free(itc);
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
_free_dirs();
|
2010-05-25 20:08:10 -07:00
|
|
|
|
2014-03-17 17:50:31 -07:00
|
|
|
// bottom panel
|
2012-03-26 23:47:07 -07:00
|
|
|
panel = elm_panel_add(vbx);
|
2010-05-27 02:03:22 -07:00
|
|
|
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_BOTTOM);
|
|
|
|
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, 0);
|
|
|
|
evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2010-09-27 14:13:32 -07:00
|
|
|
elm_panel_hidden_set(panel, EINA_TRUE);
|
2014-03-17 17:50:31 -07:00
|
|
|
elm_table_pack(tb, panel, 0, 4, 4, 1);
|
|
|
|
evas_object_show(panel);
|
2010-05-27 02:03:22 -07:00
|
|
|
|
2012-03-26 23:47:07 -07:00
|
|
|
toolbar = elm_toolbar_add(panel);
|
2014-01-07 15:23:58 -08:00
|
|
|
elm_toolbar_homogeneous_set(toolbar, EINA_FALSE);
|
2012-01-05 22:42:10 -08:00
|
|
|
elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_NONE);
|
2010-05-25 20:08:10 -07:00
|
|
|
evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND, 0);
|
|
|
|
evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
Change toolbar API for consistency with other widgets
BIG FAT WARNING: lots of changes on toolbar API
Trying to get a lib with easy to use API, I'm changing toolbar API
to be consistent with genlist / gengrid widgets and to be more concise.
Functions select_next, select_first, select_last, unselect, unselect_all
get all are gone.
You can do this calling a combination of the others functions.
This commit changes toolbar to use inlist, and previous items can be
get.
So now we have:
Elm_Toolbar_Item *elm_toolbar_first_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_last_item_get(const Evas_Object *obj)
Elm_Toolbar_Item *elm_toolbar_item_next_get(const Elm_Toolbar_Item *it)
Elm_Toolbar_Item *elm_toolbar_item_prev_get(const Elm_Toolbar_Item *it)
Eina_Bool elm_toolbar_item_selected_get(const Elm_Toolbar_Item)
void elm_toolbar_item_selected_set(Elm_Toolbar_Item *item, Eina_Bool selected)
Elm_Toolbar_Item *elm_toolbar_selected_item_get(const Evas_Object *obj)
With these functions you can iterate over the items list getting /
selecting the item you need.
Another big change is that elm_toolbar_item_add is gone. Now you can
insert items in the position you want, with the functions append,
prepend, insert after, insert before (a relative item).
If you don't like any changes or have a case of use for something
that should be different, please ping me.
At last, includes ELM_TOOLBAR_ITEM_CHECK_OR_RETURN on EAPI that
receives items.
SVN revision: 53894
2010-10-26 03:29:24 -07:00
|
|
|
elm_toolbar_item_append(toolbar, "home", "Hello", _bstatus, panel);
|
2011-10-28 21:32:24 -07:00
|
|
|
elm_object_content_set(panel, toolbar);
|
2014-03-17 17:50:31 -07:00
|
|
|
evas_object_show(toolbar);
|
2010-05-25 20:08:10 -07:00
|
|
|
|
|
|
|
evas_object_resize(win, 320, 400);
|
|
|
|
evas_object_show(win);
|
|
|
|
}
|
2014-07-06 23:08:45 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *panel = data;
|
|
|
|
elm_panel_toggle(panel);
|
|
|
|
}
|
|
|
|
|
2017-06-08 00:00:20 -07:00
|
|
|
static void
|
|
|
|
_toggled_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *list;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!elm_check_state_get(data)) return;
|
|
|
|
|
|
|
|
list = elm_object_content_get(obj);
|
|
|
|
evas_object_del(list);
|
|
|
|
|
|
|
|
list = elm_list_add(obj);
|
|
|
|
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
elm_list_item_append(list, "panel list item", NULL, NULL, NULL, NULL);
|
|
|
|
elm_object_content_set(obj, list);
|
|
|
|
|
|
|
|
printf("Panel toggled:%s\n", elm_panel_hidden_get(obj) ? "hidden" : "visible");
|
|
|
|
}
|
|
|
|
|
2015-02-20 20:38:13 -08:00
|
|
|
static void
|
|
|
|
_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
elm_config_scroll_thumbscroll_enabled_set(elm_check_state_get(obj));
|
|
|
|
}
|
|
|
|
|
2014-07-06 23:08:45 -07:00
|
|
|
void
|
|
|
|
test_panel2(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
2015-02-20 20:38:13 -08:00
|
|
|
Evas_Object *win, *box, *label, *check, *table, *panel, *list, *button;
|
2014-07-06 23:08:45 -07:00
|
|
|
int i;
|
|
|
|
|
|
|
|
// Left Panel
|
|
|
|
win = elm_win_util_standard_add("panel", "Left Panel");
|
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
|
|
|
evas_object_resize(win, 320, 400);
|
|
|
|
evas_object_show(win);
|
|
|
|
|
|
|
|
// box for button and table
|
|
|
|
box = elm_box_add(win);
|
|
|
|
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_show(box);
|
|
|
|
elm_win_resize_object_add(win, box);
|
|
|
|
|
2015-02-20 20:38:13 -08:00
|
|
|
// label
|
|
|
|
label = elm_label_add(box);
|
|
|
|
elm_object_text_set(label, "You should enable thumb scroll to use scrollable panel.<br/>"
|
|
|
|
"Check below or enable thumb scroll in elementary_config.");
|
|
|
|
evas_object_show(label);
|
|
|
|
elm_box_pack_end(box, label);
|
|
|
|
|
|
|
|
// check
|
|
|
|
check = elm_check_add(box);
|
|
|
|
elm_check_state_set(check, elm_config_scroll_thumbscroll_enabled_get());
|
|
|
|
elm_object_text_set(check, "Enable thumb scroll (temporarily)");
|
|
|
|
evas_object_show(check);
|
|
|
|
elm_box_pack_end(box, check);
|
|
|
|
|
|
|
|
evas_object_smart_callback_add(check, "changed", _changed_cb, NULL);
|
|
|
|
|
2017-06-08 00:00:20 -07:00
|
|
|
check = elm_check_add(box);
|
|
|
|
elm_object_text_set(check, "Reset content on toggle");
|
|
|
|
evas_object_show(check);
|
|
|
|
elm_box_pack_end(box, check);
|
|
|
|
|
2014-07-06 23:08:45 -07:00
|
|
|
// toggle button
|
|
|
|
button = elm_button_add(box);
|
|
|
|
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
|
|
|
|
evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(button);
|
|
|
|
elm_object_text_set(button, "Toggle");
|
|
|
|
elm_box_pack_end(box, button);
|
|
|
|
|
|
|
|
// table for panel and center content
|
|
|
|
table = elm_table_add(win);
|
|
|
|
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(table);
|
|
|
|
elm_box_pack_end(box, table);
|
|
|
|
|
|
|
|
// center content
|
|
|
|
list = elm_list_add(table);
|
|
|
|
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(list);
|
|
|
|
for (i = 0; i < 20; i++)
|
|
|
|
elm_list_item_append(list, "center list item", NULL, NULL, NULL, NULL);
|
|
|
|
elm_table_pack(table, list, 0, 0, 1, 1);
|
|
|
|
|
|
|
|
// panel
|
|
|
|
panel = elm_panel_add(table);
|
|
|
|
evas_object_size_hint_weight_set(panel, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(panel, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
evas_object_show(panel);
|
|
|
|
elm_table_pack(table, panel, 0, 0, 1, 1);
|
|
|
|
|
|
|
|
elm_panel_scrollable_set(panel, EINA_TRUE);
|
|
|
|
elm_panel_orient_set(panel, ELM_PANEL_ORIENT_LEFT);
|
|
|
|
elm_panel_hidden_set(panel, EINA_TRUE);
|
|
|
|
elm_panel_scrollable_content_size_set(panel, 0.75);
|
|
|
|
|
|
|
|
list = elm_list_add(panel);
|
|
|
|
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
for (i = 0; i < 7; i++)
|
|
|
|
elm_list_item_append(list, "panel list item", NULL, NULL, NULL, NULL);
|
|
|
|
elm_object_content_set(panel, list);
|
|
|
|
|
2017-06-08 00:00:20 -07:00
|
|
|
evas_object_smart_callback_add(panel, "toggled", _toggled_cb, check);
|
2014-07-06 23:08:45 -07:00
|
|
|
evas_object_smart_callback_add(button, "clicked", _clicked_cb, panel);
|
|
|
|
}
|