[Popup] Fix popup layout destroying issue
authorjh5.cho <jh5.cho@samsung.com>
Mon, 21 Sep 2015 02:05:25 +0000 (11:05 +0900)
committerjh5.cho <jh5.cho@samsung.com>
Mon, 21 Sep 2015 02:05:25 +0000 (11:05 +0900)
  - Remove using grid container
  - Use layout format to contain multiple widgets
  - Erase unused groups in edc file

runtime/browser/popup.cc
runtime/browser/popup.h
runtime/resources/xwalk_tizen.edc

index c8aeb815fcd4a454fb75c930b7d4b6923ba9fd0b..7b7005bb9d16af1c52729033e19cd9bca8ccbd85 100755 (executable)
@@ -27,12 +27,14 @@ namespace runtime {
 
 namespace {
 
+const char* kWRTEdjePath = "/usr/share/edje/xwalk/xwalk_tizen.edj";
+
 const char* kContentTitle = "title,text";
 const char* kContentButton1 = "button1";
 const char* kContentButton2 = "button2";
 
 const char* kStyleDefault = "default";
-const char* kStyleLabel = "default";
+const char* kStyleLabel = "popup/default";
 const char* kStyleButton = "popup";
 const char* kStyleEditPw = "editfield/password/popup";
 
@@ -41,9 +43,6 @@ const char* kSignalEdit = "elm,action,hide,search_icon";
 const char* kStateActivated = "activated";
 const char* kStateClicked = "clicked";
 
-const double kMaxPopupHeight = 0.80;
-const double kMaxScrollerHeight = 0.80;
-
 static void ButtonClickedCallback(void* data,
                                   Evas_Object* obj, void* /*eventInfo*/) {
   Popup* popup = static_cast<Popup*>(data);
@@ -95,31 +94,28 @@ static Evas_Object* AddEntry(Evas_Object* parent, Popup::EntryType type) {
 
 static Evas_Object* AddEntrySet(Evas_Object* parent,
                                 const char* str_id, Popup::EntryType type) {
-  // a grid for entry
-  Evas_Object* entry_grid = elm_grid_add(parent);
-  evas_object_size_hint_weight_set(entry_grid, EVAS_HINT_EXPAND,
-                                   EVAS_HINT_EXPAND);
-  evas_object_size_hint_align_set(entry_grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
-  evas_object_show(entry_grid);
-
-  // label for the entry
-  Evas_Object* entry_label = elm_label_add(entry_grid);
-  elm_object_style_set(entry_label, kStyleLabel);
-  elm_object_domain_translatable_part_text_set(entry_label, 0,
+  Evas_Object* entry = AddEntry(parent, type);
+  evas_object_show(entry);
+
+  Evas_Object* layout = elm_layout_add(parent);
+  elm_layout_file_set(layout, kWRTEdjePath, "PopupTextEntrySet");
+
+  Evas_Object* rectangle = evas_object_rectangle_add(
+                             evas_object_evas_get(layout));
+  evas_object_color_set(rectangle, 0, 0, 0, 0);
+  evas_object_resize(rectangle, 100, 100);
+  evas_object_size_hint_min_set(rectangle, 100, 100);
+  evas_object_show(rectangle);
+  elm_object_part_content_set(layout, "entry.rectangle", rectangle);
+  evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+  evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
+  elm_object_domain_translatable_part_text_set(layout, "entry.text",
                                                kTextDomainRuntime,
                                                str_id);
-  evas_object_color_set(entry_label, 0, 0, 0, 255);
-  evas_object_size_hint_weight_set(entry_label,
-                                   EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-  evas_object_size_hint_align_set(entry_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
-  elm_grid_pack(entry_grid, entry_label, 0, 0, 30, 100);
-  evas_object_show(entry_label);
-
-  // entry
-  Evas_Object* entry = AddEntry(entry_grid, type);
-  evas_object_show(entry);
-  elm_grid_pack(entry_grid, entry, 30, 0, 40, 100);
-  elm_box_pack_end(parent, entry_grid);
+  elm_layout_content_set(layout, "entry.swallow", entry);
+
+  evas_object_show(layout);
+  elm_box_pack_end(parent, layout);
 
   return entry;
 }
@@ -128,8 +124,7 @@ static Evas_Object* AddCheckBox(Evas_Object* parent) {
   Evas_Object* check = elm_check_add(parent);
   elm_object_style_set(check, kStyleDefault);
   elm_object_style_set(check, "multiline");
-  evas_object_size_hint_align_set(check, 0.0, 0.0);
-  evas_object_color_set(check, 0, 0, 0, 255);
+  evas_object_size_hint_align_set(check, 0.1, 0.0);
   elm_check_state_set(check, EINA_TRUE);
   return check;
 }
@@ -141,24 +136,19 @@ std::set<Popup*> Popup::opened_popups_;
 
 Popup* Popup::CreatePopup(NativeWindow* window) {
   Evas_Object* popup = elm_popup_add(window->evas_object());
+  evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_object_style_set(popup, kStyleDefault);
 
-  Evas_Object* grid = elm_grid_add(popup);
-  evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-  evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
-  elm_object_part_content_set(popup, "default", grid);
-  evas_object_show(grid);
-
-  Evas_Object* box = elm_box_add(grid);
+  Evas_Object* box = elm_box_add(popup);
   elm_box_padding_set(box, 0, 10);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
-  elm_grid_pack(grid, box, 3, 3, 94, 94);
+  elm_object_part_content_set(popup, "default", box);
   evas_object_show(box);
 
   evas_object_event_callback_add(popup, EVAS_CALLBACK_RESIZE, NULL, NULL);
 
-  return new Popup(popup, grid, box);
+  return new Popup(popup, box);
 }
 
 void Popup::ForceCloseAllPopup() {
@@ -307,8 +297,8 @@ void Popup::Result(bool is_positive) {
   handler_(this, user_data_);
 }
 
-Popup::Popup(Evas_Object* popup, Evas_Object* grid, Evas_Object* box)
-  : popup_(popup), grid_(grid), box_(box) {}
+Popup::Popup(Evas_Object* popup, Evas_Object* box)
+  : popup_(popup), box_(box) {}
 
 Popup::~Popup() {
   if (popup_)
index f611bda171295510eee4185d6098a38707142342..6e2801d689ccd15fbf12b9df79444c6687ac8327 100755 (executable)
@@ -76,11 +76,10 @@ class Popup {
   Evas_Object* popup() { return popup_; }
 
  private:
-  Popup(Evas_Object* popup, Evas_Object* grid, Evas_Object* box);
+  Popup(Evas_Object* popup, Evas_Object* box);
   ~Popup();
 
   Evas_Object* popup_;
-  Evas_Object* grid_;
   Evas_Object* box_;
   Evas_Object* button1_;
   Evas_Object* button2_;
index 0511f243b59f9e6da542b3b6578570705a262a71..0ad09ec10432e84e07096609b67a26dc7404eb4c 100644 (file)
@@ -94,305 +94,6 @@ collections {
         }//end of programs
     }//end of group
 
-    group {
-        name: "popupWithCheck";
-        parts {
-            part {
-                name: "pad_t";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.5 0.0;
-                    min: 16 0;
-                    fixed: 0 1;
-                    rel1 { relative: 1.0 0.0;to_x: "pad_l"; }
-                    rel2 { relative: 0.0 0.0;to_x: "pad_r"; }
-                }
-            }
-            part {
-                name: "pad_l";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    min: 16 0;
-                    max: 16 0;
-                    fixed: 1 0;
-                    rel1 { relative: 0.0 0.0; }
-                    rel2 { relative: 0.0 1.0; }
-                    align: 0.0 0.0;
-                }
-            }
-            part {
-                name: "pad_r";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    min: 16 0;
-                    max: 16 0;
-                    fixed: 1 0;
-                    rel1 { relative: 1.0 0.0; }
-                    rel2 { relative: 1.0 1.0; }
-                    align: 1.0 0.0;
-                }
-            }
-            part {
-                name:"elm.swallow.label";
-                type: SWALLOW;
-                scale : 1;
-                description {
-                    state: "default" 0.0;
-                    fixed: 1 0;
-                    rel1 {
-                        relative: 1.0 1.0;
-                        to_x: "pad_l";
-                        to_y: "pad_t";
-                    }
-                    rel2 {
-                        relative: 0.0 0.0;
-                        to_x: "pad_r";
-                        to_y: "pad_b";
-                    }
-                }
-            }
-            part {
-                name: "bottom_pad";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 1.0;
-                    min: 0 16;
-                    fixed: 0 1;
-                    rel1 { relative: 1.0 1.0; to_x: "pad_l"; }
-                    rel2 { relative: 0.0 1.0; to_x: "pad_r"; }
-                }
-            }
-            part {
-                name: "pad_b";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 1.0;
-                    min: 0 44;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 0.0; to: "bottom_pad"; }
-                    rel2 { relative: 1.0 0.0; to: "bottom_pad"; }
-                }
-            }
-            part {
-                name: "end_field";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 1.0;
-                    min: 0 40;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 1.0; to: "pad_b"; }
-                    rel2 { relative: 1.0 1.0; to: "pad_b"; }
-                }
-            }
-            part {
-                name: "elm.swallow.checkbox";
-                type: SWALLOW;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    fixed: 1 1;
-                    align: 0.0 0.5;
-                    rel1.to: "end_field";
-                    rel2.to: "end_field";
-                }
-            }
-        } //end of parts
-    } //end of group
-
-    group {
-        name: "authRequestPopup";
-        parts {
-            part {
-                name: "pad_t";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.5 0.0;
-                    min: 0 32;
-                    fixed: 0 1;
-                    rel1 { relative: 1.0 0.0;to_x: "pad_l"; }
-                    rel2 { relative: 0.0 0.0;to_x: "pad_r"; }
-                }
-            }
-            part {
-                name: "pad_l";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    min: 26 0;
-                    max: 26 0;
-                    fixed: 1 0;
-                    rel1 { relative: 0.0 0.0; }
-                    rel2 { relative: 0.0 1.0; }
-                    align: 0.0 0.0;
-                }
-            }
-            part {
-                name: "pad_r";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    min: 26 0;
-                    max: 26 0;
-                    fixed: 1 0;
-                    rel1 { relative: 1.0 0.0; }
-                    rel2 { relative: 1.0 1.0; }
-                    align: 1.0 0.0;
-                }
-            }
-            part {
-                name:"elm.swallow.label";
-                type: SWALLOW;
-                scale : 1;
-                description {
-                    state: "default" 0.0;
-                    fixed: 1 0;
-                    rel1 {
-                        relative: 1.0 1.0;
-                        to_x: "pad_l";
-                        to_y: "pad_t";
-                    }
-                    rel2 {
-                        relative: 0.0 0.0;
-                        to_x: "pad_r";
-                        to_y: "pad_b";
-                    }
-                }
-            }
-            part {
-                name: "bottom_pad";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 1.0;
-                    min: 0 32;
-                    fixed: 0 1;
-                    rel1 { relative: 1.0 1.0; to_x: "pad_l"; }
-                    rel2 { relative: 0.0 1.0; to_x: "pad_r"; }
-                }
-            }
-            part {
-                name: "pad_b";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 1.0;
-                    min: 0 200;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 0.1; to: "bottom_pad"; }
-                    rel2 { relative: 1.0 0.1; to: "bottom_pad"; }
-                }
-            }
-            part {
-                name: "pad_m1";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 1.0;
-                    min: 0 32;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 0.0; to: "pad_b"; }
-                    rel2 { relative: 1.0 0.0; to: "pad_b"; }
-                }
-            }
-            part{
-                name:"elm.swallow.idtext";
-                type: TEXT;
-                scale : 1;
-                description {
-                    state: "default" 0.0;
-                    color: 168 168 168 255;
-                    text {
-                        font: "Tizen:style=Medium";
-                        size: 35;
-                        align: 0.0 0.5;
-                    }
-                    align: 0.0 0.0;
-                    min: 0 40;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 1.0; to: "pad_m1"; }
-                    rel2 { relative: 1.0 1.0; to: "pad_m1"; }
-                }
-            }
-            part {
-                name: "elm.swallow.idfield";
-                type: SWALLOW;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 0.0;
-                    min: 0 63;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 1.0; to: "elm.swallow.idtext"; }
-                    rel2 { relative: 1.0 1.0; to: "elm.swallow.idtext"; }
-                }
-            }
-            part {
-                name: "pad_m2";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 1.0;
-                    min: 0 32;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 1.0; to: "elm.swallow.idfield"; }
-                    rel2 { relative: 1.0 1.0; to: "elm.swallow.idfield"; }
-                }
-            }
-            part{
-                name:"elm.swallow.pwtext";
-                type: TEXT;
-                scale : 1;
-                description {
-                    state: "default" 0.0;
-                    color: 168 168 168 255;
-                    text {
-                        font: "Tizen:style=Medium";
-                        size: 35;
-                        align: 0.0 0.5;
-                    }
-                    align: 0.0 0.0;
-                    min: 0 40;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 1.0; to: "pad_m2"; }
-                    rel2 { relative: 1.0 1.0; to: "pad_m2"; }
-                }
-            }
-            part {
-                name: "elm.swallow.pwfield";
-                type: SWALLOW;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.0 0.0;
-                    min: 0 63;
-                    fixed: 0 1;
-                    rel1 { relative: 0.0 1.0; to: "elm.swallow.pwtext"; }
-                    rel2 { relative: 1.0 1.0; to: "elm.swallow.pwtext"; }
-                }
-            }
-        } //end of parts
-    } //end of group
-
     group { name: "elm/button/base/wrt";
      #define BUTTON_HEIGHT 78.0
      parts {
@@ -444,81 +145,51 @@ collections {
     }//end of group
 
     group {
-        name: "PopupCommon";
-        parts {
-            part {
-                name: "pad_t";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    align: 0.5 0.0;
-                    min: 0 20;
-                    fixed: 0 1;
-                    rel1 { relative: 1.0 0.0;to_x: "pad_l"; }
-                    rel2 { relative: 0.0 0.0;to_x: "pad_r"; }
-                }
-            }
-            part {
-                name: "pad_l";
-                type: SPACER;
-                scale: 1;
-                description {
-                    state: "default" 0.0;
-                    min: 15 0;
-                    max: 15 0;
-                    fixed: 1 0;
-                    rel1 { relative: 0.0 0.0; }
-                    rel2 { relative: 0.0 1.0; }
-                    align: 0.0 0.0;
-                }
-            }
+        name: "PopupTextEntrySet";
+        parts{
             part {
-                name: "pad_r";
-                type: SPACER;
+                name: "entry.rectangle";
                 scale: 1;
+                type: SWALLOW;
                 description {
                     state: "default" 0.0;
-                    min: 15 0;
-                    max: 15 0;
-                    fixed: 1 0;
-                    rel1 { relative: 1.0 0.0; }
-                    rel2 { relative: 1.0 1.0; }
-                    align: 1.0 0.0;
                 }
             }
-            part {
-                name: "pad_b";
-                type: SPACER;
+            part{
+                name: "entry.text";
+                type: TEXT;
                 scale: 1;
                 description {
                     state: "default" 0.0;
-                    align: 0.0 1.0;
-                    min: 0 20;
-                    fixed: 0 1;
-                    rel1 { relative: 1.0 1.0;to_x: "pad_l"; }
-                    rel2 { relative: 0.0 1.0;to_x: "pad_r"; }
+                    fixed: 1 1;
+                    color: 168 168 168 255;
+                    rel1 {
+                        relative: 0.0 0.0;
+                    }
+                    rel2 {
+                        relative: 0.25 1.0;
+                    }
+                    text {
+                        font : "Tizen tyle=Medium";
+                        size : 15;
+                    }
                 }
             }
-            part {
-                name:"elm.swallow.body";
+            part{
+                name: "entry.swallow";
                 type: SWALLOW;
-                scale : 1.0;
+                scale: 1;
                 description {
                     state: "default" 0.0;
-                    fixed: 1 0;
+                    fixed: 1 1;
                     rel1 {
-                        relative: 1.0 1.0;
-                        to_x: "pad_l";
-                        to_y: "pad_t";
+                        relative: 0.3 0.0;
                     }
                     rel2 {
-                        relative: 0.0 0.0;
-                        to_x: "pad_r";
-                        to_y: "pad_b";
+                        relative: 0.7 1.0;
                     }
                 }
             }
         } //end of parts
     } //end of group
-}//end of collection
+} //end of collection