elementary/widget - keep orient_mode has actual degree.
authorChunEon Park <hermet@hermet.pe.kr>
Fri, 15 Feb 2013 04:45:53 +0000 (04:45 +0000)
committerChunEon Park <hermet@hermet.pe.kr>
Fri, 15 Feb 2013 04:45:53 +0000 (04:45 +0000)
SVN revision: 83932

legacy/elementary/src/lib/elm_object.h
legacy/elementary/src/lib/elm_widget.c
legacy/elementary/src/lib/elm_widget.h

index e3dc536..f9283e8 100644 (file)
@@ -461,10 +461,9 @@ EAPI void        elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina
 /**
  * Get the orientation mode of a give widget.
  *
- * @param obj The Elementary widget to query for its style
- * @return @c EINA_TRUE, if the widget orientation mode is disabled,
- *         @c EINA_FALSE if the orientation mode is enabled (or on errors)
- *
+ * @param obj The Elementary widget to query for its orientation mode.
+ * @return @c EINA_TRUE, if the orientation mode is disabled, @c EINA_FALSE
+ *            if the orientation mode is enabled (or on errors)
  * @see elm_object_orientation_mode_disabled_set()
  *
  * @since 1.8
index aacab46..cf5fd96 100644 (file)
@@ -1016,6 +1016,7 @@ _elm_widget_sub_object_add(Eo *obj, void *_pd, va_list *list)
                return;
           }
         sdc->parent_obj = obj;
+        sdc->orient_mode = sd->orient_mode;
         _elm_widget_top_win_focused_set(sobj, sd->top_win_focused);
 
         /* update child focusable-ness on self and parents, now that a
@@ -4467,9 +4468,17 @@ static void
 _elm_widget_orientation_mode_disabled_set(Eo *obj __UNUSED__, void *_pd, va_list *list)
 {
    Eina_Bool disabled = va_arg(*list, int);
+   int orient_mode = -1;
    Elm_Widget_Smart_Data *sd = _pd;
-   disabled = !!disabled;
-   sd->orientation_disabled = disabled;
+
+   if (!disabled)
+     {
+        sd->orient_mode = 0;
+        ELM_WIDGET_DATA_GET(sd->parent_obj, sd_parent);
+        if (!sd_parent) orient_mode = 0;
+        else orient_mode = sd_parent->orient_mode;
+     }
+   eo_do((Eo *) obj, elm_wdg_orientation_set(orient_mode));
 }
 
 EAPI Eina_Bool
@@ -4484,12 +4493,12 @@ elm_widget_orientation_mode_disabled_get(const Evas_Object *obj)
 static void
 _elm_widget_orientation_mode_disabled_get(Eo *obj __UNUSED__, void *_pd, va_list *list)
 {
-   Eina_Bool *ret = (Eina_Bool *)va_arg(*list, int);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
    Elm_Widget_Smart_Data *sd = _pd;
-   *ret = sd->orientation_disabled;
+   if (sd->orient_mode == -1) *ret = EINA_TRUE;
+   else *ret = EINA_FALSE;
 }
 
-
 EAPI void
 elm_widget_orientation_set(Evas_Object *obj, int rotation)
 {
@@ -4502,20 +4511,21 @@ _elm_widget_orientation_set(Eo *obj __UNUSED__, void *_pd, va_list *list)
 {
    Evas_Object *child;
    Eina_List *l;
-   int rotation = va_arg(*list, int);
+   int orient_mode = va_arg(*list, int);
    Elm_Widget_Smart_Data *sd = _pd;
-   if (sd->orientation_disabled) return;
+
+   if ((sd->orient_mode == orient_mode) || (sd->orient_mode == -1)) return;
+   sd->orient_mode = orient_mode;
 
    if (sd->resize_obj && _elm_widget_is(sd->resize_obj))
-     elm_widget_orientation_set(sd->resize_obj, rotation);
+     elm_widget_orientation_set(sd->resize_obj, orient_mode);
    if (sd->hover_obj && _elm_widget_is(sd->hover_obj))
-     elm_widget_orientation_set(sd->hover_obj, rotation);
+     elm_widget_orientation_set(sd->hover_obj, orient_mode);
 
    EINA_LIST_FOREACH (sd->subobjs, l, child)
-     elm_widget_orientation_set(child, rotation);
+     elm_widget_orientation_set(child, orient_mode);
 }
 
-
 /**
  * @internal
  *
index 9a9f648..8dd072f 100644 (file)
@@ -411,6 +411,7 @@ typedef struct _Elm_Widget_Smart_Data
                                                  Evas_Object *obj);
 
    int                           frozen;
+   int                           orient_mode; /* -1 is disabled */
 
    Eina_Bool                     drag_x_locked : 1;
    Eina_Bool                     drag_y_locked : 1;
@@ -431,7 +432,6 @@ typedef struct _Elm_Widget_Smart_Data
    Eina_Bool                     can_access : 1;
    Eina_Bool                     highlighted : 1;
    Eina_Bool                     highlight_root : 1;
-   Eina_Bool                     orientation_disabled : 1;
 } Elm_Widget_Smart_Data;
 
 /**