Elm_Button *right_title_btn = elm_button_add(base);
elm_object_text_set(right_title_btn, "Done");
+ //Set available rotation only "0, 90" of this view
+ const int rots[2] = { 0, 90 };
+ ui_view_set_available_rotations(view, rots, 2);
+
if (!ui_standard_view_set_content(view, content, "Page2", NULL, left_title_btn, right_title_btn))
{
dlog_print(DLOG_ERROR, LOG_TAG, "failed to set view content");
Elm_Button *rightTitleBtn = elm_button_add(this->getBase());
elm_object_text_set(rightTitleBtn, "Done");
+ //Set available rotation only "0, 90" of this view
+ const int rots[2] = { 0, 90 };
+ this->setAvailableRotations(rots, 2);
+
//Arguments: content, title, subtitle, title left button, title right button
this->setContent(content, "Page2", NULL, leftTitleBtn, rightTitleBtn);
}
virtual void setIndicator(UiViewIndicator indicator) override;
/**
+ * @breif Set the array of view's available rotations.
+ *
+ * @note Set an array of rotation values.
+ * For instance, {0, 90, 180, 270}. These rotation values depends on the system support.
+ *
+ * @param rotations The array of rotation values.
+ * @param count The number of arrays of rotatons.
+ */
+ virtual bool setAvailableRotations(const int *rotations, unsigned int count) override;
+
+ /**
* @brief Get current view's degree.
*
* @return Current rotation degree, -1 if it fails to get degree information.
EAPI ui_view_indicator ui_view_get_indicator(ui_view *view);
/**
+ * @breif Set the array of view's available rotations.
+ *
+ * @note Set an array of rotation values.
+ * For instance, {0, 90, 180, 270}. These rotation values depends on the system support.
+ *
+ * @param rotations The array of rotation values.
+ * @param count The number of arrays of rotatons.
+ *
+ * @see ui_view_get_available_rotations
+ */
+EAPI bool ui_view_set_available_rotations(ui_view *view, const int *rotations, unsigned int count);
+
+/**
+ * @brief Get the array of view's available rotations.
+ *
+ * @param count The number of arrays of rotations.
+ *
+ * @return The array of rotation values.
+ *
+ * @see ui_view_set_available_rotations
+ */
+EAPI const int *ui_view_get_available_rotations(ui_view *view, unsigned int *count);
+
+/**
* @brief Set content removable.
*
* @param view An ui_view instance.
virtual void setIndicator(UiViewIndicator indicator);
/**
+ * @breif Set the array of view's available rotations.
+ *
+ * @note Set an array of rotation values.
+ * For instance, {0, 90, 180, 270}. These rotation values depends on the system support.
+ *
+ * @param rotations The array of rotation values.
+ * @param count The number of arrays of rotations.
+ *
+ * @see getAvailableRotations()
+ */
+ virtual bool setAvailableRotations(const int *rotations, unsigned int count);
+
+ /**
+ * @brief Get the array of view's available rotations.
+ *
+ * @param count The number of arrays of rotations.
+ *
+ * @return The array of rotation values.
+ *
+ * @see setAvailableRotations()
+ */
+ const int *getAvailableRotations(unsigned int *count);
+
+ /**
* @brief Return a style name of this view.
*
* @return style name of view.
viewmgr->setIndicator(indicator);
}
+bool UiBaseView::setAvailableRotations(const int *rotations, unsigned int count)
+{
+ if (!UiIfaceView::setAvailableRotations(rotations, count)) {
+ return false;
+ }
+
+ UiBaseViewmgr *viewmgr = UI_BASE_VIEWMGR;
+
+ if (!viewmgr) {
+ LOGE("Failed to get a viewmgr");
+ return false;
+ }
+
+ if (this == viewmgr->getLastView())
+ elm_win_wm_rotation_available_rotations_set(viewmgr->getWindow(), rotations, count);
+
+ return true;
+}
+
void UiBaseView::onRotate(int degree)
{
}
bool _createScroller(Elm_Conformant *conform);
bool _createBaseLayout(Elm_Scroller *scroller, const char *style);
bool _setIndicator(UiViewIndicator indicator);
+ void _setAvailableRotations(UiBaseView *view);
void _activateTopView();
bool _init();
bool _term();
elm_object_part_content_set(this->getBase(), "content", content);
+ this->_setAvailableRotations(view);
this->_setIndicator(view->getIndicator());
}
return true;
}
+void UiBaseViewmgrImpl::_setAvailableRotations(UiBaseView *view)
+{
+ const int *rotations = NULL;
+ unsigned int count = 0;
+
+ rotations = view->getAvailableRotations(&count);
+
+ elm_win_wm_rotation_available_rotations_set(this->getWindow(), rotations, count);
+}
+
bool UiBaseViewmgrImpl::_createConformant(Elm_Win *win)
{
Elm_Conformant *conform = elm_conformant_add(win);
elm_layout_signal_emit(effect, "view,pop", "viewmgr");
+ this->_setAvailableRotations(pview);
this->_setIndicator(pview->getIndicator());
return true;
elm_layout_signal_emit(effect, "view,push", "viewmgr");
+ this->_setAvailableRotations(view);
this->_setIndicator(view->getIndicator());
return view;
return view->getOrientationMode();
}
+EAPI bool ui_view_set_available_rotations(ui_view *view, const int *rotations, unsigned int count)
+{
+ if (!validate_view(view)) return false;
+ return view->setAvailableRotations(rotations, count);
+}
+
+EAPI const int *ui_view_get_available_rotations(ui_view *view, unsigned int *count)
+{
+ if (!validate_view(view)) return false;
+ return view->getAvailableRotations(count);
+}
+
EAPI bool ui_view_set_transition_style(ui_view *view, const char *style)
{
if (!validate_view(view)) return false;
UiIfaceView *_view = NULL;
T _content = NULL; ///< A content instance for a screen as a view.
string _name; ///< View name.
- string _transition_style = "default"; ///< View transition style name.
+ string _transitionStyle = "default"; ///< View transition style name.
UiIfaceViewmgr *_viewmgr = NULL; ///< Viewmgr which this view belongs to.
UiViewState _state = UI_VIEW_STATE_UNLOAD; ///< View state.
UiViewIndicator _indicator = UI_VIEW_INDICATOR_DEFAULT; ///< View indicator mode.
- bool _event_block = false; ///< State of event block.
- bool _removable_content = true; ///< When this value is true, view removes it's content internally on unload state.
+ int *_rotations = NULL; ///< The pointer of rotation values.
+ unsigned int _rotationCount = 0; ///< The number of available rotations.
+ bool _eventBlock = false; ///< State of event block.
+ bool _removableContent = true; ///< When this value is true, view removes it's content internally on unload state.
public:
void setEventBlock(bool block);
bool setTransitionStyle(const char *style);
void setRemovableContent(bool removable);
void setIndicator(UiViewIndicator indicator);
+ bool setAvailableRotations(const int *rotations, unsigned int count);
+ const int *getAvailableRotations(unsigned int *count);
const char *getTransitionStyle();
const char *getName();
T getContent();
}
+#define MAX_NUM_OF_AVAILABLE_ROTATIONS 4
+
bool UiIfaceViewImpl::getEventBlock()
{
- return this->_event_block;
+ return this->_eventBlock;
}
void UiIfaceViewImpl::setEventBlock(bool block)
{
- this->_event_block = block;
+ this->_eventBlock = block;
}
void UiIfaceViewImpl::onLoad()
UiIfaceViewImpl::~UiIfaceViewImpl()
{
this->_viewmgr->removeView(this->_view);
+
+ if (this->_rotations) delete[](this->_rotations);
}
bool UiIfaceViewImpl::setContent(T content)
bool UiIfaceViewImpl::setTransitionStyle(const char *style)
{
- this->_transition_style.assign(style);
+ this->_transitionStyle.assign(style);
return true;
}
void UiIfaceViewImpl::setRemovableContent(bool removable)
{
- this->_removable_content = removable;
+ this->_removableContent = removable;
//FIXME: If this api is called on unload state? should we remove content right now?
}
this->_indicator = indicator;
}
+bool UiIfaceViewImpl::setAvailableRotations(const int *rotations, unsigned int count)
+{
+ if (count <= 0) {
+ LOGE("Invalid count value %d count must bigger than 0", count);
+ return false;
+ }
+
+ this->_rotations = new int[count];
+ if (!this->_rotations) {
+ LOGE("Allocation failed");
+ return false;
+ }
+
+ for (unsigned int i = 0; i < count; i++) {
+ this->_rotations[i] = rotations[i];
+ }
+
+ this->_rotationCount = count;
+
+ return true;
+}
+
+const int *UiIfaceViewImpl::getAvailableRotations(unsigned int *count)
+{
+ static int rots[MAX_NUM_OF_AVAILABLE_ROTATIONS] = {0, 90, 180, 270};
+
+ if (this->_rotationCount > 0) {
+ *count = this->_rotationCount;
+ return this->_rotations;
+ }
+ else {
+ *count = MAX_NUM_OF_AVAILABLE_ROTATIONS;
+ return rots;
+ }
+}
+
const char *UiIfaceViewImpl::getTransitionStyle()
{
- return this->_transition_style.c_str();
+ return this->_transitionStyle.c_str();
}
const char *UiIfaceViewImpl::getName()
bool UiIfaceViewImpl::getRemovableContent()
{
- return this->_removable_content;
+ return this->_removableContent;
}
UiViewIndicator UiIfaceViewImpl::getIndicator()
this->_impl->setIndicator(indicator);
}
+bool UiIfaceView::setAvailableRotations(const int *rotations, unsigned int count)
+{
+ return this->_impl->setAvailableRotations(rotations, count);
+}
+
+const int *UiIfaceView::getAvailableRotations(unsigned int *count)
+{
+ return this->_impl->getAvailableRotations(count);
+}
+
const char *UiIfaceView::getTransitionStyle()
{
return this->_impl->getTransitionStyle();