diff options
Diffstat (limited to 'services/SimpleUI')
-rwxr-xr-x[-rw-r--r--] | services/SimpleUI/ContentPopup_mob.h | 116 | ||||
-rwxr-xr-x[-rw-r--r--] | services/SimpleUI/InputPopup.cpp | 559 | ||||
-rwxr-xr-x[-rw-r--r--] | services/SimpleUI/InputPopup.h | 109 | ||||
-rwxr-xr-x[-rw-r--r--] | services/SimpleUI/NotificationPopup.h | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | services/SimpleUI/SimplePopup.h | 117 | ||||
-rwxr-xr-x[-rw-r--r--] | services/SimpleUI/TextPopup_mob.h | 93 | ||||
-rwxr-xr-x[-rw-r--r--] | services/SimpleUI/ViewManager.h | 58 |
7 files changed, 576 insertions, 476 deletions
diff --git a/services/SimpleUI/ContentPopup_mob.h b/services/SimpleUI/ContentPopup_mob.h index b46955e1..0d494e84 100644..100755 --- a/services/SimpleUI/ContentPopup_mob.h +++ b/services/SimpleUI/ContentPopup_mob.h @@ -30,61 +30,71 @@ namespace tizen_browser { -namespace base_ui -{ - -class ContentPopup : public interfaces::AbstractPopup -{ -public: - static ContentPopup* createPopup(Evas_Object* parent); - static ContentPopup* createPopup(Evas_Object* parent, const std::string& title); - - void show(); - void dismiss(); - void onBackPressed(); - void orientationChanged() override { } - - void setTitle(const std::string& title); - void setContent(Evas_Object* content); - void addButton(const PopupButtons& button, bool dismissOnClick = true); - boost::signals2::signal<void (PopupButtons)> buttonClicked; - boost::signals2::signal<bool ()> isLandscape; - - ~ContentPopup(); - - Evas_Object* getMainLayout() { return m_scroller; } -private: - ContentPopup(Evas_Object* parent); - ContentPopup(Evas_Object* parent, const std::string& title); - void createLayout(); - - static void _layout_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); - static void _response_cb(void* data, Evas_Object* obj, void* event_info); - - struct Button { - Button(PopupButtons type, bool dismissOnClick, Evas_Object* object) - : m_type(type) - , m_dismissOnClick(dismissOnClick) - , m_evasObject(object) - {}; - PopupButtons m_type; - bool m_dismissOnClick; - Evas_Object* m_evasObject; + namespace base_ui + { + + class ContentPopup:public interfaces::AbstractPopup + { + public: + static ContentPopup *createPopup(Evas_Object * parent); + static ContentPopup *createPopup(Evas_Object * parent, + const std::string & title); + + void show(); + void dismiss(); + void onBackPressed(); + void orientationChanged() override + { + } + + void setTitle(const std::string & title); + void setContent(Evas_Object * content); + void addButton(const PopupButtons & button, bool dismissOnClick = true); + boost::signals2::signal < void(PopupButtons) > buttonClicked; + boost::signals2::signal < bool() > isLandscape; + + ~ContentPopup(); + + Evas_Object *getMainLayout() + { + return m_scroller; + } + private: + ContentPopup(Evas_Object * parent); + ContentPopup(Evas_Object * parent, const std::string & title); + void createLayout(); + + static void _layout_resize_cb(void *data, Evas * e, Evas_Object * obj, + void *event_info); + static void _response_cb(void *data, Evas_Object * obj, + void *event_info); + + struct Button + { + Button(PopupButtons type, bool dismissOnClick, Evas_Object * object) + :m_type(type) + , m_dismissOnClick(dismissOnClick) + , m_evasObject(object) + { + }; + PopupButtons m_type; + bool m_dismissOnClick; + Evas_Object *m_evasObject; + }; + + Evas_Object *m_parent; + Evas_Object *m_layout; + Evas_Object *m_buttons_box; + Evas_Object *m_scroller; + Evas_Object *m_content; + std::vector < Button > m_buttons; + std::string m_title; + std::string m_message; + std::string m_edjFilePath; + static const int MARGIN = 44; }; - Evas_Object* m_parent; - Evas_Object* m_layout; - Evas_Object* m_buttons_box; - Evas_Object* m_scroller; - Evas_Object* m_content; - std::vector<Button> m_buttons; - std::string m_title; - std::string m_message; - std::string m_edjFilePath; - static const int MARGIN = 44; -}; - -} + } } diff --git a/services/SimpleUI/InputPopup.cpp b/services/SimpleUI/InputPopup.cpp index 6d55c35a..aa59ec2a 100644..100755 --- a/services/SimpleUI/InputPopup.cpp +++ b/services/SimpleUI/InputPopup.cpp @@ -1,281 +1,338 @@ #include "InputPopup.h" -namespace tizen_browser { -namespace base_ui { - -InputPopup::InputPopup() : - m_parent(nullptr), - m_layout(nullptr), - m_buttons_box(nullptr), - m_button_left(nullptr), - m_button_right(nullptr), - m_input_area(nullptr), - m_input_cancel(nullptr), - m_entry(nullptr), - m_accept_right_left(false) +namespace tizen_browser { - m_edjFilePath = EDJE_DIR; - m_edjFilePath.append("SimpleUI/InputPopup.edj"); - elm_theme_extension_add(nullptr, m_edjFilePath.c_str()); - m_bad_words.push_back(""); -} - -InputPopup::~InputPopup() -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - evas_object_smart_callback_del(m_entry, "focused", _entry_focused); - evas_object_smart_callback_del(m_entry, "unfocused", _entry_unfocused); - evas_object_smart_callback_del(m_entry, "changed,user", _entry_changed); - evas_object_smart_callback_del(m_input_cancel, "clicked", _input_cancel_clicked); - evas_object_smart_callback_del(m_button_right, "clicked", _right_button_clicked); - evas_object_smart_callback_del(m_button_left, "clicked", _left_button_clicked); - evas_object_del(m_input_cancel); - evas_object_del(m_entry); - evas_object_del(m_input_area); - evas_object_del(m_button_right); - evas_object_del(m_button_left); - evas_object_del(m_buttons_box); - evas_object_del(m_layout); - button_clicked.disconnect_all_slots(); - popupDismissed.disconnect_all_slots(); - popupShown.disconnect_all_slots(); - m_bad_words.clear(); -} + namespace base_ui + { + + InputPopup::InputPopup():m_parent(nullptr), + m_layout(nullptr), + m_buttons_box(nullptr), + m_button_left(nullptr), + m_button_right(nullptr), + m_input_area(nullptr), + m_input_cancel(nullptr), m_entry(nullptr), m_accept_right_left(false) + { + m_edjFilePath = EDJE_DIR; + m_edjFilePath.append("SimpleUI/InputPopup.edj"); + elm_theme_extension_add(nullptr, m_edjFilePath.c_str()); + m_bad_words.push_back(""); + } -InputPopup* InputPopup::createPopup(Evas_Object* parent) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - InputPopup *inputPopup = new InputPopup(); - inputPopup->m_parent = parent; - return inputPopup; -} + InputPopup::~InputPopup() + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + evas_object_smart_callback_del(m_entry, "focused", _entry_focused); + evas_object_smart_callback_del(m_entry, "unfocused", _entry_unfocused); + evas_object_smart_callback_del(m_entry, "changed,user", _entry_changed); + evas_object_smart_callback_del(m_input_cancel, "clicked", + _input_cancel_clicked); + evas_object_smart_callback_del(m_button_right, "clicked", + _right_button_clicked); + evas_object_smart_callback_del(m_button_left, "clicked", + _left_button_clicked); + evas_object_del(m_input_cancel); + evas_object_del(m_entry); + evas_object_del(m_input_area); + evas_object_del(m_button_right); + evas_object_del(m_button_left); + evas_object_del(m_buttons_box); + evas_object_del(m_layout); + button_clicked.disconnect_all_slots(); + popupDismissed.disconnect_all_slots(); + popupShown.disconnect_all_slots(); + m_bad_words.clear(); + } -InputPopup* InputPopup::createPopup(Evas_Object *parent, const std::string& title, const std::string& message, const std::string& input, - const std::string& rightButtonText, const std::string& leftButtonText, bool accept_right_left) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - InputPopup *inputPopup = new InputPopup(); - inputPopup->m_parent = parent; - inputPopup->m_title = title; - inputPopup->m_message = message; - inputPopup->m_input = input; - inputPopup->m_ok_button_text = rightButtonText; - inputPopup->m_cancel_button_text = leftButtonText; - inputPopup->m_accept_right_left = accept_right_left; - return inputPopup; -} + InputPopup *InputPopup::createPopup(Evas_Object * parent) + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + InputPopup *inputPopup = new InputPopup(); + inputPopup->m_parent = parent; + return inputPopup; + } -void InputPopup::setInput(const std::string& input) -{ - m_input = input; -} + InputPopup *InputPopup::createPopup(Evas_Object * parent, + const std::string & title, + const std::string & message, + const std::string & input, + const std::string & rightButtonText, + const std::string & leftButtonText, + bool accept_right_left) + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + InputPopup *inputPopup = new InputPopup(); + inputPopup->m_parent = parent; + inputPopup->m_title = title; + inputPopup->m_message = message; + inputPopup->m_input = input; + inputPopup->m_ok_button_text = rightButtonText; + inputPopup->m_cancel_button_text = leftButtonText; + inputPopup->m_accept_right_left = accept_right_left; + return inputPopup; + } -void InputPopup::setTitle(const std::string& title) -{ - m_title = title; -} + void InputPopup::setInput(const std::string & input) + { + m_input = input; + } -void InputPopup::setMessage(const std::string& message) -{ - m_message = message; -} + void InputPopup::setTitle(const std::string & title) + { + m_title = title; + } -void InputPopup::setOkButtonText(const std::string& okButtonText) -{ - m_ok_button_text = okButtonText; -} + void InputPopup::setMessage(const std::string & message) + { + m_message = message; + } -void InputPopup::setCancelButtonText(const std::string& cancelButtonText) -{ - m_cancel_button_text = cancelButtonText; -} + void InputPopup::setOkButtonText(const std::string & okButtonText) + { + m_ok_button_text = okButtonText; + } -void InputPopup::setAcceptRightLeft(bool right_left) -{ - m_accept_right_left = right_left; -} + void InputPopup::setCancelButtonText(const std::string & cancelButtonText) + { + m_cancel_button_text = cancelButtonText; + } -void InputPopup::addBadWord(const std::string &word) -{ - m_bad_words.push_back(word); -} + void InputPopup::setAcceptRightLeft(bool right_left) + { + m_accept_right_left = right_left; + } -void InputPopup::show() -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - createLayout(); - popupShown(this); -} + void InputPopup::addBadWord(const std::string & word) + { + m_bad_words.push_back(word); + } -void InputPopup::dismiss() -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - popupDismissed(this); -} + void InputPopup::show() + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + createLayout(); + popupShown(this); + } -void InputPopup::onBackPressed() -{ - dismiss(); -} + void InputPopup::dismiss() + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + popupDismissed(this); + } -void InputPopup::createLayout() -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - - m_layout = elm_layout_add(m_parent); - elm_layout_file_set(m_layout, m_edjFilePath.c_str(), "input-popup-layout"); - evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(m_layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_text_set(m_layout, "title_text", m_title.c_str()); - - m_input_area = elm_layout_add(m_layout); - elm_object_part_content_set(m_layout, "input_swallow", m_input_area); - - evas_object_size_hint_weight_set(m_input_area, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(m_input_area, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(m_input_area); - - elm_layout_file_set(m_input_area, m_edjFilePath.c_str(), "input-area-layout"); - elm_object_part_text_set(m_input_area, "input_message_text", m_message.c_str()); - - m_entry = elm_entry_add(m_input_area); - elm_object_style_set(m_entry, "popup-input-entry"); - - elm_entry_single_line_set(m_entry, EINA_TRUE); - elm_entry_scrollable_set(m_entry, EINA_TRUE); - elm_entry_input_panel_layout_set(m_entry, ELM_INPUT_PANEL_LAYOUT_URL); - elm_object_part_content_set(m_input_area, "input_text_swallow", m_entry); - elm_object_part_text_set(m_entry, "elm.text", elm_entry_utf8_to_markup(m_input.c_str())); - - evas_object_smart_callback_add(m_entry, "focused", _entry_focused, (void*)this); - evas_object_smart_callback_add(m_entry, "unfocused", _entry_unfocused, (void*)this); - evas_object_smart_callback_add(m_entry, "changed,user", _entry_changed, (void*)this); - - m_input_cancel = elm_button_add(m_input_area); - elm_object_style_set(m_input_cancel, "invisible_button"); - evas_object_smart_callback_add(m_input_cancel, "clicked", _input_cancel_clicked, this); - - evas_object_show(m_input_cancel); - elm_object_part_content_set(m_input_area, "input_cancel_click", m_input_cancel); - - m_buttons_box = elm_box_add(m_layout); - elm_box_horizontal_set(m_buttons_box, EINA_TRUE); - evas_object_size_hint_weight_set(m_buttons_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(m_buttons_box, EVAS_HINT_FILL, EVAS_HINT_FILL); - - m_button_left = elm_button_add(m_buttons_box); - elm_object_style_set(m_button_left, "input-popup-button"); - evas_object_size_hint_weight_set(m_button_left, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(m_button_left, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_text_set(m_button_left, "elm.text", m_cancel_button_text.c_str()); - elm_box_pack_end(m_buttons_box, m_button_left); - evas_object_smart_callback_add(m_button_left, "clicked", _left_button_clicked, (void*)this); - - evas_object_show(m_button_left); - - m_button_right = elm_button_add(m_buttons_box); - elm_object_style_set(m_button_right, "input-popup-button"); - evas_object_size_hint_weight_set(m_button_right, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(m_button_right, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_text_set(m_button_right, "elm.text", m_ok_button_text.c_str()); - elm_box_pack_end(m_buttons_box, m_button_right); - evas_object_smart_callback_add(m_button_right, "clicked", _right_button_clicked, (void*)this); - - evas_object_show(m_button_right); - elm_object_signal_emit(m_button_right, "visible", "ui"); - - evas_object_show(m_buttons_box); - elm_object_part_content_set(m_layout, "buttons_swallow", m_buttons_box); - - evas_object_show(m_layout); - elm_object_part_content_set(m_parent, "popup_content", m_layout); - - if (std::find(m_bad_words.begin(), m_bad_words.end(), m_input) != m_bad_words.end()) { - elm_object_disabled_set(m_accept_right_left ? m_button_right : m_button_left, EINA_TRUE); - elm_object_signal_emit(m_accept_right_left ? m_button_right : m_button_left, "dissabled", "ui"); + void InputPopup::onBackPressed() + { + dismiss(); } - elm_object_signal_emit(m_input_area, "close_icon_show", "ui"); -} + void InputPopup::createLayout() + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + + m_layout = elm_layout_add(m_parent); + elm_layout_file_set(m_layout, m_edjFilePath.c_str(), + "input-popup-layout"); + evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_layout, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_object_part_text_set(m_layout, "title_text", m_title.c_str()); + + m_input_area = elm_layout_add(m_layout); + elm_object_part_content_set(m_layout, "input_swallow", m_input_area); + + evas_object_size_hint_weight_set(m_input_area, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_input_area, EVAS_HINT_FILL, + EVAS_HINT_FILL); + evas_object_show(m_input_area); + + elm_layout_file_set(m_input_area, m_edjFilePath.c_str(), + "input-area-layout"); + elm_object_part_text_set(m_input_area, "input_message_text", + m_message.c_str()); + + m_entry = elm_entry_add(m_input_area); + elm_object_style_set(m_entry, "popup-input-entry"); + + elm_entry_single_line_set(m_entry, EINA_TRUE); + elm_entry_scrollable_set(m_entry, EINA_TRUE); + elm_entry_input_panel_layout_set(m_entry, ELM_INPUT_PANEL_LAYOUT_URL); + elm_object_part_content_set(m_input_area, "input_text_swallow", + m_entry); + elm_object_part_text_set(m_entry, "elm.text", + elm_entry_utf8_to_markup(m_input.c_str())); + + evas_object_smart_callback_add(m_entry, "focused", _entry_focused, + (void *) this); + evas_object_smart_callback_add(m_entry, "unfocused", _entry_unfocused, + (void *) this); + evas_object_smart_callback_add(m_entry, "changed,user", _entry_changed, + (void *) this); + + m_input_cancel = elm_button_add(m_input_area); + elm_object_style_set(m_input_cancel, "invisible_button"); + evas_object_smart_callback_add(m_input_cancel, "clicked", + _input_cancel_clicked, this); + + evas_object_show(m_input_cancel); + elm_object_part_content_set(m_input_area, "input_cancel_click", + m_input_cancel); + + m_buttons_box = elm_box_add(m_layout); + elm_box_horizontal_set(m_buttons_box, EINA_TRUE); + evas_object_size_hint_weight_set(m_buttons_box, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_buttons_box, EVAS_HINT_FILL, + EVAS_HINT_FILL); + + m_button_left = elm_button_add(m_buttons_box); + elm_object_style_set(m_button_left, "input-popup-button"); + evas_object_size_hint_weight_set(m_button_left, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_button_left, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_object_part_text_set(m_button_left, "elm.text", + m_cancel_button_text.c_str()); + elm_box_pack_end(m_buttons_box, m_button_left); + evas_object_smart_callback_add(m_button_left, "clicked", + _left_button_clicked, (void *) this); + + evas_object_show(m_button_left); + + m_button_right = elm_button_add(m_buttons_box); + elm_object_style_set(m_button_right, "input-popup-button"); + evas_object_size_hint_weight_set(m_button_right, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(m_button_right, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_object_part_text_set(m_button_right, "elm.text", + m_ok_button_text.c_str()); + elm_box_pack_end(m_buttons_box, m_button_right); + evas_object_smart_callback_add(m_button_right, "clicked", + _right_button_clicked, (void *) this); + + evas_object_show(m_button_right); + elm_object_signal_emit(m_button_right, "visible", "ui"); + + evas_object_show(m_buttons_box); + elm_object_part_content_set(m_layout, "buttons_swallow", m_buttons_box); + + evas_object_show(m_layout); + elm_object_part_content_set(m_parent, "popup_content", m_layout); + + if (std::find(m_bad_words.begin(), m_bad_words.end(), m_input) != + m_bad_words.end()) { + elm_object_disabled_set(m_accept_right_left ? m_button_right : + m_button_left, EINA_TRUE); + elm_object_signal_emit(m_accept_right_left ? m_button_right : + m_button_left, "dissabled", "ui"); + } + + elm_object_signal_emit(m_input_area, "close_icon_show", "ui"); + } -void InputPopup::_entry_focused(void* data, Evas_Object *, void *) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if (data != nullptr) { - InputPopup* inputPopup = static_cast<InputPopup*>(data); - elm_object_focus_allow_set(inputPopup->m_input_cancel, EINA_TRUE); - elm_object_signal_emit(inputPopup->m_entry, "focused", "ui"); + void InputPopup::_entry_focused(void *data, Evas_Object *, void *) + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (data != nullptr) { + InputPopup *inputPopup = static_cast < InputPopup * >(data); + elm_object_focus_allow_set(inputPopup->m_input_cancel, EINA_TRUE); + elm_object_signal_emit(inputPopup->m_entry, "focused", "ui"); + } } -} -void InputPopup::_entry_unfocused(void* data, Evas_Object *, void *) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if (data != nullptr) { - InputPopup* inputPopup = static_cast<InputPopup*>(data); - elm_object_focus_allow_set(inputPopup->m_input_cancel, EINA_FALSE); - elm_object_signal_emit(inputPopup->m_entry, "unfocused", "ui"); + void InputPopup::_entry_unfocused(void *data, Evas_Object *, void *) + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (data != nullptr) { + InputPopup *inputPopup = static_cast < InputPopup * >(data); + elm_object_focus_allow_set(inputPopup->m_input_cancel, EINA_FALSE); + elm_object_signal_emit(inputPopup->m_entry, "unfocused", "ui"); + } } -} -void InputPopup::_entry_changed(void* data, Evas_Object *, void *) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if (data != nullptr) { - InputPopup* inputPopup = static_cast<InputPopup*>(data); - std::string text = elm_entry_markup_to_utf8(elm_object_part_text_get(inputPopup->m_entry, "elm.text")); - - if (text.empty()) - elm_object_signal_emit(inputPopup->m_input_area, "close_icon_hide", "ui"); - else - elm_object_signal_emit(inputPopup->m_input_area, "close_icon_show", "ui"); - - if (std::find(inputPopup->m_bad_words.begin(), inputPopup->m_bad_words.end(), text) - != inputPopup->m_bad_words.end()) { - elm_object_disabled_set(inputPopup->m_accept_right_left ? inputPopup->m_button_right : - inputPopup->m_button_left, EINA_TRUE); - elm_object_signal_emit(inputPopup->m_accept_right_left ? inputPopup->m_button_right : - inputPopup->m_button_left, "dissabled", "ui"); - } else { - elm_object_disabled_set(inputPopup->m_accept_right_left ? inputPopup->m_button_right : - inputPopup->m_button_left, EINA_FALSE); - elm_object_signal_emit(inputPopup->m_accept_right_left ? inputPopup->m_button_right : - inputPopup->m_button_left, "enabled", "ui"); - } + void InputPopup::_entry_changed(void *data, Evas_Object *, void *) + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (data != nullptr) { + InputPopup *inputPopup = static_cast < InputPopup * >(data); + std::string text = + elm_entry_markup_to_utf8(elm_object_part_text_get + (inputPopup->m_entry, "elm.text")); + + if (text.empty()) + elm_object_signal_emit(inputPopup->m_input_area, "close_icon_hide", + "ui"); + else + elm_object_signal_emit(inputPopup->m_input_area, "close_icon_show", + "ui"); + + if (std:: + find(inputPopup->m_bad_words.begin(), + inputPopup->m_bad_words.end(), text) + != inputPopup->m_bad_words.end()) { + elm_object_disabled_set(inputPopup-> + m_accept_right_left ? inputPopup-> + m_button_right : inputPopup->m_button_left, + EINA_TRUE); + elm_object_signal_emit(inputPopup-> + m_accept_right_left ? inputPopup-> + m_button_right : inputPopup->m_button_left, + "dissabled", "ui"); + } else { + elm_object_disabled_set(inputPopup-> + m_accept_right_left ? inputPopup-> + m_button_right : inputPopup->m_button_left, + EINA_FALSE); + elm_object_signal_emit(inputPopup-> + m_accept_right_left ? inputPopup-> + m_button_right : inputPopup->m_button_left, + "enabled", "ui"); + } + } } -} -void InputPopup::_input_cancel_clicked(void * data, Evas_Object *, void *) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - if (data != nullptr) { - InputPopup* inputPopup = static_cast<InputPopup*>(data); - elm_object_part_text_set(inputPopup->m_entry, "elm.text", ""); - elm_object_disabled_set(inputPopup->m_accept_right_left ? inputPopup->m_button_right : - inputPopup->m_button_left, EINA_TRUE); - elm_object_signal_emit(inputPopup->m_accept_right_left ? inputPopup->m_button_right : - inputPopup->m_button_left, "dissabled", "ui"); - elm_object_signal_emit(inputPopup->m_input_area, "close_icon_hide", "ui"); + void InputPopup::_input_cancel_clicked(void *data, Evas_Object *, void *) + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + if (data != nullptr) { + InputPopup *inputPopup = static_cast < InputPopup * >(data); + elm_object_part_text_set(inputPopup->m_entry, "elm.text", ""); + elm_object_disabled_set(inputPopup->m_accept_right_left ? inputPopup-> + m_button_right : inputPopup->m_button_left, + EINA_TRUE); + elm_object_signal_emit(inputPopup->m_accept_right_left ? inputPopup-> + m_button_right : inputPopup->m_button_left, + "dissabled", "ui"); + elm_object_signal_emit(inputPopup->m_input_area, "close_icon_hide", + "ui"); + } } -} -void InputPopup::_right_button_clicked(void *data, Evas_Object *, void*) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - InputPopup *inputPopup = static_cast<InputPopup*>(data); - if (inputPopup->m_accept_right_left) - inputPopup->button_clicked(elm_entry_markup_to_utf8(elm_object_part_text_get(inputPopup->m_entry, "elm.text"))); - inputPopup->dismiss(); -} + void InputPopup::_right_button_clicked(void *data, Evas_Object *, void *) + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + InputPopup *inputPopup = static_cast < InputPopup * >(data); + if (inputPopup->m_accept_right_left) + inputPopup-> + button_clicked(elm_entry_markup_to_utf8 + (elm_object_part_text_get + (inputPopup->m_entry, "elm.text"))); + inputPopup->dismiss(); + } -void InputPopup::_left_button_clicked(void* data, Evas_Object *, void*) -{ - BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); - InputPopup *inputPopup = static_cast<InputPopup*>(data); - if (!inputPopup->m_accept_right_left) - inputPopup->button_clicked(elm_entry_markup_to_utf8(elm_object_part_text_get(inputPopup->m_entry, "elm.text"))); - inputPopup->dismiss(); -} + void InputPopup::_left_button_clicked(void *data, Evas_Object *, void *) + { + BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__); + InputPopup *inputPopup = static_cast < InputPopup * >(data); + if (!inputPopup->m_accept_right_left) + inputPopup-> + button_clicked(elm_entry_markup_to_utf8 + (elm_object_part_text_get + (inputPopup->m_entry, "elm.text"))); + inputPopup->dismiss(); + } -} + } } diff --git a/services/SimpleUI/InputPopup.h b/services/SimpleUI/InputPopup.h index 18eaab65..5b745504 100644..100755 --- a/services/SimpleUI/InputPopup.h +++ b/services/SimpleUI/InputPopup.h @@ -32,65 +32,74 @@ #include "AbstractPopup.h" #include "ServiceManager.h" -namespace tizen_browser { -namespace base_ui { - -class InputPopup : public interfaces::AbstractPopup +namespace tizen_browser { + namespace base_ui + { -public: - static InputPopup* createPopup(Evas_Object *parent); - static InputPopup* createPopup(Evas_Object *parent,const std::string& title,const std::string& message,const std::string& input, - const std::string& rightButtonText, const std::string& leftButtonText, bool accept_right_left); + class InputPopup:public interfaces::AbstractPopup + { + public: + static InputPopup *createPopup(Evas_Object * parent); + static InputPopup *createPopup(Evas_Object * parent, + const std::string & title, + const std::string & message, + const std::string & input, + const std::string & rightButtonText, + const std::string & leftButtonText, + bool accept_right_left); - void show(); - void dismiss(); - void onBackPressed(); + void show(); + void dismiss(); + void onBackPressed(); #if PROFILE_MOBILE - void orientationChanged() {}; + void orientationChanged() + { + }; #endif - void setContent(Evas_Object *content); - void setInput(const std::string &input); - void setTitle(const std::string &title); - void setMessage(const std::string &message); - void setOkButtonText(const std::string &okButtonText); - void setCancelButtonText(const std::string &cancelButtonText); - void setAcceptRightLeft(bool right_left); - void addBadWord(const std::string &word); + void setContent(Evas_Object * content); + void setInput(const std::string & input); + void setTitle(const std::string & title); + void setMessage(const std::string & message); + void setOkButtonText(const std::string & okButtonText); + void setCancelButtonText(const std::string & cancelButtonText); + void setAcceptRightLeft(bool right_left); + void addBadWord(const std::string & word); - boost::signals2::signal<void (const std::string&)> button_clicked; + boost::signals2::signal < void(const std::string &) > button_clicked; -private: - InputPopup(); - ~InputPopup(); - void createLayout(); + private: + InputPopup(); + ~InputPopup(); + void createLayout(); - std::string m_edjFilePath; - static void _right_button_clicked(void *data, Evas_Object *btn, void*); - static void _left_button_clicked(void *data, Evas_Object *btn, void*); - static void _entry_changed(void * data, Evas_Object *, void*); - static void _entry_unfocused(void * data, Evas_Object *, void*); - static void _entry_focused(void * data, Evas_Object *, void*); - static void _input_cancel_clicked(void * data, Evas_Object *, void *); + std::string m_edjFilePath; + static void _right_button_clicked(void *data, Evas_Object * btn, + void *); + static void _left_button_clicked(void *data, Evas_Object * btn, void *); + static void _entry_changed(void *data, Evas_Object *, void *); + static void _entry_unfocused(void *data, Evas_Object *, void *); + static void _entry_focused(void *data, Evas_Object *, void *); + static void _input_cancel_clicked(void *data, Evas_Object *, void *); - Evas_Object *m_parent; - Evas_Object *m_layout; - Evas_Object *m_buttons_box; - Evas_Object *m_button_left; - Evas_Object *m_button_right; - Evas_Object *m_input_area; - Evas_Object *m_input_cancel; - Evas_Object *m_entry; - std::string m_input; - std::string m_title; - std::string m_message; - std::string m_ok_button_text; - std::string m_cancel_button_text; - std::vector<std::string> m_bad_words; - bool m_accept_right_left; -}; + Evas_Object *m_parent; + Evas_Object *m_layout; + Evas_Object *m_buttons_box; + Evas_Object *m_button_left; + Evas_Object *m_button_right; + Evas_Object *m_input_area; + Evas_Object *m_input_cancel; + Evas_Object *m_entry; + std::string m_input; + std::string m_title; + std::string m_message; + std::string m_ok_button_text; + std::string m_cancel_button_text; + std::vector < std::string > m_bad_words; + bool m_accept_right_left; + }; + } } -} -#endif //__INPUT_POPUP_H__ +#endif //__INPUT_POPUP_H__ diff --git a/services/SimpleUI/NotificationPopup.h b/services/SimpleUI/NotificationPopup.h index 570019b7..570019b7 100644..100755 --- a/services/SimpleUI/NotificationPopup.h +++ b/services/SimpleUI/NotificationPopup.h diff --git a/services/SimpleUI/SimplePopup.h b/services/SimpleUI/SimplePopup.h index d19cd0f4..54518a25 100644..100755 --- a/services/SimpleUI/SimplePopup.h +++ b/services/SimpleUI/SimplePopup.h @@ -30,61 +30,74 @@ namespace tizen_browser { -namespace base_ui -{ - -struct PopupData { - virtual ~PopupData() {}; -}; - -struct CertificatePopupData : public PopupData { - basic_webengine::CertificateConfirmationPtr cert; -}; - -struct EntryPopupData : public PopupData { - std::string text; - Evas_Object * entry; -}; - -class SimplePopup : public interfaces::AbstractPopup -{ -public: - static SimplePopup* createPopup(Evas_Object* parent); - static SimplePopup* createPopup(Evas_Object* parent, const std::string &title, const std::string &message); - - void show(); - void dismiss(); - void onBackPressed(); + namespace base_ui + { + + struct PopupData + { + virtual ~PopupData() + { + }; + }; + + struct CertificatePopupData:public PopupData + { + basic_webengine::CertificateConfirmationPtr cert; + }; + + struct EntryPopupData:public PopupData + { + std::string text; + Evas_Object *entry; + }; + + class SimplePopup:public interfaces::AbstractPopup + { + public: + static SimplePopup *createPopup(Evas_Object * parent); + static SimplePopup *createPopup(Evas_Object * parent, + const std::string & title, + const std::string & message); + + void show(); + void dismiss(); + void onBackPressed(); #if PROFILE_MOBILE - void orientationChanged() {}; + void orientationChanged() + { + }; #endif - void setTitle(const std::string &title); - void setMessage(const std::string &message); - void setContent(Evas_Object *content); - void setData(std::shared_ptr<PopupData> popupData); - void addButton(PopupButtons buttonId); - - boost::signals2::signal<void (PopupButtons, std::shared_ptr<PopupData>)> buttonClicked; - - ~SimplePopup(); - -private: - SimplePopup(Evas_Object* parent); - SimplePopup(Evas_Object* parent, const std::string &title, const std::string &message); - - Evas_Object *m_parent; - Evas_Object *popup; - Evas_Object *content; - std::string title; - std::string message; - std::list<PopupButtons> buttons; - static void _response_cb(void *data, Evas_Object *obj, void *event_info); - std::map<Evas_Object *, PopupButtons> addedButtons; - std::shared_ptr<PopupData> popupData; -}; - -} + void setTitle(const std::string & title); + void setMessage(const std::string & message); + void setContent(Evas_Object * content); + void setData(std::shared_ptr < PopupData > popupData); + void addButton(PopupButtons buttonId); + + boost::signals2::signal < void(PopupButtons, + std::shared_ptr < PopupData >) > + buttonClicked; + + ~SimplePopup(); + + private: + SimplePopup(Evas_Object * parent); + SimplePopup(Evas_Object * parent, const std::string & title, + const std::string & message); + + Evas_Object *m_parent; + Evas_Object *popup; + Evas_Object *content; + std::string title; + std::string message; + std::list < PopupButtons > buttons; + static void _response_cb(void *data, Evas_Object * obj, + void *event_info); + std::map < Evas_Object *, PopupButtons > addedButtons; + std::shared_ptr < PopupData > popupData; + }; + + } } diff --git a/services/SimpleUI/TextPopup_mob.h b/services/SimpleUI/TextPopup_mob.h index ed43c960..0eaffc78 100644..100755 --- a/services/SimpleUI/TextPopup_mob.h +++ b/services/SimpleUI/TextPopup_mob.h @@ -30,58 +30,67 @@ namespace tizen_browser { -namespace base_ui -{ + namespace base_ui + { -class TextPopup : public interfaces::AbstractPopup -{ -public: - static TextPopup* createPopup(Evas_Object* parent); - static TextPopup* createPopup(Evas_Object* parent, const std::string& title, const std::string& message); + class TextPopup:public interfaces::AbstractPopup + { + public: + static TextPopup *createPopup(Evas_Object * parent); + static TextPopup *createPopup(Evas_Object * parent, + const std::string & title, + const std::string & message); - void show(); - void dismiss(); - void onBackPressed(); + void show(); + void dismiss(); + void onBackPressed(); #if PROFILE_MOBILE - void orientationChanged() {}; + void orientationChanged() + { + }; #endif - void setTitle(const std::string& title); - void setMessage(const std::string& message); - void setContent(Evas_Object* content); - void addButton(const PopupButtons& button, bool dismissOnClick = true, bool defaultBackButton = false); - void createLayout(); - boost::signals2::signal<void (PopupButtons)> buttonClicked; + void setTitle(const std::string & title); + void setMessage(const std::string & message); + void setContent(Evas_Object * content); + void addButton(const PopupButtons & button, bool dismissOnClick = + true, bool defaultBackButton = false); + void createLayout(); + boost::signals2::signal < void(PopupButtons) > buttonClicked; - ~TextPopup(); + ~TextPopup(); -private: - TextPopup(Evas_Object* parent); - TextPopup(Evas_Object* parent, const std::string& title, const std::string& message); + private: + TextPopup(Evas_Object * parent); + TextPopup(Evas_Object * parent, const std::string & title, + const std::string & message); - struct Button { - Button(PopupButtons type, bool dismissOnClick) - : m_type(type) - , m_dismissOnClick(dismissOnClick) - , m_evasObject(nullptr) - {}; - PopupButtons m_type; - bool m_dismissOnClick; - Evas_Object* m_evasObject; - }; + struct Button + { + Button(PopupButtons type, bool dismissOnClick) + :m_type(type) + , m_dismissOnClick(dismissOnClick) + , m_evasObject(nullptr) + { + }; + PopupButtons m_type; + bool m_dismissOnClick; + Evas_Object *m_evasObject; + }; - Evas_Object* m_parent; - Evas_Object* m_layout; - Evas_Object* m_buttons_box; - std::vector<Button> m_buttons; - std::string m_title; - std::string m_message; - static void _response_cb(void* data, Evas_Object* obj, void* event_info); - std::string m_edjFilePath; - PopupButtons m_defaultBackButton = NONE; -}; + Evas_Object *m_parent; + Evas_Object *m_layout; + Evas_Object *m_buttons_box; + std::vector < Button > m_buttons; + std::string m_title; + std::string m_message; + static void _response_cb(void *data, Evas_Object * obj, + void *event_info); + std::string m_edjFilePath; + PopupButtons m_defaultBackButton = NONE; + }; -} + } } diff --git a/services/SimpleUI/ViewManager.h b/services/SimpleUI/ViewManager.h index 51082d9b..accfeb1b 100644..100755 --- a/services/SimpleUI/ViewManager.h +++ b/services/SimpleUI/ViewManager.h @@ -31,34 +31,36 @@ #include "core/AbstractInterfaces/AbstractUIComponent.h" -namespace tizen_browser{ -namespace base_ui{ +namespace tizen_browser +{ + namespace base_ui + { /** * @brief This class simplifies UI component management. It is a views stack. * It handles all widget framework issues related to changing active view. */ -class ViewManager -{ -public: + class ViewManager + { + public: /** * @brief constructor. */ - ViewManager(); + ViewManager(); /** * @brief initialization method * * @param A window which will contatin ViewManager's main layout. */ - void init(Evas_Object* parentWindow); + void init(Evas_Object * parentWindow); /** * @brief destructor * */ - ~ViewManager(); + ~ViewManager(); /** * @brief Pops stack to specified view. Hides actual view (if there is any) and @@ -67,13 +69,13 @@ public: * * @param A view which stack should be popped to. Do not use nullptr. */ - void popStackTo(interfaces::AbstractUIComponent* view); + void popStackTo(interfaces::AbstractUIComponent * view); /** * @brief Pops actual view from the stack, hides it and if there is any view * under it makes it visible. */ - void popTheStack(); + void popTheStack(); /** * @brief Pushes view to the stack, hides if any wiew was visible hides it and @@ -81,7 +83,7 @@ public: * * @param View pushed to stack. Do not use nullptr. */ - void pushViewToStack(interfaces::AbstractUIComponent* view); + void pushViewToStack(interfaces::AbstractUIComponent * view); /** * @brief Function returns elm layout used in view management. It's parent is @@ -89,14 +91,14 @@ public: * * @return ViewManager's main layout. */ - Evas_Object* getContent(); + Evas_Object *getContent(); /** * @brief Function returns conformant used in view management. * * @return ViewManager's conformant. */ - Evas_Object* getConformant(); + Evas_Object *getConformant(); /** * @brief Returns actual top of stack which is dispalyed. It stack is empty @@ -104,24 +106,24 @@ public: * * @return actual dispalyed view */ - interfaces::AbstractUIComponent* topOfStack(); + interfaces::AbstractUIComponent * topOfStack(); /** * @brief Signal checks if browser is in landscape mode. * * @return Returnes true when app is in landscape mode. */ - boost::signals2::signal<bool ()> isLandscape; - -private: - void updateLayout(interfaces::AbstractUIComponent* previousView); -private: - Evas_Object* m_mainLayout; - Evas_Object* m_conformant; - Evas_Object* m_parentWindow; - std::stack<interfaces::AbstractUIComponent*> m_viewStack; -}; - -}//namespace base_ui -}//namespace tizen_browser -#endif //VIEWMANAGER_H_ + boost::signals2::signal < bool() > isLandscape; + + private: + void updateLayout(interfaces::AbstractUIComponent * previousView); + private: + Evas_Object * m_mainLayout; + Evas_Object *m_conformant; + Evas_Object *m_parentWindow; + std::stack < interfaces::AbstractUIComponent * >m_viewStack; + }; + + } //namespace base_ui +} //namespace tizen_browser +#endif //VIEWMANAGER_H_ |