+++ /dev/null
-images {
- image: "grid_bg.png" COMP;
-}
-
-collections {
- group { name: "main";
- parts {
- part { name: "Grid";
- type: IMAGE;
- description { state: "default" 0;
- image.normal: "grid_bg.png";
- }
- }
- part { name: "ColorPreview";
- type: SWALLOW;
- mouse_events: 0;
- description { state: "default" 0;
- }
- }
- }
- }
-}
+++ /dev/null
-/////////////////////////////////////////////////////////////////////////////
-// CURSOR
-/////////////////////////////////////////////////////////////////////////////
-collections {
- group { name: "elm/cursor/hand2/default";
- min: 30 30;
- max: 30 30;
- data {
- item: "hot_x" "0";
- item: "hot_y" "0";
- }
- parts {
- part { name: "base";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- color: 0 255 0 255;
- }
- }
- }
- }
-
- group { name: "elm/cursor/hand3/default";
- min: 30 30;
- max: 30 30;
- data {
- item: "hot_x" "0";
- item: "hot_y" "0";
- }
- parts {
- part { name: "base";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- color: 255 0 0 255;
- }
- description { state: "blue" 0.0;
- color: 0 0 255 255;
- }
- }
- }
- programs {
- program { name: "load";
- signal: "load";
- source: "";
- after: "go_blue";
- }
- program { name: "go_blue";
- action: STATE_SET "blue" 0.0;
- transition: LINEAR 1;
- target: "base";
- after: "go_red";
- }
- program { name: "go_red";
- action: STATE_SET "default" 0.0;
- transition: LINEAR 1;
- target: "base";
- after: "go_blue";
- }
- }
- }
-
- group { name: "elm/cursor/hand3/transparent";
- min: 30 30;
- max: 30 30;
- data {
- item: "hot_x" "0";
- item: "hot_y" "0";
- }
- parts {
- part { name: "base";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- color: 255 0 0 120;
- }
- }
- }
- }
-}
+++ /dev/null
-color_classes {
- color_class {
- name: "entry_text";
- color: 0 0 0 255;
- }
-}
-
-collections {
-
- group { name: "font_preview";
- parts {
-
- /* some fonts have weird alignments, thus they overflow badly */
- part { name: "clipper";
- type: RECT;
- description {
- state: "default" 0.0;
- }
- }
-
- part { name: "elm.text";
- type: TEXT;
- mouse_events: 0;
- scale: 1;
- clip_to: "clipper";
- description {
- state: "default" 0.0;
- color_class: "entry_text";
- text {
- font: "Sans";
- min: 0 1;
- size: 10;
- align: 0.5 0.5;
- text_class: "font_preview";
- }
- }
- }
- }
- }
-}
+++ /dev/null
-externals.external: "elm";
-
-#define SCROLLBARS_ADD() \
- images { \
- image: "bt_sm_base2.png" COMP; \
- image: "bt_sm_shine.png" COMP; \
- image: "bt_sm_hilight.png" COMP; \
- image: "sb_runnerh.png" COMP; \
- image: "sb_runnerv.png" COMP; \
- image: "arrow_up.png" COMP; \
- image: "arrow_down.png" COMP; \
- image: "arrow_right.png" COMP; \
- image: "arrow_left.png" COMP; \
- } \
- script { \
- public sbvis_v, sbvis_h; \
- } \
- part { name: "elm.scrollbar.base"; \
- type: SWALLOW; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- min: 0 0; \
- fixed: 1 1; \
- align: 0.0 0.0; \
- rel1.relative: 1.0 1.0; \
- } \
- description { state: "vertical" 0.0; \
- inherit: "default" 0.0; \
- min: 17 0; \
- align: 1.0 0.0; \
- } \
- description { state: "horizontal" 0.0; \
- inherit: "default" 0.0; \
- min: 0 17; \
- align: 0.0 1.0; \
- } \
- description { state: "both" 0.0; \
- inherit: "default" 0.0; \
- min: 17 17; \
- align: 1.0 1.0; \
- } \
- } \
- part { name: "sb_vbar_clip_master"; \
- type: RECT; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- } \
- description { state: "hidden" 0.0; \
- visible: 0; \
- } \
- } \
- part { name: "sb_vbar_clip"; \
- type: RECT; \
- mouse_events: 0; \
- clip_to: "sb_vbar_clip_master"; \
- description { state: "default" 0.0; \
- rel1.to: "sb_vbar_clip_master"; \
- rel2.to: "sb_vbar_clip_master"; \
- } \
- description { state: "hidden" 0.0; \
- inherit: "default" 0.0; \
- visible: 0; \
- max: 0 99999; \
- } \
- } \
- part { name: "sb_vbar"; \
- type: RECT; \
- mouse_events: 0; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- min: 17 0; \
- fixed: 1 1; \
- color: 0 0 0 0; \
- align: 0.5 0.5; \
- rel1 { \
- to_y: "sb_vbar_a1"; \
- to_x: "elm.scrollbar.base"; \
- relative: 0.0 1.0; \
- offset: 0 -1; \
- } \
- rel2 { \
- to_y: "sb_vbar_a2"; \
- relative: 1.0 0.0; \
- offset: -1 -2; \
- } \
- } \
- } \
- part { name: "sb_vbar_runner"; \
- mouse_events: 0; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- min: 3 0; \
- max: 3 99999; \
- fixed: 1 1; \
- align: 1.0 0.5; \
- rel1 { \
- to: "sb_vbar"; \
- relative: 0.5 0.0; \
- offset: 0 2; \
- } \
- rel2 { \
- to: "sb_vbar"; \
- relative: 0.5 1.0; \
- offset: 0 -2; \
- } \
- image { \
- normal: "sb_runnerv.png"; \
- border: 0 0 4 4; \
- } \
- fill.smooth: 0; \
- } \
- } \
- part { name: "sb_vbar_p1"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- color: 0 0 0 0; \
- fixed: 1 1; \
- rel1 { \
- to: "sb_vbar_a1"; \
- relative: 0.0 1.0; \
- } \
- rel2 { \
- to: "elm.dragable.vbar"; \
- relative: 1.0 0.0; \
- } \
- } \
- } \
- part { name: "sb_vbar_p2"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- color: 0 0 0 0; \
- fixed: 1 1; \
- rel1 { \
- to: "elm.dragable.vbar"; \
- relative: 0.0 1.0; \
- } \
- rel2 { \
- to: "sb_vbar_a2"; \
- relative: 1.0 0.0; \
- } \
- } \
- } \
- part { name: "sb_vbar_a1"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- min: 17 17; \
- fixed: 1 1; \
- align: 0.5 0.0; \
- aspect: 1.0 1.0; \
- aspect_preference: HORIZONTAL; \
- color: 0 0 0 0; \
- rel1 { \
- to_y: "sb_vbar_clip"; \
- to_x: "elm.scrollbar.base"; \
- relative: 0.0 0.0; \
- offset: 0 1; \
- } \
- rel2 { \
- to: "elm.scrollbar.base"; \
- relative: 1.0 0.0; \
- offset: -1 -2; \
- } \
- } \
- } \
- part { name: "sb_vbar_a1_arrow"; \
- mouse_events: 0; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- rel1.to: "sb_vbar_a1"; \
- rel2.to: "sb_vbar_a1"; \
- image.normal: "arrow_up.png"; \
- } \
- description { state: "clicked" 0.0; \
- inherit: "default" 0.0; \
- rel1.offset: 0 -1; \
- rel2.offset: -1 -2; \
- } \
- } \
- part { name: "sb_vbar_a2"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- min: 17 17; \
- fixed: 1 1; \
- align: 0.5 1.0; \
- aspect: 1.0 1.0; \
- aspect_preference: HORIZONTAL; \
- color: 0 0 0 0; \
- rel1.to: "elm.scrollbar.base"; \
- rel2 { \
- to: "elm.scrollbar.base"; \
- relative: 1.0 0.0; \
- } \
- } \
- } \
- part { name: "sb_vbar_a2_arrow"; \
- mouse_events: 0; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- rel1.to: "sb_vbar_a2"; \
- rel2.to: "sb_vbar_a2"; \
- image.normal: "arrow_down.png"; \
- } \
- description { state: "clicked" 0.0; \
- inherit: "default" 0.0; \
- rel1.offset: 0 1; \
- rel2.offset: -1 0; \
- } \
- } \
- part { name: "elm.dragable.vbar"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_vbar_clip"; \
- dragable { \
- x: 0 0 0; \
- y: 1 1 0; \
- confine: "sb_vbar"; \
- } \
- description { state: "default" 0.0; \
- min: 17 17; \
- fixed: 1 1; \
- aspect: 1.0 0.5; \
- aspect_preference: VERTICAL; \
- align: 0.5 0.0; \
- color: 0 0 0 0; \
- rel1 { \
- to_y: "sb_vbar"; \
- to_x: "elm.scrollbar.base"; \
- relative: 0.0 0.0; \
- } \
- rel2.to_y: "sb_vbar"; \
- } \
- } \
- part { name: "elm.dragable.vbar.image"; \
- mouse_events: 0; \
- clip_to: "sb_vbar_clip"; \
- description { state: "default" 0.0; \
- rel1.to: "elm.dragable.vbar"; \
- rel2.to: "elm.dragable.vbar"; \
- image { \
- normal: "bt_sm_base2.png"; \
- border: 6 6 6 6; \
- } \
- } \
- } \
- part { name: "sb_vbar_over1"; \
- clip_to: "sb_vbar_clip"; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- rel1.to: "elm.dragable.vbar.image"; \
- rel2 { \
- to: "elm.dragable.vbar.image"; \
- relative: 1.0 0.5; \
- } \
- image { \
- normal: "bt_sm_hilight.png"; \
- border: 6 6 6 0; \
- } \
- } \
- } \
- part { name: "sb_vbar_over2"; \
- clip_to: "sb_vbar_clip"; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- rel1.to: "elm.dragable.vbar.image"; \
- rel2.to: "elm.dragable.vbar.image"; \
- image { \
- normal: "bt_sm_shine.png"; \
- border: 6 6 6 0; \
- } \
- } \
- } \
- part { name: "sb_hbar_clip_master"; \
- type: RECT; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- } \
- description { state: "hidden" 0.0; \
- visible: 0; \
- } \
- } \
- part { name: "sb_hbar_clip"; \
- type: RECT; \
- mouse_events: 0; \
- clip_to: "sb_hbar_clip_master"; \
- description { state: "default" 0.0; \
- rel1.to: "sb_hbar_clip_master"; \
- rel2.to: "sb_hbar_clip_master"; \
- } \
- description { state: "hidden" 0.0; \
- inherit: "default" 0.0; \
- visible: 0; \
- max: 99999 0; \
- } \
- } \
- part { name: "sb_hbar"; \
- type: RECT; \
- mouse_events: 0; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- min: 0 17; \
- fixed: 1 1; \
- color: 0 0 0 0; \
- align: 0.5 0.5; \
- rel1 { \
- to_x: "sb_hbar_a1"; \
- to_y: "elm.scrollbar.base"; \
- relative: 1.0 0.0; \
- offset: -1 0; \
- } \
- rel2 { \
- to_x: "sb_hbar_a2"; \
- relative: 0.0 1.0; \
- offset: -2 -1; \
- } \
- } \
- } \
- part { name: "sb_hbar_runner"; \
- mouse_events: 0; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- min: 0 3; \
- max: 99999 3; \
- fixed: 1 1; \
- align: 0.5 0.5; \
- rel1 { \
- to: "sb_hbar"; \
- relative: 0.0 0.5; \
- offset: 2 0; \
- } \
- rel2 { \
- to: "sb_hbar"; \
- relative: 1.0 0.5; \
- offset: -2 0; \
- } \
- image { \
- normal: "sb_runnerh.png"; \
- border: 4 4 0 0; \
- } \
- fill.smooth: 0; \
- } \
- } \
- part { name: "elm.dragable.hbar"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_hbar_clip"; \
- dragable { \
- x: 1 1 0; \
- y: 0 0 0; \
- confine: "sb_hbar"; \
- } \
- description { state: "default" 0.0; \
- min: 17 17; \
- fixed: 1 1; \
- aspect_preference: HORIZONTAL; \
- align: 0.0 1.0; \
- color: 0 0 0 0; \
- rel1 { \
- to_x: "sb_hbar"; \
- relative: 0.0 1.0; \
- } \
- rel2.to_x: "sb_hbar"; \
- } \
- } \
- part { name: "elm.dragable.hbar.image"; \
- mouse_events: 0; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- rel1.to: "elm.dragable.hbar"; \
- rel2.to: "elm.dragable.hbar"; \
- image { \
- normal: "bt_sm_base2.png"; \
- border: 6 6 6 6; \
- } \
- } \
- } \
- part { name: "sb_hbar_over1"; \
- clip_to: "sb_hbar_clip"; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- rel1.to: "elm.dragable.hbar.image"; \
- rel2 { \
- to: "elm.dragable.hbar.image"; \
- relative: 1.0 0.5; \
- } \
- image { \
- normal: "bt_sm_hilight.png"; \
- border: 6 6 6 0; \
- } \
- } \
- } \
- part { name: "sb_hbar_over2"; \
- clip_to: "sb_hbar_clip"; \
- mouse_events: 0; \
- description { state: "default" 0.0; \
- rel1.to: "elm.dragable.hbar.image"; \
- rel2.to: "elm.dragable.hbar.image"; \
- image { \
- normal: "bt_sm_shine.png"; \
- border: 6 6 6 0; \
- } \
- } \
- } \
- part { name: "sb_hbar_p1"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- color: 0 0 0 0; \
- fixed: 1 1; \
- rel1 { \
- to: "sb_hbar_a1"; \
- relative: 1.0 0.0; \
- } \
- rel2 { \
- to: "elm.dragable.hbar"; \
- relative: 0.0 1.0; \
- } \
- } \
- } \
- part { name: "sb_hbar_p2"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- color: 0 0 0 0; \
- fixed: 1 1; \
- rel1 { \
- to: "elm.dragable.hbar"; \
- relative: 1.0 0.0; \
- } \
- rel2 { \
- to: "sb_hbar_a2"; \
- relative: 0.0 1.0; \
- } \
- } \
- } \
- part { name: "sb_hbar_a1"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- min: 17 17; \
- fixed: 1 1; \
- align: 0.0 1.0; \
- aspect: 1.0 1.0; \
- aspect_preference: VERTICAL; \
- color: 0 0 0 0; \
- rel1 { \
- to_x: "sb_hbar_clip"; \
- to_y: "elm.scrollbar.base"; \
- relative: 0.0 0.0; \
- } \
- rel2 { \
- to: "elm.scrollbar.base"; \
- relative: 0.0 1.0; \
- offset: -1 -1; \
- } \
- } \
- } \
- part { name: "sb_hbar_a1_arrow"; \
- mouse_events: 0; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- rel1.to: "sb_hbar_a1"; \
- rel2.to: "sb_hbar_a1"; \
- image.normal: "arrow_left.png"; \
- } \
- description { state: "clicked" 0.0; \
- inherit: "default" 0.0; \
- rel1.offset: -1 0; \
- rel2.offset: -2 -1; \
- } \
- } \
- part { name: "sb_hbar_a2"; \
- type: RECT; \
- mouse_events: 1; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- min: 17 17; \
- align: 1.0 1.0; \
- aspect: 1.0 1.0; \
- fixed: 1 1; \
- aspect_preference: VERTICAL; \
- color: 0 0 0 0; \
- rel1 { \
- to: "elm.scrollbar.base"; \
- relative: 1.0 0.0; \
- } \
- rel2 { \
- to: "elm.scrollbar.base"; \
- relative: 0.0 1.0; \
- } \
- } \
- } \
- part { name: "sb_hbar_a2_arrow"; \
- mouse_events: 0; \
- clip_to: "sb_hbar_clip"; \
- description { state: "default" 0.0; \
- rel1.to: "sb_hbar_a2"; \
- rel2.to: "sb_hbar_a2"; \
- image.normal: "arrow_right.png"; \
- } \
- description { state: "clicked" 0.0; \
- inherit: "default" 0.0; \
- rel1.offset: 1 0; \
- rel2.offset: 0 -1; \
- } \
- } \
- part { name: "disabler"; \
- type: RECT; \
- description { state: "default" 0.0; \
- rel1.to: "clipper"; \
- rel2.to: "clipper"; \
- color: 0 0 0 0; \
- visible: 0; \
- } \
- description { state: "disabled" 0.0; \
- inherit: "default" 0.0; \
- visible: 1; \
- color: 128 128 128 128; \
- } \
- } \
- programs { \
- program { name: "load"; \
- signal: "load"; \
- source: ""; \
- script { \
- set_state(PART:"sb_hbar_clip", "hidden", 0.0); \
- set_state(PART:"sb_vbar_clip", "hidden", 0.0); \
- set_int(sbvis_h, 0); \
- set_int(sbvis_v, 0); \
- } \
- } \
- program { name: "vbar_show"; \
- signal: "elm,action,show,vbar"; \
- source: "elm"; \
- script { \
- set_state(PART:"sb_vbar_clip_master", "default", 0.0); \
- set_int(sbvis_v, 1); \
- if (get_int(sbvis_h)) \
- set_state(PART:"elm.scrollbar.base", "both", 0.0); \
- else \
- set_state(PART:"elm.scrollbar.base", "vertical", 0.0); \
- emit("do-show-vbar", ""); \
- } \
- } \
- program { name: "vbar_hide"; \
- signal: "elm,action,hide,vbar"; \
- source: "elm"; \
- script { \
- set_state(PART:"sb_vbar_clip_master", "hidden", 0.0); \
- set_int(sbvis_v, 0); \
- if (get_int(sbvis_h)) \
- set_state(PART:"elm.scrollbar.base", "horizontal", 0.0); \
- else \
- set_state(PART:"elm.scrollbar.base", "default", 0.0); \
- emit("do-hide-vbar", ""); \
- } \
- } \
- program { name: "sb_vbar_down"; \
- signal: "mouse,down,1"; \
- source: "elm.dragable.vbar"; \
- action: STATE_SET "clicked" 0.0; \
- target: "elm.dragable.vbar"; \
- } \
- program { name: "sb_vbar_up"; \
- signal: "mouse,up,1"; \
- source: "elm.dragable.vbar"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.dragable.vbar"; \
- } \
- program { name: "sb_vbar_show"; \
- signal: "do-show-vbar"; \
- source: ""; \
- action: STATE_SET "default" 0.0; \
- transition: LINEAR 0.1; \
- target: "sb_vbar_clip"; \
- } \
- program { name: "sb_vbar_hide"; \
- signal: "do-hide-vbar"; \
- source: ""; \
- action: STATE_SET "hidden" 0.0; \
- transition: LINEAR 1.0; \
- target: "sb_vbar_clip"; \
- } \
- program { name: "sb_vbar_a1_down"; \
- signal: "mouse,down,1"; \
- source: "sb_vbar_a1"; \
- action: STATE_SET "clicked" 0.0; \
- target: "sb_vbar_a1_arrow"; \
- } \
- program { name: "sb_vbar_a1_down2"; \
- signal: "mouse,down,1"; \
- source: "sb_vbar_a1"; \
- action: DRAG_VAL_STEP 0.0 -1.0; \
- target: "elm.dragable.vbar"; \
- } \
- program { name: "sb_vbar_a1_up"; \
- signal: "mouse,up,1"; \
- source: "sb_vbar_a1"; \
- action: STATE_SET "default" 0.0; \
- target: "sb_vbar_a1_arrow"; \
- } \
- program { name: "sb_vbar_a2_down"; \
- signal: "mouse,down,1"; \
- source: "sb_vbar_a2"; \
- action: STATE_SET "clicked" 0.0; \
- target: "sb_vbar_a2_arrow"; \
- } \
- program { name: "sb_vbar_a2_down2"; \
- signal: "mouse,down,1"; \
- source: "sb_vbar_a2"; \
- action: DRAG_VAL_STEP 0.0 1.0; \
- target: "elm.dragable.vbar"; \
- } \
- program { name: "sb_vbar_a2_up"; \
- signal: "mouse,up,1"; \
- source: "sb_vbar_a2"; \
- action: STATE_SET "default" 0.0; \
- target: "sb_vbar_a2_arrow"; \
- } \
- program { name: "sb_vbar_p1_down"; \
- signal: "mouse,down,1"; \
- source: "sb_vbar_p1"; \
- action: DRAG_VAL_PAGE 0.0 -1.0; \
- target: "elm.dragable.vbar"; \
- } \
- program { name: "sb_vbar_p2_down"; \
- signal: "mouse,down,1"; \
- source: "sb_vbar_p2"; \
- action: DRAG_VAL_PAGE 0.0 1.0; \
- target: "elm.dragable.vbar"; \
- } \
- program { name: "hbar_show"; \
- signal: "elm,action,show,hbar"; \
- source: "elm"; \
- script { \
- set_state(PART:"sb_hbar_clip_master", "default", 0.0); \
- set_int(sbvis_h, 1); \
- if (get_int(sbvis_v)) \
- set_state(PART:"elm.scrollbar.base", "both", 0.0); \
- else \
- set_state(PART:"elm.scrollbar.base", "horizontal", 0.0); \
- emit("do-show-hbar", ""); \
- } \
- } \
- program { name: "hbar_hide"; \
- signal: "elm,action,hide,hbar"; \
- source: "elm"; \
- script { \
- set_state(PART:"sb_hbar_clip_master", "hidden", 0.0); \
- set_int(sbvis_h, 0); \
- if (get_int(sbvis_v)) \
- set_state(PART:"elm.scrollbar.base", "vertical", 0.0); \
- else \
- set_state(PART:"elm.scrollbar.base", "default", 0.0); \
- emit("do-hide-hbar", ""); \
- } \
- } \
- program { name: "sb_hbar_down"; \
- signal: "mouse,down,1"; \
- source: "elm.dragable.hbar"; \
- action: STATE_SET "clicked" 0.0; \
- target: "elm.dragable.hbar"; \
- } \
- program { name: "sb_hbar_up"; \
- signal: "mouse,up,1"; \
- source: "elm.dragable.hbar"; \
- action: STATE_SET "default" 0.0; \
- target: "elm.dragable.hbar"; \
- } \
- program { name: "sb_hbar_show"; \
- signal: "do-show-hbar"; \
- source: ""; \
- action: STATE_SET "default" 0.0; \
- transition: LINEAR 0.1; \
- target: "sb_hbar_clip"; \
- } \
- program { name: "sb_hbar_hide"; \
- signal: "do-hide-hbar"; \
- source: ""; \
- action: STATE_SET "hidden" 0.0; \
- transition: LINEAR 1.0; \
- target: "sb_hbar_clip"; \
- } \
- program { name: "sb_hbar_a1_down"; \
- signal: "mouse,down,1"; \
- source: "sb_hbar_a1"; \
- action: STATE_SET "clicked" 0.0; \
- target: "sb_hbar_a1_arrow"; \
- } \
- program { name: "sb_hbar_a1_down2"; \
- signal: "mouse,down,1"; \
- source: "sb_hbar_a1"; \
- action: DRAG_VAL_STEP -1.0 0.0; \
- target: "elm.dragable.hbar"; \
- } \
- program { name: "sb_hbar_a1_up"; \
- signal: "mouse,up,1"; \
- source: "sb_hbar_a1"; \
- action: STATE_SET "default" 0.0; \
- target: "sb_hbar_a1_arrow"; \
- } \
- program { name: "sb_hbar_a2_down"; \
- signal: "mouse,down,1"; \
- source: "sb_hbar_a2"; \
- action: STATE_SET "clicked" 0.0; \
- target: "sb_hbar_a2_arrow"; \
- } \
- program { name: "sb_hbar_a2_down2"; \
- signal: "mouse,down,1"; \
- source: "sb_hbar_a2"; \
- action: DRAG_VAL_STEP 1.0 0.0; \
- target: "elm.dragable.hbar"; \
- } \
- program { name: "sb_hbar_a2_up"; \
- signal: "mouse,up,1"; \
- source: "sb_hbar_a2"; \
- action: STATE_SET "default" 0.0; \
- target: "sb_hbar_a2_arrow"; \
- } \
- program { name: "sb_hbar_p1_down"; \
- signal: "mouse,down,1"; \
- source: "sb_hbar_p1"; \
- action: DRAG_VAL_PAGE -1.0 0.0; \
- target: "elm.dragable.hbar"; \
- } \
- program { name: "sb_hbar_p2_down"; \
- signal: "mouse,down,1"; \
- source: "sb_hbar_p2"; \
- action: DRAG_VAL_PAGE 1.0 0.0; \
- target: "elm.dragable.hbar"; \
- } \
- program { name: "disable"; \
- signal: "elm,state,disabled"; \
- source: "elm"; \
- action: STATE_SET "disabled" 0.0; \
- target: "disabler"; \
- } \
- program { name: "enable"; \
- signal: "elm,state,enabled"; \
- source: "elm"; \
- action: STATE_SET "default" 0.0; \
- target: "disabler"; \
- } \
- } \
-
-collections {
-
- group { name: "elm/scroller/base/default";
- alias: "elm/list/base/default";
- alias: "elm/genlist/base/default";
- alias: "elm/carousel/base/default";
- alias: "elm/gengrid/base/default";
-
- data {
- item: "focus_highlight" "on";
- }
-
- images {
- image: "shelf_inset.png" COMP;
- image: "sl_bt2_2.png" COMP;
- }
-
- parts {
- part { name: "bg";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.offset: 1 1;
- rel2.offset: -2 -2;
- color: 255 255 255 0;
- }
- }
- part { name: "clipper";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.to: "bg";
- rel2.to: "bg";
- }
- }
- part { name: "elm.swallow.content";
- type: SWALLOW;
- clip_to: "clipper";
- description { state: "default" 0.0;
- rel2 {
- to_x: "sb_vbar";
- to_y: "sb_hbar";
- relative: 0.0 0.0;
- offset: -1 -1;
- }
- }
- }
- part { name: "conf_over";
- mouse_events: 0;
- description { state: "default" 0.0;
- image {
- normal: "shelf_inset.png";
- border: 7 7 7 7;
- middle: 0;
- }
- fill.smooth: 0;
- }
- }
- part { name: "focus_highlight";
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.offset: -1 -1;
- rel2.offset: 0 0;
- image {
- normal: "sl_bt2_2.png";
- border: 7 7 7 7;
- middle: 0;
- }
- fill.smooth: 0;
- color: 200 155 0 0;
- }
- description { state: "enabled" 0.0;
- inherit: "default" 0.0;
- color: 200 155 0 255;
- }
- }
- SCROLLBARS_ADD()
- }
- }
-
- group { name: "elm/scroller/entry/default";
-
- data {
- item: "focus_highlight" "on";
- }
-
- images {
- image: "shelf_inset.png" COMP;
- image: "sl_bt2_2.png" COMP;
- }
-
- parts {
- part { name: "bg";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.offset: 1 1;
- rel2.offset: -2 -2;
- color: 255 255 255 255;
- }
- }
- part { name: "clipper";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.to: "bg";
- rel2.to: "bg";
- }
- }
- part { name: "content.clipper";
- type: RECT;
- mouse_events: 0;
- clip_to: "clipper";
- description { state: "default" 0.0;
- rel1 {
- to: "elm.swallow.icon";
- relative: 1.0 0.0;
- }
- rel2 {
- to: "elm.swallow.end";
- relative: 0.0 1.0;
- }
- }
- }
- part { name: "elm.swallow.icon";
- type: SWALLOW;
- clip_to: "clipper";
- description { state: "default" 0.0;
- fixed: 1 1;
- visible: 0;
- rel1 {
- to: "bg";
- relative: 0.0 0.0;
- offset: 0 0;
- }
- rel2 {
- to: "bg";
- relative: 0.0 1.0;
- offset: -1 -1;
- }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part { name: "elm.swallow.end";
- type: SWALLOW;
- clip_to: "clipper";
- description { state: "default" 0.0;
- fixed: 1 1;
- visible: 0;
- rel1 {
- to: "bg";
- relative: 1.0 0.0;
- offset: 0 0;
- }
- rel2 {
- to_x: "elm.dragable.vbar";
- to_y: "elm.dragable.hbar";
- relative: 0.0 0.0;
- offset: -1 -1;
- }
- }
- description { state: "visible" 0.0;
- inherit: "default" 0.0;
- visible: 1;
- }
- }
- part { name: "elm.swallow.content";
- type: SWALLOW;
- clip_to: "content.clipper";
- description { state: "default" 0.0;
- rel1 {
- to: "elm.swallow.icon";
- relative: 1.0 0.0;
- offset: 4 4;
- }
- rel2 {
- to: "elm.swallow.end";
- relative: 0.0 1.0;
- offset: -5 -5;
- }
- }
- }
- part { name: "conf_over";
- mouse_events: 0;
- description { state: "default" 0.0;
- image {
- normal: "shelf_inset.png";
- border: 7 7 7 7;
- middle: 0;
- }
- fill.smooth: 0;
- }
- }
- part { name: "focus_highlight";
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.offset: -1 -1;
- rel2.offset: 0 0;
- image {
- normal: "sl_bt2_2.png";
- border: 7 7 7 7;
- middle: 0;
- }
- fill.smooth: 0;
- color: 200 155 0 0;
- }
- description { state: "enabled" 0.0;
- inherit: "default" 0.0;
- color: 200 155 0 255;
- }
- }
- SCROLLBARS_ADD()
- }
- programs {
- program { name: "icon_show";
- signal: "elm,action,show,icon";
- source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "elm.swallow.icon";
- }
- program { name: "icon_hide";
- signal: "elm,action,hide,icon";
- source: "elm";
- action: STATE_SET "default" 0.0;
- target: "elm.swallow.icon";
- }
- program { name: "end_show";
- signal: "elm,action,show,end";
- source: "elm";
- action: STATE_SET "visible" 0.0;
- target: "elm.swallow.end";
- }
- program { name: "end_hide";
- signal: "elm,action,hide,end";
- source: "elm";
- action: STATE_SET "default" 0.0;
- target: "elm.swallow.end";
- }
- program { name: "highlight_show";
- signal: "elm,action,focus_highlight,show";
- source: "elm";
- action: STATE_SET "enabled" 0.0;
- transition: ACCELERATE 0.3;
- target: "focus_highlight";
- target: "conf_over";
- }
- program { name: "highlight_hide";
- signal: "elm,action,focus_highlight,hide";
- source: "elm";
- action: STATE_SET "default" 0.0;
- transition: DECELERATE 0.3;
- target: "focus_highlight";
- target: "conf_over";
- }
- }
- }
-
- group { name: "elm/photocam/base/default";
-
- images {
- image: "shelf_inset.png" COMP;
- image: "busy-1.png" COMP;
- image: "busy-2.png" COMP;
- image: "busy-3.png" COMP;
- image: "busy-4.png" COMP;
- image: "busy-5.png" COMP;
- image: "busy-6.png" COMP;
- image: "busy-7.png" COMP;
- image: "busy-8.png" COMP;
- image: "busy-9.png" COMP;
- }
- parts {
- part { name: "bg";
- type: RECT;
- description { state: "default" 0.0;
- rel1.offset: 1 1;
- rel2.offset: -2 -2;
- color: 255 255 255 0;
- }
- }
- part { name: "clipper";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.to: "bg";
- rel2.to: "bg";
- }
- }
- part { name: "elm.swallow.content";
- clip_to: "clipper";
- type: SWALLOW;
- description { state: "default" 0.0;
- rel1.offset: 1 1;
- rel2.offset: -2 -2;
- }
- }
- part { name: "busy_clip";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- visible: 0;
- color: 255 255 255 0;
- }
- description { state: "active" 0.0;
- visible: 1;
- color: 255 255 255 255;
- }
- }
- part { name: "busy";
- clip_to: "busy_clip";
- mouse_events: 0;
- description { state: "default" 0.0;
- fixed: 1 1;
- min: 32 32;
- aspect: 1.0 1.0;
- align: 1.0 1.0;
- aspect_preference: BOTH;
- rel1 {
- relative: 0.9 0.9;
- offset: -9 -9;
- }
- rel2 {
- relative: 0.9 0.9;
- offset: -9 -9;
- }
- image {
- normal: "busy-9.png";
- tween: "busy-1.png";
- tween: "busy-2.png";
- tween: "busy-3.png";
- tween: "busy-4.png";
- tween: "busy-5.png";
- tween: "busy-6.png";
- tween: "busy-7.png";
- tween: "busy-8.png";
- }
- }
- }
- part { name: "conf_over";
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.offset: 0 0;
- rel2.offset: -1 -1;
- image {
- normal: "shelf_inset.png";
- border: 7 7 7 7;
- middle: 0;
- }
- fill.smooth : 0;
- }
- }
- SCROLLBARS_ADD()
- }
- programs {
- program { name: "go1";
- signal: "elm,state,busy,start";
- source: "elm";
- action: STATE_SET "active" 0.0;
- transition: SINUSOIDAL 1.0;
- target: "busy_clip";
- }
- program { name: "go2";
- signal: "elm,state,busy,start";
- source: "elm";
- action: STATE_SET "default" 0.0;
- transition: LINEAR 0.5;
- target: "busy";
- after: "go2";
- }
- program { name: "stop1";
- signal: "elm,state,busy,stop";
- source: "elm";
- action: STATE_SET "default" 0.0;
- transition: SINUSOIDAL 1.0;
- target: "busy_clip";
- after: "stop2";
- }
- program { name: "stop2";
- action: ACTION_STOP;
- target: "go2";
- }
- }
- }
-
- ///////////////////////////////////////////////////////////////////////////////
- group { name: "elm/map/base/default";
- images {
- image: "shelf_inset.png" COMP;
- image: "busy-1.png" COMP;
- image: "busy-2.png" COMP;
- image: "busy-3.png" COMP;
- image: "busy-4.png" COMP;
- image: "busy-5.png" COMP;
- image: "busy-6.png" COMP;
- image: "busy-7.png" COMP;
- image: "busy-8.png" COMP;
- image: "busy-9.png" COMP;
- }
- parts {
- part { name: "bg";
- type: RECT;
- description { state: "default" 0.0;
- rel1.offset: 1 1;
- rel2.offset: -2 -2;
- color: 255 255 255 0;
- }
- }
- part { name: "clipper";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.to: "bg";
- rel2.to: "bg";
- }
- }
- part { name: "elm.swallow.content";
- clip_to: "clipper";
- type: SWALLOW;
- description { state: "default" 0.0;
- rel1.offset: 1 1;
- rel2.offset: -2 -2;
- }
- }
- part { name: "busy_clip";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- visible: 0;
- color: 255 255 255 0;
- }
- description { state: "active" 0.0;
- visible: 1;
- color: 255 255 255 255;
- }
- }
- part { name: "busy";
- clip_to: "busy_clip";
- mouse_events: 0;
- description { state: "default" 0.0;
- fixed: 1 1;
- min: 32 32;
- aspect: 1.0 1.0;
- align: 1.0 1.0;
- aspect_preference: BOTH;
- rel1 {
- relative: 0.9 0.9;
- offset: -9 -9;
- }
- rel2 {
- relative: 0.9 0.9;
- offset: -9 -9;
- }
- image {
- normal: "busy-9.png";
- tween: "busy-1.png";
- tween: "busy-2.png";
- tween: "busy-3.png";
- tween: "busy-4.png";
- tween: "busy-5.png";
- tween: "busy-6.png";
- tween: "busy-7.png";
- tween: "busy-8.png";
- }
- }
- }
- part { name: "conf_over";
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.offset: 0 0;
- rel2.offset: -1 -1;
- image {
- normal: "shelf_inset.png";
- border: 7 7 7 7;
- middle: 0;
- }
- fill.smooth : 0;
- }
- }
- SCROLLBARS_ADD()
- }
- programs {
- program { name: "go1";
- signal: "elm,state,busy,start";
- source: "elm";
- action: STATE_SET "active" 0.0;
- transition: SINUSOIDAL 1.0;
- target: "busy_clip";
- }
- program { name: "go2";
- signal: "elm,state,busy,start";
- source: "elm";
- action: STATE_SET "default" 0.0;
- transition: LINEAR 0.5;
- target: "busy";
- after: "go2";
- }
- program { name: "stop1";
- signal: "elm,state,busy,stop";
- source: "elm";
- action: STATE_SET "default" 0.0;
- transition: SINUSOIDAL 1.0;
- target: "busy_clip";
- after: "stop2";
- }
- program { name: "stop2";
- action: ACTION_STOP;
- target: "go2";
- }
- }
- }
-
- group { name: "elm/list/base/hoverlist";
- data {
- item: "focus_highlight" "on";
- }
- images {
- image: "sl_bt2_2.png" COMP;
- }
- parts {
- part { name: "bg";
- type: RECT;
- description { state: "default" 0.0;
- rel1.offset: 2 2;
- rel2.offset: -3 -3;
- color: 255 255 255 0;
- }
- }
- part { name: "clipper";
- type: RECT;
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1 {
- to: "bg";
- offset: 2 2;
- }
- rel2 {
- to: "bg";
- offset: -3 -3;
- }
- }
- }
- part { name: "elm.swallow.content";
- clip_to: "clipper";
- type: SWALLOW;
- description { state: "default" 0.0;
- rel1 {
- to: "bg";
- offset: 2 2;
- }
- rel2 {
- to: "bg";
- offset: -3 -3;
- }
- }
- }
- part { name: "focus_highlight";
- mouse_events: 0;
- description { state: "default" 0.0;
- rel1.offset: -1 -1;
- rel2.offset: 0 0;
- image {
- normal: "sl_bt2_2.png";
- border: 7 7 7 7;
- middle: 0;
- }
- fill.smooth : 0;
- color: 200 155 0 0;
- }
- description { state: "enabled" 0.0;
- inherit: "default" 0.0;
- color: 200 155 0 255;
- }
- }
- SCROLLBARS_ADD()
- }
- programs {
- program { name: "highlight_show";
- signal: "elm,action,focus_highlight,show";
- source: "elm";
- action: STATE_SET "enabled" 0.0;
- transition: ACCELERATE 0.3;
- target: "focus_highlight";
- }
- program { name: "highlight_hide";
- signal: "elm,action,focus_highlight,hide";
- source: "elm";
- action: STATE_SET "default" 0.0;
- transition: DECELERATE 0.3;
- target: "focus_highlight";
- }
- }
- }
-}
elementary (1.0.0+svn.51480slp2+build88) unstable; urgency=low
- * Packaging for fixing ctx_popup and elm_config (preload)
+ * Packaging for fixing ctx_popup and elm_config(preload)
* Git: 165.213.180.234:slp/pkgs/e/elementary
* Tag: elementary_1.0.0+svn.51480slp2+build88
+++ /dev/null
-#include <Elementary.h>
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-#ifndef ELM_LIB_QUICKLAUNCH
-
-static void
-_disk_sel(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info)
-{
- Elm_Diskselector_Item *it = event_info;
- printf("Equinox: %s\n", elm_diskselector_item_label_get(it));
-}
-
-static void
-_disk_next(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info)
-{
- Elm_Diskselector_Item *next, *prev, *it = event_info;
- prev = elm_diskselector_item_prev_get(it);
- next = elm_diskselector_item_next_get(it);
- printf("Prev: %s, Next: %s\n", elm_diskselector_item_label_get(prev),
- elm_diskselector_item_label_get(next));
-}
-
-static void
-_print_disk_info_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Elm_Diskselector_Item *it = event_info;
- printf("Selected label: %s\n", elm_diskselector_item_label_get(it));
-}
-
-static Evas_Object *
-_disk_create(Evas_Object *win, Eina_Bool round)
-{
- Elm_Diskselector_Item *it;
- Evas_Object *di;
-
- di = elm_diskselector_add(win);
-
- elm_diskselector_item_append(di, "January", NULL, NULL, NULL);
- elm_diskselector_item_append(di, "February", NULL, _disk_next, NULL);
- elm_diskselector_item_append(di, "March", NULL, _disk_sel, NULL);
- elm_diskselector_item_append(di, "April", NULL, NULL, NULL);
- elm_diskselector_item_append(di, "May", NULL, NULL, NULL);
- elm_diskselector_item_append(di, "June", NULL, NULL, NULL);
- elm_diskselector_item_append(di, "July", NULL, NULL, NULL);
- it = elm_diskselector_item_append(di, "August", NULL, NULL, NULL);
- elm_diskselector_item_append(di, "September", NULL, _disk_sel, NULL);
- elm_diskselector_item_append(di, "October", NULL, NULL, NULL);
- elm_diskselector_item_append(di, "November", NULL, NULL, NULL);
- elm_diskselector_item_append(di, "December", NULL, NULL, NULL);
-
- elm_diskselector_item_selected_set(it, EINA_TRUE);
- elm_diskselector_round_set(di, round);
-
- return di;
-}
-
-void
-test_diskselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Evas_Object *win, *bg, *bx, *disk, *ic;
- Elm_Diskselector_Item *it;
- char buf[PATH_MAX];
-
- win = elm_win_add(NULL, "diskselector", ELM_WIN_BASIC);
- elm_win_title_set(win, "Disk Selector");
- 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, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(bg);
-
- bx = elm_box_add(win);
- elm_win_resize_object_add(win, bx);
- evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(bx);
-
- disk = _disk_create(win, EINA_TRUE);
- evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(bx, disk);
- evas_object_show(disk);
- evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
- it = elm_diskselector_selected_item_get(disk);
- elm_diskselector_item_selected_set(it, EINA_FALSE);
-
- disk = _disk_create(win, EINA_FALSE);
- evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(bx, disk);
- evas_object_show(disk);
- evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
- it = elm_diskselector_first_item_get(disk);
- it = elm_diskselector_item_next_get(it);
- elm_diskselector_item_selected_set(it, EINA_TRUE);
-
- disk = _disk_create(win, EINA_FALSE);
- evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(bx, disk);
- evas_object_show(disk);
- evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
- elm_diskselector_side_label_lenght_set(disk, 4);
-
- disk = elm_diskselector_add(win);
- 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_icon_scale_set(ic, 1, 1);
- elm_diskselector_item_append(disk, "Sunday", ic, NULL, NULL);
- elm_diskselector_item_append(disk, "Monday", NULL, NULL, NULL);
- elm_diskselector_item_append(disk, "Tuesday", NULL, NULL, NULL);
- elm_diskselector_item_append(disk, "Wednesday", NULL, NULL, NULL);
- elm_diskselector_item_append(disk, "Thursday", NULL, NULL, NULL);
- elm_diskselector_item_append(disk, "Friday", NULL, NULL, NULL);
- elm_diskselector_item_append(disk, "Saturday", NULL, NULL, NULL);
- elm_diskselector_round_set(disk, EINA_TRUE);
- evas_object_size_hint_weight_set(disk, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(disk, EVAS_HINT_FILL, 0.5);
- elm_box_pack_end(bx, disk);
- evas_object_show(disk);
- evas_object_smart_callback_add(disk, "selected", _print_disk_info_cb, NULL);
-
- evas_object_resize(win, 320, 480);
- evas_object_show(win);
-}
-
-#endif
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
- /**
- * @defgroup File_Selector_Entry File Selector Entry
- *
- * An entry that shows to enter/display path and have an associated
- * button to allow selecting the file from a dialog.
- *
- * The button, when clicked, creates an Elementary window (or inner
- * window) with an Elementary File Selector within. When a file is
- * chosen, the (inner) window is closed and the selected file is
- * exposed as an evas_object_smart_callback_call() of the button.
- */
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data
-{
- Evas_Object *edje;
- Evas_Object *button;
- Evas_Object *entry;
-};
-
-static const char *widtype = NULL;
-
-static const char SIG_CHANGED[] = "changed";
-static const char SIG_ACTIVATED[] = "activated";
-static const char SIG_PRESS[] = "press";
-static const char SIG_LONGPRESSED[] = "longpressed";
-static const char SIG_CLICKED[] = "clicked";
-static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
-static const char SIG_FOCUSED[] = "focused";
-static const char SIG_UNFOCUSED[] = "unfocused";
-static const char SIG_SELECTION_PASTE[] = "selection,paste";
-static const char SIG_SELECTION_COPY[] = "selection,copy";
-static const char SIG_SELECTION_CUT[] = "selection,cut";
-static const char SIG_UNPRESSED[] = "unpressed";
-static const char SIG_FILE_CHOSEN[] = "file,chosen";
-static const Evas_Smart_Cb_Description _signals[] =
-{
- {SIG_CHANGED, ""},
- {SIG_ACTIVATED, ""},
- {SIG_PRESS, ""},
- {SIG_LONGPRESSED, ""},
- {SIG_CLICKED, ""},
- {SIG_CLICKED_DOUBLE, ""},
- {SIG_FOCUSED, ""},
- {SIG_UNFOCUSED, ""},
- {SIG_SELECTION_PASTE, ""},
- {SIG_SELECTION_COPY, ""},
- {SIG_SELECTION_CUT, ""},
- {SIG_UNPRESSED, ""},
- {SIG_FILE_CHOSEN, "s"},
- {NULL, NULL}
-};
-
-#define SIG_FWD(name) \
-static void \
-_##name##_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info) \
-{ \
- evas_object_smart_callback_call(data, SIG_##name, event_info); \
-}
-SIG_FWD(CHANGED)
-SIG_FWD(PRESS)
-SIG_FWD(LONGPRESSED)
-SIG_FWD(CLICKED)
-SIG_FWD(CLICKED_DOUBLE)
-SIG_FWD(FOCUSED)
-SIG_FWD(UNFOCUSED)
-SIG_FWD(SELECTION_PASTE)
-SIG_FWD(SELECTION_COPY)
-SIG_FWD(SELECTION_CUT)
-SIG_FWD(UNPRESSED)
-#undef SIG_FWD
-
-static void
-_FILE_CHOSEN_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- const char *file = event_info;
- elm_scrolled_entry_entry_set(wd->entry, file);
- evas_object_smart_callback_call(data, SIG_FILE_CHOSEN, event_info);
-}
-
-static void
-_ACTIVATED_fwd(void *data, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- const char *file = elm_scrolled_entry_entry_get(wd->entry);
- elm_fileselector_button_path_set(wd->button, file);
- evas_object_smart_callback_call(data, SIG_ACTIVATED, event_info);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- free(wd);
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Coord minw = -1, minh = -1;
- if (!wd) return;
- edje_object_size_min_calc(wd->edje, &minw, &minh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, -1, -1);
-}
-
-static Eina_Bool
-_elm_fileselector_entry_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd)
- return EINA_FALSE;
-
- Evas_Object *chain[2];
-
- /* Direction */
- if (dir == ELM_FOCUS_PREVIOUS)
- {
- chain[0] = wd->button;
- chain[1] = wd->entry;
- }
- else if (dir == ELM_FOCUS_NEXT)
- {
- chain[0] = wd->entry;
- chain[1] = wd->button;
- }
- else
- return EINA_FALSE;
-
- unsigned char i = elm_widget_focus_get(chain[1]);
-
- if (elm_widget_focus_next_get(chain[i], dir, next))
- return EINA_TRUE;
-
- i = !i;
-
- Evas_Object *to_focus;
- if (elm_widget_focus_next_get(chain[i], dir, &to_focus))
- {
- *next = to_focus;
- return !!i;
- }
-
- return EINA_FALSE;
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- const char *style = elm_widget_style_get(obj);
- char buf[1024];
-
- if (!wd) return;
- _elm_theme_object_set(obj, wd->edje, "fileselector_entry", "base", style);
- if (elm_object_disabled_get(obj))
- edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm");
-
- if (!style) style = "default";
- snprintf(buf, sizeof(buf), "fileselector_entry/%s", style);
- elm_widget_style_set(wd->button, buf);
- elm_widget_style_set(wd->entry, buf);
-
- edje_object_part_swallow(obj, "elm.swallow.button", wd->button);
- edje_object_part_swallow(obj, "elm.swallow.entry", wd->entry);
-
- edje_object_message_signal_process(wd->edje);
- edje_object_scale_set
- (wd->edje, elm_widget_scale_get(obj) * _elm_config->scale);
- _sizing_eval(obj);
-}
-
-static void
-_disable_hook(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Eina_Bool val = elm_widget_disabled_get(obj);
- if (!wd) return;
- if (val)
- edje_object_signal_emit(wd->edje, "elm,state,disabled", "elm");
- else
- edje_object_signal_emit(wd->edje, "elm,state,enabled", "elm");
-
- elm_widget_disabled_set(wd->button, val);
- elm_widget_disabled_set(wd->entry, val);
-}
-
-static void
-_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- _sizing_eval(data);
-}
-
-/**
- * Add a new file selector entry into the parent object.
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup File_Selector_Entry
- */
-EAPI Evas_Object *
-elm_fileselector_entry_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e = evas_object_evas_get(parent);
- if (!e) return NULL;
- Widget_Data *wd;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
-
- obj = elm_widget_add(e);
- ELM_SET_WIDTYPE(widtype, "fileselector_entry");
- elm_widget_type_set(obj, "fileselector_entry");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_disable_hook_set(obj, _disable_hook);
- elm_widget_focus_next_hook_set(obj, _elm_fileselector_entry_focus_next_hook);
- elm_widget_can_focus_set(obj, EINA_FALSE);
- elm_widget_theme_hook_set(obj, _theme_hook);
-
- wd->edje = edje_object_add(e);
- _elm_theme_object_set(obj, wd->edje, "fileselector_entry", "base", "default");
- elm_widget_resize_object_set(obj, wd->edje);
-
- wd->button = elm_fileselector_button_add(obj);
- elm_widget_style_set(wd->button, "fileselector_entry/default");
- edje_object_part_swallow(wd->edje, "elm.swallow.button", wd->button);
- elm_widget_sub_object_add(obj, wd->button);
- evas_object_event_callback_add
- (wd->button, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
- elm_fileselector_button_expandable_set(wd->button,
- _elm_config->fileselector_expand_enable);
-
-#define SIG_FWD(name) \
- evas_object_smart_callback_add(wd->button, SIG_##name, _##name##_fwd, obj)
- SIG_FWD(CLICKED);
- SIG_FWD(UNPRESSED);
- SIG_FWD(FILE_CHOSEN);
-#undef SIG_FWD
-
- wd->entry = elm_scrolled_entry_add(obj);
- elm_widget_style_set(wd->entry, "fileselector_entry/default");
- elm_scrolled_entry_single_line_set(wd->entry, EINA_TRUE);
- elm_scrolled_entry_editable_set(wd->entry, EINA_TRUE);
- edje_object_part_swallow(wd->edje, "elm.swallow.entry", wd->entry);
- elm_widget_sub_object_add(obj, wd->entry);
- evas_object_event_callback_add
- (wd->entry, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
-
-#define SIG_FWD(name) \
- evas_object_smart_callback_add(wd->entry, SIG_##name, _##name##_fwd, obj)
- SIG_FWD(CHANGED);
- SIG_FWD(ACTIVATED);
- SIG_FWD(PRESS);
- SIG_FWD(LONGPRESSED);
- SIG_FWD(CLICKED);
- SIG_FWD(CLICKED_DOUBLE);
- SIG_FWD(FOCUSED);
- SIG_FWD(UNFOCUSED);
- SIG_FWD(SELECTION_PASTE);
- SIG_FWD(SELECTION_COPY);
- SIG_FWD(SELECTION_CUT);
-#undef SIG_FWD
-
- _sizing_eval(obj);
-
- // TODO: convert Elementary to subclassing of Evas_Smart_Class
- // TODO: and save some bytes, making descriptions per-class and not instance!
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- return obj;
-}
-
-/**
- * Set the label used in the file selector entry.
- *
- * @param obj The entry object
- * @param label The text label text to be displayed on the entry
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_button_label_set(Evas_Object *obj, const char *label)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_label_set(wd->button, label);
-}
-
-EAPI const char *
-elm_fileselector_entry_button_label_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_fileselector_button_label_get(wd->button);
-}
-
-/**
- * Set the path to start the entry's file selector with, when clicked.
- *
- * @param obj The entry object
- * @param path Path to a file/directory
- *
- * Default path is "HOME" environment variable's value.
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_selected_set(Evas_Object *obj, const char *path)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_path_set(wd->button, path);
-}
-
-/**
- * Get the <b>last</b> path which the entry's file selector was set to.
- *
- * @param obj The entry object
- * @param path Path to a file/directory
- *
- * Default path is "HOME" environment variable's value.
- *
- * @ingroup File_Selector_Entry
- */
-EAPI const char *
-elm_fileselector_entry_selected_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_fileselector_button_path_get(wd->button);
-}
-
-/**
- * Set the title of the file selector entry's window.
- *
- * @param obj The entry object
- * @param title The title string
- *
- * Note that it will only take any effect if the fileselector entry
- * not at "inwin mode".
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_window_title_set(Evas_Object *obj, const char *title)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_window_title_set(wd->button, title);
-}
-
-/**
- * Get the title of the file selector entry's window.
- *
- * @param obj The entry object
- *
- * @ingroup File_Selector_Entry
- */
-EAPI const char *
-elm_fileselector_entry_window_title_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_fileselector_button_window_title_get(wd->button);
-}
-
-/**
- * Set the size of the file selector entry's window.
- *
- * @param obj The entry object
- * @param width The width
- * @param height The height
- *
- * Note that it will only take any effect if the fileselector entry not at
- * "inwin mode". Default size for the window (when applicable) is 400x400.
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_window_size_set(Evas_Object *obj, Evas_Coord width, Evas_Coord height)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_window_size_set(wd->button, width, height);
-}
-
-/**
- * Get the size of the file selector entry's window.
- *
- * @param obj The entry object
- * @param width Pointer into which to store the width value
- * @param height Pointer into which to store the height value
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_window_size_get(const Evas_Object *obj, Evas_Coord *width, Evas_Coord *height)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_window_size_get(wd->button, width, height);
-}
-
-/**
- * Set the starting path of the file selector entry's window.
- *
- * @param obj The entry object
- * @param path The path string
- *
- * It must be a <b>directory</b> path.
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_path_set(Evas_Object *obj, const char *path)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_path_set(wd->button, path);
- elm_scrolled_entry_entry_set(wd->entry, path);
-}
-
-/**
- * Get the <b>last</b> path of the file selector entry's window.
- *
- * @param obj The entry object
- *
- * @ingroup File_Selector_Entry
- */
-EAPI const char *
-elm_fileselector_entry_path_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_scrolled_entry_entry_get(wd->entry);
-}
-
-/**
- * Set whether the entry's file selector is to present itself as an
- * Elementary Generic List (which will expand its entries for nested
- * directories) or as canonical list, which will be rendered again
- * with the contents of each selected directory.
- *
- * @param obj The entry object
- * @param value The expandable flag
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_expandable_set(Evas_Object *obj, Eina_Bool value)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_expandable_set(wd->button, value);
-}
-
-/**
- * Get the entry's file selector expandable flag.
- *
- * @param obj The entry object
- * @return value The expandable flag
- *
- * @ingroup File_Selector_Entry
- */
-EAPI Eina_Bool
-elm_fileselector_entry_expandable_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
- return elm_fileselector_button_expandable_get(wd->button);
-}
-
-/**
- * Set whether the entry's file selector list is to display folders
- * only or the directory contents, as well.
- *
- * @param obj The entry object
- * @param value The "folder only" flag
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_folder_only_set(Evas_Object *obj, Eina_Bool value)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_folder_only_set(wd->button, value);
-}
-
-/**
- * Get the entry's file selector "folder only" flag.
- *
- * @param obj The entry object
- * @return value The "folder only" flag
- *
- * @ingroup File_Selector_Entry
- */
-EAPI Eina_Bool
-elm_fileselector_entry_folder_only_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
- return elm_fileselector_button_folder_only_get(wd->button);
-}
-
-/**
- * Set whether the entry's file selector has an editable text entry
- * which will hold its current selection.
- *
- * @param obj The entry object
- * @param value The "is save" flag
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_is_save_set(Evas_Object *obj, Eina_Bool value)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_is_save_set(wd->button, value);
-}
-
-/**
- * Get the entry's file selector "is save" flag.
- *
- * @param obj The entry object
- * @return value The "is save" flag
- *
- * @ingroup File_Selector_Entry
- */
-EAPI Eina_Bool
-elm_fileselector_entry_is_save_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
- return elm_fileselector_button_is_save_get(wd->button);
-}
-
-/**
- * Set whether the entry's file selector will raise an Elementary
- * Inner Window, instead of a dedicated Elementary Window. By default,
- * it won't.
- *
- * @param obj The entry object
- * @param value The "inwin mode" flag
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_inwin_mode_set(Evas_Object *obj, Eina_Bool value)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_inwin_mode_set(wd->button, value);
-}
-
-/**
- * Get the entry's file selector "inwin mode" flag.
- *
- * @param obj The entry object
- * @return value The "inwin mode" flag
- *
- * @ingroup File_Selector_Entry
- */
-EAPI Eina_Bool
-elm_fileselector_entry_inwin_mode_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
- return elm_fileselector_button_inwin_mode_get(wd->button);
-}
-
-/**
- * Set the icon used for the entry button
- *
- * Once the icon object is set, a previously set one will be deleted.
- *
- * @param obj The entry object
- * @param icon The image for the entry
- *
- * @ingroup File_Selector_Entry
- */
-EAPI void
-elm_fileselector_entry_button_icon_set(Evas_Object *obj, Evas_Object *icon)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_fileselector_button_icon_set(wd->button, icon);
-}
-
-/**
- * Get the icon used for the entry button
- *
- * @param obj The entry object
- * @return The image for the entry
- *
- * @ingroup File_Selector_Entry
- */
-EAPI Evas_Object *
-elm_fileselector_entry_button_icon_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_fileselector_button_icon_get(wd->button);
-}
-
-/**
- * Unset the icon used for the entry button
- *
- * Unparent and return the icon object which was set for this widget.
- *
- * @param obj The entry object
- * @return The icon object that was being used
- *
- * @ingroup File_Selector_Entry
- */
-EAPI Evas_Object *
-elm_fileselector_entry_button_icon_unset(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return elm_fileselector_button_icon_unset(wd->button);
-}
+++ /dev/null
-/**
- * @defgroup Diskselector
- *
- * A diskselector is a kind of list widget. It scrolls horizontally,
- * and can contain label and icon objects. Three items are displayed
- * with the selected on the middle.
- *
- * It can act like a circular list with round mode and labels can be
- * reduced for a defined lenght for side items.
- *
- * Signal emitted by this widget:
- * "selected" - when item is selected (scroller stops)
- */
-
-#include <Elementary.h>
-#include "elm_priv.h"
-
-#ifndef MAX
-# define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data
-{
- Evas_Object *self;
- Evas_Object *scroller;
- Evas_Object *main_box;
- Evas_Object *left_blank;
- Evas_Object *right_blank;
- Elm_Diskselector_Item *selected_item;
- Elm_Diskselector_Item *first;
- Elm_Diskselector_Item *second;
- Elm_Diskselector_Item *s_last;
- Elm_Diskselector_Item *last;
- Eina_List *items;
- Eina_List *r_items;
- int item_count, len_threshold, len_side;
- Ecore_Idler *idler;
- Ecore_Idler *check_idler;
- Eina_Bool init:1;
- Eina_Bool round:1;
-};
-
-struct _Elm_Diskselector_Item
-{
- Elm_Widget_Item base;
- Eina_List *node;
- Evas_Object *icon;
- const char *label;
- Evas_Smart_Cb func;
-};
-
-static const char *widtype = NULL;
-
-#define ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, ...) \
- ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
- ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__;
-
-static Eina_Bool _move_scroller(void *data);
-static void _del_hook(Evas_Object * obj);
-static void _del_pre_hook(Evas_Object * obj);
-static void _sizing_eval(Evas_Object * obj);
-static void _theme_hook(Evas_Object * obj);
-static void _on_focus_hook(void *data, Evas_Object *obj);
-static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src, Evas_Callback_Type type, void *event_info);
-static void _sub_del(void *data, Evas_Object * obj, void *event_info);
-static void _round_items_del(Widget_Data *wd);
-static void _scroller_move_cb(void *data, Evas_Object *obj, void *event_info);
-
-static const char SIG_SELECTED[] = "selected";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_SELECTED, ""},
- {NULL, NULL}
-};
-
-static void
-_diskselector_object_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
-{
- Widget_Data *wd;
- Evas_Coord w, h, minw = -1, minh = -1;
-
- wd = elm_widget_data_get(data);
- if (!wd) return;
-
- elm_coords_finger_size_adjust(6, &minw, 1, &minh);
- edje_object_size_min_restricted_calc(elm_smart_scroller_edje_object_get(
- wd->scroller), &minw, &minh, minw, minh);
- evas_object_size_hint_min_set(obj, minw, minh);
- evas_object_size_hint_max_set(obj, -1, -1);
-
- evas_object_geometry_get(wd->scroller, NULL, NULL, &w, &h);
- if (wd->round)
- evas_object_resize(wd->main_box, w / 3 * (wd->item_count + 4), h);
- else
- evas_object_resize(wd->main_box, w / 3 * (wd->item_count + 2), h);
-
- elm_smart_scroller_paging_set(wd->scroller, 0, 0,
- (int)(w / 3), 0);
-
- if (!wd->idler)
- wd->idler = ecore_idler_add(_move_scroller, data);
-}
-
-static Elm_Diskselector_Item *
-_item_new(Evas_Object *obj, Evas_Object *icon, const char *label, Evas_Smart_Cb func, const void *data)
-{
- Elm_Diskselector_Item *it;
- const char *style = elm_widget_style_get(obj);
-
- it = elm_widget_item_new(obj, Elm_Diskselector_Item);
- if (!it) return NULL;
-
- it->label = eina_stringshare_add(label);
- it->icon = icon;
- it->func = func;
- it->base.data = data;
- it->base.view = edje_object_add(evas_object_evas_get(obj));
- _elm_theme_object_set(obj, it->base.view, "diskselector", "item", style);
- evas_object_size_hint_weight_set(it->base.view, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(it->base.view, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- evas_object_show(it->base.view);
-
- if (it->label)
- edje_object_part_text_set(it->base.view, "elm.text", it->label);
- if (it->icon)
- {
- evas_object_size_hint_min_set(it->icon, 24, 24);
- evas_object_size_hint_max_set(it->icon, 40, 40);
- edje_object_part_swallow(it->base.view, "elm.swallow.icon", it->icon);
- evas_object_show(it->icon);
- elm_widget_sub_object_add(obj, it->icon);
- }
- return it;
-}
-
-static void
-_item_del(Elm_Diskselector_Item *item)
-{
- if (!item) return;
- eina_stringshare_del(item->label);
- if (item->icon)
- evas_object_del(item->icon);
- elm_widget_item_del(item);
-}
-
-static void
-_theme_data_get(Widget_Data *wd)
-{
- const char* str;
- str = edje_object_data_get(wd->right_blank, "len_threshold");
- if (str) wd->len_threshold = atoi(str);
- else wd->len_threshold = 0;
-}
-
-static void
-_del_hook(Evas_Object * obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- free(wd);
-}
-
-static void
-_del_pre_hook(Evas_Object * obj)
-{
- Elm_Diskselector_Item *it;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->left_blank)
- evas_object_del(wd->left_blank);
- if (wd->right_blank)
- evas_object_del(wd->right_blank);
- if (wd->last)
- {
- eina_stringshare_del(wd->last->label);
- evas_object_del(wd->last->base.view);
- free(wd->last);
- }
- if (wd->s_last)
- {
- eina_stringshare_del(wd->s_last->label);
- evas_object_del(wd->s_last->base.view);
- free(wd->s_last);
- }
- if (wd->second)
- {
- eina_stringshare_del(wd->second->label);
- evas_object_del(wd->second->base.view);
- free(wd->second);
- }
- if (wd->first)
- {
- eina_stringshare_del(wd->first->label);
- evas_object_del(wd->first->base.view);
- free(wd->first);
- }
-
- EINA_LIST_FREE(wd->items, it) _item_del(it);
- eina_list_free(wd->r_items);
-}
-
-static void
-_sizing_eval(Evas_Object * obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _diskselector_object_resize(obj, NULL, obj, NULL);
-}
-
-static void
-_theme_hook(Evas_Object * obj)
-{
- Eina_List *l;
- Elm_Diskselector_Item *it;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->scroller)
- elm_smart_scroller_object_theme_set(obj, wd->scroller, "diskselector",
- "base", elm_widget_style_get(obj));
- if (wd->round)
- {
- EINA_LIST_FOREACH(wd->r_items, l, it)
- {
- _elm_theme_object_set(obj, it->base.view, "diskselector", "item",
- elm_widget_style_get(obj));
- }
- }
- else
- {
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- _elm_theme_object_set(obj, it->base.view, "diskselector", "item",
- elm_widget_style_get(obj));
- }
- }
- _theme_data_get(wd);
- _sizing_eval(obj);
-}
-
-static void
-_sub_del(void *data __UNUSED__, Evas_Object * obj, void *event_info)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- Evas_Object *sub = event_info;
- Elm_Diskselector_Item *it;
- const Eina_List *l;
-
- if (!wd) return;
- if (!sub) abort();
- if (sub == wd->scroller)
- wd->scroller = NULL;
- else
- {
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- if (sub == it->icon)
- {
- it->icon = NULL;
- _sizing_eval(obj);
- break;
- }
- }
- }
-}
-
-static void
-_select_item(Elm_Diskselector_Item *it)
-{
- if (!it) return;
- Widget_Data *wd = elm_widget_data_get(it->base.widget);
- wd->selected_item = it;
- if (it->func) it->func((void *)it->base.data, it->base.widget, it);
- evas_object_smart_callback_call(it->base.widget, SIG_SELECTED, it);
-}
-
-static void
-_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- if (elm_widget_focus_get(obj))
- {
- edje_object_signal_emit(wd->self, "elm,action,focus", "elm");
- evas_object_focus_set(wd->self, EINA_TRUE);
- }
- else
- {
- edje_object_signal_emit(wd->self, "elm,action,unfocus", "elm");
- evas_object_focus_set(wd->self, EINA_FALSE);
- }
-}
-
-static Eina_Bool
-_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
-{
- if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
- Evas_Event_Key_Down *ev = event_info;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
- if (elm_widget_disabled_get(obj)) return EINA_FALSE;
-
- Elm_Diskselector_Item *it = NULL;
- Eina_List *l;
-
- if (!wd->selected_item) {
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
- return EINA_TRUE;
- }
-
- if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")) ||
- (!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
- {
- l = wd->selected_item->node->prev;
- if ((!l) && (wd->round))
- l = eina_list_last(wd->items);
- }
- else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")) ||
- (!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
- {
- l = wd->selected_item->node->next;
- if ((!l) && (wd->round))
- l = wd->items;
- }
- else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
- l = wd->items;
- else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
- l = eina_list_last(wd->items);
- else return EINA_FALSE;
-
- if (l)
- it = eina_list_data_get(l);
-
- if (it)
- {
- wd->selected_item = it;
- if (!wd->idler)
- wd->idler = ecore_idler_add(_move_scroller, obj);
- }
-
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
- return EINA_TRUE;
-}
-
-static int
-_check_letter(const char *str, int length)
-{
- int code = str[length];
-
- if (code == '\0')
- return length; // null string
- else if (((code >= 65) && (code <= 90)) || ((code >= 97) && (code <= 122)))
- return length; // alphabet
- else if ((48 <= code) && (code < 58))
- return length; // number
- else if (((33 <= code) && (code < 47)) || ((58 <= code) && (code < 64))
- || ((91 <= code) && (code < 96)) || ((123 <= code) && (code < 126)))
- return length; // special letter
- return length - 1;
-}
-
-static Eina_Bool
-_check_string(void *data)
-{
- int mid, steps, length, diff;
- Elm_Diskselector_Item *it;
- Eina_List *list, *l;
- Evas_Coord ox, ow;
- char buf[1024];
- Widget_Data *wd = data;
-
- evas_object_geometry_get(wd->scroller, &ox, NULL, &ow, NULL);
- if (ow <= 0)
- return EINA_FALSE;
- if (!wd->init)
- return EINA_FALSE;
- if (!wd->round)
- list = wd->items;
- else
- list = wd->r_items;
-
- EINA_LIST_FOREACH(list, l, it)
- {
- Evas_Coord x, w;
- int len;
- evas_object_geometry_get(it->base.view, &x, NULL, &w, NULL);
- /* item not visible */
- if ((x + w <= ox) || (x >= ox + ow))
- continue;
-
- len = eina_stringshare_strlen(it->label);
-
- if (x <= ox + 5)
- edje_object_signal_emit(it->base.view, "elm,state,left_side",
- "elm");
- else if (x + w >= ox + ow - 5)
- edje_object_signal_emit(it->base.view, "elm,state,right_side",
- "elm");
- else
- {
- if ((wd->len_threshold) && (len > wd->len_threshold))
- edje_object_signal_emit(it->base.view, "elm,state,center_small",
- "elm");
- else
- edje_object_signal_emit(it->base.view, "elm,state,center",
- "elm");
- }
-
- if (len <= wd->len_side)
- continue;
-
- steps = len - wd->len_side + 1;
- mid = x + w / 2;
- if (mid <= ox + ow / 2)
- diff = (ox + ow / 2) - mid;
- else
- diff = mid - (ox + ow / 2);
-
- length = len - (int)(diff * steps / (ow / 3));
- length = MAX(length, wd->len_side);
- length = _check_letter(it->label, length);
- strncpy(buf, it->label, length);
- buf[length] = '\0';
- edje_object_part_text_set(it->base.view, "elm.text", buf);
- }
-
- if (wd->check_idler)
- ecore_idler_del(wd->check_idler);
- wd->check_idler = NULL;
- return EINA_FALSE;
-}
-
-static void
-_scroller_move_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Evas_Coord x, y, w, h, bw;
- Widget_Data *wd = data;
-
- _check_string(wd);
- elm_smart_scroller_child_pos_get(obj, &x, &y);
- elm_smart_scroller_child_viewport_size_get(obj, &w, &h);
- if (wd->round)
- {
- evas_object_geometry_get(wd->main_box, NULL, NULL, &bw, NULL);
- if (x > w / 3 * (wd->item_count + 1))
- elm_smart_scroller_child_region_show(wd->scroller,
- x - w / 3 * wd->item_count,
- y, w, h);
- else if (x < 0)
- elm_smart_scroller_child_region_show(wd->scroller,
- x + w / 3 * wd->item_count,
- y, w, h);
- }
-}
-
-static void
-_scroller_stop_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Elm_Diskselector_Item *it;
- Widget_Data *wd = data;
- Evas_Coord x, w, ow;
- Eina_List *l, *list;
-
- if (wd->idler)
- return;
-
- if (!wd->round)
- list = wd->items;
- else
- list = wd->r_items;
-
- evas_object_geometry_get(wd->scroller, NULL, NULL, &ow, NULL);
- EINA_LIST_FOREACH(list, l, it)
- {
- evas_object_geometry_get(it->base.view, &x, NULL, &w, NULL);
- if (abs((int)(ow / 2 - (int)(x + w / 2))) < 10)
- break;
- }
-
- if (!it)
- return;
-
- _select_item(it);
-}
-
-static Eina_Bool
-_move_scroller(void *data)
-{
- Evas_Object *obj = data;
- Widget_Data *wd;
- Eina_List *l;
- Elm_Diskselector_Item *dit;
- Evas_Coord y, w, h;
- int i;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
-
- if (wd->round)
- i = 1;
- else
- i = 0;
-
- EINA_LIST_FOREACH(wd->items, l, dit)
- {
- if (wd->selected_item == dit)
- break;
- i++;
- }
- if (!dit)
- {
- wd->selected_item =
- (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0);
- return EINA_FALSE;
- }
-
- evas_object_geometry_get(wd->scroller, NULL, &y, &w, &h);
- elm_smart_scroller_child_region_show(wd->scroller, w / 3 * i, y, w, h);
- _select_item(dit);
- if (wd->idler)
- {
- ecore_idler_del(wd->idler);
- wd->idler = NULL;
- }
- wd->init = EINA_TRUE;
- _check_string(wd);
-
- return EINA_TRUE;
-}
-
-static void
-_round_item_del(Widget_Data *wd, Elm_Diskselector_Item *it)
-{
- if (!it) return;
- elm_box_unpack(wd->main_box, it->base.view);
- wd->r_items = eina_list_remove(wd->r_items, it);
- eina_stringshare_del(it->label);
- evas_object_del(it->base.view);
- free(it);
-}
-
-static void
-_round_items_del(Widget_Data *wd)
-{
- _round_item_del(wd, wd->last);
- wd->last = NULL;
- _round_item_del(wd, wd->s_last);
- wd->s_last = NULL;
- _round_item_del(wd, wd->second);
- wd->second = NULL;
- _round_item_del(wd, wd->first);
- wd->first = NULL;
-}
-
-static void
-_round_items_add(Widget_Data *wd)
-{
- Elm_Diskselector_Item *dit;
- Elm_Diskselector_Item *it;
-
- dit = it = eina_list_nth(wd->items, 0);
- if (!dit) return;
-
- if (!wd->first)
- {
- wd->first = _item_new(it->base.widget, it->icon, it->label, it->func,
- it->base.data);
- wd->first->node = it->node;
- wd->r_items = eina_list_append(wd->r_items, wd->first);
- }
-
- it = eina_list_nth(wd->items, 1);
- if (!it)
- it = dit;
- if (!wd->second)
- {
- wd->second = _item_new(it->base.widget, it->icon, it->label, it->func,
- it->base.data);
- wd->second->node = it->node;
- wd->r_items = eina_list_append(wd->r_items, wd->second);
- }
-
- it = eina_list_nth(wd->items, wd->item_count - 1);
- if (!it)
- it = dit;
- if (!wd->last)
- {
- wd->last = _item_new(it->base.widget, it->icon, it->label, it->func,
- it->base.data);
- wd->last->node = it->node;
- wd->r_items = eina_list_prepend(wd->r_items, wd->last);
- }
-
- it = eina_list_nth(wd->items, wd->item_count - 2);
- if (!it)
- it = dit;
- if (!wd->s_last)
- {
- wd->s_last = _item_new(it->base.widget, it->icon, it->label, it->func,
- it->base.data);
- wd->s_last->node = it->node;
- wd->r_items = eina_list_prepend(wd->r_items, wd->s_last);
- }
-}
-
-/**
- * Add a new diskselector object
- *
- * @param parent The parent object
- * @return The new object or NULL if it cannot be created
- *
- * @ingroup Diskselector
- */
-EAPI Evas_Object *
-elm_diskselector_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Widget_Data *wd;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- wd->self = obj = elm_widget_add(evas_object_evas_get(parent));
- ELM_SET_WIDTYPE(widtype, "diskselector");
- elm_widget_type_set(obj, "diskselector");
- elm_widget_sub_object_add(parent, obj);
- elm_widget_data_set(obj, wd);
- elm_widget_del_hook_set(obj, _del_hook);
- elm_widget_del_pre_hook_set(obj, _del_pre_hook);
- elm_widget_theme_hook_set(obj, _theme_hook);
- elm_widget_can_focus_set(obj, EINA_TRUE);
- elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
- elm_widget_event_hook_set(obj, _event_hook);
-
- wd->item_count = 0;
- wd->round = EINA_FALSE;
- wd->init = EINA_FALSE;
- wd->len_side = 3;
-
- wd->scroller = elm_smart_scroller_add(evas_object_evas_get(parent));
- elm_smart_scroller_widget_set(wd->scroller, obj);
- _theme_hook(obj);
- elm_widget_resize_object_set(obj, wd->scroller);
- elm_smart_scroller_policy_set(wd->scroller, ELM_SMART_SCROLLER_POLICY_OFF,
- ELM_SMART_SCROLLER_POLICY_OFF);
- elm_smart_scroller_bounce_allow_set(wd->scroller, EINA_TRUE, EINA_FALSE);
- evas_object_smart_callback_add(wd->scroller, "scroll", _scroller_move_cb,
- wd);
- evas_object_smart_callback_add(wd->scroller, "animate,stop",
- _scroller_stop_cb, wd);
- _elm_theme_object_set(obj, wd->scroller, "diskselector", "base",
- "default");
- evas_object_event_callback_add(wd->scroller, EVAS_CALLBACK_RESIZE,
- _diskselector_object_resize, obj);
-
- wd->main_box = elm_box_add(parent);
- elm_box_horizontal_set(wd->main_box, EINA_TRUE);
- elm_box_homogenous_set(wd->main_box, EINA_TRUE);
- evas_object_size_hint_weight_set(wd->main_box, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->main_box, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- _elm_theme_object_set(obj, wd->main_box, "diskselector", "base",
- "default");
- elm_widget_sub_object_add(obj, wd->main_box);
-
- elm_smart_scroller_child_set(wd->scroller, wd->main_box);
-
- wd->left_blank = edje_object_add(evas_object_evas_get(obj));
- _elm_theme_object_set(obj, wd->left_blank, "diskselector", "item",
- "default");
- evas_object_size_hint_weight_set(wd->left_blank, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->left_blank, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- elm_box_pack_end(wd->main_box, wd->left_blank);
- evas_object_show(wd->left_blank);
-
- wd->right_blank = edje_object_add(evas_object_evas_get(obj));
- _elm_theme_object_set(obj, wd->right_blank, "diskselector", "item",
- "default");
- evas_object_size_hint_weight_set(wd->right_blank, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(wd->right_blank, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- elm_box_pack_end(wd->main_box, wd->right_blank);
- evas_object_show(wd->right_blank);
-
- _theme_data_get(wd);
-
- evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- _sizing_eval(obj);
- return obj;
-}
-
-/**
- * Get round mode
- *
- * If round mode is activated the items list will work like a circle list,
- * so when the user reaches the last item, the first one will popup.
- *
- * @param obj The diskselector object
- * @return if or not set round mode or false if not a valid diskselector
- *
- * @ingroup Diskselector
- */
-EAPI Eina_Bool
-elm_diskselector_round_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return EINA_FALSE;
- return wd->round;
-}
-
-/**
- * Set round mode
- *
- * If round mode is activated the items list will work like a circle list,
- * so when the user reaches the last item, the first one will popup.
- *
- * @param it The item of diskselector
- * @param if or not set round mode
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_round_set(Evas_Object * obj, Eina_Bool round)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->round == round)
- return;
-
- wd->round = round;
- if (round)
- {
- wd->r_items = eina_list_clone(wd->items);
- elm_box_unpack(wd->main_box, wd->left_blank);
- evas_object_hide(wd->left_blank);
- elm_box_unpack(wd->main_box, wd->right_blank);
- evas_object_hide(wd->right_blank);
- if (!wd->items)
- return;
-
- _round_items_add(wd);
-
- if (wd->last)
- elm_box_pack_start(wd->main_box, wd->last->base.view);
- if (wd->s_last)
- elm_box_pack_start(wd->main_box, wd->s_last->base.view);
- if (wd->first)
- elm_box_pack_end(wd->main_box, wd->first->base.view);
- if (wd->second)
- elm_box_pack_end(wd->main_box, wd->second->base.view);
- }
- else
- {
- _round_items_del(wd);
- elm_box_pack_start(wd->main_box, wd->left_blank);
- elm_box_pack_end(wd->main_box, wd->right_blank);
- eina_list_free(wd->r_items);
- wd->r_items = NULL;
- }
- _sizing_eval(obj);
-}
-
-/**
- * Get the side labels max lenght
- *
- * @param obj The diskselector object
- * @return The max lenght defined for side labels, or 0 if not a valid
- * diskselector
- *
- * @ingroup Diskselector
- */
-EAPI int
-elm_diskselector_side_label_lenght_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) 0;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return 0;
- return wd->len_side;
-}
-
-/**
- * Set the side labels max lenght
- *
- * @param obj The diskselector object
- * @param len The max lenght defined for side labels
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_side_label_lenght_set(Evas_Object *obj, int len)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- wd->len_side = len;
-}
-
-/**
- * Set bounce mode
- *
- * This will enable or disable the scroller bounce mode for the diskselector.
- * See elm_scroller_bounce_set() for details. Horizontal bounce is enabled by
- * default.
- *
- * @param obj The diskselector object
- * @param h_bounce Allow bounce horizontally
- * @param v_bounce Allow bounce vertically
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if (wd->scroller)
- elm_smart_scroller_bounce_allow_set(wd->scroller, h_bounce, v_bounce);
-}
-
-/**
- * Get the bounce mode
- *
- * @param obj The Diskselector object
- * @param h_bounce Allow bounce horizontally
- * @param v_bounce Allow bounce vertically
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- elm_smart_scroller_bounce_allow_get(wd->scroller, h_bounce, v_bounce);
-}
-
-/**
- * Get the scrollbar policy
- *
- * This sets the scrollbar visibility policy for the given scroller.
- * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it
- * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
- * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
- * This applies respectively for the horizontal and vertical scrollbars.
- * The both are disabled by default.
- *
- * @param obj The diskselector object
- * @param policy_h Horizontal scrollbar policy
- * @param policy_v Vertical scrollbar policy
- *
- * @ingroup Diskselector
- */
-
-EAPI void
-elm_diskselector_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
- Widget_Data *wd = elm_widget_data_get(obj);
- if ((!wd) || (!wd->scroller)) return;
- elm_smart_scroller_policy_get(wd->scroller, &s_policy_h, &s_policy_v);
- *policy_h = (Elm_Scroller_Policy) s_policy_h;
- *policy_v = (Elm_Scroller_Policy) s_policy_v;
-}
-
-
-/**
- * Set the scrollbar policy
- *
- * This sets the scrollbar visibility policy for the given scroller.
- * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it
- * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
- * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
- * This applies respectively for the horizontal and vertical scrollbars.
- * The both are disabled by default.
- *
- * @param obj The diskselector object
- * @param policy_h Horizontal scrollbar policy
- * @param policy_v Vertical scrollbar policy
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- if ((policy_h >= 3) || (policy_v >= 3)) return;
- if (wd->scroller)
- elm_smart_scroller_policy_set(wd->scroller, policy_h, policy_v);
-}
-
-/**
- * Clears a diskselector of all items.
- *
- * @param obj The diskselector object
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_clear(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- Elm_Diskselector_Item *it;
-
- if (!wd) return;
- if (!wd->items) return;
-
- wd->selected_item = NULL;
- EINA_LIST_FREE(wd->items, it) _item_del(it);
- _round_items_del(wd);
- _sizing_eval(obj);
-}
-
-/**
- * Returns a list of all the diskselector items.
- *
- * @param obj The diskselector object
- * @return An Eina_List* of the diskselector items, or NULL on failure
- *
- * @ingroup Diskselector
- */
-EAPI const Eina_List *
-elm_diskselector_items_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->items;
-}
-
-/**
- * Appends an item to the diskselector object.
- *
- * @param obj The diskselector object
- * @param label The label of the diskselector item
- * @param icon The icon object to use for the left side of the item
- * @param func The function to call when the item is selected
- * @param data The data to associate with the item for related callbacks
- *
- * @return The created item or NULL upon failure
- *
- * @ingroup Diskselector
- */
-EAPI Elm_Diskselector_Item *
-elm_diskselector_item_append(Evas_Object *obj, const char *label, Evas_Object *icon, Evas_Smart_Cb func, const void *data)
-{
- Elm_Diskselector_Item *it;
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
-
- it = _item_new(obj, icon, label, func, data);
- wd->items = eina_list_append(wd->items, it);
- it->node = eina_list_last(wd->items);
- wd->item_count++;
- if (wd->round)
- {
- _round_items_del(wd);
- wd->r_items = eina_list_append(wd->r_items, it);
- _round_items_add(wd);
- if (wd->last)
- elm_box_pack_start(wd->main_box, wd->last->base.view);
- if (wd->s_last)
- elm_box_pack_start(wd->main_box, wd->s_last->base.view);
- elm_box_pack_end(wd->main_box, it->base.view);
- if (wd->first)
- elm_box_pack_end(wd->main_box, wd->first->base.view);
- if (wd->second)
- elm_box_pack_end(wd->main_box, wd->second->base.view);
- }
- else
- {
- elm_box_unpack(wd->main_box, wd->right_blank);
- elm_box_pack_end(wd->main_box, it->base.view);
- elm_box_pack_end(wd->main_box, wd->right_blank);
- }
- if (!wd->selected_item)
- wd->selected_item = it;
- if (!wd->idler)
- wd->idler = ecore_idler_add(_move_scroller, obj);
- _sizing_eval(obj);
- return it;
-}
-
-/**
- * Delete the item
- *
- * @param it The item of diskselector
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_del(Elm_Diskselector_Item * it)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
- Elm_Diskselector_Item *dit;
- Widget_Data *wd = elm_widget_data_get(it->base.widget);
- if (!wd) return;
-
- elm_box_unpack(wd->main_box, it->base.view);
-
- if (wd->round)
- wd->r_items = eina_list_remove(wd->r_items, it);
-
- wd->items = eina_list_remove(wd->items, it);
-
- if (wd->selected_item == it)
- {
- dit = (Elm_Diskselector_Item *) eina_list_nth(wd->items, 0);
- if (dit != it)
- wd->selected_item = dit;
- else
- wd->selected_item = eina_list_nth(wd->items, 1);
- }
-
- _item_del(it);
- wd->item_count -= 1;
-
- if (wd->round)
- {
- if (!wd->item_count)
- {
- evas_object_hide(wd->first->base.view);
- evas_object_hide(wd->second->base.view);
- evas_object_hide(wd->last->base.view);
- evas_object_hide(wd->s_last->base.view);
- }
- else
- {
- dit = eina_list_nth(wd->items, 0);
- if (dit)
- {
- eina_stringshare_replace(&wd->first->label, dit->label);
- edje_object_part_text_set(wd->first->base.view, "elm.text",
- wd->first->label);
- }
- dit = eina_list_nth(wd->items, 1);
- if (dit)
- {
- eina_stringshare_replace(&wd->second->label, dit->label);
- edje_object_part_text_set(wd->second->base.view, "elm.text",
- wd->second->label);
- }
- dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 1);
- if (dit)
- {
- eina_stringshare_replace(&wd->last->label, dit->label);
- edje_object_part_text_set(wd->last->base.view, "elm.text",
- wd->last->label);
- }
- dit = eina_list_nth(wd->items, eina_list_count(wd->items) - 2);
- if (dit)
- {
- eina_stringshare_replace(&wd->s_last->label, dit->label);
- edje_object_part_text_set(wd->s_last->base.view, "elm.text",
- wd->s_last->label);
- }
- }
- }
- wd->check_idler = ecore_idler_add(_check_string, wd);
- _sizing_eval(it->base.widget);
-}
-
-/**
- * Get the label of item
- *
- * @param it The item of diskselector
- * @return The label of item
- *
- * @ingroup Diskselector
- */
-EAPI const char *
-elm_diskselector_item_label_get(const Elm_Diskselector_Item * it)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
- return it->label;
-}
-
-/**
- * Set the label of item
- *
- * @param it The item of diskselector
- * @param label The label of item
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_label_set(Elm_Diskselector_Item * it, const char *label)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
- eina_stringshare_replace(&it->label, label);
- edje_object_part_text_set(it->base.view, "elm.text", it->label);
-}
-
-/**
- * Get the selected item
- *
- * @param obj The diskselector object
- * @return The selected diskselector item
- *
- * @ingroup Diskselector
- */
-EAPI Elm_Diskselector_Item *
-elm_diskselector_selected_item_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return NULL;
- return wd->selected_item;
-}
-
-/**
- * Set the selected state of an item
- *
- * This sets the selected state (EINA_TRUE selected, EINA_FALSE not selected)
- * of the given item @p it.
- * If a new item is selected the previosly selected will be unselected.
- * If the item @p it is unselected, the first item will be selected.
- *
- * @param it The diskselector item
- * @param selected The selected state
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_selected_set(Elm_Diskselector_Item *it, Eina_Bool selected)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
- Widget_Data *wd;
- wd = elm_widget_data_get(it->base.widget);
- if (!wd) return;
-
- if ((wd->selected_item == it) && (selected))
- return;
-
- if ((wd->selected_item == it) && (!selected))
- wd->selected_item = eina_list_data_get(wd->items);
- else
- wd->selected_item = it;
-
- if (!wd->idler)
- ecore_idler_add(_move_scroller, it->base.widget);
-}
-
-/*
- * Get the selected state of @p item.
- *
- * @param it The diskselector item
- * @return If true, the item is selected
- *
- * @ingroup Diskselector
- */
-EAPI Eina_Bool
-elm_diskselector_item_selected_get(const Elm_Diskselector_Item *it)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
- Widget_Data *wd;
-
- wd = elm_widget_data_get(it->base.widget);
- if (!wd) return EINA_FALSE;
- return (wd->selected_item == it);
-}
-
-/**
- * Set the function called when a diskselector item is freed.
- *
- * @param it The item to set the callback on
- * @param func The function called
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_del_cb_set(Elm_Diskselector_Item *it, Evas_Smart_Cb func)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
- elm_widget_item_del_cb_set(it, func);
-}
-
-/**
- * Returns the data associated with the item.
- *
- * @param it The diskselector item
- * @return The data associated with @p it
- *
- * @ingroup Diskselector
- */
-EAPI void *
-elm_diskselector_item_data_get(const Elm_Diskselector_Item *it)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
- return elm_widget_item_data_get(it);
-}
-
-/**
- * Returns the icon associated with the item.
- *
- * @param it The diskselector item
- * @return The icon associated with @p it
- *
- * @ingroup Diskselector
- */
-EAPI Evas_Object *
-elm_diskselector_item_icon_get(const Elm_Diskselector_Item *it)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
- return it->icon;
-}
-
-/**
- * Sets the icon associated with the item.
- *
- * Once the icon object is set, a previously set one will be deleted.
- * You probably don't want, then, to have the <b>same</b> icon object set
- * for more than one item of the diskselector.
- *
- * @param it The diskselector item
- * @param icon The icon object to associate with @p it
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_icon_set(Elm_Diskselector_Item *it, Evas_Object *icon)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it);
- if (it->icon == icon) return;
- if (it->icon)
- evas_object_del(it->icon);
- it->icon = icon;
- if (it->base.view)
- edje_object_part_swallow(it->base.view, "elm.swallow.icon", icon);
-}
-
-/**
- * Gets the item before @p it in the list.
- *
- * @param it The diskselector item
- * @return The item before @p it, or NULL on failure
- *
- * @ingroup Diskselector
- */
-EAPI Elm_Diskselector_Item *
-elm_diskselector_item_prev_get(const Elm_Diskselector_Item *it)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
- if (it->node->prev) return it->node->prev->data;
- else return NULL;
-}
-
-/**
- * Gets the item after @p it in the list.
- *
- * @param it The diskselector item
- * @return The item after @p it, or NULL on failure
- *
- * @ingroup Diskselector
- */
-EAPI Elm_Diskselector_Item *
-elm_diskselector_item_next_get(const Elm_Diskselector_Item *it)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(it, NULL);
- if (it->node->next) return it->node->next->data;
- else return NULL;
-}
-
-/**
- * Get the first item in the diskselector
- *
- * @param obj The diskselector object
- * @return The first item, or NULL if none
- *
- * @ingroup Diskselector
- */
-EAPI Elm_Diskselector_Item *
-elm_diskselector_first_item_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd || !wd->items)
- return NULL;
-
- return eina_list_data_get(wd->items);
-}
-
-/**
- * Get the last item in the diskselector
- *
- * @param obj The diskselector object
- * @return The last item, or NULL if none
- *
- * @ingroup Diskselector
- */
-EAPI Elm_Diskselector_Item *
-elm_diskselector_last_item_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
- Widget_Data *wd;
- wd = elm_widget_data_get(obj);
- if (!wd || !wd->items)
- return NULL;
-
- return eina_list_data_get(eina_list_last(wd->items));
-}
-
-/**
- * Set the text to be shown in the diskselector item.
- *
- * @param item Target item
- * @param text The text to set in the content
- *
- * Setup the text as tooltip to object. The item can have only one tooltip,
- * so any previous tooltip data is removed.
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_tooltip_text_set(Elm_Diskselector_Item *item, const char *text)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
- elm_widget_item_tooltip_text_set(item, text);
-}
-
-/**
- * Set the content to be shown in the tooltip item
- *
- * Setup the tooltip to item. The item can have only one tooltip,
- * so any previous tooltip data is removed. @p func(with @p data) will
- * be called every time that need show the tooltip and it should
- * return a valid Evas_Object. This object is then managed fully by
- * tooltip system and is deleted when the tooltip is gone.
- *
- * @param item the diskselector item being attached a tooltip.
- * @param func the function used to create the tooltip contents.
- * @param data what to provide to @a func as callback data/context.
- * @param del_cb called when data is not needed anymore, either when
- * another callback replaces @func, the tooltip is unset with
- * elm_diskselector_item_tooltip_unset() or the owner @a item
- * dies. This callback receives as the first parameter the
- * given @a data, and @c event_info is the item.
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_tooltip_content_cb_set(Elm_Diskselector_Item *item, Elm_Tooltip_Item_Content_Cb func, const void *data, Evas_Smart_Cb del_cb)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
- elm_widget_item_tooltip_content_cb_set(item, func, data, del_cb);
-}
-
-/**
- * Unset tooltip from item
- *
- * @param item diskselector item to remove previously set tooltip.
- *
- * Remove tooltip from item. The callback provided as del_cb to
- * elm_diskselector_item_tooltip_content_cb_set() will be called to notify
- * it is not used anymore.
- *
- * @see elm_diskselector_item_tooltip_content_cb_set()
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_tooltip_unset(Elm_Diskselector_Item *item)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
- elm_widget_item_tooltip_unset(item);
-}
-
-/**
- * Sets a different style for this item tooltip.
- *
- * @note before you set a style you should define a tooltip with
- * elm_diskselector_item_tooltip_content_cb_set() or
- * elm_diskselector_item_tooltip_text_set()
- *
- * @param item diskselector item with tooltip already set.
- * @param style the theme style to use (default, transparent, ...)
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_tooltip_style_set(Elm_Diskselector_Item *item, const char *style)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
- elm_widget_item_tooltip_style_set(item, style);
-}
-
-/**
- * Get the style for this item tooltip.
- *
- * @param item diskselector item with tooltip already set.
- * @return style the theme style in use, defaults to "default". If the
- * object does not have a tooltip set, then NULL is returned.
- *
- * @ingroup Diskselector
- */
-EAPI const char *
-elm_diskselector_item_tooltip_style_get(const Elm_Diskselector_Item *item)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, NULL);
- return elm_widget_item_tooltip_style_get(item);
-}
-
-/**
- * Set the cursor to be shown when mouse is over the diskselector item
- *
- * @param item Target item
- * @param cursor the cursor name to be used.
- *
- * @see elm_object_cursor_set()
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_cursor_set(Elm_Diskselector_Item *item, const char *cursor)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
- elm_widget_item_cursor_set(item, cursor);
-}
-
-/**
- * Get the cursor to be shown when mouse is over the diskselector item
- *
- * @param item diskselector item with cursor already set.
- * @return the cursor name.
- *
- * @ingroup Diskselector
- */
-EAPI const char *
-elm_diskselector_item_cursor_get(const Elm_Diskselector_Item *item)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, NULL);
- return elm_widget_item_cursor_get(item);
-}
-
-/**
- * Unset the cursor to be shown when mouse is over the diskselector item
- *
- * @param item Target item
- *
- * @see elm_object_cursor_unset()
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_cursor_unset(Elm_Diskselector_Item *item)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
- elm_widget_item_cursor_unset(item);
-}
-
-/**
- * Sets a different style for this item cursor.
- *
- * @note before you set a style you should define a cursor with
- * elm_diskselector_item_cursor_set()
- *
- * @param item diskselector item with cursor already set.
- * @param style the theme style to use (default, transparent, ...)
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_cursor_style_set(Elm_Diskselector_Item *item, const char *style)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
- elm_widget_item_cursor_style_set(item, style);
-}
-
-/**
- * Get the style for this item cursor.
- *
- * @param item diskselector item with cursor already set.
- * @return style the theme style in use, defaults to "default". If the
- * object does not have a cursor set, then NULL is returned.
- *
- * @ingroup Diskselector
- */
-EAPI const char *
-elm_diskselector_item_cursor_style_get(const Elm_Diskselector_Item *item)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, NULL);
- return elm_widget_item_cursor_style_get(item);
-}
-
-/**
- * Set if the cursor set should be searched on the theme or should use
- * the provided by the engine, only.
- *
- * @note before you set if should look on theme you should define a cursor
- * with elm_object_cursor_set(). By default it will only look for cursors
- * provided by the engine.
- *
- * @param item widget item with cursor already set.
- * @param engine_only boolean to define it cursors should be looked only
- * between the provided by the engine or searched on widget's theme as well.
- *
- * @ingroup Diskselector
- */
-EAPI void
-elm_diskselector_item_cursor_engine_only_set(Elm_Diskselector_Item *item, Eina_Bool engine_only)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item);
- elm_widget_item_cursor_engine_only_set(item, engine_only);
-}
-
-/**
- * Get the cursor engine only usage for this item cursor.
- *
- * @param item widget item with cursor already set.
- * @return engine_only boolean to define it cursors should be looked only
- * between the provided by the engine or searched on widget's theme as well. If
- * the object does not have a cursor set, then EINA_FALSE is returned.
- *
- * @ingroup Diskselector
- */
-EAPI Eina_Bool
-elm_diskselector_item_cursor_engine_only_get(const Elm_Diskselector_Item *item)
-{
- ELM_DISKSELECTOR_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
- return elm_widget_item_cursor_engine_only_get(item);
-}
+++ /dev/null
-#include <Elementary.h>
-#include "elm_priv.h"
-
-/**
- * @addtogroup Flipselector Flipselector
- *
- * A flip selector is a widget to show a set of label items, one at a
- * time, with an animation when one changes the current selection
- * (like the flip of calendar sheets, in the default theme).
- */
-
-/* TODO: ideally, the default theme would use map{} blocks on the TEXT
- parts to implement their fading in/out propertly (as in the clock
- widget) */
-/* TODO: if one ever wants to extend it to receiving generic widgets
- as items, be my guest. in this case, remember to implement the
- items tooltip infra. */
-/* TODO: implement disabled mode -- disable_hook() and stuff. */
-/* TODO: fix default theme image borders for looong strings as item
- labels. */
-/* TODO: set text elipsis on labels if one enforces mininum size on
- * the overall widget less the required for displaying it. */
-/* TODO: find a way to, in the default theme, to detect we are
- * bootstrapping (receiving the 1st message) and populate the downmost
- * TEXT parts with the same text as the upmost, where appropriate. */
-
-#define FLIP_FIRST_INTERVAL (0.85)
-#define FLIP_MIN_INTERVAL (0.1)
-#define MSG_FLIP_DOWN (1)
-#define MSG_FLIP_UP (2)
-#define MAX_LEN_DEFAULT (50)
-
-#define DATA_GET eina_list_data_get
-
-struct _Elm_Flipselector_Item {
- Elm_Widget_Item base;
- const char *label;
- Evas_Smart_Cb func;
- void *data;
- int deleted : 1;
-};
-
-typedef struct _Widget_Data Widget_Data;
-
-struct _Widget_Data {
- Evas_Object *self;
- Evas_Object *base;
- Eina_List *items;
- Eina_List *current;
- Eina_List *sentinel; /* item containing the largest label string */
- int walking;
- unsigned int max_len;
- Ecore_Timer *spin;
- double interval, first_interval;
-};
-
-static const char *widtype = NULL;
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _sizing_eval(Evas_Object *obj);
-static void _update_view(Evas_Object *obj);
-static void _callbacks_set(Evas_Object *obj);
-static void _flip_up(Widget_Data *wd);
-static void _flip_down(Widget_Data *wd);
-
-static const char SIG_SELECTED[] = "selected";
-static const char SIG_UNDERFLOWED[] = "underflowed";
-static const char SIG_OVERFLOWED[] = "overflowed";
-static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_SELECTED, ""},
- {SIG_UNDERFLOWED, ""},
- {SIG_OVERFLOWED, ""},
- {NULL, NULL}
-};
-
-#define ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(it, ...) \
- ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, __VA_ARGS__); \
- if (it->deleted) \
- { \
- ERR(""#it" has been DELETED.\n"); \
- return __VA_ARGS__; \
- } \
-
-static Elm_Flipselector_Item *
-_item_new(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *data)
-{
- unsigned int len;
- Elm_Flipselector_Item *it;
- Widget_Data *wd = elm_widget_data_get(obj);
-
- it = elm_widget_item_new(obj, Elm_Flipselector_Item);
- if (!it)
- return NULL;
-
- len = strlen(label);
- if (len > wd->max_len)
- len = wd->max_len;
-
- it->label = eina_stringshare_add_length(label, len);
- it->func = func;
- it->base.data = data;
-
- /* TODO: no view here, but if one desires general contents in the
- * future... */
- return it;
-}
-
-static inline void
-_item_free(Elm_Flipselector_Item *it)
-{
- eina_stringshare_del(it->label);
- elm_widget_item_del(it);
-}
-
-static void
-_del_hook(Evas_Object *obj)
-{
- Elm_Flipselector_Item *item;
-
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- if (wd->walking)
- ERR("flipselector deleted while walking.\n");
-
- EINA_LIST_FREE(wd->items, item)
- _item_free(item);
-
- if (wd->spin) ecore_timer_del(wd->spin);
- free(wd);
-}
-
-static void
-_theme_hook(Evas_Object *obj)
-{
- Widget_Data *wd;
- const char *max_len;
-
- wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- _elm_theme_object_set(obj, wd->base, "flipselector", "base",
- elm_widget_style_get(obj));
- edje_object_scale_set(wd->base,
- elm_widget_scale_get(obj) * _elm_config->scale);
-
- max_len = edje_object_data_get(wd->base, "max_len");
- if (!max_len)
- wd->max_len = MAX_LEN_DEFAULT;
- else
- {
- wd->max_len = atoi(max_len);
- if (!wd->max_len)
- wd->max_len = MAX_LEN_DEFAULT;
- }
-
- _update_view(obj);
- _sizing_eval(obj);
-}
-
-static void
-_sentinel_eval(Widget_Data *wd)
-{
- Elm_Flipselector_Item *it;
- Eina_List *l;
-
- if (!wd->items)
- {
- wd->sentinel = NULL;
- return;
- }
-
- wd->sentinel = wd->items;
-
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- if (strlen(elm_flipselector_item_label_get(it)) >
- strlen(elm_flipselector_item_label_get(DATA_GET(wd->sentinel))))
- wd->sentinel = l;
- }
-}
-
-/* TODO: create a flag to avoid looping here all times */
-static void
-_flipselector_process_deletions(Widget_Data *wd)
-{
- Elm_Flipselector_Item *it;
- Eina_List *l;
- Eina_Bool skip = EINA_TRUE;
- Eina_Bool sentinel_eval = EINA_FALSE;
-
- wd->walking++; /* avoid nested deletions */
-
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- if (!it->deleted)
- continue;
-
- if (wd->current == l)
- {
- if (wd->current == wd->sentinel)
- sentinel_eval = EINA_TRUE;
-
- wd->current = eina_list_prev(wd->current);
- }
- wd->items = eina_list_remove(wd->items, it);
-
- if (!wd->current)
- wd->current = wd->items;
-
- _item_free(it);
- skip = EINA_FALSE;
-
- if (eina_list_count(wd->items) <= 1)
- edje_object_signal_emit(wd->base, "elm,state,button,hidden", "elm");
- else
- edje_object_signal_emit(wd->base, "elm,state,button,visible", "elm");
- }
-
- if (!skip)
- _update_view(wd->self);
-
- if (sentinel_eval)
- _sentinel_eval(wd);
-
- wd->walking--;
-}
-
-static inline void
-_flipselector_walk(Widget_Data *wd)
-{
- if (wd->walking < 0)
- {
- ERR("walking was negative. fixed!\n");
- wd->walking = 0;
- }
- wd->walking++;
-}
-
-static inline void
-_flipselector_unwalk(Widget_Data *wd)
-{
- wd->walking--;
- if (wd->walking < 0)
- {
- ERR("walking became negative. fixed!\n");
- wd->walking = 0;
- }
-
- if (wd->walking)
- return;
-
- _flipselector_process_deletions(wd);
-}
-
-static Eina_Bool
-_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
-{
- Evas_Event_Key_Down *ev;
- Widget_Data *wd;
- Eina_Bool is_up = EINA_TRUE;
-
- if (type != EVAS_CALLBACK_KEY_DOWN)
- return EINA_FALSE;
-
- wd = elm_widget_data_get(obj);
- if (!wd)
- return EINA_FALSE;
-
- ev = event_info;
- if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
- return EINA_FALSE;
-
- if (elm_widget_disabled_get(obj))
- return EINA_FALSE;
-
- if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
- is_up = EINA_FALSE;
- else if ((strcmp(ev->keyname, "Up")) && (strcmp(ev->keyname, "KP_Up")))
- return EINA_FALSE;
-
- if (wd->spin) ecore_timer_del(wd->spin);
-
- /* TODO: if direction setting via API is not coming in, replace
- these calls by flip_{next,prev} */
- _flipselector_walk(wd);
- if (is_up)
- _flip_up(wd);
- else
- _flip_down(wd);
- _flipselector_unwalk(wd);
-
- ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
- return EINA_TRUE;
-}
-
-static void
-_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- /* FIXME: no treatment of this signal so far */
- if (elm_widget_focus_get(obj))
- {
- edje_object_signal_emit(wd->base, "elm,action,focus", "elm");
- evas_object_focus_set(wd->base, EINA_TRUE);
- }
- else
- {
- edje_object_signal_emit(wd->base, "elm,action,unfocus", "elm");
- evas_object_focus_set(wd->base, EINA_FALSE);
- }
-}
-
-static void
-_sizing_eval(Evas_Object *obj)
-{
- Widget_Data *wd;
- const char *tmp = NULL;
- Evas_Coord minw = -1, minh = -1, w, h;
-
- wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- elm_coords_finger_size_adjust(1, &minw, 2, &minh);
-
- if (wd->sentinel)
- {
- const char *label = \
- elm_flipselector_item_label_get(DATA_GET(wd->sentinel));
-
- tmp = edje_object_part_text_get(wd->base, "top");
- edje_object_part_text_set(wd->base, "top", label);
- }
-
- edje_object_size_min_restricted_calc(wd->base, &minw, &minh, minw, minh);
- elm_coords_finger_size_adjust(1, &minw, 2, &minh);
- evas_object_size_hint_min_get(obj, &w, &h);
-
- if (wd->sentinel)
- edje_object_part_text_set(wd->base, "top", tmp);
-
- if (w > minw) minw = w;
- if (h > minh) minh = h;
-
- evas_object_size_hint_min_set(obj, minw, minh);
-}
-
-static void
-_update_view(Evas_Object *obj)
-{
- Widget_Data *wd;
- const char *label;
- Elm_Flipselector_Item *item;
-
- wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- label = NULL;
- item = DATA_GET(wd->current);
- if (item)
- label = item->label;
-
- edje_object_part_text_set(wd->base, "top", label ? label : "");
- edje_object_part_text_set(wd->base, "bottom", label ? label : "");
-
- edje_object_message_signal_process(wd->base);
-}
-
-static void
-_changed(Widget_Data *wd)
-{
- Elm_Flipselector_Item *item;
-
- item = DATA_GET(wd->current);
- if (!item)
- return;
-
- if (item->func)
- item->func((void *)item->base.data, item->base.widget, item);
- if (!item->deleted)
- evas_object_smart_callback_call(wd->self, SIG_SELECTED, item);
-}
-
-static void
-_send_msg(Widget_Data *wd, int flipside, char *label)
-{
- Edje_Message_String msg;
-
- msg.str = label;
- edje_object_message_send(wd->base, EDJE_MESSAGE_STRING, flipside, &msg);
- edje_object_message_signal_process(wd->base);
-
- _changed(wd);
-}
-
-static void
-_flip_up(Widget_Data *wd)
-{
- Elm_Flipselector_Item *item;
-
- if (!wd->current)
- return;
-
- if (wd->current == wd->items)
- {
- wd->current = eina_list_last(wd->items);
- evas_object_smart_callback_call(wd->self, SIG_UNDERFLOWED, NULL);
- }
- else
- wd->current = eina_list_prev(wd->current);
-
- item = DATA_GET(wd->current);
- if (!item)
- return;
-
- _send_msg(wd, MSG_FLIP_UP, (char *)item->label);
-}
-
-static Eina_Bool
-_signal_val_up(void *data)
-{
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (!wd)
- goto val_up_exit_on_error;
-
- _flipselector_walk(wd);
-
- if (wd->interval > FLIP_MIN_INTERVAL)
- wd->interval = wd->interval / 1.05;
-
- ecore_timer_interval_set(wd->spin, wd->interval);
-
- _flip_up(wd);
-
- _flipselector_unwalk(wd);
-
- return ECORE_CALLBACK_RENEW;
-
- val_up_exit_on_error:
- return ECORE_CALLBACK_CANCEL;
-}
-
-static void
-_signal_val_up_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd)
- return;
-
- wd->interval = wd->first_interval;
-
- if (wd->spin)
- ecore_timer_del(wd->spin);
- wd->spin = ecore_timer_add(wd->interval, _signal_val_up, data);
-
- _signal_val_up(data);
-}
-
-static void
-_flip_down(Widget_Data *wd)
-{
- Elm_Flipselector_Item *item;
-
- if (!wd->current)
- return;
-
- wd->current = eina_list_next(wd->current);
- if (!wd->current)
- {
- wd->current = wd->items;
- evas_object_smart_callback_call(wd->self, SIG_OVERFLOWED, NULL);
- }
-
- item = DATA_GET(wd->current);
- if (!item)
- return;
-
- _send_msg(wd, MSG_FLIP_DOWN, (char *)item->label);
-}
-
-static Eina_Bool
-_signal_val_down(void *data)
-{
- Widget_Data *wd = elm_widget_data_get(data);
-
- if (!wd)
- goto val_down_exit_on_error;
-
- _flipselector_walk(wd);
-
- if (wd->interval > FLIP_MIN_INTERVAL)
- wd->interval = wd->interval / 1.05;
- ecore_timer_interval_set(wd->spin, wd->interval);
-
- _flip_down(wd);
-
- _flipselector_unwalk(wd);
-
- return ECORE_CALLBACK_RENEW;
-
- val_down_exit_on_error:
- return ECORE_CALLBACK_CANCEL;
-}
-
-static void
-_signal_val_down_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd)
- return;
-
- wd->interval = wd->first_interval;
-
- if (wd->spin)
- ecore_timer_del(wd->spin);
- wd->spin = ecore_timer_add(wd->interval, _signal_val_down, data);
-
- _signal_val_down(data);
-}
-
-static void
-_signal_val_change_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
-{
- Widget_Data *wd = elm_widget_data_get(data);
- if (!wd)
- return;
-
- if (wd->spin)
- ecore_timer_del(wd->spin);
- wd->spin = NULL;
-}
-
-static void
-_callbacks_set(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
-
- edje_object_signal_callback_add(wd->base, "elm,action,up,start",
- "", _signal_val_up_start, obj);
- edje_object_signal_callback_add(wd->base, "elm,action,up,stop",
- "", _signal_val_change_stop, obj);
- edje_object_signal_callback_add(wd->base, "elm,action,down,start",
- "", _signal_val_down_start, obj);
- edje_object_signal_callback_add(wd->base, "elm,action,down,stop",
- "", _signal_val_change_stop, obj);
-}
-
-/**
- * Add a new flipselector to the parent.
- *
- * @param parent The parent object
- * @return The new object or NULL, if it cannot be created
- *
- * @ingroup Flipselector
- */
-EAPI Evas_Object *
-elm_flipselector_add(Evas_Object *parent)
-{
- Evas_Object *obj;
- Evas *e;
- Widget_Data *wd;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
-
- wd = ELM_NEW(Widget_Data);
- e = evas_object_evas_get(parent);
- if (!e) return NULL;
- obj = elm_widget_add(e);
- wd->self = obj;
- ELM_SET_WIDTYPE(widtype, "flipselector");
- elm_widget_type_set(obj, "flipselector");
- 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);
- /* TODO: elm_widget_disable_hook_set(obj, _disable_hook); */
-
- elm_widget_can_focus_set(obj, EINA_TRUE);
- elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
- elm_widget_event_hook_set(obj, _event_hook);
-
- wd->base = edje_object_add(e);
- elm_widget_resize_object_set(obj, wd->base);
-
- _callbacks_set(obj);
-
- wd->first_interval = FLIP_FIRST_INTERVAL;
-
- _theme_hook(obj);
-
- evas_object_smart_callbacks_descriptions_set(obj, _signals);
- return obj;
-}
-
-/**
- * Select next item of a flipselector.
- *
- * @param obj The flipselector object
- *
- * @ingroup Flipselector
- */
-EAPI void
-elm_flipselector_flip_next(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
-
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- if (wd->spin) ecore_timer_del(wd->spin);
-
- _flipselector_walk(wd);
- _flip_down(wd);
- _flipselector_unwalk(wd);
-}
-
-/**
- * Select previous item of a flipselector.
- *
- * @param obj The flipselector object
- *
- * @ingroup Flipselector
- */
-EAPI void
-elm_flipselector_flip_prev(Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
-
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- if (wd->spin) ecore_timer_del(wd->spin);
-
- _flipselector_walk(wd);
- _flip_up(wd);
- _flipselector_unwalk(wd);
-}
-
-/**
- * Append item to a flipselector.
- *
- * @param obj The flipselector object
- * @param label The label of new item
- * @param func Convenience function called when item selected
- * @param data Data passed to @p func above
- * @return A handle to the item added or NULL, on errors
- *
- * @note The maximum length of the label is going to be determined by
- * the widget's theme. Strings larger than that value are going to be
- * truncated.
- *
- * @ingroup Flipselector
- */
-EAPI Elm_Flipselector_Item *
-elm_flipselector_item_append(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
- Elm_Flipselector_Item *item;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd)
- return NULL;
-
- item = _item_new(obj, label, func, data);
- if (!item)
- return NULL;
-
- wd->items = eina_list_append(wd->items, item);
- if (!wd->current) {
- wd->current = wd->items;
- _update_view(obj);
- }
-
- if (!wd->sentinel ||
- (strlen(elm_flipselector_item_label_get(item)) >
- strlen(elm_flipselector_item_label_get(DATA_GET(wd->sentinel)))))
- {
- wd->sentinel = eina_list_last(wd->items);
- _sizing_eval(obj);
- }
-
- if (eina_list_count(wd->items) >= 2)
- edje_object_signal_emit(wd->base, "elm,state,button,visible", "elm");
-
- return item;
-}
-
-/**
- * Prepend item to a flipselector.
- *
- * @param obj The flipselector object
- * @param label The label of new item
- * @param func Convenience function called when item selected
- * @param data Data passed to @p func above
- * @return A handle to the item added or NULL, on errors
- *
- * @note The maximum length of the label is going to be determined by
- * the widget's theme. Strings larger than that value are going to be
- * truncated.
- *
- * @ingroup Flipselector
- */
-EAPI Elm_Flipselector_Item *
-elm_flipselector_item_prepend(Evas_Object *obj, const char *label, void (*func)(void *data, Evas_Object *obj, void *event_info), void *data)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
- Elm_Flipselector_Item *item;
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd)
- return NULL;
-
- item = _item_new(obj, label, func, data);
- if (!item)
- return NULL;
-
- wd->items = eina_list_prepend(wd->items, item);
- if (!wd->current) {
- wd->current = wd->items;
- _update_view(obj);
- }
-
- if (!wd->sentinel ||
- (strlen(elm_flipselector_item_label_get(item)) >
- strlen(elm_flipselector_item_label_get(DATA_GET(wd->sentinel)))))
- {
- wd->sentinel = wd->items;
- _sizing_eval(obj);
- }
-
- if (eina_list_count(wd->items) >= 2)
- edje_object_signal_emit(wd->base, "elm,state,button,visible", "elm");
-
- return item;
-}
-
-/* TODO: account for deleted items? */
-/**
- * Get a list of items in the flipselector.
- *
- * @param obj The flipselector object
- * @return The list of items, or NULL on errors.
- *
- * @ingroup Flipselector
- */
-EAPI const Eina_List *
-elm_flipselector_items_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return NULL;
-
- return wd->items;
-}
-
-/**
- * Get the first item in the flipselector
- *
- * @param obj The flipselector object
- * @return The first item, or NULL if none
- *
- * @ingroup Flipselector
- */
-EAPI Elm_Flipselector_Item *
-elm_flipselector_first_item_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
- Elm_Flipselector_Item *it;
- Widget_Data *wd;
- Eina_List *l;
-
- wd = elm_widget_data_get(obj);
- if (!wd || !wd->items)
- return NULL;
-
- EINA_LIST_FOREACH(wd->items, l, it)
- {
- if (it->deleted)
- continue;
-
- return it;
- }
-
- return NULL;
-}
-
-/**
- * Get the last item in the flipselector
- *
- * @param obj The flipselector object
- * @return The last item, or NULL if none
- *
- * @ingroup Flipselector
- */
-EAPI Elm_Flipselector_Item *
-elm_flipselector_last_item_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
- Elm_Flipselector_Item *it;
- Widget_Data *wd;
- Eina_List *l;
-
- wd = elm_widget_data_get(obj);
- if (!wd || !wd->items)
- return NULL;
-
- EINA_LIST_REVERSE_FOREACH(wd->items, l, it)
- {
- if (it->deleted)
- continue;
-
- return it;
- }
-
- return NULL;
-}
-
-/**
- * Get the selected item in a flipselector.
- *
- * @param obj The flipselector object
- * @return The selected item, or NULL if none
- *
- * @ingroup Flipselector
- */
-EAPI Elm_Flipselector_Item *
-elm_flipselector_selected_item_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd || !wd->current)
- return NULL;
-
- return DATA_GET(wd->current);
-}
-
-/**
- * Set the selected state of an item
- *
- * This sets the selected state (EINA_TRUE selected, EINA_FALSE not selected)
- * of the given item @p item.
- * If a new item is selected the previosly selected will be unselected.
- * If the item @p item is unselected, the first item will be selected.
- *
- * @param item The item
- * @param selected The selected state
- *
- * @ingroup Flipselector
- */
-EAPI void
-elm_flipselector_item_selected_set(Elm_Flipselector_Item *item, Eina_Bool selected)
-{
- ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item);
-
- Elm_Flipselector_Item *_item, *cur;
- int flipside = MSG_FLIP_UP;
- Widget_Data *wd;
- Eina_List *l;
-
- wd = elm_widget_data_get(item->base.widget);
- if (!wd)
- return;
-
- cur = DATA_GET(wd->current);
- if ((selected) && (cur == item))
- return;
-
- _flipselector_walk(wd);
-
- if ((!selected) && (cur == item))
- {
- EINA_LIST_FOREACH(wd->items, l, _item)
- {
- if (!_item->deleted)
- {
- wd->current = l;
- _send_msg(wd, MSG_FLIP_UP, (char *)_item->label);
- break;
- }
- }
- _flipselector_unwalk(wd);
- return;
- }
-
- EINA_LIST_FOREACH(wd->items, l, _item)
- {
- if (_item == cur)
- flipside = MSG_FLIP_DOWN;
-
- if (_item == item)
- {
- wd->current = l;
- _send_msg(wd, flipside, (char *)item->label);
- break;
- }
- }
-
- _flipselector_unwalk(wd);
-}
-
-/*
- * Get the selected state of @p item.
- *
- * @param item The flipselector item
- * @return If true, the item is selected
- *
- * @ingroup Flipselector
- */
-EAPI Eina_Bool
-elm_flipselector_item_selected_get(const Elm_Flipselector_Item *item)
-{
- ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item, EINA_FALSE);
- Widget_Data *wd;
-
- wd = elm_widget_data_get(item->base.widget);
- if (!wd) return EINA_FALSE;
- return (eina_list_data_get(wd->current) == item);
-}
-
-/**
- * Delete a given item from a flipselector.
- *
- * @param item The item
- *
- * @ingroup Flipselector
- */
-EAPI void
-elm_flipselector_item_del(Elm_Flipselector_Item *item)
-{
- ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item);
-
- Widget_Data *wd;
-
- wd = elm_widget_data_get(item->base.widget);
- if (!wd)
- return;
-
- if (wd->walking > 0)
- {
- item->deleted = EINA_TRUE;
- return;
- }
-
- _flipselector_walk(wd);
-
- wd->items = eina_list_remove(wd->items, item);
- _item_free(item);
- _sentinel_eval(wd);
-
- _flipselector_unwalk(wd);
-}
-
-/**
- * Get the label of a given flipselector item.
- *
- * @param item The item
- * @return The label of a given item, or NULL if none
- *
- * @ingroup Flipselector
- */
-EAPI const char *
-elm_flipselector_item_label_get(const Elm_Flipselector_Item *item)
-{
- ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item, NULL);
-
- Elm_Flipselector_Item *_item;
- Widget_Data *wd;
- Eina_List *l;
-
- wd = elm_widget_data_get(item->base.widget);
- if ((!wd) || (!wd->items))
- return NULL;
-
- EINA_LIST_FOREACH(wd->items, l, _item)
- if (_item == item)
- return item->label;
-
- return NULL;
-}
-
-/**
- * Set the label of a given flipselector item.
- *
- * @param item The item
- * @param label The text label string in UTF-8
- *
- * @ingroup Flipselector
- */
-EAPI void
-elm_flipselector_item_label_set(Elm_Flipselector_Item *item, const char *label)
-{
- ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item);
-
- Widget_Data *wd;
- Eina_List *l;
-
- if ((!item) || (!label))
- return;
-
- wd = elm_widget_data_get(item->base.widget);
- if ((!wd) || (!wd->items))
- return;
-
- l = eina_list_data_find_list(wd->items, item);
- if (!l)
- return;
-
- eina_stringshare_del(item->label);
- item->label = eina_stringshare_add_length(label, wd->max_len);
-
- if (strlen(label) >
- strlen(elm_flipselector_item_label_get(DATA_GET(wd->sentinel))))
- wd->sentinel = l;
-
- if (wd->current == l)
- {
- _update_view(item->base.widget);
- _sizing_eval(wd->self);
- }
-
- return;
-}
-
-/**
- * Gets the item before @p item in a flipselector.
- *
- * @param item The item
- * @return The item before the item @p item
- *
- * @ingroup Flipselector
- */
-EAPI Elm_Flipselector_Item *
-elm_flipselector_item_prev_get(Elm_Flipselector_Item *item)
-{
- ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item, NULL);
-
- Elm_Flipselector_Item *_item;
- Widget_Data *wd;
- Eina_List *l;
-
- wd = elm_widget_data_get(item->base.widget);
- if ((!wd) || (!wd->items))
- return NULL;
-
- EINA_LIST_FOREACH(wd->items, l, _item)
- if (_item == item)
- {
- l = eina_list_prev(l);
- if (!l)
- return NULL;
- return DATA_GET(l);
- }
-
- return NULL;
-}
-
-/**
- * Gets the item after @p item in a flipselector.
- *
- * @param item The item
- * @return The item after the item @p item
- *
- * @ingroup Flipselector
- */
-EAPI Elm_Flipselector_Item *
-elm_flipselector_item_next_get(Elm_Flipselector_Item *item)
-{
- ELM_FLIPSELECTOR_ITEM_CHECK_DELETED_RETURN(item, NULL);
-
- Elm_Flipselector_Item *_item;
- Widget_Data *wd;
- Eina_List *l;
-
- wd = elm_widget_data_get(item->base.widget);
- if ((!wd) || (!wd->items))
- return NULL;
-
- EINA_LIST_FOREACH(wd->items, l, _item)
- if (_item == item)
- {
- l = eina_list_next(l);
- if (!l)
- return NULL;
- return DATA_GET(l);
- }
-
- return NULL;
-}
-
-/**
- * Set the flipping interval for the flipselector.
- *
- * @param obj The flipselector object
- * @param interval The interval value in seconds
- *
- * The interval value is decreased while the user flips the widget up
- * or down repeatedly. The next interval value is the previous
- * interval / 1.05, so it speeds up a bit. Default value is 0.85
- * seconds.
- *
- * @ingroup Flipselector
- */
-EAPI void
-elm_flipselector_interval_set(Evas_Object *obj, double interval)
-{
- ELM_CHECK_WIDTYPE(obj, widtype);
-
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd)
- return;
-
- wd->first_interval = interval;
-}
-
-/**
- * Get the flipping interval of the flipselector.
- *
- * @param obj The flipselector object
- * @return The value of the first interval in seconds
- *
- * The interval value is decreased while the user flips the widget up
- * or down repeatedly. The next interval value is the previous
- * interval / 1.05, so it speeds up a bit. Default value is 0.85
- * seconds.
- *
- * @ingroup Flipselector
- */
-EAPI double
-elm_flipselector_interval_get(const Evas_Object *obj)
-{
- ELM_CHECK_WIDTYPE(obj, widtype) 0.0;
-
- Widget_Data *wd = elm_widget_data_get(obj);
-
- if (!wd)
- return 0.0;
- return wd->first_interval;
-}
+++ /dev/null
-#include <Elementary.h>
-#include <Elementary_Cursor.h>
-#include "elm_priv.h"
-
-#ifndef EFL_HAVE_THREADS
-# error "No thread support. Required."
-#endif
-
-#ifdef EFL_HAVE_POSIX_THREADS
-# include <pthread.h>
-# define LK(x) pthread_mutex_t x
-# define LKI(x) pthread_mutex_init(&(x), NULL);
-# define LKD(x) pthread_mutex_destroy(&(x));
-# define LKL(x) pthread_mutex_lock(&(x));
-# define LKU(x) pthread_mutex_unlock(&(x));
-#else /* EFL_HAVE_WIN32_THREADS */
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-# undef WIN32_LEAN_AND_MEAN
-# define LK(x) HANDLE x
-# define LKI(x) x = CreateMutex(NULL, FALSE, NULL)
-# define LKD(x) CloseHandle(x)
-# define LKL(x) WaitForSingleObject(x, INFINITE)
-# define LKU(x) ReleaseMutex(x)
-#endif
-
-#define ELM_STORE_MAGIC 0x3f89ea56
-#define ELM_STORE_FILESYSTEM_MAGIC 0x3f89ea57
-#define ELM_STORE_ITEM_MAGIC 0x5afe8c1d
-
-struct _Elm_Store
-{
- EINA_MAGIC;
- void (*free)(Elm_Store *store);
- struct {
- void (*free)(Elm_Store_Item *item);
- } item;
- Evas_Object *genlist;
- Ecore_Thread *list_th;
- Eina_Inlist *items;
- Eina_List *realized;
- int realized_count;
- int cache_max;
- struct {
- struct {
- Elm_Store_Item_List_Cb func;
- void *data;
- } list;
- struct {
- Elm_Store_Item_Fetch_Cb func;
- void *data;
- } fetch;
- struct {
- Elm_Store_Item_Unfetch_Cb func;
- void *data;
- } unfetch;
- } cb;
- Eina_Bool sorted : 1;
- Eina_Bool fetch_thread : 1;
-};
-
-struct _Elm_Store_Item
-{
- EINA_INLIST;
- EINA_MAGIC;
- Elm_Store *store;
- Elm_Genlist_Item *item;
- Ecore_Thread *fetch_th;
- Ecore_Job *eval_job;
- const Elm_Store_Item_Mapping *mapping;
- void *data;
- LK(lock);
- Eina_Bool live : 1;
- Eina_Bool was_live : 1;
- Eina_Bool realized : 1;
- Eina_Bool fetched : 1;
-};
-
-struct _Elm_Store_Filesystem
-{
- Elm_Store base;
- EINA_MAGIC;
- const char *dir;
-};
-
-struct _Elm_Store_Item_Filesystem
-{
- Elm_Store_Item base;
- const char *path;
-};
-
-static Elm_Genlist_Item_Class _store_item_class;
-
-static void
-_store_cache_trim(Elm_Store *st)
-{
- while ((st->realized ) &&
- (((int)eina_list_count(st->realized) - st->realized_count)
- > st->cache_max))
- {
- Elm_Store_Item *sti = st->realized->data;
- if (sti->realized)
- {
- st->realized = eina_list_remove_list(st->realized, st->realized);
- sti->realized = EINA_FALSE;
- }
- LKL(sti->lock);
- if (!sti->fetched)
- {
- LKU(sti->lock);
- if (sti->fetch_th)
- {
- ecore_thread_cancel(sti->fetch_th);
- sti->fetch_th = NULL;
- }
- LKL(sti->lock);
- }
- sti->fetched = EINA_FALSE;
- LKU(sti->lock);
- if (st->cb.unfetch.func)
- st->cb.unfetch.func(st->cb.unfetch.data, sti);
- LKL(sti->lock);
- sti->data = NULL;
- LKU(sti->lock);
- }
-}
-
-static void
-_store_genlist_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
-{
- Elm_Store *st = data;
- st->genlist = NULL;
- if (st->list_th)
- {
- ecore_thread_cancel(st->list_th);
- st->list_th = NULL;
- }
- eina_list_free(st->realized);
- while (st->items)
- {
- Elm_Store_Item *sti = (Elm_Store_Item *)st->items;
- if (sti->eval_job) ecore_job_del(sti->eval_job);
- if (sti->fetch_th)
- {
- ecore_thread_cancel(sti->fetch_th);
- sti->fetch_th = NULL;
- }
- if (sti->store->item.free) sti->store->item.free(sti);
- if (sti->data)
- {
- if (st->cb.unfetch.func)
- st->cb.unfetch.func(st->cb.unfetch.data, sti);
- sti->data = NULL;
- }
- LKD(sti->lock);
- free(sti);
- }
- // FIXME: kill threads and more
-}
-
-////// **** WARNING ***********************************************************
-//// * This function runs inside a thread outside efl mainloop. Be careful! *
-// ************************************************************************
-/* TODO: refactor lock part into core? this does not depend on filesystm part */
-static void
-_store_filesystem_fetch_do(void *data, Ecore_Thread *th __UNUSED__)
-{
- Elm_Store_Item *sti = data;
- LKL(sti->lock);
- if (sti->data)
- {
- LKU(sti->lock);
- return;
- }
- if (!sti->fetched)
- {
- LKU(sti->lock);
- if (sti->store->cb.fetch.func)
- sti->store->cb.fetch.func(sti->store->cb.fetch.data, sti);
- LKL(sti->lock);
- sti->fetched = EINA_TRUE;
- }
- LKU(sti->lock);
-}
-// ************************************************************************
-//// * End of separate thread function. *
-////// ************************************************************************
-/* TODO: refactor lock part into core? this does not depend on filesystm part */
-static void
-_store_filesystem_fetch_end(void *data, Ecore_Thread *th)
-{
- Elm_Store_Item *sti = data;
- LKL(sti->lock);
- if (sti->data) elm_genlist_item_update(sti->item);
- LKU(sti->lock);
- if (th == sti->fetch_th) sti->fetch_th = NULL;
-}
-
-/* TODO: refactor lock part into core? this does not depend on filesystm part */
-static void
-_store_filesystem_fetch_cancel(void *data, Ecore_Thread *th)
-{
- Elm_Store_Item *sti = data;
- LKL(sti->lock);
- if (th == sti->fetch_th) sti->fetch_th = NULL;
- if (sti->data) elm_genlist_item_update(sti->item);
- LKU(sti->lock);
-}
-
-static void
-_store_item_eval(void *data)
-{
- Elm_Store_Item *sti = data;
- sti->eval_job = NULL;
- if (sti->live == sti->was_live) return;
- sti->was_live = sti->live;
- if (sti->live)
- {
- _store_cache_trim(sti->store);
- if (sti->realized)
- sti->store->realized = eina_list_remove(sti->store->realized, sti);
- sti->store->realized = eina_list_append(sti->store->realized, sti);
- sti->realized = EINA_TRUE;
- if ((sti->store->fetch_thread) && (!sti->fetch_th))
- sti->fetch_th = ecore_thread_run(_store_filesystem_fetch_do,
- _store_filesystem_fetch_end,
- _store_filesystem_fetch_cancel,
- sti);
- else if ((!sti->store->fetch_thread))
- {
- _store_filesystem_fetch_do(sti, NULL);
- _store_filesystem_fetch_end(sti, NULL);
- }
- }
- else
- {
- if (sti->fetch_th)
- {
- ecore_thread_cancel(sti->fetch_th);
- sti->fetch_th = NULL;
- }
- _store_cache_trim(sti->store);
- }
-}
-
-static void
-_store_genlist_item_realized(void *data, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Elm_Store *st = data;
- Elm_Genlist_Item *gli = event_info;
- Elm_Store_Item *sti = elm_genlist_item_data_get(gli);
- if (!sti) return;
- st->realized_count++;
- sti->live = EINA_TRUE;
- if (sti->eval_job) ecore_job_del(sti->eval_job);
- sti->eval_job = ecore_job_add(_store_item_eval, sti);
-}
-
-static void
-_store_genlist_item_unrealized(void *data, Evas_Object *obj __UNUSED__, void *event_info)
-{
- Elm_Store *st = data;
- Elm_Genlist_Item *gli = event_info;
- Elm_Store_Item *sti = elm_genlist_item_data_get(gli);
- if (!sti) return;
- st->realized_count--;
- sti->live = EINA_FALSE;
- if (sti->eval_job) ecore_job_del(sti->eval_job);
- sti->eval_job = ecore_job_add(_store_item_eval, sti);
-}
-
-static const Elm_Store_Item_Mapping *
-_store_item_mapping_find(Elm_Store_Item *sti, const char *part)
-{
- const Elm_Store_Item_Mapping *m;
-
- for (m = sti->mapping; m; m ++)
- {
- if (m->type == ELM_STORE_ITEM_MAPPING_NONE) break;
- if (!strcmp(part, m->part)) return m;
- }
- return NULL;
-}
-
-static char *
-_store_item_label_get(void *data, Evas_Object *obj __UNUSED__, const char *part)
-{
- Elm_Store_Item *sti = data;
- const char *s = "";
- LKL(sti->lock);
- if (sti->data)
- {
- const Elm_Store_Item_Mapping *m = _store_item_mapping_find(sti, part);
- if (m)
- {
- switch (m->type)
- {
- case ELM_STORE_ITEM_MAPPING_LABEL:
- s = *(char **)(((unsigned char *)sti->data) + m->offset);
- break;
- case ELM_STORE_ITEM_MAPPING_CUSTOM:
- if (m->details.custom.func)
- s = m->details.custom.func(sti->data, sti, part);
- break;
- default:
- break;
- }
- }
- }
- LKU(sti->lock);
- return strdup(s);
-}
-
-static Evas_Object *
-_store_item_icon_get(void *data, Evas_Object *obj, const char *part)
-{
- Elm_Store_Item *sti = data;
- LKL(sti->lock);
- if (sti->data)
- {
- const Elm_Store_Item_Mapping *m = _store_item_mapping_find(sti, part);
- if (m)
- {
- Evas_Object *ic = NULL;
- const char *s = NULL;
-
- switch (m->type)
- {
- case ELM_STORE_ITEM_MAPPING_ICON:
- ic = elm_icon_add(obj);
- s = *(char **)(((unsigned char *)sti->data) + m->offset);
- elm_icon_order_lookup_set(ic, m->details.icon.lookup_order);
- evas_object_size_hint_aspect_set(ic,
- EVAS_ASPECT_CONTROL_VERTICAL,
- m->details.icon.w,
- m->details.icon.h);
- elm_icon_smooth_set(ic, m->details.icon.smooth);
- elm_icon_no_scale_set(ic, m->details.icon.no_scale);
- elm_icon_scale_set(ic,
- m->details.icon.scale_up,
- m->details.icon.scale_down);
- if (s)
- {
- if (m->details.icon.standard_name)
- elm_icon_standard_set(ic, s);
- else
- elm_icon_file_set(ic, s, NULL);
- }
- break;
- case ELM_STORE_ITEM_MAPPING_PHOTO:
- ic = elm_icon_add(obj);
- s = *(char **)(((unsigned char *)sti->data) + m->offset);
- elm_photo_size_set(ic, m->details.photo.size);
- if (s)
- elm_photo_file_set(ic, s);
- break;
- case ELM_STORE_ITEM_MAPPING_CUSTOM:
- if (m->details.custom.func)
- ic = m->details.custom.func(sti->data, sti, part);
- break;
- default:
- break;
- }
- LKU(sti->lock);
- return ic;
- }
- }
- LKU(sti->lock);
- return NULL;
-}
-
-static void
-_store_item_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__)
-{
-}
-
-////// **** WARNING ***********************************************************
-//// * This function runs inside a thread outside efl mainloop. Be careful! *
-// ************************************************************************
-static int
-_store_filesystem_sort_cb(void *d1, void *d2)
-{
- Elm_Store_Item_Info *info1 = d1, *info2 = d2;
- if ((!info1->sort_id) || (!info2->sort_id)) return 0;
- return strcoll(info1->sort_id, info2->sort_id);
-}
-
-static void
-_store_filesystem_list_do(void *data, Ecore_Thread *th __UNUSED__)
-{
- Elm_Store_Filesystem *st = data;
- Eina_Iterator *it;
- const Eina_File_Direct_Info *finf;
- Eina_List *sorted = NULL;
- Elm_Store_Item_Info_Filesystem *info;
-
- // FIXME: need a way to abstract the open, list, feed items from list
- // and maybe get initial sortable key vals etc.
- it = eina_file_stat_ls(st->dir);
- if (!it) return;
- EINA_ITERATOR_FOREACH(it, finf)
- {
- Eina_Bool ok;
- size_t pathsz = finf->path_length + 1;
-
- info = calloc(1, sizeof(Elm_Store_Item_Info_Filesystem) + pathsz);
- if (!info) continue;
- info->path = ((char *)info) + sizeof(Elm_Store_Item_Info_Filesystem);
- memcpy(info->path, finf->path, pathsz);
- ok = EINA_TRUE;
- if (st->base.cb.list.func)
- ok = st->base.cb.list.func(st->base.cb.list.data, &info->base);
- if (ok)
- {
- if (!st->base.sorted) ecore_thread_feedback(th, info);
- else sorted = eina_list_append(sorted, info);
- }
- else
- {
- if (info->base.sort_id) free(info->base.sort_id);
- free(info);
- }
- if (ecore_thread_check(th)) break;
- }
- eina_iterator_free(it);
- if (sorted)
- {
- sorted = eina_list_sort(sorted, 0,
- EINA_COMPARE_CB(_store_filesystem_sort_cb));
- EINA_LIST_FREE(sorted, info)
- {
- if (!ecore_thread_check(th)) ecore_thread_feedback(th, info);
- }
- }
-}
-// ************************************************************************
-//// * End of separate thread function. *
-////// ************************************************************************
-
-static void
-_store_filesystem_list_end(void *data, Ecore_Thread *th)
-{
- Elm_Store *st = data;
- if (th == st->list_th) st->list_th = NULL;
-}
-
-static void
-_store_filesystem_list_cancel(void *data, Ecore_Thread *th)
-{
- Elm_Store *st = data;
- if (th == st->list_th) st->list_th = NULL;
-}
-
-static void
-_store_filesystem_list_update(void *data, Ecore_Thread *th __UNUSED__, void *msg)
-{
- Elm_Store *st = data;
- Elm_Store_Item_Filesystem *sti;
- Elm_Genlist_Item_Class *itc;
- Elm_Store_Item_Info_Filesystem *info = msg;
-
- sti = calloc(1, sizeof(Elm_Store_Item_Filesystem));
- if (!sti) goto done;
- LKI(sti->base.lock);
- EINA_MAGIC_SET(&(sti->base), ELM_STORE_ITEM_MAGIC);
- sti->base.store = st;
- sti->base.data = info->base.data;
- sti->base.mapping = info->base.mapping;
- sti->path = eina_stringshare_add(info->path);
-
- itc = info->base.item_class;
- if (!itc) itc = &_store_item_class;
- else
- {
- itc->func.label_get = _store_item_label_get;
- itc->func.icon_get = _store_item_icon_get;
- itc->func.state_get = NULL; // FIXME: support state gets later
- itc->func.del = _store_item_del;
- }
-
- // FIXME: handle being a parent (tree)
- sti->base.item = elm_genlist_item_append(st->genlist, itc,
- sti/* item data */,
- NULL/* parent */,
- ELM_GENLIST_ITEM_NONE,
- NULL/* func */,
- NULL/* func data */);
- st->items = eina_inlist_append(st->items, (Eina_Inlist *)sti);
-done:
- if (info->base.sort_id) free(info->base.sort_id);
- free(info);
-}
-
-// public api calls
-static Elm_Store *
-_elm_store_new(size_t size)
-{
- Elm_Store *st = calloc(1, size);
- EINA_SAFETY_ON_NULL_RETURN_VAL(st, NULL);
-
- // TODO: BEGIN - move to elm_store_init()
- eina_magic_string_set(ELM_STORE_MAGIC, "Elm_Store");
- eina_magic_string_set(ELM_STORE_FILESYSTEM_MAGIC, "Elm_Store_Filesystem");
- eina_magic_string_set(ELM_STORE_ITEM_MAGIC, "Elm_Store_Item");
- // setup default item class (always the same) if list cb doesnt provide one
- _store_item_class.item_style = "default";
- _store_item_class.func.label_get = _store_item_label_get;
- _store_item_class.func.icon_get = _store_item_icon_get;
- _store_item_class.func.state_get = NULL; // FIXME: support state gets later
- _store_item_class.func.del = _store_item_del;
- // TODO: END - move to elm_store_init()
-
- EINA_MAGIC_SET(st, ELM_STORE_MAGIC);
- st->cache_max = 128;
- st->fetch_thread = EINA_TRUE;
- return st;
-}
-#define elm_store_new(type) (type*)_elm_store_new(sizeof(type))
-
-static void
-_elm_store_filesystem_free(Elm_Store *store)
-{
- Elm_Store_Filesystem *st = (Elm_Store_Filesystem *)store;
- eina_stringshare_del(st->dir);
-}
-
-static void
-_elm_store_filesystem_item_free(Elm_Store_Item *item)
-{
- Elm_Store_Item_Filesystem *sti = (Elm_Store_Item_Filesystem *)item;
- eina_stringshare_del(sti->path);
-}
-
-EAPI Elm_Store *
-elm_store_filesystem_new(void)
-{
- Elm_Store_Filesystem *st = elm_store_new(Elm_Store_Filesystem);
- EINA_SAFETY_ON_NULL_RETURN_VAL(st, NULL);
-
- EINA_MAGIC_SET(st, ELM_STORE_FILESYSTEM_MAGIC);
- st->base.free = _elm_store_filesystem_free;
- st->base.item.free = _elm_store_filesystem_item_free;
-
- return &st->base;
-}
-
-EAPI void
-elm_store_free(Elm_Store *st)
-{
- void (*item_free)(Elm_Store_Item *);
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
- if (st->list_th)
- {
- ecore_thread_cancel(st->list_th);
- st->list_th = NULL;
- }
- eina_list_free(st->realized);
- item_free = st->item.free;
- while (st->items)
- {
- Elm_Store_Item *sti = (Elm_Store_Item *)st->items;
- if (sti->eval_job) ecore_job_del(sti->eval_job);
- if (sti->fetch_th)
- {
- ecore_thread_cancel(sti->fetch_th);
- sti->fetch_th = NULL;
- }
- if (item_free) item_free(sti);
- if (sti->data)
- {
- if (st->cb.unfetch.func)
- st->cb.unfetch.func(st->cb.unfetch.data, sti);
- sti->data = NULL;
- }
- LKD(sti->lock);
- free(sti);
- }
- if (st->genlist)
- {
- evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st);
- evas_object_smart_callback_del(st->genlist, "realized", _store_genlist_item_realized);
- evas_object_smart_callback_del(st->genlist, "unrealized", _store_genlist_item_unrealized);
- elm_genlist_clear(st->genlist);
- st->genlist = NULL;
- }
- if (st->free) st->free(st);
- free(st);
-}
-
-EAPI void
-elm_store_target_genlist_set(Elm_Store *st, Evas_Object *obj)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
- if (st->genlist == obj) return;
- if (st->genlist)
- {
- evas_object_event_callback_del_full(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st);
- evas_object_smart_callback_del(st->genlist, "realized", _store_genlist_item_realized);
- evas_object_smart_callback_del(st->genlist, "unrealized", _store_genlist_item_unrealized);
- elm_genlist_clear(st->genlist);
- }
- st->genlist = obj;
- if (!st->genlist) return;
- evas_object_smart_callback_add(st->genlist, "realized", _store_genlist_item_realized, st);
- evas_object_smart_callback_add(st->genlist, "unrealized", _store_genlist_item_unrealized, st);
- evas_object_event_callback_add(st->genlist, EVAS_CALLBACK_DEL, _store_genlist_del, st);
- elm_genlist_clear(st->genlist);
-}
-
-EAPI void
-elm_store_filesystem_directory_set(Elm_Store *store, const char *dir)
-{
- Elm_Store_Filesystem *st = (Elm_Store_Filesystem *)store;
- if (!EINA_MAGIC_CHECK(store, ELM_STORE_MAGIC)) return;
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_FILESYSTEM_MAGIC)) return;
- if (store->list_th)
- {
- ecore_thread_cancel(store->list_th);
- store->list_th = NULL;
- }
- if (!eina_stringshare_replace(&st->dir, dir)) return;
- store->list_th = ecore_thread_feedback_run(_store_filesystem_list_do,
- _store_filesystem_list_update,
- _store_filesystem_list_end,
- _store_filesystem_list_cancel,
- st, EINA_TRUE);
-}
-
-EAPI const char *
-elm_store_filesystem_directory_get(const Elm_Store *store)
-{
- const Elm_Store_Filesystem *st = (const Elm_Store_Filesystem *)store;
- if (!EINA_MAGIC_CHECK(store, ELM_STORE_MAGIC)) return NULL;
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_FILESYSTEM_MAGIC)) return NULL;
- return st->dir;
-}
-
-EAPI void
-elm_store_cache_set(Elm_Store *st, int max)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
- if (max < 0) max = 0;
- st->cache_max = max;
- _store_cache_trim(st);
-}
-
-EAPI int
-elm_store_cache_get(const Elm_Store *st)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return 0;
- return st->cache_max;
-}
-
-EAPI void
-elm_store_list_func_set(Elm_Store *st, Elm_Store_Item_List_Cb func, const void *data)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
- st->cb.list.func = func;
- st->cb.list.data = (void *)data;
-}
-
-EAPI void
-elm_store_fetch_func_set(Elm_Store *st, Elm_Store_Item_Fetch_Cb func, const void *data)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
- st->cb.fetch.func = func;
- st->cb.fetch.data = (void *)data;
-}
-
-EAPI void
-elm_store_fetch_thread_set(Elm_Store *st, Eina_Bool use_thread)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
- st->fetch_thread = !!use_thread;
-}
-
-EAPI Eina_Bool
-elm_store_fetch_thread_get(const Elm_Store *st)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return EINA_FALSE;
- return st->fetch_thread;
-}
-
-EAPI void
-elm_store_unfetch_func_set(Elm_Store *st, Elm_Store_Item_Unfetch_Cb func, const void *data)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
- st->cb.unfetch.func = func;
- st->cb.unfetch.data = (void *)data;
-}
-
-EAPI void
-elm_store_sorted_set(Elm_Store *st, Eina_Bool sorted)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return;
- st->sorted = sorted;
-}
-
-EAPI Eina_Bool
-elm_store_sorted_get(const Elm_Store *st)
-{
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_MAGIC)) return EINA_FALSE;
- return st->sorted;
-}
-
-EAPI void
-elm_store_item_data_set(Elm_Store_Item *sti, void *data)
-{
- if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return;
- LKL(sti->lock);
- sti->data = data;
- LKU(sti->lock);
-}
-
-EAPI void *
-elm_store_item_data_get(Elm_Store_Item *sti)
-{
- if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL;
- void *d;
- LKL(sti->lock);
- d = sti->data;
- LKU(sti->lock);
- return d;
-}
-
-EAPI const Elm_Store *
-elm_store_item_store_get(const Elm_Store_Item *sti)
-{
- if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL;
- // dont need lock
- return sti->store;
-}
-
-EAPI const Elm_Genlist_Item *
-elm_store_item_genlist_item_get(const Elm_Store_Item *sti)
-{
- if (!EINA_MAGIC_CHECK(sti, ELM_STORE_ITEM_MAGIC)) return NULL;
- // dont need lock
- return sti->item;
-}
-
-EAPI const char *
-elm_store_item_filesystem_path_get(const Elm_Store_Item *item)
-{
- Elm_Store_Item_Filesystem *sti = (Elm_Store_Item_Filesystem *)item;
- Elm_Store_Filesystem *st;
- if (!EINA_MAGIC_CHECK(item, ELM_STORE_ITEM_MAGIC)) return NULL;
- if (!EINA_MAGIC_CHECK(item->store, ELM_STORE_MAGIC)) return NULL;
- /* ensure we're dealing with filesystem item */
- st = (Elm_Store_Filesystem *)item->store;
- if (!EINA_MAGIC_CHECK(st, ELM_STORE_FILESYSTEM_MAGIC)) return NULL;
- // dont need lock
- return sti->path;
-}
+++ /dev/null
-
-MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = \
--I. \
--I$(top_builddir) \
--I$(top_srcdir) \
--I$(top_srcdir)/src/lib \
--I$(top_builddir)/src/lib \
--DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
--DPACKAGE_LIB_DIR=\"$(libdir)\" \
-@ELEMENTARY_CFLAGS@ \
-@ELEMENTARY_X_CFLAGS@ \
-@ELEMENTARY_FB_CFLAGS@ \
-@ELEMENTARY_WIN32_CFLAGS@ \
-@ELEMENTARY_WINCE_CFLAGS@ \
-@ELEMENTARY_EDBUS_CFLAGS@ \
-@ELEMENTARY_EFREET_CFLAGS@ \
-@ELEMENTARY_ETHUMB_CFLAGS@
-
-if ELEMENTARY_WINDOWS_BUILD
-AM_CPPFLAGS += -DELEMENTARY_BUILD
-endif
-
-pkgdir = $(libdir)/elementary/modules/test_map/$(MODULE_ARCH)
-pkg_LTLIBRARIES = module.la
-
-module_la_SOURCES = mod.c
-
-module_la_LIBADD = $(top_builddir)/src/lib/libelementary.la
-module_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version
-module_la_LIBTOOLFLAGS = --tag=disable-static
+++ /dev/null
-#include <Elementary.h>
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-
-EAPI int
-elm_modapi_init(void *m __UNUSED__)
-{
- return 1; // succeed always
-}
-
-EAPI int
-elm_modapi_shutdown(void *m __UNUSED__)
-{
- return 1; // succeed always
-}
-
-EAPI Eina_Bool
-obj_hook(Evas_Object *obj __UNUSED__)
-{
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-obj_unhook(Evas_Object *obj __UNUSED__)
-{
- return EINA_TRUE;
-}
-
-EAPI Eina_Bool
-obj_convert_geo_into_coord(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int size __UNUSED__, int *x __UNUSED__, int *y __UNUSED__)
-{
- return EINA_FALSE;
-}
-
-EAPI Eina_Bool
-obj_convert_coord_into_geo(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, int x __UNUSED__, int y __UNUSED__, int size __UNUSED__, double *lon __UNUSED__, double *lat __UNUSED__)
-{
- return EINA_FALSE;
-}
-
-EAPI char*
-obj_url_request(Evas_Object *obj __UNUSED__, int x, int y, int zoom)
-{
- char buf[PATH_MAX];
- snprintf(buf, sizeof(buf), "http://tile.openstreetmap.org/%d/%d/%d.png",
- zoom, x, y);
- return strdup(buf);
-}
-