#define THUMBNAIL_T 60
#define THUMBNAIL_B 110
+#define MULTILINE_LR 32
+#define MULTILINE_TB 24
+
+#define TEXT_H 54
+#define SUBTEXT_H 43
+
+styles {
+ style {
+ name: "text";
+ base: "font=Tizen:style=Light font_size=40 wrap=mixed color=#000000 text_class=list_item";
+ }
+ style {
+ name: "subtext";
+ base: "font=Tizen:style=Regular font_size=32 color=#737373 text_class=list_item ellipsis=1.0";
+ }
+}
+
collections
{
base_scale: 2.6;
}
}
}
+
+ group { "elm/genlist/item/"STYLE_ITEM_MULTILINE_SUB"/default";
+ alias: "elm/genlist/item_compress/"STYLE_ITEM_MULTILINE_SUB"/default";
+ alias: "elm/genlist/tree/"STYLE_ITEM_MULTILINE_SUB"/default";
+ alias: "elm/genlist/tree_compress/"STYLE_ITEM_MULTILINE_SUB"/default";
+
+ data.item: "texts" "elm.text elm.text.sub";
+ data.item: "banded_bg_area" "elm.swallow.bg";
+
+ parts {
+ swallow { "elm.swallow.bg"; }
+ spacer { "spacer.left_top"; scale;
+ desc { "default";
+ min: MULTILINE_LR MULTILINE_TB;
+ align: 0.0 0.0;
+ rel2.relative: 0.0 0.0;
+ }
+ }
+ spacer { "spacer.right_bottom"; scale;
+ desc { "default";
+ min: MULTILINE_LR MULTILINE_TB;
+ align: 1.0 1.0;
+ rel1.relative: 1.0 1.0;
+ }
+ }
+ textblock { "elm.text.sub"; scale;
+ desc { "default";
+ min: 0 SUBTEXT_H;
+ align: 0.5 0.0;
+ rel1 { relative: 1.0 1.0; to: "spacer.left_top"; }
+ rel2 { relative: 0.0 1.0; to_x: "spacer.right_bottom"; to_y: "spacer.left_top"; }
+ text {
+ min: 0 1;
+ style: "subtext";
+ }
+ }
+ }
+ textblock { "elm.text"; scale;
+ desc { "default";
+ min: 0 TEXT_H;
+ rel1 { relative: 1.0 1.0; to_x: "spacer.left_top"; to_y: "elm.text.sub"; }
+ rel2 { relative: 0.0 0.0; to: "spacer.right_bottom"; }
+ text {
+ min: 0 1;
+ style: "text";
+ }
+ }
+ }
+ }
+ }
}
* @see GenItem::getItemClass()
*/
virtual Elm_Genlist_Item_Class *getItemClass() const override;
-
- /**
- * @see GenItem::getText()
- */
- virtual char *getText(Evas_Object *parent, const char *part) override;
-
- /**
- * @see FieldItem::onFieldUpdated()
- */
- virtual void onFieldUpdated(Model::ContactField &field, contacts_changed_e change) override;
-
- private:
- static char *formatText(const char *textStyle, int textSize, const char *textColor, const char *text);
};
}
}
*/
#include "Contacts/Details/MultilineFieldItem.h"
-
-#define TEXT_MARKUP "<font=Tizen:style=%s font_size=%d color=#%s>"
-#define TEXT_MARKUP_SIZE sizeof(TEXT_MARKUP)
-
-#define TEXT_STYLE "Light"
-#define TEXT_SIZE 40
-#define TEXT_COLOR "000"
-
-#define SUBTEXT_STYLE "Normal"
-#define SUBTEXT_SIZE 32
-#define SUBTEXT_COLOR "737373"
+#include "DetailsItemLayout.h"
using namespace Contacts::Details;
using namespace Contacts::Model;
Elm_Genlist_Item_Class *MultilineFieldItem::getItemClass() const
{
- static Elm_Genlist_Item_Class itc = createItemClass("multiline");
+ static Elm_Genlist_Item_Class itc = createItemClass(STYLE_ITEM_MULTILINE_SUB);
return &itc;
}
-
-char *MultilineFieldItem::getText(Evas_Object *parent, const char *part)
-{
- const char *textStyle = nullptr;
- int textSize = 0;
- const char *textColor = nullptr;
-
- if (strcmp(part, "elm.text.multiline") == 0) {
- part = "elm.text";
- textStyle = TEXT_STYLE;
- textSize = TEXT_SIZE;
- textColor = TEXT_COLOR;
- } else if (strcmp(part, "elm.text") == 0) {
- part = "elm.text.sub";
- textStyle = SUBTEXT_STYLE;
- textSize = SUBTEXT_SIZE;
- textColor = SUBTEXT_COLOR;
- }
-
- char *text = FieldItem::getText(parent, part);
- if (text) {
- char *formattedText = formatText(textStyle, textSize, textColor, text);
- free(text);
- return formattedText;
- }
-
- return nullptr;
-}
-
-void MultilineFieldItem::onFieldUpdated(ContactField &field, contacts_changed_e change)
-{
- if (&field == &getField()) {
- elm_genlist_item_fields_update(getObjectItem(), "elm.text.multiline", ELM_GENLIST_ITEM_FIELD_TEXT);
- } else {
- FieldItem::onFieldUpdated(field, change);
- }
-}
-
-char *MultilineFieldItem::formatText(const char *textStyle, int textSize, const char *textColor, const char *text)
-{
- size_t size = strlen(text) + strlen(textStyle) + strlen(textColor) + TEXT_MARKUP_SIZE;
- char *buffer = (char *) malloc(size);
- snprintf(buffer, size, TEXT_MARKUP "%s", textStyle, textSize, textColor, text);
- return buffer;
-}