elementary/index - more apis
authorhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 6 Mar 2012 12:28:52 +0000 (12:28 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 6 Mar 2012 12:28:52 +0000 (12:28 +0000)
elm_index_horizontal_set/get

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68820 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

data/themes/widgets/index.edc
src/lib/elm_index.c
src/lib/elm_index.h

index 0224490..1eaee91 100644 (file)
@@ -126,7 +126,7 @@ group { name: "elm/index/base/vertical/default";
             }
          }
       }
-      part {        name: "over1";
+      part { name: "over1";
          mouse_events: 0;
          clip_to: "clip2";
          description { state: "default" 0.0;
@@ -409,4 +409,401 @@ group { name: "elm/index/item_odd/vertical/default";
       }
    }
 }
+group { name: "elm/index/base/horizontal/default";
+   images {
+      image: "bt_base1.png" COMP;
+      image: "bt_base2.png" COMP;
+      image: "bt_hilight.png" COMP;
+      image: "bt_shine.png" COMP;
+   }
+   parts {
+      part { name: "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: "clip2";
+         type: RECT;
+         mouse_events:  0;
+         clip_to: "clip";
+         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: "elm.swallow.index.0";
+         type: SWALLOW;
+         clip_to: "clip";
+         description { state: "default" 0.0;
+            align: 0.5 1.0;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.5 1;
+               offset: 0 0;
+            }
+            rel2 {
+               relative: 0.5 1;
+               offset: -1 -1;
+            }
+         }
+      }
+      part { name: "button_image";
+         mouse_events: 1;
+         clip_to: "clip2";
+         description { state: "default" 0.0;
+            rel1 {
+               to: "elm.text";
+               offset: -5 -5;
+            }
+            rel2 {
+               to: "elm.text";
+               offset: 4 4;
+            }
+            image {
+               normal: "bt_base2.png";
+               border: 7 7 7 7;
+            }
+            image.middle: SOLID;
+         }
+      }
+      part { name: "elm.text.body";
+         type: TEXT;
+         effect: SOFT_SHADOW;
+         mouse_events: 0;
+         scale: 1;
+         clip_to: "clip2";
+         description { state: "default" 0.0;
+            align: 0.5 1;
+            fixed: 1 1;
+            rel1 {
+               to: "elm.text";
+               relative: 0.0 0.0;
+            }
+            rel2 {
+               to: "elm.text";
+               relative: 0.1 0.0;
+            }
+            color: 224 224 224 255;
+            color3: 0 0 0 64;
+            text {
+               font:     "Sans,Edje-Vera";
+               size:     20;
+               min:      1 1;
+               align:    0.5 1;
+            }
+         }
+      }
+      part { name: "elm.text";
+         type: TEXT;
+         effect: SOFT_SHADOW;
+         mouse_events: 0;
+         scale: 1;
+         clip_to: "clip2";
+         description { state: "default" 0.0;
+            align: 0.5 1;
+            fixed: 1 1;
+            rel1 {
+               to_x: "elm.dragable.pointer";
+               to_y: "elm.swallow.event.0";
+               relative: 0.5 0;
+               offset: 0 -16;
+            }
+            rel2 {
+               to_x: "elm.dragable.pointer";
+               to_y: "elm.swallow.event.0";
+               relative: 0.5 0;
+               offset: -1 -16;
+            }
+            color: 255 0 0 255;
+            color3: 0 0 0 64;
+            text {
+               font:     "Sans,Edje-Vera";
+               size:     20;
+               min:      1 1;
+               align:    0.5 1;
+            }
+         }
+      }
+      part { name: "over1";
+         mouse_events: 0;
+         clip_to: "clip2";
+         description { state: "default" 0.0;
+            rel1 {
+               to: "button_image";
+            }
+            rel2 {
+               to: "button_image";
+               relative: 0.5 1;
+            }
+            image {
+               normal: "bt_hilight.png";
+               border: 7 7 7 0;
+            }
+         }
+      }
+      part { name: "over2";
+         mouse_events: 1;
+         repeat_events: 1;
+         ignore_flags: ON_HOLD;
+         clip_to: "clip2";
+         description { state: "default" 0.0;
+            rel1 {
+               to: "button_image";
+            }
+            rel2 {
+               to: "button_image";
+            }
+            image {
+               normal: "bt_shine.png";
+               border: 7 7 7 7;
+            }
+         }
+      }
+      part { name: "elm.dragable.pointer";
+         type: RECT;
+         mouse_events: 0;
+         dragable {
+            x: 1 1 0;
+            y: 1 1 0;
+         }
+         clip_to: "clip";
+         description { state: "default" 0.0;
+            fixed: 1 1;
+            min: 8 8;
+            max: 8 8;
+            visible: 0;
+            rel1 {
+               relative: 0.0 0.0;
+               offset:   0 0;
+            }
+            rel2 {
+               relative: 0.0 0.0;
+               offset:   0 0;
+            }
+         }
+      }
+      part { name: "elm.swallow.event.0";
+         type: SWALLOW;
+         description { state: "default" 0.0;
+            align: 0.5 1;
+            fixed: 1 1;
+            rel1 {
+               relative: 0.0 1.0;
+               offset: -1 0;
+            }
+            rel2 {
+               relative: 1.0 1.0;
+               offset: -1 -1;
+            }
+         }
+      }
+   }
+   programs {
+      program { name: "active";
+         signal: "elm,state,active";
+         source: "elm";
+         action: STATE_SET "active" 0.0;
+         transition: DECELERATE 0.5;
+         target: "clip";
+      }
+      program { name: "inactive";
+         signal: "elm,state,inactive";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         transition: DECELERATE 0.5;
+         target: "clip";
+      }
+      program { name: "active2";
+         signal: "elm,indicator,state,active";
+         source: "elm";
+         action: STATE_SET "active" 0.0;
+         transition: DECELERATE 0.5;
+         target: "clip2";
+      }
+      program { name: "inactive2";
+         signal: "elm,indicator,state,inactive";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         transition: DECELERATE 0.5;
+         target: "clip2";
+      }
+   }
+}
+group { name: "elm/index/item/horizontal/default";
+   data.item: "stacking" "above";
+   data.item: "selectraise" "on";
+   images {
+      image: "ilist_1.png" COMP;
+      image: "ilist_item_shadow.png" COMP;
+   }
+   parts {
+      part {
+         name: "base_sh";
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            align: 0.0 0.0;
+            min: 0 10;
+            fixed: 1 1;
+            rel1 {
+               to: "base";
+               relative: 0.0 1.0;
+            }
+            rel2 {
+               to: "base";
+               relative: 1.0 1.0;
+            }
+            image {
+               normal: "ilist_item_shadow.png";
+            }
+            fill.smooth: 0;
+         }
+      }
+      part {
+         name: "base";
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            image {
+               normal: "ilist_1.png";
+               border: 2 2 2 2;
+            }
+            fill.smooth: 0;
+         }
+         description { state: "active" 0.0;
+            inherit: "default" 0.0;
+            rel1 {
+               offset: 0 -16;
+            }
+         }
+      }
+      part { name: "elm.text";
+         type:           TEXT;
+         mouse_events:   0;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               to: "base";
+               relative: 0.25  0.0;
+            }
+            rel2 {
+               to: "base";
+               relative: 0.75 1.0;
+            }
+            color: 0 0 0 128;
+            text {
+               font: "Sans";
+               size: 10;
+               min: 1 1;
+               align: 0.5 0.5;
+            }
+         }
+         description { state: "active" 0.0;
+            inherit: "default" 0.0;
+            color: 0 0 0 255;
+         }
+      }
+   }
+   programs {
+      program { name: "active";
+         signal: "elm,state,active";
+         source: "elm";
+         action: STATE_SET "active" 0.0;
+         transition: DECELERATE 0.5;
+         target: "elm.text";
+         target: "base";
+      }
+      program { name: "inactive";
+         signal: "elm,state,inactive";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         transition: DECELERATE 0.5;
+         target: "elm.text";
+         target: "base";
+      }
+   }
+}
+group { name: "elm/index/item_odd/horizontal/default";
+   data.item: "stacking" "below";
+   images {
+      image: "ilist_2.png" COMP;
+   }
+   parts {
+      part {
+         name: "base";
+         mouse_events: 0;
+         description {
+            state: "default" 0.0;
+            image {
+               normal: "ilist_2.png";
+               border: 2 2 2 2;
+            }
+            fill.smooth: 0;
+         }
+         description { state: "active" 0.0;
+            inherit: "default" 0.0;
+            rel1 {
+               offset: 0 -16;
+            }
+         }
+      }
+      part { name: "elm.text";
+         type:           TEXT;
+         mouse_events:   0;
+         scale: 1;
+         description {
+            state: "default" 0.0;
+            rel1 {
+               to: "base";
+               relative: 0.25  0.0;
+            }
+            rel2 {
+               to: "base";
+               relative: 0.75  1.0;
+            }
+            color: 0 0 0 128;
+            text {
+               font: "Sans";
+               size: 10;
+               min: 1 1;
+               align: 0.5 0.5;
+            }
+         }
+         description { state: "active" 0.0;
+            inherit: "default" 0.0;
+            color: 0 0 0 255;
+         }
+      }
+   }
+   programs {
+      program { name: "active";
+         signal: "elm,state,active";
+         source: "elm";
+         action: STATE_SET "active" 0.0;
+         transition: DECELERATE 0.5;
+         target: "elm.text";
+         target: "base";
+      }
+      program { name: "inactive";
+         signal: "elm,state,inactive";
+         source: "elm";
+         action: STATE_SET "default" 0.0;
+         transition: DECELERATE 0.5;
+         target: "elm.text";
+         target: "base";
+      }
+   }
+}
 
index a3a83df..ec447dd 100644 (file)
@@ -268,10 +268,26 @@ _index_box_auto_fill(Evas_Object *obj, Evas_Object *box, int level)
         o = edje_object_add(evas_object_evas_get(obj));
         VIEW(it) = o;
         edje_object_mirrored_set(VIEW(it), rtl);
-        if (i & 0x1)
-          _elm_theme_object_set(obj, o, "index", "item_odd/vertical", elm_widget_style_get(obj));
+
+        if (wd->horizontal)
+          {
+             if (i & 0x1)
+               _elm_theme_object_set(obj, o, "index", "item_odd/horizontal",
+                                     elm_widget_style_get(obj));
+             else
+               _elm_theme_object_set(obj, o, "index", "item/horizontal",
+                                     elm_widget_style_get(obj));
+          }
         else
-          _elm_theme_object_set(obj, o, "index", "item/vertical", elm_widget_style_get(obj));
+          {
+             if (i & 0x1)
+               _elm_theme_object_set(obj, o, "index", "item_odd/vertical",
+                                     elm_widget_style_get(obj));
+             else
+               _elm_theme_object_set(obj, o, "index", "item/vertical",
+                                     elm_widget_style_get(obj));
+          }
+
         edje_object_part_text_set(o, "elm.text", it->letter);
         edje_object_size_min_restricted_calc(o, &mw, &mh, 0, 0);
         evas_object_size_hint_min_set(o, mw, mh);
@@ -919,3 +935,26 @@ elm_index_item_letter_get(const Elm_Object_Item *it)
    return ((Elm_Index_Item *)it)->letter;
 }
 
+EAPI void
+elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return;
+
+   horizontal = !!horizontal;
+   if (horizontal == wd->horizontal) return;
+   wd->horizontal = horizontal;
+   _theme_hook(obj);
+}
+
+EAPI Eina_Bool
+elm_index_horizontal_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->horizontal;
+}
+
+
index d01b72a..60d36aa 100644 (file)
@@ -313,5 +313,38 @@ EAPI void                 elm_index_indicator_disabled_set(Evas_Object *obj, Ein
 EAPI Eina_Bool            elm_index_indicator_disabled_get(const Evas_Object *obj);
 
 /**
+ * Enable or disable horizontal mode on the index object
+ *
+ * @param obj The index object.
+ * @param horizontal @c EINA_TRUE to enable horizontal or @c EINA_FALSE to
+ * disable it, i.e., to enable vertical mode. it's an area one @ref Fingers
+ * "finger" wide on the bottom side of the index widget's container.
+ *
+ * @note Vertical mode is set by default.
+ *
+ * On horizontal mode items are displayed on index from left to right,
+ * instead of from top to bottom. Also, the index will scroll horizontally.
+ *
+ * @see elm_index_horizontal_get()
+ *
+ * @ingroup Index
+ */
+EAPI void                      elm_index_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
+
+/**
+ * Get a value whether horizontal mode is enabled or not.
+ *
+ * @param obj The index object.
+ * @return @c EINA_TRUE means horizontal mode selection is enabled.
+ * @c EINA_FALSE indicates it's disabled. If @p obj is @c NULL,
+ * @c EINA_FALSE is returned.
+ *
+ * @see elm_index_horizontal_set() for details.
+ *
+ * @ingroup Index
+ */
+EAPI Eina_Bool                 elm_index_horizontal_get(const Evas_Object *obj);
+
+/**
  * @}
  */