forked from enlightenment/efl
parent
347e702f87
commit
56bb7d664a
|
@ -67,7 +67,11 @@ outdent-top.png \
|
|||
outdent-bottom.png \
|
||||
updown.png \
|
||||
leftright.png \
|
||||
hoversel_entry_bg.png
|
||||
hoversel_entry_bg.png \
|
||||
bt_dis_shine.png \
|
||||
icon_left_arrow.png \
|
||||
icon_right_arrow.png \
|
||||
toolbar_sel.png
|
||||
|
||||
default.edj: Makefile $(EXTRA_DIST)
|
||||
$(EDJE_CC) $(EDJE_FLAGS) \
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -4439,84 +4439,265 @@ collections {
|
|||
image.normal: "icon_arrow_right.png"; } } } }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
group { name: "elm/contact/base/default";
|
||||
group { name: "elm/toolbar/base/default";
|
||||
images {
|
||||
image: "bt_base1.png" COMP;
|
||||
image: "bt_base2.png" COMP;
|
||||
image: "bt_hilight.png" COMP;
|
||||
image: "bt_shine.png" COMP;
|
||||
image: "bt_dis_base.png" COMP;
|
||||
image: "bt_dis_hilight.png" COMP;
|
||||
image: "bt_dis_shine.png" COMP;
|
||||
image: "icon_left_arrow.png" COMP;
|
||||
image: "icon_right_arrow.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "button_image";
|
||||
mouse_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
image {
|
||||
normal: "bt_base2.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
description { state: "clicked" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
image.normal: "bt_base1.png";
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.content";
|
||||
type: SWALLOW;
|
||||
type: RECT;
|
||||
description { state: "default" 0.0;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: VERTICAL;
|
||||
align: 0.0 0.5;
|
||||
rel1.offset: 4 4;
|
||||
rel2.offset: 4 -5;
|
||||
rel2.relative: 0.0 1.0;
|
||||
color: 255 0 0 128;
|
||||
}
|
||||
}
|
||||
part {
|
||||
name: "elm.text";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
align: 0.0 1.0;
|
||||
rel1.to_x: "elm.swallow.content";
|
||||
rel1.relative: 1.0 1.0;
|
||||
rel1.offset: 0 -5;
|
||||
rel2.offset: -5 -5;
|
||||
color: 224 224 224 255;
|
||||
color3: 0 0 0 64;
|
||||
text {
|
||||
text: "Name of Contact goes here";
|
||||
font: "Sans:style=Bold,Edje-Vera-Bold";
|
||||
size: 10;
|
||||
min: 0 1;
|
||||
align: 0.0 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "over1";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
rel2.relative: 1.0 0.5;
|
||||
image {
|
||||
normal: "bt_hilight.png";
|
||||
border: 7 7 7 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "over2";
|
||||
mouse_events: 1;
|
||||
repeat_events: 1;
|
||||
part { name: "base";
|
||||
mouse_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 2 2;
|
||||
}
|
||||
rel2.offset: -3 -3;
|
||||
image {
|
||||
normal: "bt_dis_base.png";
|
||||
border: 4 4 4 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "clipper";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "base";
|
||||
offset: 2 2;
|
||||
}
|
||||
rel2 {
|
||||
to: "base";
|
||||
offset: -3 -3;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.content";
|
||||
clip_to: "clipper";
|
||||
type: SWALLOW;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1.to: "clipper";
|
||||
rel2.to: "clipper";
|
||||
}
|
||||
}
|
||||
part { name: "over2";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "base";
|
||||
rel2.to: "base";
|
||||
image {
|
||||
normal: "bt_dis_shine.png";
|
||||
border: 4 4 4 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "over1";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "base";
|
||||
rel2.to: "base";
|
||||
rel2.relative: 1.0 0.5;
|
||||
image {
|
||||
normal: "bt_dis_hilight.png";
|
||||
border: 4 4 4 0;
|
||||
}
|
||||
color: 255 255 255 128;
|
||||
}
|
||||
}
|
||||
part { name: "left_arrow";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
image.normal: "icon_left_arrow.png";
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: VERTICAL;
|
||||
align: 0.0 0.5;
|
||||
min: 32 32;
|
||||
max: 32 32;
|
||||
}
|
||||
description { state: "hidden" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
}
|
||||
part { name: "right_arrow";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
image.normal: "icon_right_arrow.png";
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: VERTICAL;
|
||||
align: 1.0 0.5;
|
||||
min: 32 32;
|
||||
max: 32 32;
|
||||
}
|
||||
description { state: "hidden" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
}
|
||||
part { name: "event";
|
||||
type: RECT;
|
||||
mouse_events: 1;
|
||||
repeat_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program { name: "sb_hbar_show";
|
||||
signal: "elm,action,show,hbar";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LINEAR 0.5;
|
||||
target: "left_arrow";
|
||||
target: "right_arrow";
|
||||
}
|
||||
program { name: "sb_hbar_hide";
|
||||
signal: "elm,action,hide,hbar";
|
||||
source: "elm";
|
||||
action: STATE_SET "hidden" 0.0;
|
||||
target: "left_arrow";
|
||||
target: "right_arrow";
|
||||
transition: LINEAR 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group { name: "elm/toolbar/item/default";
|
||||
images {
|
||||
image: "toolbar_sel.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "label2";
|
||||
type: TEXT;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
align: 0.5 1.0;
|
||||
fixed: 0 1;
|
||||
rel1.to: "elm.text";
|
||||
rel2.to: "elm.text";
|
||||
color: 0 0 0 255;
|
||||
text {
|
||||
font: "Sans";
|
||||
text_source: "elm.text";
|
||||
size: 10;
|
||||
min: 1 1;
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
description { state: "selected" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
part { name: "bg";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
color: 255 255 255 0;
|
||||
image {
|
||||
normal: "toolbar_sel.png";
|
||||
border: 3 3 0 0;
|
||||
}
|
||||
fill.smooth: 0;
|
||||
}
|
||||
description { state: "selected" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
color: 255 255 255 255;
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.icon";
|
||||
type: SWALLOW;
|
||||
description { state: "default" 0.0;
|
||||
align: 0.5 0.5;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: VERTICAL;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 2 2;
|
||||
}
|
||||
rel2 {
|
||||
to_y: "elm.text";
|
||||
relative: 1.0 0.0;
|
||||
offset: -3 -1;
|
||||
}
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
}
|
||||
part { name: "elm.text";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
align: 0.5 1.0;
|
||||
fixed: 0 1;
|
||||
rel1 {
|
||||
relative: 0.0 1.0;
|
||||
offset: 0 -1;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
visible: 0;
|
||||
color: 224 224 224 255;
|
||||
color3: 0 0 0 32;
|
||||
text {
|
||||
font: "Sans:style=Bold";
|
||||
size: 10;
|
||||
min: 1 1;
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
description { state: "selected" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
}
|
||||
}
|
||||
part { name: "event";
|
||||
type: RECT;
|
||||
mouse_events: 1;
|
||||
ignore_flags: ON_HOLD;
|
||||
description { state: "default" 0.0;
|
||||
image {
|
||||
normal: "bt_shine.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
description { state: "default" 0.0;
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program { name: "go_active";
|
||||
signal: "elm,state,selected";
|
||||
source: "elm";
|
||||
action: STATE_SET "selected" 0.0;
|
||||
target: "bg";
|
||||
target: "elm.text";
|
||||
target: "label2";
|
||||
transition: LINEAR 0.2;
|
||||
}
|
||||
program { name: "go_passive";
|
||||
signal: "elm,state,unselected";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "bg";
|
||||
target: "elm.text";
|
||||
target: "label2";
|
||||
transition: LINEAR 0.1;
|
||||
}
|
||||
program { name: "go";
|
||||
signal: "mouse,up,1";
|
||||
source: "event";
|
||||
action: SIGNAL_EMIT "elm,action,click" "elm";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -1247,6 +1247,63 @@ my_bt_17(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_show(win);
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_18(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win, *bg, *bx, *tb, *ic;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
win = elm_win_add(NULL, "toolbar", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Toolbar");
|
||||
elm_win_autodel_set(win, 1);
|
||||
|
||||
bg = elm_bg_add(win);
|
||||
elm_win_resize_object_add(win, bg);
|
||||
evas_object_size_hint_weight_set(bg, 1.0, 1.0);
|
||||
evas_object_show(bg);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
elm_win_resize_object_add(win, bx);
|
||||
evas_object_size_hint_weight_set(bx, 1.0, 1.0);
|
||||
evas_object_show(bx);
|
||||
|
||||
tb = elm_toolbar_add(win);
|
||||
evas_object_size_hint_weight_set(tb, 0.0, 0.0);
|
||||
evas_object_size_hint_align_set(tb, -1.0, 0.0);
|
||||
|
||||
ic = elm_icon_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||
elm_icon_file_set(ic, buf, NULL);
|
||||
elm_toolbar_item_add(tb, ic, "Hello", NULL, NULL);
|
||||
|
||||
ic = elm_icon_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||
elm_icon_file_set(ic, buf, NULL);
|
||||
elm_toolbar_item_add(tb, ic, "World", NULL, NULL);
|
||||
|
||||
ic = elm_icon_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||
elm_icon_file_set(ic, buf, NULL);
|
||||
elm_toolbar_item_add(tb, ic, "Here", NULL, NULL);
|
||||
|
||||
ic = elm_icon_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||
elm_icon_file_set(ic, buf, NULL);
|
||||
elm_toolbar_item_add(tb, ic, "Comes", NULL, NULL);
|
||||
|
||||
ic = elm_icon_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||
elm_icon_file_set(ic, buf, NULL);
|
||||
elm_toolbar_item_add(tb, ic, "Elementary", NULL, NULL);
|
||||
|
||||
elm_box_pack_end(bx, tb);
|
||||
evas_object_show(tb);
|
||||
|
||||
evas_object_resize(win, 320, 300);
|
||||
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
static void
|
||||
my_win_main(void)
|
||||
{
|
||||
|
@ -1459,6 +1516,13 @@ my_win_main(void)
|
|||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Toolbar");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_bt_18, NULL);
|
||||
evas_object_size_hint_align_set(bt, -1.0, 0.0);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
/* set an initial window size */
|
||||
evas_object_resize(win, 320, 520);
|
||||
/* show the window */
|
||||
|
|
|
@ -326,7 +326,14 @@ extern "C" {
|
|||
EAPI void elm_hoversel_hover_end(Evas_Object *obj);
|
||||
EAPI Elm_Hoversel_Item *elm_hoversel_item_add(Evas_Object *obj, const char *label, const char *icon_file, Elm_Icon_Type icon_type, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
||||
EAPI void elm_hoversel_item_del(Elm_Hoversel_Item *item);
|
||||
|
||||
|
||||
typedef struct _Elm_Toolbar_Item Elm_Toolbar_Item;
|
||||
EAPI Evas_Object *elm_toolbar_add(Evas_Object *parent);
|
||||
EAPI Elm_Toolbar_Item *elm_toolbar_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data);
|
||||
EAPI void elm_toolbar_item_del(Elm_Toolbar_Item *item);
|
||||
EAPI void elm_toolbar_item_select(Elm_Toolbar_Item *item);
|
||||
EAPI void elm_toolbar_scrollable_set(Evas_Object *obj, Evas_Bool scrollable);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
/// FIXME: TODO LIST ///////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -372,6 +379,9 @@ extern "C" {
|
|||
// * dialpad widget - need one with a phone dialpad
|
||||
//
|
||||
//// (improvements - low priority)
|
||||
// * somehow a pdf(ps) viewer widget that doesnt make it gpl (lgpl)
|
||||
// * emotion widget?
|
||||
// * ewebkit widget
|
||||
// * need url and path entry modes for vkbd
|
||||
// * return list of toplevel window objects
|
||||
// * widgets should show who is focused (not useful for touchscreen)
|
||||
|
|
|
@ -35,6 +35,7 @@ elm_hover.c \
|
|||
elm_entry.c \
|
||||
elm_bubble.c \
|
||||
elm_photo.c \
|
||||
elm_toolbar.c \
|
||||
\
|
||||
elc_notepad.c \
|
||||
elc_anchorview.c \
|
||||
|
|
|
@ -127,19 +127,20 @@ elm_init(int argc, char **argv)
|
|||
int val = 1000;
|
||||
|
||||
ecore_x_init(NULL);
|
||||
if (!ecore_x_screen_is_composited(0))
|
||||
_elm_config->compositing = 0;
|
||||
_elm_atom_enlightenment_scale = ecore_x_atom_get("ENLIGHTENMENT_SCALE");
|
||||
ecore_x_event_mask_set(ecore_x_window_root_first_get(),
|
||||
ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
|
||||
_elm_event_property_change = ecore_event_handler_add
|
||||
(ECORE_X_EVENT_WINDOW_PROPERTY, _elm_window_property_change, NULL);
|
||||
/* FIXME if quickstart this happens in child */
|
||||
if (ecore_x_window_prop_card32_get(ecore_x_window_root_first_get(),
|
||||
_elm_atom_enlightenment_scale,
|
||||
&val, 1) > 0)
|
||||
{
|
||||
if (val > 0) _elm_config->scale = (double)val / 1000.0;
|
||||
}
|
||||
if (!ecore_x_screen_is_composited(0))
|
||||
_elm_config->compositing = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -147,6 +148,27 @@ elm_init(int argc, char **argv)
|
|||
{
|
||||
_elm_config->scale = atof(elm_scale);
|
||||
}
|
||||
/* FIXME: implement quickstart below */
|
||||
/* if !quickstart return
|
||||
* else
|
||||
* set up fast-start-fifo (in $ELM_FAST_START_FIFO)
|
||||
* sit on blocking read
|
||||
* read 2 bytes == length of data in bytes including nulls
|
||||
* read N bytes (must be < (page_size - 2))
|
||||
* format: exename\0exepath\0[arg1\0][arg2\0][...]
|
||||
* dlopen exepath
|
||||
* dlsym elm_main in exe
|
||||
* if (elm_main ! exists)
|
||||
* ecore_exe exename
|
||||
* else
|
||||
* fork()
|
||||
* [child]
|
||||
* call exit(elm_main());
|
||||
* [parent]
|
||||
* close x fd the nasty way (with close())
|
||||
* ecore_x_shutdown()
|
||||
* ecore_x_init() etc. etc. loop back to blocking on fifo read
|
||||
*/
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -28,7 +28,7 @@ static void
|
|||
_theme_hook(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
elm_smart_scroller_theme_set(wd->scr, "default");
|
||||
elm_smart_scroller_theme_set(wd->scr, "scroller", "base", "default");
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,235 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
typedef struct _Item Item;
|
||||
|
||||
struct _Widget_Data
|
||||
{
|
||||
Evas_Object *scr, *bx;
|
||||
Eina_List *items;
|
||||
int icon_size;
|
||||
Evas_Bool scrollable : 1;
|
||||
};
|
||||
|
||||
struct _Item
|
||||
{
|
||||
Evas_Object *obj;
|
||||
Evas_Object *base;
|
||||
const char *label;
|
||||
Evas_Object *icon;
|
||||
void (*func) (void *data, Evas_Object *obj, void *event_info);
|
||||
const void *data;
|
||||
Evas_Bool selected : 1;
|
||||
};
|
||||
|
||||
static void _del_hook(Evas_Object *obj);
|
||||
static void _theme_hook(Evas_Object *obj);
|
||||
static void _sizing_eval(Evas_Object *obj);
|
||||
static void _mouse_up(void *data, Evas_Object *obj, void *event_info);
|
||||
|
||||
static void
|
||||
_item_show(Item *it)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||
Evas_Coord x, y, w, h, bx, by;
|
||||
|
||||
evas_object_geometry_get(wd->bx, &bx, &by, NULL, NULL);
|
||||
evas_object_geometry_get(it->base, &x, &y, &w, &h);
|
||||
elm_smart_scroller_child_region_show(wd->scr, x - bx, y - by, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_del_hook(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
free(wd);
|
||||
}
|
||||
|
||||
static void
|
||||
_theme_hook(Evas_Object *obj)
|
||||
{
|
||||
// FIXME: re-eval icon and all min sizes
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_sizing_eval(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
|
||||
Evas_Coord vw = 0, vh = 0;
|
||||
|
||||
edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
|
||||
evas_object_resize(wd->scr, 500, 500);
|
||||
evas_object_size_hint_min_get(wd->bx, &minw, &minh);
|
||||
evas_object_resize(wd->bx, minw, minh);
|
||||
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
|
||||
if (wd->scrollable)
|
||||
{
|
||||
minw = 500 - vw;
|
||||
minh = minh + (500 - vh);
|
||||
}
|
||||
else
|
||||
{
|
||||
minw = minw + (500 - vw);
|
||||
minh = minh + (500 - vh);
|
||||
}
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
evas_object_size_hint_max_set(obj, maxw, maxh);
|
||||
}
|
||||
|
||||
static void
|
||||
_mouse_up(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
evas_object_smart_callback_call(data, "clicked", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
Evas_Coord mw, mh, vw, vh, w, h;
|
||||
Eina_List *l;
|
||||
Item *it;
|
||||
|
||||
elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
|
||||
evas_object_size_hint_min_get(wd->bx, &mw, &mh);
|
||||
evas_object_geometry_get(wd->bx, NULL, NULL, &w, &h);
|
||||
if (vw >= mw)
|
||||
{
|
||||
if (w != vw) evas_object_resize(wd->bx, vw, h);
|
||||
}
|
||||
for (l = wd->items; l; l = l->next)
|
||||
{
|
||||
it = l->data;
|
||||
if (it->selected)
|
||||
{
|
||||
_item_show(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
_select(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
Item *it = data, *it2;
|
||||
Widget_Data *wd = elm_widget_data_get(it->obj);
|
||||
Eina_List *l;
|
||||
if (it->selected) return;
|
||||
for (l = wd->items; l; l = l->next)
|
||||
{
|
||||
it2 = l->data;
|
||||
if (it2->selected)
|
||||
{
|
||||
it2->selected = 0;
|
||||
edje_object_signal_emit(it2->base, "elm,state,unselected", "elm");
|
||||
break;
|
||||
}
|
||||
}
|
||||
it->selected = 1;
|
||||
edje_object_signal_emit(it->base, "elm,state,selected", "elm");
|
||||
_item_show(it);
|
||||
if (it->func) it->func(it->data, it->obj, NULL);
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_toolbar_add(Evas_Object *parent)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
Evas *e;
|
||||
Widget_Data *wd;
|
||||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
obj = elm_widget_add(e);
|
||||
elm_widget_data_set(obj, wd);
|
||||
elm_widget_del_hook_set(obj, _del_hook);
|
||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_can_focus_set(obj, 0);
|
||||
|
||||
wd->scr = elm_smart_scroller_add(e);
|
||||
elm_smart_scroller_theme_set(wd->scr, "toolbar", "base", "default");
|
||||
elm_widget_resize_object_set(obj, wd->scr);
|
||||
elm_smart_scroller_policy_set(wd->scr,
|
||||
ELM_SMART_SCROLLER_POLICY_AUTO,
|
||||
ELM_SMART_SCROLLER_POLICY_OFF);
|
||||
|
||||
wd->icon_size = 32;
|
||||
wd->scrollable = 1;
|
||||
|
||||
wd->bx = _els_smart_box_add(e);
|
||||
_els_smart_box_orientation_set(wd->bx, 1);
|
||||
_els_smart_box_homogenous_set(wd->bx, 1);
|
||||
elm_widget_sub_object_add(obj, wd->bx);
|
||||
elm_smart_scroller_child_set(wd->scr, wd->bx);
|
||||
evas_object_show(wd->bx);
|
||||
|
||||
evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE,
|
||||
_resize, obj);
|
||||
|
||||
_sizing_eval(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
EAPI Elm_Toolbar_Item *
|
||||
elm_toolbar_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Coord mw, mh;
|
||||
Item *it = calloc(1, sizeof(Item));
|
||||
if (!it) return NULL;
|
||||
wd->items = eina_list_append(wd->items, it);
|
||||
it->obj = obj;
|
||||
it->label = eina_stringshare_add(label);
|
||||
it->icon = icon;
|
||||
it->func = func;
|
||||
it->data = data;
|
||||
it->base = edje_object_add(evas_object_evas_get(obj));
|
||||
_elm_theme_set(it->base, "toolbar", "item", "default");
|
||||
edje_object_signal_callback_add(it->base, "elm,action,click", "elm",
|
||||
_select, it);
|
||||
if (icon)
|
||||
{
|
||||
edje_extern_object_min_size_set(icon,
|
||||
(double)wd->icon_size * _elm_config->scale,
|
||||
(double)wd->icon_size * _elm_config->scale);
|
||||
edje_object_part_swallow(it->base, "elm.swallow.icon", icon);
|
||||
evas_object_show(icon);
|
||||
elm_widget_sub_object_add(obj, it->icon);
|
||||
}
|
||||
edje_object_part_text_set(it->base, "elm.text", label);
|
||||
edje_object_size_min_calc(it->base, &mw, &mh);
|
||||
evas_object_size_hint_weight_set(it->base, 0.0, 0.0);
|
||||
evas_object_size_hint_align_set(it->base, -1.0, -1.0);
|
||||
evas_object_size_hint_min_set(it->base, mw, mh);
|
||||
evas_object_size_hint_max_set(it->base, 9999, mh);
|
||||
_els_smart_box_pack_end(wd->bx, it->base);
|
||||
evas_object_show(it->base);
|
||||
elm_widget_sub_object_add(obj, it->base);
|
||||
_sizing_eval(obj);
|
||||
return (Elm_Toolbar_Item *)it;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_toolbar_item_del(Elm_Toolbar_Item *item)
|
||||
{
|
||||
// FIXME: remove item
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_toolbar_item_select(Elm_Toolbar_Item *item)
|
||||
{
|
||||
// FIXME select item
|
||||
// Widget_Data *wd = elm_widget_data_get(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_toolbar_scrollable_set(Evas_Object *obj, Evas_Bool scrollable)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
wd->scrollable = scrollable;
|
||||
_sizing_eval(obj);
|
||||
}
|
|
@ -338,10 +338,10 @@ elm_smart_scroller_single_dir_get(Evas_Object *obj)
|
|||
}
|
||||
|
||||
void
|
||||
elm_smart_scroller_theme_set(Evas_Object *obj, const char *style)
|
||||
elm_smart_scroller_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style)
|
||||
{
|
||||
API_ENTRY return;
|
||||
_elm_theme_set(sd->edje_obj, "scroller", "base", style);
|
||||
_elm_theme_set(sd->edje_obj, clas, group, style);
|
||||
if (sd->pan_obj)
|
||||
edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj);
|
||||
sd->vbar_visible = !sd->vbar_visible;
|
||||
|
|
|
@ -23,5 +23,4 @@ void elm_smart_scroller_policy_get (Evas_Object *obj, Elm_Smart_Scr
|
|||
Evas_Object *elm_smart_scroller_edje_object_get (Evas_Object *obj);
|
||||
void elm_smart_scroller_single_dir_set (Evas_Object *obj, Evas_Bool single_dir);
|
||||
Evas_Bool elm_smart_scroller_single_dir_get (Evas_Object *obj);
|
||||
void elm_smart_scroller_theme_set (Evas_Object *obj, const char *style);
|
||||
|
||||
void elm_smart_scroller_theme_set (Evas_Object *obj, const char *clas, const char *group, const char *style);
|
||||
|
|
Loading…
Reference in New Issue