*/
virtual bool pop_view();
+ /**
+ * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right before of the given view, @before.
+ *
+ * @param view A view to insert in the viewmgr view list.
+ * @param before A view that will be just inserted after @p view. If you pass @c NULL, @p view will be inserted at the front of the view list.
+ *
+ * @return @c true on success or @c false otherwise.
+ */
+ virtual bool insert_view_before(ui_base_view *view, ui_base_view *before);
+
+ /**
+ * @brief Insert a view in this viewmgr view list. Specifically, insert a given @p view right after of the given view, @after.
+ *
+ * @param view A view to insert in the viewmgr view list.
+ * @param after A view that will be just inserted before the @p view. If you pass @c NULL, @p view will be inserted at the end of the view list.
+ *
+ * @return @c true on success or @c false otherwise.
+ */
+ virtual bool insert_view_after(ui_base_view *view, ui_base_view *after);
+
/** @brief Get a window object of viewmgr.
*/
Elm_Win *get_window()
return view;
}
+bool ui_base_viewmgr::insert_view_before(ui_base_view *view, ui_base_view *before)
+{
+ ui_iface_viewmgr::insert_view_before(view, before);
+
+ return true;
+}
+
+bool ui_base_viewmgr::insert_view_after(ui_base_view *view, ui_base_view *after)
+{
+ ui_iface_viewmgr::insert_view_after(view, after);
+
+ return true;
+}
+
ui_base_view *ui_base_viewmgr::get_view(unsigned int idx)
{
return dynamic_cast<ui_base_view *>(ui_iface_viewmgr::get_view(idx));
bool ui_iface_viewmgr::insert_view_before(ui_iface_view *view, ui_iface_view *before)
{
- //TODO: ...
+ typename std::list<ui_iface_view*>::iterator it;
+
+ if (!view)
+ {
+ LOGE("invalid view argument. view(NULL)");
+ return false;
+ }
+
+ if (!this->connect_view(view))
+ {
+ LOGE("connect view failed");
+ return false;
+ }
+
+ if (this->view_list.size() > 0)
+ {
+ for (it = this->view_list.begin(); it != this->view_list.end(); it++)
+ {
+ if (before == *it)
+ {
+ this->view_list.insert(it, view);
+
+ return true;
+ }
+ }
+ }
+
+ //If there is no matching before view with current list.
+ //also in case of before is NULL.
+ this->push_view(view);
+
return true;
}
bool ui_iface_viewmgr::insert_view_after(ui_iface_view *view, ui_iface_view *after)
{
- //TODO: ...
+ typename std::list<ui_iface_view*>::iterator it;
+
+ if (!view)
+ {
+ LOGE("invalid view argument. view(NULL)");
+ return false;
+ }
+
+ if (!this->connect_view(view))
+ {
+ LOGE("connect view failed");
+ return false;
+ }
+
+ ui_iface_view *bview;
+
+ if (this->view_list.size() > 0)
+ {
+ for (it = this->view_list.begin(); it != this->view_list.end(); it++)
+ {
+ if (after == *it)
+ {
+ //If the after is a last item of list.
+ //view has to push now.
+ if (it == this->view_list.end())
+ this->push_view(view);
+ else
+ this->view_list.insert(++it, view);
+
+ return true;
+ }
+ }
+ }
+
+ //If there is no matching after view with current list.
+ //also in case of after is NULL.
+ this->push_view(view);
+
return true;
}