Evas textblock: Added "password" tag - toggle password mode.

This lets you toggle the password mode inside the text. Especially
useful for implementing "show last char" in password entries.

Patch by Shilpaonkar Singh

SVN revision: 59000
This commit is contained in:
Tom Hacohen 2011-04-28 11:08:20 +00:00
parent 368a77aea0
commit ff0bcef2db
3 changed files with 19 additions and 1 deletions

View File

@ -24,4 +24,5 @@ Sung W. Park <sungwoo@gmail.com>
Jiyoun Park <jy0703.park@samsung.com> Jiyoun Park <jy0703.park@samsung.com>
Myoungwoon Roy Kim(roy_kim) <myoungwoon.kim@samsung.com> <myoungwoon@gmail.com> Myoungwoon Roy Kim(roy_kim) <myoungwoon.kim@samsung.com> <myoungwoon@gmail.com>
Thierry el Borgi <thierry@substantiel.fr> Thierry el Borgi <thierry@substantiel.fr>
Shilpa Singh <shilpa.singh@samsung.com> <shilpasingh.o@gmail.com>

View File

@ -285,3 +285,8 @@
evas_image_loader.extension e.g. evas_image_loader.pdf or evas_image_loader.extension e.g. evas_image_loader.pdf or
evas_image_loader.xcf or evas_image_loader.xcf.gz etc. etc. evas_image_loader.xcf or evas_image_loader.xcf.gz etc. etc.
2011-04-28 Shilpaonkar Singh
* Textblock: Add "password" tag to turn on/off password in the middle
of the textblok. Especially useful for implementing "show last char"
for password entries.

View File

@ -342,6 +342,7 @@ struct _Evas_Object_Textblock_Format
unsigned char underline2 : 1; unsigned char underline2 : 1;
unsigned char strikethrough : 1; unsigned char strikethrough : 1;
unsigned char backing : 1; unsigned char backing : 1;
unsigned char password : 1;
}; };
struct _Evas_Textblock_Style struct _Evas_Textblock_Style
@ -1026,6 +1027,7 @@ static const char *linerelgapstr = NULL;
static const char *itemstr = NULL; static const char *itemstr = NULL;
static const char *linefillstr = NULL; static const char *linefillstr = NULL;
static const char *ellipsisstr = NULL; static const char *ellipsisstr = NULL;
static const char *passwordstr = NULL;
/** /**
* @internal * @internal
@ -1066,6 +1068,7 @@ _format_command_init(void)
itemstr = eina_stringshare_add("item"); itemstr = eina_stringshare_add("item");
linefillstr = eina_stringshare_add("linefill"); linefillstr = eina_stringshare_add("linefill");
ellipsisstr = eina_stringshare_add("ellipsis"); ellipsisstr = eina_stringshare_add("ellipsis");
passwordstr = eina_stringshare_add("password");
} }
format_refcount++; format_refcount++;
} }
@ -1109,6 +1112,7 @@ _format_command_shutdown(void)
eina_stringshare_del(itemstr); eina_stringshare_del(itemstr);
eina_stringshare_del(linefillstr); eina_stringshare_del(linefillstr);
eina_stringshare_del(ellipsisstr); eina_stringshare_del(ellipsisstr);
eina_stringshare_del(passwordstr);
} }
/** /**
@ -1510,6 +1514,13 @@ _format_command(Evas_Object *obj, Evas_Object_Textblock_Format *fmt, const char
o->have_ellipsis = 1; o->have_ellipsis = 1;
} }
} }
else if (cmd == passwordstr)
{
if (!strcmp(tmp_param, "off"))
fmt->password = 0;
else if (!strcmp(tmp_param, "on"))
fmt->password = 1;
}
if (new_font) if (new_font)
{ {
@ -1993,6 +2004,7 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt)
fmt->linerelsize = 0.0; fmt->linerelsize = 0.0;
fmt->linegap = 0; fmt->linegap = 0;
fmt->linerelgap = 0.0; fmt->linerelgap = 0.0;
fmt->password = 1;
} }
return fmt; return fmt;
} }
@ -2770,7 +2782,7 @@ _layout_text_append(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Text
/* If we work with a replacement char, create a string which is the same /* If we work with a replacement char, create a string which is the same
* but with replacement chars instead of regular chars. */ * but with replacement chars instead of regular chars. */
if ((repch) && (eina_ustrbuf_length_get(n->unicode))) if ((fmt->password) && (repch) && (eina_ustrbuf_length_get(n->unicode)))
{ {
int i, ind; int i, ind;
Eina_Unicode *ptr; Eina_Unicode *ptr;