summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2011-03-30 10:31:29 +0000
committerCarsten Haitzler <raster@rasterman.com>2011-03-30 10:31:29 +0000
commit12d1b2d24d88f8fc67fe453b725b3ad030e8f433 (patch)
treef8d28c97619c38e2e8695b23aa89bac0047733c9 /legacy
parent1588a92819f4edb6f2889928b9171d86d6977c70 (diff)
flesh out valign prop to have real api. untested currently.
SVN revision: 58199
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evas/src/lib/Evas.h3
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_textblock.c48
2 files changed, 48 insertions, 3 deletions
diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h
index bf137f5cdd..579476b112 100644
--- a/legacy/evas/src/lib/Evas.h
+++ b/legacy/evas/src/lib/Evas.h
@@ -1409,6 +1409,9 @@ typedef void (*Evas_Object_Image_Pixels_Get_Cb) (void *data, Evas_Object *o);
1409 EAPI const Evas_Textblock_Style *evas_object_textblock_style_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 1409 EAPI const Evas_Textblock_Style *evas_object_textblock_style_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1410 EAPI void evas_object_textblock_replace_char_set(Evas_Object *obj, const char *ch) EINA_ARG_NONNULL(1); 1410 EAPI void evas_object_textblock_replace_char_set(Evas_Object *obj, const char *ch) EINA_ARG_NONNULL(1);
1411 EAPI const char *evas_object_textblock_replace_char_get(Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 1411 EAPI const char *evas_object_textblock_replace_char_get(Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1412 EAPI void evas_object_textblock_valign_set(Evas_Object *obj, double align);
1413 EAPI double evas_object_textblock_valign_get(const Evas_Object *obj);
1414
1412 EAPI void evas_object_textblock_newline_mode_set(Evas_Object *obj, Eina_Bool mode) EINA_ARG_NONNULL(1); 1415 EAPI void evas_object_textblock_newline_mode_set(Evas_Object *obj, Eina_Bool mode) EINA_ARG_NONNULL(1);
1413 EAPI Eina_Bool evas_object_textblock_newline_mode_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE; 1416 EAPI Eina_Bool evas_object_textblock_newline_mode_get(const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
1414 1417
diff --git a/legacy/evas/src/lib/canvas/evas_object_textblock.c b/legacy/evas/src/lib/canvas/evas_object_textblock.c
index 390a36e186..547be2baeb 100644
--- a/legacy/evas/src/lib/canvas/evas_object_textblock.c
+++ b/legacy/evas/src/lib/canvas/evas_object_textblock.c
@@ -420,10 +420,11 @@ struct _Evas_Object_Textblock
420 Evas_Object_Textblock_Node_Text *text_nodes; 420 Evas_Object_Textblock_Node_Text *text_nodes;
421 Evas_Object_Textblock_Node_Format *format_nodes; 421 Evas_Object_Textblock_Node_Format *format_nodes;
422 Evas_Object_Textblock_Paragraph *paragraphs; 422 Evas_Object_Textblock_Paragraph *paragraphs;
423 int last_w; 423 int last_w, last_h;
424 struct { 424 struct {
425 int l, r, t, b; 425 int l, r, t, b;
426 } style_pad; 426 } style_pad;
427 double valign;
427 char *markup_text; 428 char *markup_text;
428 void *engine_data; 429 void *engine_data;
429 const char *repch; 430 const char *repch;
@@ -3760,6 +3761,7 @@ _relayout(const Evas_Object *obj)
3760 &o->formatted.w, &o->formatted.h); 3761 &o->formatted.w, &o->formatted.h);
3761 o->formatted.valid = 1; 3762 o->formatted.valid = 1;
3762 o->last_w = obj->cur.geometry.w; 3763 o->last_w = obj->cur.geometry.w;
3764 o->last_h = obj->cur.geometry.h;
3763 o->changed = 0; 3765 o->changed = 0;
3764 o->content_changed = 0; 3766 o->content_changed = 0;
3765 o->redraw = 1; 3767 o->redraw = 1;
@@ -4145,6 +4147,43 @@ evas_object_textblock_newline_mode_get(const Evas_Object *obj)
4145} 4147}
4146 4148
4147/** 4149/**
4150 * @brief Sets the vertical alignment of text within the textblock object
4151 * as a whole.
4152 *
4153 * Normally alignment is 0.0 (top of object). Values given should be
4154 * between 0.0 and 1.0 (1.0 bottom of object, 0.5 being vertically centered
4155 * etc.).
4156 *
4157 * @param obj The given textblock object.
4158 * @param align A value between 0.0 and 1.0
4159 * @since 1.1.0
4160 */
4161EAPI void
4162evas_object_textblock_valign_set(Evas_Object *obj, double align)
4163{
4164 TB_HEAD();
4165 if (align < 0.0) align = 0.0;
4166 else if (align > 1.0) align = 1.0;
4167 if (o->valign == align) return;
4168 o->valign = align;
4169 _evas_textblock_text_node_changed(o, obj, NULL);
4170}
4171
4172/**
4173 * @brief Gets the vertical alignment of a textblock
4174 *
4175 * @param obj The given textblock object.
4176 * @return The elignment set for the object
4177 * @since 1.1.0
4178 */
4179EAPI double
4180evas_object_textblock_valign_get(const Evas_Object *obj)
4181{
4182 TB_HEAD_RETURN(0.0);
4183 return o->valign;
4184}
4185
4186/**
4148 * @brief Get the "replacement character" for given textblock object. Returns 4187 * @brief Get the "replacement character" for given textblock object. Returns
4149 * NULL if no replacement character is in use. 4188 * NULL if no replacement character is in use.
4150 * 4189 *
@@ -8605,7 +8644,8 @@ evas_object_textblock_render_pre(Evas_Object *obj)
8605 /* if so what and where and add the appropriate redraw textblocks */ 8644 /* if so what and where and add the appropriate redraw textblocks */
8606 o = (Evas_Object_Textblock *)(obj->object_data); 8645 o = (Evas_Object_Textblock *)(obj->object_data);
8607 if ((o->changed) || (o->content_changed) || 8646 if ((o->changed) || (o->content_changed) ||
8608 (o->last_w != obj->cur.geometry.w)) 8647 ((obj->cur.geometry.w != o->last_w) ||
8648 ((o->valign != 0.0) && (obj->cur.geometry.h != o->last_h))))
8609 { 8649 {
8610 o->formatted.valid = 0; 8650 o->formatted.valid = 0;
8611 _layout(obj, 8651 _layout(obj,
@@ -8614,6 +8654,7 @@ evas_object_textblock_render_pre(Evas_Object *obj)
8614 &o->formatted.w, &o->formatted.h); 8654 &o->formatted.w, &o->formatted.h);
8615 o->formatted.valid = 1; 8655 o->formatted.valid = 1;
8616 o->last_w = obj->cur.geometry.w; 8656 o->last_w = obj->cur.geometry.w;
8657 o->last_h = obj->cur.geometry.h;
8617 o->redraw = 0; 8658 o->redraw = 0;
8618 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj); 8659 evas_object_render_pre_prev_cur_add(&obj->layer->evas->clip_changes, obj);
8619 o->changed = 0; 8660 o->changed = 0;
@@ -8760,7 +8801,8 @@ evas_object_textblock_coords_recalc(Evas_Object *obj)
8760 Evas_Object_Textblock *o; 8801 Evas_Object_Textblock *o;
8761 8802
8762 o = (Evas_Object_Textblock *)(obj->object_data); 8803 o = (Evas_Object_Textblock *)(obj->object_data);
8763 if (obj->cur.geometry.w != o->last_w) 8804 if ((obj->cur.geometry.w != o->last_w) ||
8805 ((o->valign != 0.0) && (obj->cur.geometry.h != o->last_h)))
8764 { 8806 {
8765 o->formatted.valid = 0; 8807 o->formatted.valid = 0;
8766 o->changed = 1; 8808 o->changed = 1;