collections {
- base_scale: 1.8;
+ base_scale: 2.6;
externals {
external: "elm";
MSG_BUBBLE_BUTTON_STYLE_TRANSLATE("translate_button", "M01_circle_button.png", "M01_circle_button_press.png", "M01_circle_button_dim.png", "M01_btn_translate.png")
+#define BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC 80 80
+#define BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC 80 80
+#define BUTTON_NAVIFRAME_BACK_CORNER_RADIUS "10"
+#define GLIDE_EASE_OUT(duration) CUBIC_BEZIER (duration) 0.25 0.46 0.45 1.0
+#define BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_WHITE 250 250 250 255
+#define BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_BLUE 61 185 204 255
+ group {
+ name: "elm/button/base/naviframe/arrow_back";
+ data.item: "vector_ux" "no_bg";
+ data.item: "corner_radius" BUTTON_NAVIFRAME_BACK_CORNER_RADIUS;
+ images {
+ image: "core_icon_back.png" COMP;
+ }
+ script {
+ public mouse_down = 0;
+ public multi_down = 0;
+ public animate = 0;
+ public disabled = 0;
+ }
+ parts {
+ part {
+ name: "button_bg";
+ type: SPACER;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+ max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "effect_spacer";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1.relative: 0.5 0.5;
+ rel2.relative: 0.5 0.5;
+ min: BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC;
+ max: BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC;
+ }
+ }
+ part {
+ name: "tizen_vg_shape";
+ type: SWALLOW;
+ clip_to: "tizen_vg_shape_clipper";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1.relative: 0.5 0.5;
+ rel2.relative: 0.5 0.5;
+ }
+ description {
+ state: "ready" 0.0;
+ rel1.to: "effect_spacer";
+ rel2.to: "effect_spacer";
+ rel1.relative: 0.15 0.15;
+ rel2.relative: 0.85 0.85;
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "ready" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ }
+ }
+ part {
+ name: "tizen_vg_shape_clipper";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ visible: 0;
+ fixed: 1 1;
+ rel1.to: "tizen_vg_shape";
+ rel2.to: "tizen_vg_shape";
+ }
+ description {
+ state: "ready" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ color: 0 0 0 77;
+ visible: 1;
+ }
+ }
+ part {
+ name: "button_icon";
+ type: IMAGE;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+ max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+ fixed: 1 1;
+ color: BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_WHITE;
+ image.normal: "core_icon_back.png";
+ }
+ description {
+ state: "blue" 0.0;
+ inherit: "default" 0.0;
+ color: BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_BLUE;
+ }
+ }
+ part {
+ name: "event";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "button_bg";
+ rel2.to: "button_bg";
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "pressed_effect";
+ action: STATE_SET "ready" 0.0;
+ target: "tizen_vg_shape_clipper";
+ target: "tizen_vg_shape";
+ after: "pressed_effect2";
+ }
+ program {
+ name: "pressed_effect2";
+ action: STATE_SET "pressed" 0.0;
+ target: "tizen_vg_shape_clipper";
+ target: "tizen_vg_shape";
+ transition: GLIDE_EASE_OUT(0.15);
+ after: "pressed_effect3";
+ }
+ program {
+ name: "pressed_effect3";
+ script {
+ set_int(animate, 0);
+ }
+ }
+ program {
+ name: "delay_unpressed_effect";
+ in: 0.1 0.0;
+ after: "unpressed_effect";
+ }
+ program {
+ name: "unpressed_effect";
+ script {
+ run_program(PROGRAM:"unpressed_effect2");
+ }
+ }
+ program {
+ name: "unpressed_effect2";
+ action: STATE_SET "ready" 0.0;
+ target: "tizen_vg_shape_clipper";
+ transition: GLIDE_EASE_OUT(0.45);
+ after: "unpressed_effect3";
+ }
+ program {
+ name: "unpressed_effect3";
+ action: STATE_SET "default" 0.0;
+ target: "tizen_vg_shape";
+ target: "tizen_vg_shape_clipper";
+ }
+ program {
+ name: "pressed";
+ signal: "mouse,down,1*";
+ source: "event";
+ script {
+ if (get_int(multi_down) == 0) {
+ set_int(mouse_down, 1);
+ set_int(animate, 1);
+ emit("elm,action,press", "");
+ run_program(PROGRAM:"pressed_effect");
+ }
+ }
+ }
+ program {
+ name: "unpressed";
+ signal: "mouse,up,1";
+ source: "event";
+ script {
+ if (get_int(mouse_down) == 1) {
+ set_int(mouse_down, 0);
+ if (get_int(disabled) == 0) {
+ if (get_int(animate) == 0) {
+ run_program(PROGRAM:"unpressed_effect");
+ }
+ else {
+ set_state(PART:"tizen_vg_shape", "pressed", 0.0);
+ set_state(PART:"tizen_vg_shape_clipper", "pressed", 0.0);
+ set_int(animate, 0);
+ run_program(PROGRAM:"delay_unpressed_effect");
+ }
+ emit("elm,action,unpress", "");
+ }
+ }
+ }
+ }
+ program {
+ name: "button_click";
+ signal: "mouse,clicked,1";
+ source: "event";
+ script {
+ if (get_int(multi_down) == 0) {
+ run_program(PROGRAM:"clicked_signal");
+ }
+ }
+ }
+ program {
+ name: "play_sound";
+ action: RUN_PLUGIN "touch_sound";
+ }
+ program {
+ name: "clicked_signal";
+ in: 0.001 0.0;
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script {
+ set_int(disabled, 0);
+ }
+ }
+ program {
+ name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script {
+ set_int(disabled, 1);
+ }
+ }
+ program {
+ name: "multi_down";
+ signal: "elm,action,multi,down";
+ source: "elm";
+ script {
+ set_int(multi_down, 1);
+ }
+ }
+ program {
+ name: "multi_up";
+ signal: "elm,action,multi,up";
+ source: "elm";
+ script {
+ set_int(multi_down, 0);
+ }
+ }
+ program {
+ name: "pass_event_enable";
+ signal: "elm,event,pass,enabled";
+ source: "elm";
+ script {
+ set_mouse_events(PART:"event", 0);
+ }
+ }
+ program {
+ name: "pass_event_disable";
+ signal: "elm,event,pass,disabled";
+ source:"elm";
+ script {
+ set_mouse_events(PART:"event", 1);
+ }
+ }
+ program {
+ name: "repeat_event_enable";
+ signal: "elm,event,repeat,enabled";
+ source: "elm";
+ script {
+ set_repeat_events(PART:"event", 1);
+ }
+ }
+ program {
+ name: "repeat_event_disable";
+ signal: "elm,event,repeat,disabled";
+ source:"elm";
+ script {
+ set_repeat_events(PART:"event", 0);
+ }
+ }
+ program {
+ name: "make_blue";
+ signal: "button,color,blue";
+ source: "*";
+ action: STATE_SET "blue" 0.0;
+ target: "button_icon";
+ }
+ program {
+ name: "make_white";
+ signal: "button,color,white";
+ source: "*";
+ action: STATE_SET "default" 0.0;
+ target: "button_icon";
+ }
+ }
+ }
+
+ group {
+ name: "elm/button/base/naviframe/arrow_down";
+ data.item: "vector_ux" "no_bg";
+ data.item: "corner_radius" BUTTON_NAVIFRAME_BACK_CORNER_RADIUS;
+ images {
+ image: "core_icon_expand_close.png" COMP;
+ image: "core_icon_expand_open.png" COMP;
+ }
+ script {
+ public mouse_down = 0;
+ public multi_down = 0;
+ public animate = 0;
+ public disabled = 0;
+ }
+ parts {
+ part {
+ name: "button_bg";
+ type: SPACER;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+ max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+ fixed: 1 1;
+ }
+ }
+ part {
+ name: "effect_spacer";
+ type: SPACER;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1.relative: 0.5 0.5;
+ rel2.relative: 0.5 0.5;
+ min: BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC;
+ max: BUTTON_NAVIFRAME_BACK_BUTTON_EFFECT_MAX_SIZE_INC;
+ }
+ }
+ part {
+ name: "tizen_vg_shape";
+ type: SWALLOW;
+ clip_to: "tizen_vg_shape_clipper";
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ fixed: 1 1;
+ rel1.relative: 0.5 0.5;
+ rel2.relative: 0.5 0.5;
+ }
+ description {
+ state: "ready" 0.0;
+ rel1.to: "effect_spacer";
+ rel2.to: "effect_spacer";
+ rel1.relative: 0.15 0.15;
+ rel2.relative: 0.85 0.85;
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "ready" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ }
+ }
+ part {
+ name: "tizen_vg_shape_clipper";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ color: 0 0 0 0;
+ visible: 0;
+ fixed: 1 1;
+ rel1.to: "tizen_vg_shape";
+ rel2.to: "tizen_vg_shape";
+ }
+ description {
+ state: "ready" 0.0;
+ inherit: "default" 0.0;
+ visible: 1;
+ }
+ description {
+ state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ color: 0 0 0 77;
+ visible: 1;
+ }
+ }
+ part {
+ name: "button_icon";
+ type: IMAGE;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ min: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+ max: BUTTON_NAVIFRAME_BACK_BUTTON_SIZE_INC;
+ fixed: 1 1;
+ image.normal: "core_icon_expand_close.png";
+ }
+ description {
+ state: "expanded" 0.0;
+ inherit: "default" 0.0;
+ image.normal: "core_icon_expand_open.png";
+ }
+ }
+ part {
+ name: "color_rect";
+ type: RECT;
+ scale: 1;
+ clip_to: "button_icon";
+ description {
+ state: "default" 0.0;
+ rel1.to: "button_icon";
+ rel2.to: "button_icon";
+ color: BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_WHITE;
+ }
+ description {
+ state: "blue" 0.0;
+ inherit: "default" 0.0;
+ color: BUTTON_NAVIFRAME_BACK_BUTTON_COLOR_BLUE;
+ }
+ }
+ part {
+ name: "event";
+ type: RECT;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1.to: "button_bg";
+ rel2.to: "button_bg";
+ color: 0 0 0 0;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "pressed_effect";
+ action: STATE_SET "ready" 0.0;
+ target: "tizen_vg_shape_clipper";
+ target: "tizen_vg_shape";
+ after: "pressed_effect2";
+ }
+ program {
+ name: "pressed_effect2";
+ action: STATE_SET "pressed" 0.0;
+ target: "tizen_vg_shape_clipper";
+ target: "tizen_vg_shape";
+ transition: GLIDE_EASE_OUT(0.15);
+ after: "pressed_effect3";
+ }
+ program {
+ name: "pressed_effect3";
+ script {
+ set_int(animate, 0);
+ }
+ }
+ program {
+ name: "delay_unpressed_effect";
+ in: 0.1 0.0;
+ after: "unpressed_effect";
+ }
+ program {
+ name: "unpressed_effect";
+ script {
+ run_program(PROGRAM:"unpressed_effect2");
+ }
+ }
+ program {
+ name: "unpressed_effect2";
+ action: STATE_SET "ready" 0.0;
+ target: "tizen_vg_shape_clipper";
+ transition: GLIDE_EASE_OUT(0.45);
+ after: "unpressed_effect3";
+ }
+ program {
+ name: "unpressed_effect3";
+ action: STATE_SET "default" 0.0;
+ target: "tizen_vg_shape";
+ target: "tizen_vg_shape_clipper";
+ }
+ program {
+ name: "pressed";
+ signal: "mouse,down,1*";
+ source: "event";
+ script {
+ if (get_int(multi_down) == 0) {
+ set_int(mouse_down, 1);
+ set_int(animate, 1);
+ emit("elm,action,press", "");
+ run_program(PROGRAM:"pressed_effect");
+ }
+ }
+ }
+ program {
+ name: "unpressed";
+ signal: "mouse,up,1";
+ source: "event";
+ script {
+ if (get_int(mouse_down) == 1) {
+ set_int(mouse_down, 0);
+ if (get_int(disabled) == 0) {
+ if (get_int(animate) == 0) {
+ run_program(PROGRAM:"unpressed_effect");
+ }
+ else {
+ set_state(PART:"tizen_vg_shape", "pressed", 0.0);
+ set_state(PART:"tizen_vg_shape_clipper", "pressed", 0.0);
+ set_int(animate, 0);
+ run_program(PROGRAM:"delay_unpressed_effect");
+ }
+ emit("elm,action,unpress", "");
+ }
+ }
+ }
+ }
+ program {
+ name: "button_click";
+ signal: "mouse,clicked,1";
+ source: "event";
+ script {
+ if (get_int(multi_down) == 0) {
+ run_program(PROGRAM:"clicked_signal");
+ }
+ }
+ }
+ program {
+ name: "play_sound";
+ action: RUN_PLUGIN "touch_sound";
+ }
+ program {
+ name: "clicked_signal";
+ in: 0.001 0.0;
+ action: SIGNAL_EMIT "elm,action,click" "";
+ }
+ program {
+ name: "enable";
+ signal: "elm,state,enabled";
+ source: "elm";
+ script {
+ set_int(disabled, 0);
+ }
+ }
+ program {
+ name: "disable";
+ signal: "elm,state,disabled";
+ source: "elm";
+ script {
+ set_int(disabled, 1);
+ }
+ }
+ program {
+ name: "multi_down";
+ signal: "elm,action,multi,down";
+ source: "elm";
+ script {
+ set_int(multi_down, 1);
+ }
+ }
+ program {
+ name: "multi_up";
+ signal: "elm,action,multi,up";
+ source: "elm";
+ script {
+ set_int(multi_down, 0);
+ }
+ }
+ program {
+ name: "pass_event_enable";
+ signal: "elm,event,pass,enabled";
+ source: "elm";
+ script {
+ set_mouse_events(PART:"event", 0);
+ }
+ }
+ program {
+ name: "pass_event_disable";
+ signal: "elm,event,pass,disabled";
+ source:"elm";
+ script {
+ set_mouse_events(PART:"event", 1);
+ }
+ }
+ program {
+ name: "repeat_event_enable";
+ signal: "elm,event,repeat,enabled";
+ source: "elm";
+ script {
+ set_repeat_events(PART:"event", 1);
+ }
+ }
+ program {
+ name: "repeat_event_disable";
+ signal: "elm,event,repeat,disabled";
+ source:"elm";
+ script {
+ set_repeat_events(PART:"event", 0);
+ }
+ }
+ program {
+ name: "make_blue";
+ signal: "button,color,blue";
+ source: "*";
+ action: STATE_SET "blue" 0.0;
+ target: "color_rect";
+ }
+ program {
+ name: "make_white";
+ signal: "button,color,white";
+ source: "*";
+ action: STATE_SET "default" 0.0;
+ target: "color_rect";
+ }
+ program {
+ name: "make_expand";
+ signal: "button,expand";
+ source: "*";
+ action: STATE_SET "expanded" 0.0;
+ target: "button_icon";
+ }
+ program {
+ name: "make_collapse";
+ signal: "button,collapse";
+ source: "*";
+ action: STATE_SET "default" 0.0;
+ target: "button_icon";
+ }
+ }
+ }
}
ContextPopup &getCtxPopup();
void resetCtxPopup();
+ // NaviFrameItem
+ virtual void onViewItemCreated();
+
private:
Popup *m_pPopup;
ContextPopup *m_pCtxPopup;
}
}
-
+void FrameController::onViewItemCreated()
+{
+ NaviFrameItem::onViewItemCreated();
+}
{
enum class TextAlign
{
+ None,
Left,
Center,
Right
public:
TextStyle();
- TextStyle(int size, const std::string &color, TextAlign align = TextAlign::Left);
+ TextStyle(int size, const std::string &color, TextAlign align = TextAlign::None);
~TextStyle();
void setColor(const std::string &color);
static std::string make(const std::string &text,
int size = TextStyle::defaultFontSize,
const std::string &color = TextStyle::defaultColor,
- TextAlign align = TextAlign::Left);
+ TextAlign align = TextAlign::None);
};
}
TextStyle::TextStyle()
: m_Color(defaultColor)
- , m_Align(TextAlign::Left)
+ , m_Align(TextAlign::None)
, m_Size(defaultFontSize)
{
}
TextAlign align)
{
std::ostringstream ss;
- ss << OPEN_TAG("font_size", size) << OPEN_TAG("color", color) << OPEN_TAG("align", alignAsString(align));
+ ss << OPEN_TAG("font_size", size) << OPEN_TAG("color", color);
+ if (align != TextAlign::None)
+ {
+ ss << OPEN_TAG("align", alignAsString(align));
+ }
ss << text;
- ss << CLOSE_TAG("color") << CLOSE_TAG("font_size") << CLOSE_TAG("align");
+ if (align != TextAlign::None)
+ {
+ ss << CLOSE_TAG("align");
+ }
+ ss << CLOSE_TAG("color") << CLOSE_TAG("font_size");
return ss.str();
}
#define NaviFrameItem_h_
#include "ViewItem.h"
+#include "View.h"
#include <string>
#include <memory>
{
NaviCancelButtonId = 0,
NaviOkButtonId,
+ NaviCenterButtonId,
NaviPrevButtonId,
+ NaviDownButtonId,
NaviButtonMax
};
protected:
virtual void onButtonClicked(NaviFrameItem &item, NaviButtonId buttonId) {};
+ //ViewItem
+ virtual void onViewItemCreated();
+
private:
NaviFrameView &m_Owner;
NaviBar *m_pNaviBar;
};
class NaviFrameItem::NaviBar
+ :public View
{
friend class NaviFrameItem;
public:
+ enum NaviColorId
+ {
+ NaviBlueColorId = 0,
+ NaviWhiteColorId,
+ NaviColorMax
+ };
+
+ public:
NaviFrameItem &getOwner();
const NaviFrameItem &getOwner() const;
- void show(bool value, bool transition = false);
- bool isVisible();
+ void setVisible(bool visible);
void setTitle(const std::string &title);
void setTitle(const TText &title);
std::string getTitle() const;
- void setBadge(const std::string &badge);
- void showBadge(bool value);
- std::string getBadge() const;
void showButton(NaviButtonId id, bool value);
void disabledButton(NaviButtonId id, bool value);
+ void setButtonText(NaviButtonId id, const std::string &text);
+ void setButtonText(NaviButtonId id, const TText &text);
+ void clearBar();
+ void switchToSearch(Evas_Object *searchPanel);
+ void setColor(NaviColorId id);
+ void expandDownButton(bool value);
private:
NaviBar(NaviFrameItem &onwer);
- ~NaviBar();
+ virtual ~NaviBar();
void getButton(NaviButtonId id);
+ void setButtonColor(NaviButtonId id, NaviColorId titleColor);
void showCancelButtonPart(bool value);
void showOkButtonPart(bool value);
- void setContent(Evas_Object * obj, const char *part);
+ void showCenterButtonPart(bool value, bool expand = false);
+ void showPrevButtonPart(bool value);
+ void showDownButtonPart(bool value);
+ void initNaviBar();
static void on_button_clicked(void *data, Evas_Object *obj, void *event_info);
+ static void on_button_delete(void *data, Evas *e, Evas_Object *obj, void *event_info);
private:
struct ButtonStruct
{
- ButtonStruct(Evas_Object *b = nullptr, const char *p = nullptr, const char *s = nullptr)
+ ButtonStruct(Evas_Object *b = nullptr, const char *p = nullptr, const char *s = nullptr, const char *d = "IDS_MSG_OPT_DEFAULT")
: button(b)
, part(p)
, style(s)
+ , default_text_id(d)
{
}
Evas_Object *button;
const char *part;
const char *style;
+ const char *default_text_id;
};
private:
NaviFrameItem &m_Owner;
std::string m_Badge;
ButtonStruct ButtonList[NaviButtonMax];
+ NaviColorId m_CurrentColor;
};
}
inline void View::setText(const std::string &text, const char *part)
{
- setText(part, text.c_str());
+ setText(text.c_str(), part);
}
inline void View::setText(const TText &text, const char *part)
#include "NaviFrameItem.h"
+#include "NaviFrameView.h"
#include "Logger.h"
+#include "TextDecorator.h"
using namespace Msg;
namespace
{
- const char *okButtonPart = "title_right_btn";
- const char *cancelButtonPart = "title_left_btn";
- const char *prevButtonPart = "elm.swallow.prev_btn";
- const char *okButtonStyle = "naviframe/title_done";
- const char *cancelButtonStyle = "naviframe/title_cancel";
- const char *prevButtonStyle = "naviframe/back_btn/default";
+ const char *titleStyleName = "title";
+ const char *naviTitlePart = "title";
+ const char *titleTextPart = "text.center";
+ const char *okButtonPart = "swallow.right";
+ const char *cancelButtonPart = "swallow.left";
+ const char *prevButtonPart = "swallow.left";
+ const char *downButtonPart = "swallow.right";
+ const char *centerButtonPart = "swallow.center";
+ const char *okButtonStyle = "naviframe/title_right";
+ const char *cancelButtonStyle = "naviframe/title_left";
+ const char *prevButtonStyle = "naviframe/arrow_back";
+ const char *downButtonStyle = "naviframe/arrow_down";
+ const char *cancelButtonDefTextId = "IDS_MSG_ACBUTTON_CANCEL_ABB";
+ const char *okButtonDefTextId = "IDS_MSG_ACBUTTON_DONE_ABB";
const char *badgePart = "title_badge";
const char *buttonTypeKey = "BTkey";
+ const char *textColorWhiteTitleButtons = "#3db9cc";
+ const char *textColorBlueTitleButtons = "#fafafa";
+ const int textSizeTitleButtons = 32;
}
NaviFrameItem::NaviFrameItem(NaviFrameView &owner)
NaviFrameItem::~NaviFrameItem()
{
- delete m_pNaviBar;
}
const NaviFrameItem::NaviBar &NaviFrameItem::getNaviBar() const
NaviFrameItem::NaviBar::NaviBar(NaviFrameItem &onwer)
: m_Owner(onwer)
, ButtonList()
+ , m_CurrentColor(NaviBlueColorId)
{
- ButtonList[NaviCancelButtonId] = ButtonStruct(nullptr, cancelButtonPart, cancelButtonStyle);
- ButtonList[NaviOkButtonId] = ButtonStruct(nullptr, okButtonPart, okButtonStyle);
+ ButtonList[NaviCancelButtonId] = ButtonStruct(nullptr, cancelButtonPart, cancelButtonStyle, cancelButtonDefTextId);
+ ButtonList[NaviOkButtonId] = ButtonStruct(nullptr, okButtonPart, okButtonStyle, okButtonDefTextId);
+ //TODO: implement style for center button
+ ButtonList[NaviCenterButtonId] = ButtonStruct(nullptr, centerButtonPart, prevButtonStyle);
ButtonList[NaviPrevButtonId] = ButtonStruct(nullptr, prevButtonPart, prevButtonStyle);
+ ButtonList[NaviDownButtonId] = ButtonStruct(nullptr, downButtonPart, downButtonStyle);
}
NaviFrameItem::NaviBar::~NaviBar()
{
+ for (int iter = NaviCancelButtonId; iter < NaviButtonMax; iter++)
+ {
+ evas_object_del(ButtonList[iter].button);
+ }
}
NaviFrameItem &NaviFrameItem::NaviBar::getOwner()
return m_Owner;
}
-void NaviFrameItem::NaviBar::show(bool value, bool transition)
-{
- elm_naviframe_item_title_enabled_set(m_Owner.getElmObjItem(), value, transition);
-}
-
-bool NaviFrameItem::NaviBar::isVisible()
+//TODO: fix show (update title part in naviframe item manually)
+void NaviFrameItem::NaviBar::setVisible(bool visible)
{
- return elm_naviframe_item_title_enabled_get(m_Owner.getElmObjItem());
+ const char *sig = visible ? "title,state,show" :"title,state,hide";
+ emitSignal(sig, "*");
+ elm_naviframe_item_title_visible_set(getOwner(), visible);
}
void NaviFrameItem::NaviBar::setTitle(const std::string &title)
{
- m_Owner.setText(title);
+ setText(title, titleTextPart);
}
void NaviFrameItem::NaviBar::setTitle(const TText &title)
{
- m_Owner.setText(title);
+ setText(title, titleTextPart);
}
std::string NaviFrameItem::NaviBar::getTitle() const
{
- return m_Owner.getText();
-}
-
-void NaviFrameItem::NaviBar::setBadge(const std::string &badge)
-{
- elm_object_item_part_text_set(m_Owner.getElmObjItem(), badgePart, badge.c_str());
-}
-
-void NaviFrameItem::NaviBar::showBadge(bool value)
-{
- const char *sig = value ? "elm,state,title_badge,show" :"elm,state,title_badge,hide";
- m_Owner.emitSignal(sig);
-}
-
-std::string NaviFrameItem::NaviBar::getBadge() const
-{
- const char *text = elm_object_item_part_text_get(m_Owner.getElmObjItem(), badgePart);
- return text ? text : std::string();
+ return getText(titleTextPart);
}
void NaviFrameItem::NaviBar::getButton(NaviButtonId id)
{
if(!ButtonList[id].button)
{
- Evas_Object *parent = getOwner().getWidget();
+ Evas_Object *parent = getEo();
Evas_Object *btn = elm_button_add(parent);
ButtonList[id].button = btn;
elm_object_style_set(btn, ButtonList[id].style);
+ setButtonText(id, msgt(ButtonList[id].default_text_id));
evas_object_data_set(btn, buttonTypeKey, (void*)id);
evas_object_smart_callback_add(btn, "clicked", on_button_clicked, this);
+ evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, on_button_delete, this);
}
}
{
getButton(id);
- if(!getOwner().getContent(ButtonList[id].part))
- getOwner().setContent(ButtonList[id].button, ButtonList[id].part);
-
+ if(!getContent(ButtonList[id].part) != ButtonList[id].button)
+ setContent(ButtonList[id].button, ButtonList[id].part);
+ setButtonColor(id, m_CurrentColor);
evas_object_show(ButtonList[id].button);
}
else
{
- evas_object_hide(ButtonList[id].button);
+ if (getContent(ButtonList[id].part) == ButtonList[id].button)
+ {
+ elm_object_part_content_unset(getEo(),ButtonList[id].part);
+ evas_object_hide(ButtonList[id].button);
+ }
}
switch(id)
{
case NaviCancelButtonId:
- showOkButtonPart(value);
+ showCancelButtonPart(value);
break;
case NaviOkButtonId:
- showCancelButtonPart(value);
+ showOkButtonPart(value);
+ break;
+
+ case NaviCenterButtonId:
+ showCenterButtonPart(value);
+ break;
+
+ case NaviPrevButtonId:
+ showPrevButtonPart(value);
+ break;
+
+ case NaviDownButtonId:
+ showDownButtonPart(value);
break;
default:
void NaviFrameItem::NaviBar::showCancelButtonPart(bool value)
{
- const char *sig = value ? "elm,state,title_left_btn,show" : "elm,state,title_left_btn,hide";
- m_Owner.emitSignal(sig);
+ const char *sig = value ? "cancel,show,btn" : "left,clear";
+ emitSignal(sig, "*");
}
void NaviFrameItem::NaviBar::showOkButtonPart(bool value)
{
- const char *sig = value ? "elm,state,title_right_btn,show" : "elm,state,title_right_btn,hide";
- m_Owner.emitSignal(sig);
+ const char *sig = value ? "done,show,btn" : "right,clear";
+ emitSignal(sig, "*");
+}
+
+void NaviFrameItem::NaviBar::showCenterButtonPart(bool value, bool expand)
+{
+ const char *sig = value ? "center,show,btn" : "center,hide,btn";
+ emitSignal(sig, "*");
+}
+
+void NaviFrameItem::NaviBar::showPrevButtonPart(bool value)
+{
+ const char *sig1 = value ? "back,show,btn" : "left,clear";
+ const char *sig2 = value ? "empty,right,show" : "right,clear";
+ emitSignal(sig1, "*");
+ emitSignal(sig2, "*");
+}
+
+void NaviFrameItem::NaviBar::showDownButtonPart(bool value)
+{
+ const char *sig = value ? "down,show,btn" : "right,clear";
+ emitSignal(sig, "*");
}
void NaviFrameItem::NaviBar::on_button_clicked(void *data, Evas_Object *obj, void *event_info)
int type = (int)evas_object_data_get(obj, buttonTypeKey);
naviBar->getOwner().onButtonClicked(naviBar->getOwner(), (NaviButtonId)type);
}
+
+void NaviFrameItem::NaviBar::on_button_delete(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ NaviFrameItem::NaviBar *naviBar = static_cast<NaviFrameItem::NaviBar*>(data);
+ int type = (int)evas_object_data_get(obj, buttonTypeKey);
+ naviBar->ButtonList[type] = nullptr;
+}
+
+void NaviFrameItem::onViewItemCreated()
+{
+ ViewItem::onViewItemCreated();
+ m_pNaviBar->initNaviBar();
+ setContent(*m_pNaviBar, naviTitlePart);
+}
+
+void NaviFrameItem::NaviBar::initNaviBar()
+{
+ setEo(elm_layout_add(m_Owner.getOwner()));
+ std::string edjPath = ResourceUtils::getResourcePath(MSG_TITLE_EDJ_PATH);
+ elm_layout_file_set(getEo(), edjPath.c_str(), titleStyleName);
+}
+
+void NaviFrameItem::NaviBar::setColor(NaviColorId id)
+{
+ switch(id)
+ {
+ case NaviBlueColorId:
+ emitSignal("title,color,blue", "*");
+ m_CurrentColor = NaviBlueColorId;
+ break;
+
+ case NaviWhiteColorId:
+ emitSignal("title,color,white", "*");
+ m_CurrentColor = NaviWhiteColorId;
+ break;
+
+ default:
+ break;
+ }
+}
+
+void NaviFrameItem::NaviBar::setButtonText(NaviButtonId id, const std::string &text)
+{
+ elm_object_text_set(ButtonList[id].button, text.c_str());
+}
+
+void NaviFrameItem::NaviBar::setButtonText(NaviButtonId id, const TText &text)
+{
+ elm_object_domain_translatable_text_set(ButtonList[id].button, text.getDomain(), text.getMsg());
+}
+
+void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleColor)
+{
+ // Note that, button's color is opposite to title's color
+ if (id == NaviPrevButtonId || id == NaviDownButtonId)
+ {
+ switch(titleColor)
+ {
+ case NaviBlueColorId:
+ elm_object_signal_emit(ButtonList[id].button, "button,color,white", "*");
+ break;
+
+ case NaviWhiteColorId:
+ elm_object_signal_emit(ButtonList[id].button, "button,color,blue", "*");
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ TextStyle style;
+
+ switch(titleColor)
+ {
+ case NaviBlueColorId:
+ style.setColor(textColorBlueTitleButtons);
+ break;
+
+ case NaviWhiteColorId:
+ style.setColor(textColorWhiteTitleButtons);
+ break;
+
+ default:
+ break;
+ }
+ style.setSize(textSizeTitleButtons);
+ const char *buttonText = elm_object_text_get(ButtonList[id].button);
+ if (buttonText != nullptr)
+ {
+ setButtonText(id, TextDecorator::make(buttonText, style).c_str());
+ }
+ }
+}
+
+void NaviFrameItem::NaviBar::clearBar()
+{
+ emitSignal("sides,clear", "*");
+ for (int iter = NaviCancelButtonId; iter < NaviButtonMax; iter++)
+ {
+ evas_object_hide(elm_object_part_content_unset(getEo(), ButtonList[iter].part));
+ }
+}
+
+void NaviFrameItem::NaviBar::switchToSearch(Evas_Object *searchPanel)
+{
+ //TODO: implement switchToSearch
+}
+
+void NaviFrameItem::NaviBar::expandDownButton(bool value)
+{
+ if (!value)
+ {
+ elm_object_signal_emit(ButtonList[NaviDownButtonId].button, "button,expand", "*");
+ }
+ else
+ {
+ elm_object_signal_emit(ButtonList[NaviDownButtonId].button, "button,collapse", "*");
+ }
+}
using namespace Msg;
+namespace
+{
+ const char *naviTitleStyleEmpty = "empty";
+}
+
NaviFrameView::NaviFrameView(Evas_Object *parent)
: View()
{
void NaviFrameView::push(NaviFrameItem &item, Evas_Object *content)
{
Elm_Object_Item *it = elm_naviframe_item_push(getEo(), NULL, NULL, NULL, content, NULL);
+ elm_naviframe_item_style_set(it, naviTitleStyleEmpty);
item.setElmObjItem(it);
}
void Conversation::onViewItemCreated()
{
+ FrameController::onViewItemCreated();
getNaviBar().setTitle("Conversation");
+ getNaviBar().setColor(NaviBar::NaviWhiteColorId);
setHwButtonListener(getContent(), this);
}
void MsgThread::onViewItemCreated()
{
+ FrameController::onViewItemCreated();
getNaviBar().setTitle(msgt("IDS_MSG_HEADER_MESSAGES"));
+ getNaviBar().setColor(NaviBar::NaviBlueColorId);
setHwButtonListener(getContent(), this);
}
m_pLayout->showSearchPanel(value);
m_pSearchPanel->setEntryFocus(value);
- getNaviBar().show(!value);
+ getNaviBar().setVisible(!value);
}
void MsgThread::onSearchButtonClicked(MsgThreadSearchPanel &obj)
void MsgOnSimCard::onViewItemCreated()
{
+ FrameController::onViewItemCreated();
setTitleTranslatable();
+ getNaviBar().setColor(NaviBar::NaviWhiteColorId);
setHwButtonListener(getContent(), this);
/* auto list = getMsgEngine().getStorage().getSimMsgList();
void Settings::onViewItemCreated()
{
+ FrameController::onViewItemCreated();
getNaviBar().setTitle("Settings");
+ getNaviBar().setColor(NaviBar::NaviWhiteColorId);
}
Evas_Object *Settings::getContent()
void Viewer::onViewItemCreated()
{
+ FrameController::onViewItemCreated();
getNaviBar().setTitle("Viewer");
+ getNaviBar().setColor(NaviBar::NaviBlueColorId);
setHwButtonListener(getContent(), this);
}
ASSERT_NE(foundPos, std::string::npos);
foundPos = result.find("<align=left");
- ASSERT_NE(foundPos, std::string::npos);
+ ASSERT_EQ(foundPos, std::string::npos);
}