forked from enlightenment/efl
parent
cd8a1192b0
commit
1d74aa8f21
|
@ -2661,6 +2661,49 @@ collections {
|
|||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
group { name: "elm/entry/base/default";
|
||||
styles
|
||||
{
|
||||
style { name: "entry_textblock_style";
|
||||
base: "font=Sans font_size=10 align=left color=#000 wrap=word";
|
||||
tag: "br" "\n";
|
||||
tag: "tab" "\t";
|
||||
tag: "em" "+ font=Sans:style=Oblique";
|
||||
tag: "b" "+ font=Sans:style=Bold";
|
||||
tag: "link" "+ color=#800 underline=on underline_color=#8008";
|
||||
tag: "hilight" "+ font=Sans:style=Bold";
|
||||
}
|
||||
}
|
||||
parts {
|
||||
part { name: "elm.text";
|
||||
type: TEXTBLOCK;
|
||||
mouse_events: 1;
|
||||
scale: 1;
|
||||
entry_mode: EDITABLE;
|
||||
multiline: 1;
|
||||
// source: "X"; // selection under
|
||||
// source2: "X"; // selection over
|
||||
source3: "elm/button/base/default"; // cursor under
|
||||
// source4: "X"; // cursor over
|
||||
description { state: "default" 0.0;
|
||||
text {
|
||||
style: "entry_textblock_style";
|
||||
min: 1 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program { name: "focus";
|
||||
signal: "load";
|
||||
source: "";
|
||||
action: FOCUS_SET;
|
||||
target: "elm.text";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
group { name: "elm/icon/base/default"; min: 10 10;
|
||||
images.image: "bt_base1.png" COMP; parts { part { name: "base";
|
||||
|
|
|
@ -629,6 +629,70 @@ my_bt_12(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_show(win);
|
||||
}
|
||||
|
||||
static void
|
||||
my_entry_bt_1(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *en = data;
|
||||
}
|
||||
|
||||
static void
|
||||
my_entry_bt_2(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *en = data;
|
||||
printf("TEXT:\n");
|
||||
printf("%s\n",
|
||||
elm_entry_entry_get(en));
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_13(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win, *bg, *bx, *bt, *en;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
win = elm_win_add(NULL, "entry", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Entry");
|
||||
elm_win_autodel_set(win, 1);
|
||||
|
||||
bg = elm_bg_add(win);
|
||||
elm_win_resize_object_add(win, bg);
|
||||
evas_object_size_hint_weight_set(bg, 1.0, 1.0);
|
||||
evas_object_show(bg);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(bx, 1.0, 1.0);
|
||||
elm_win_resize_object_add(win, bx);
|
||||
evas_object_show(bx);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Clear");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_entry_bt_1, en);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
en = elm_entry_add(win);
|
||||
elm_entry_entry_set(en,
|
||||
"This is an entry widget in this window that<br>"
|
||||
"uses markup <b>like this</b> for styling and<br>"
|
||||
"formatting <em>like this</em>, as well as<br>"
|
||||
"<a href=X><link>links in the text</link></a>, so enter text<br>"
|
||||
"in here to edit it.");
|
||||
evas_object_size_hint_weight_set(en, 1.0, 1.0);
|
||||
evas_object_size_hint_align_set(en, -1.0, -1.0);
|
||||
elm_box_pack_end(bx, en);
|
||||
evas_object_show(en);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Print");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_entry_bt_2, en);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
elm_widget_focus_set(en, 1);
|
||||
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
static void
|
||||
my_win_main(void)
|
||||
{
|
||||
|
@ -806,6 +870,13 @@ my_win_main(void)
|
|||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Entry");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_bt_13, NULL);
|
||||
evas_object_size_hint_align_set(bt, -1.0, 0.0);
|
||||
elm_box_pack_end(bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
/* set an initial window size */
|
||||
evas_object_resize(win, 320, 320);
|
||||
/* show the window */
|
||||
|
|
|
@ -181,6 +181,8 @@ extern "C" {
|
|||
*/
|
||||
|
||||
EAPI Evas_Object *elm_entry_add(Evas_Object *parent);
|
||||
EAPI void elm_entry_entry_set(Evas_Object *obj, const char *entry);
|
||||
EAPI const char *elm_entry_entry_get(Evas_Object *obj);
|
||||
|
||||
// FIXME: fixes to do
|
||||
// * current sizing tree inefficient
|
||||
|
|
|
@ -64,3 +64,10 @@ elm_entry_entry_set(Evas_Object *obj, const char *entry)
|
|||
edje_object_part_text_set(wd->ent, "elm.text", entry);
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
elm_entry_entry_get(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
return edje_object_part_text_get(wd->ent, "elm.text");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue