Add title show/hide example. 89/66689/2
authorWoochan Lee <wc0917.lee@samsung.com>
Wed, 20 Apr 2016 09:32:01 +0000 (18:32 +0900)
committerwoochan lee <wc0917.lee@samsung.com>
Wed, 20 Apr 2016 09:32:46 +0000 (02:32 -0700)
Change-Id: Ibd0a12c6e68442720f13eb871734c58bdfda0338

src/examples/efl/main.cpp
src/examples/efl/main.h
src/examples/efl/page15.h
src/examples/efl/page16.h [new file with mode: 0644]

index 8898b7e..ffeb835 100644 (file)
@@ -15,6 +15,7 @@
  *
  */
 #include "main.h"
+#include "page16.h"
 #include "page15.h"
 #include "page14.h"
 #include "page13.h"
@@ -138,6 +139,104 @@ create_landscape_content(Evas_Object *parent, const char *text, Evas_Smart_Cb pr
 }
 
 Evas_Object*
+create_title_handle_content(Evas_Object *parent, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb,
+                               Evas_Smart_Cb title_show_btn_clicked_cb, Evas_Smart_Cb title_hide_btn_clicked_cb,
+                               Evas_Smart_Cb title_show_anim_btn_clicked_cb, Evas_Smart_Cb title_hide_anim_btn_clicked_cb, ui_view *view)
+{
+       Elm_Grid *grid;
+       Elm_Box *box;
+       Elm_Layout *layout;
+       Elm_Button *btn;
+
+       /* Grid */
+       grid = elm_grid_add(parent);
+       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);
+       evas_object_show(grid);
+
+       /* NoContent Layout */
+       layout = elm_layout_add(grid);
+       elm_layout_theme_set(layout, "layout", "nocontents", "default");
+       elm_object_part_text_set(layout, "elm.text", NULL);
+       evas_object_show(layout);
+       elm_grid_pack(grid, layout, 0, 0, 100, 100);
+
+       /* Box */
+       box = elm_box_add(grid);
+       //elm_box_horizontal_set(box, EINA_TRUE);
+       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_box_padding_set(box, ELM_SCALE_SIZE(50), 0);
+       evas_object_show(box);
+       elm_grid_pack(grid, box, 25, 15, 50, 50);
+
+       /* Title Show Button */
+       btn = elm_button_add(grid);
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+       elm_object_text_set(btn, "Title Show");
+       evas_object_smart_callback_add(btn, "clicked", title_show_btn_clicked_cb, view);
+       evas_object_show(btn);
+       elm_box_pack_end(box, btn);
+
+       /* Title Hide Button */
+       btn = elm_button_add(grid);
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+       elm_object_text_set(btn, "Title Hide");
+       evas_object_smart_callback_add(btn, "clicked", title_hide_btn_clicked_cb, view);
+       evas_object_show(btn);
+       elm_box_pack_end(box, btn);
+
+       /* Title Show Anim Button */
+       btn = elm_button_add(grid);
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+       elm_object_text_set(btn, "Title Show Anim");
+       evas_object_smart_callback_add(btn, "clicked", title_show_anim_btn_clicked_cb, view);
+       evas_object_show(btn);
+       elm_box_pack_end(box, btn);
+
+       /* Title Hide Anim Button */
+       btn = elm_button_add(grid);
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+       elm_object_text_set(btn, "Title Hide Anim");
+       evas_object_smart_callback_add(btn, "clicked", title_hide_anim_btn_clicked_cb, view);
+       evas_object_show(btn);
+       elm_box_pack_end(box, btn);
+
+       /* Box */
+       box = elm_box_add(grid);
+       elm_box_horizontal_set(box, EINA_TRUE);
+       evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(box, EVAS_HINT_FILL, 1.0);
+       elm_box_padding_set(box, ELM_SCALE_SIZE(50), 0);
+       evas_object_show(box);
+       elm_grid_pack(grid, box, 0, 0, 100, 100);
+
+       /* Previous Page Button */
+       btn = elm_button_add(grid);
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+       elm_object_text_set(btn, "Prev");
+       evas_object_smart_callback_add(btn, "clicked", prev_btn_clicked_cb, NULL);
+       evas_object_show(btn);
+       elm_box_pack_end(box, btn);
+
+       /* Next Page Button */
+       btn = elm_button_add(grid);
+       evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, 1.0);
+       elm_object_text_set(btn, "Next");
+       evas_object_smart_callback_add(btn, "clicked", next_btn_clicked_cb, NULL);
+       evas_object_show(btn);
+       elm_box_pack_end(box, btn);
+
+       return grid;
+}
+
+Evas_Object*
 create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb)
 {
        Elm_Grid *grid;
index 80ee4b5..6364456 100644 (file)
@@ -41,4 +41,7 @@ typedef struct appdata {
 Evas_Object *create_landscape_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb);
 Evas_Object *create_content(Evas_Object *parent, const char *text, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb);
 Evas_Object *create_scrolling_content(Evas_Object *parent);
+Evas_Object* create_title_handle_content(Evas_Object *parent, Evas_Smart_Cb prev_btn_clicked_cb, Evas_Smart_Cb next_btn_clicked_cb,
+                                       Evas_Smart_Cb title_show_btn_clicked_cb, Evas_Smart_Cb title_hide_btn_clicked_cb,
+                                       Evas_Smart_Cb title_show_anim_btn_clicked_cb, Evas_Smart_Cb title_hide_anim_btn_clicked_cb, ui_view *view);
 Elm_Toolbar *create_toolbar(Evas_Object *parent, const char *style);
index b554f93..549275b 100644 (file)
@@ -36,7 +36,7 @@ protected:
                evas_object_smart_callback_add(right_btn, "clicked",
                                [](void *data, Evas_Object *obj, void *event_info) -> void
                                {
-                                       UI_VIEWMGR->deactivate();
+                                       create_page16();
                                },
                                this);
                this->set_title_right_btn(right_btn);
diff --git a/src/examples/efl/page16.h b/src/examples/efl/page16.h
new file mode 100644 (file)
index 0000000..c02bf39
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *               http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+/** This example create a simple view which is inheritance ui_view.
+ *  Then push in viewmgr.
+ */
+class page16: public ui_view
+{
+protected:
+       void on_load()
+       {
+               ui_view::on_load();
+
+               //Create a main content.
+               Evas_Object *content = create_title_handle_content(this->get_base(),
+                               //Prev Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       UI_VIEWMGR->pop_view();
+                               },
+                               //Next Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       UI_VIEWMGR->deactivate();
+                               },
+                               //Title Show Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       ui_view *view = static_cast<ui_view *>(data);
+                                       view->set_title_visible(true, false);
+                               },
+                               //Title Hide Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       ui_view *view = static_cast<ui_view *>(data);
+                                       view->set_title_visible(false, false);
+                               },
+                               //Title Show Anim Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       ui_view *view = static_cast<ui_view *>(data);
+                                       view->set_title_visible(true, true);
+                               },
+                               //Title Hide Anim Button Callback
+                               [](void *data, Evas_Object *obj, void *event_info) -> void
+                               {
+                                       ui_view *view = static_cast<ui_view *>(data);
+                                       view->set_title_visible(false, true);
+                               }, this);
+
+               this->set_content(content, "Page16");
+       }
+
+public:
+       page16() : ui_view("page16") {}
+       ~page16() {}
+};
+
+void create_page16()
+{
+       //Push this view in viewmgr.
+       UI_VIEWMGR->push_view(new page16());
+}