2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2018-02-14 18:14:52 -08:00
|
|
|
#define EFL_LAYOUT_CALC_PROTECTED
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_PROTECTED
|
2017-09-25 01:15:44 -07:00
|
|
|
#define EFL_ACCESS_TEXT_PROTECTED
|
|
|
|
#define EFL_ACCESS_EDITABLE_TEXT_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_PROTECTED
|
2017-11-14 09:56:08 -08:00
|
|
|
#define EFL_UI_FOCUS_OBJECT_PROTECTED
|
2017-11-27 16:56:32 -08:00
|
|
|
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2008-10-14 01:05:30 -07:00
|
|
|
#include <Elementary.h>
|
2010-09-17 15:28:29 -07:00
|
|
|
#include <Elementary_Cursor.h>
|
2008-10-14 01:05:30 -07:00
|
|
|
#include "elm_priv.h"
|
2012-08-30 09:45:15 -07:00
|
|
|
#include "elm_widget_entry.h"
|
2008-10-14 01:05:30 -07:00
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_entry_part.eo.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
#include "elm_part_helper.h"
|
2016-10-18 03:34:12 -07:00
|
|
|
#include "elm_hoversel.eo.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_ENTRY_CLASS
|
2017-07-27 23:35:10 -07:00
|
|
|
#define MY_CLASS_PFX elm_entry
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Entry"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_entry"
|
2010-04-12 01:12:02 -07:00
|
|
|
|
2011-05-15 09:02:03 -07:00
|
|
|
/* Maximum chunk size to be inserted to the entry at once
|
|
|
|
* FIXME: This size is arbitrary, should probably choose a better size.
|
|
|
|
* Possibly also find a way to set it to a low value for weak computers,
|
|
|
|
* and to a big value for better computers. */
|
2014-01-23 06:09:28 -08:00
|
|
|
#define ELM_ENTRY_CHUNK_SIZE 10000
|
2014-01-23 06:05:24 -08:00
|
|
|
#define ELM_ENTRY_DELAY_WRITE_TIME 2.0
|
2011-05-15 09:02:03 -07:00
|
|
|
|
2013-07-14 20:13:53 -07:00
|
|
|
#define ELM_PRIV_ENTRY_SIGNALS(cmd) \
|
|
|
|
cmd(SIG_ABORTED, "aborted", "") \
|
|
|
|
cmd(SIG_ACTIVATED, "activated", "") \
|
|
|
|
cmd(SIG_ANCHOR_CLICKED, "anchor,clicked", "") \
|
|
|
|
cmd(SIG_ANCHOR_DOWN, "anchor,down", "") \
|
|
|
|
cmd(SIG_ANCHOR_HOVER_OPENED, "anchor,hover,opened", "") \
|
|
|
|
cmd(SIG_ANCHOR_IN, "anchor,in", "") \
|
|
|
|
cmd(SIG_ANCHOR_OUT, "anchor,out", "") \
|
|
|
|
cmd(SIG_ANCHOR_UP, "anchor,up", "") \
|
|
|
|
cmd(SIG_CHANGED, "changed", "") \
|
|
|
|
cmd(SIG_CHANGED_USER, "changed,user", "") \
|
|
|
|
cmd(SIG_CLICKED, "clicked", "") \
|
|
|
|
cmd(SIG_CLICKED_DOUBLE, "clicked,double", "") \
|
|
|
|
cmd(SIG_CLICKED_TRIPLE, "clicked,triple", "") \
|
|
|
|
cmd(SIG_CURSOR_CHANGED, "cursor,changed", "") \
|
|
|
|
cmd(SIG_CURSOR_CHANGED_MANUAL, "cursor,changed,manual", "") \
|
|
|
|
cmd(SIG_FOCUSED, "focused", "") \
|
|
|
|
cmd(SIG_UNFOCUSED, "unfocused", "") \
|
|
|
|
cmd(SIG_LONGPRESSED, "longpressed", "") \
|
|
|
|
cmd(SIG_MAX_LENGTH, "maxlength,reached", "") \
|
|
|
|
cmd(SIG_PREEDIT_CHANGED, "preedit,changed", "") \
|
|
|
|
cmd(SIG_PRESS, "press", "") \
|
|
|
|
cmd(SIG_REDO_REQUEST, "redo,request", "") \
|
|
|
|
cmd(SIG_SELECTION_CHANGED, "selection,changed", "") \
|
|
|
|
cmd(SIG_SELECTION_CLEARED, "selection,cleared", "") \
|
|
|
|
cmd(SIG_SELECTION_COPY, "selection,copy", "") \
|
|
|
|
cmd(SIG_SELECTION_CUT, "selection,cut", "") \
|
|
|
|
cmd(SIG_SELECTION_PASTE, "selection,paste", "") \
|
|
|
|
cmd(SIG_SELECTION_START, "selection,start", "") \
|
|
|
|
cmd(SIG_TEXT_SET_DONE, "text,set,done", "") \
|
|
|
|
cmd(SIG_THEME_CHANGED, "theme,changed", "") \
|
2013-12-30 01:25:15 -08:00
|
|
|
cmd(SIG_UNDO_REQUEST, "undo,request", "") \
|
|
|
|
cmd(SIG_REJECTED, "rejected", "")
|
2013-07-14 20:13:53 -07:00
|
|
|
|
|
|
|
ELM_PRIV_ENTRY_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
|
|
|
|
2015-06-03 08:36:42 -07:00
|
|
|
#define ENTRY_PASSWORD_MASK_CHARACTER 0x002A
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
2013-07-14 21:37:34 -07:00
|
|
|
ELM_PRIV_ENTRY_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
|
2014-01-23 02:30:34 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2012-08-30 09:45:15 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2013-10-18 10:20:34 -07:00
|
|
|
#undef ELM_PRIV_ENTRY_SIGNALS
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
|
|
|
{
|
|
|
|
{"default", "elm.text"},
|
|
|
|
{"guide", "elm.guide"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
|
|
|
{
|
|
|
|
{"icon", "elm.swallow.icon"},
|
|
|
|
{"end", "elm.swallow.end"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2008-11-18 00:45:38 -08:00
|
|
|
static Eina_List *entries = NULL;
|
|
|
|
|
2009-12-01 03:03:14 -08:00
|
|
|
struct _Mod_Api
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
void (*obj_hook)(Evas_Object *obj);
|
|
|
|
void (*obj_unhook)(Evas_Object *obj);
|
|
|
|
void (*obj_longpress)(Evas_Object *obj);
|
2009-12-01 03:03:14 -08:00
|
|
|
};
|
|
|
|
|
2014-04-24 01:52:22 -07:00
|
|
|
static void _create_selection_handlers(Evas_Object *obj, Elm_Entry_Data *sd);
|
2016-02-04 22:05:57 -08:00
|
|
|
static void _magnifier_move(void *data);
|
2014-04-24 01:52:22 -07:00
|
|
|
|
2017-07-07 13:26:50 -07:00
|
|
|
static Evas_Object *
|
|
|
|
_entry_win_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Evas_Object *top;
|
|
|
|
top = elm_widget_top_get(obj);
|
|
|
|
if ((!elm_win_window_id_get(top)) && (elm_win_type_get(top) == ELM_WIN_INLINED_IMAGE))
|
2017-08-17 07:48:06 -07:00
|
|
|
top = efl_ui_win_inlined_parent_get(top);
|
2017-07-07 13:26:50 -07:00
|
|
|
return top;
|
|
|
|
}
|
|
|
|
|
2009-12-01 03:03:14 -08:00
|
|
|
static Mod_Api *
|
2014-01-06 06:30:02 -08:00
|
|
|
_module_find(Evas_Object *obj EINA_UNUSED)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
|
|
|
static Elm_Module *m = NULL;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (m) goto ok; // already found - just use
|
2009-12-01 03:03:14 -08:00
|
|
|
if (!(m = _elm_module_find_as("entry/api"))) return NULL;
|
|
|
|
// get module api
|
|
|
|
m->api = malloc(sizeof(Mod_Api));
|
|
|
|
if (!m->api) return NULL;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
((Mod_Api *)(m->api))->obj_hook = // called on creation
|
|
|
|
_elm_module_symbol_get(m, "obj_hook");
|
|
|
|
((Mod_Api *)(m->api))->obj_unhook = // called on deletion
|
|
|
|
_elm_module_symbol_get(m, "obj_unhook");
|
|
|
|
((Mod_Api *)(m->api))->obj_longpress = // called on long press menu
|
|
|
|
_elm_module_symbol_get(m, "obj_longpress");
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
ok: // ok - return api
|
2009-12-01 03:03:14 -08:00
|
|
|
return m->api;
|
|
|
|
}
|
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
static char *
|
2012-12-05 23:28:57 -08:00
|
|
|
_file_load(const char *file)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
2012-12-05 23:28:57 -08:00
|
|
|
Eina_File *f;
|
|
|
|
char *text = NULL;
|
|
|
|
void *tmp = NULL;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-12-05 23:28:57 -08:00
|
|
|
f = eina_file_open(file, EINA_FALSE);
|
|
|
|
if (!f) return NULL;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-12-06 01:02:22 -08:00
|
|
|
tmp = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
|
2012-12-05 23:28:57 -08:00
|
|
|
if (!tmp) goto on_error;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-12-05 23:28:57 -08:00
|
|
|
text = malloc(eina_file_size_get(f) + 1);
|
|
|
|
if (!text) goto on_error;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
|
2012-12-05 23:28:57 -08:00
|
|
|
memcpy(text, tmp, eina_file_size_get(f));
|
|
|
|
text[eina_file_size_get(f)] = 0;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
|
2012-12-06 01:00:18 -08:00
|
|
|
if (eina_file_map_faulted(f, tmp))
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
2014-01-21 18:08:47 -08:00
|
|
|
ELM_SAFE_FREE(text, free);
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
2012-12-05 23:28:57 -08:00
|
|
|
|
|
|
|
on_error:
|
2012-12-06 01:02:22 -08:00
|
|
|
if (tmp) eina_file_map_free(f, tmp);
|
2012-12-05 23:28:57 -08:00
|
|
|
eina_file_close(f);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2012-08-30 09:45:15 -07:00
|
|
|
_plain_load(const char *file)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
|
|
|
char *text;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
text = _file_load(file);
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
char *text2;
|
|
|
|
|
|
|
|
text2 = elm_entry_utf8_to_markup(text);
|
|
|
|
free(text);
|
|
|
|
return text2;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-03-06 14:51:40 -08:00
|
|
|
static Eina_Bool
|
2012-08-30 09:45:15 -07:00
|
|
|
_load_do(Evas_Object *obj)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
|
|
|
char *text;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->file)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
2011-12-30 02:02:19 -08:00
|
|
|
elm_object_text_set(obj, "");
|
2012-03-06 14:51:40 -08:00
|
|
|
return EINA_TRUE;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
switch (sd->format)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
|
|
|
case ELM_TEXT_FORMAT_PLAIN_UTF8:
|
2012-08-30 09:45:15 -07:00
|
|
|
text = _plain_load(sd->file);
|
|
|
|
break;
|
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
case ELM_TEXT_FORMAT_MARKUP_UTF8:
|
2012-08-30 09:45:15 -07:00
|
|
|
text = _file_load(sd->file);
|
|
|
|
break;
|
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
default:
|
2012-08-30 09:45:15 -07:00
|
|
|
text = NULL;
|
|
|
|
break;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
if (text)
|
|
|
|
{
|
2011-12-30 02:02:19 -08:00
|
|
|
elm_object_text_set(obj, text);
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
free(text);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-03-06 14:51:40 -08:00
|
|
|
return EINA_TRUE;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
|
|
|
else
|
2012-03-06 14:51:40 -08:00
|
|
|
{
|
|
|
|
elm_object_text_set(obj, "");
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-03-06 14:51:40 -08:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_utf8_markup_save(const char *file,
|
|
|
|
const char *text)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
|
2015-02-18 00:46:05 -08:00
|
|
|
if (!text)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
|
|
|
ecore_file_unlink(file);
|
|
|
|
return;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
f = fopen(file, "wb");
|
|
|
|
if (!f)
|
|
|
|
{
|
2015-01-29 15:02:21 -08:00
|
|
|
ERR("Failed to open %s for writing", file);
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
return;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2015-01-29 15:02:21 -08:00
|
|
|
if (fputs(text, f) == EOF)
|
|
|
|
ERR("Failed to write text to file %s", file);
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_utf8_plain_save(const char *file,
|
|
|
|
const char *text)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
|
|
|
char *text2;
|
|
|
|
|
|
|
|
text2 = elm_entry_markup_to_utf8(text);
|
|
|
|
if (!text2)
|
|
|
|
return;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
_utf8_markup_save(file, text2);
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
free(text2);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_save_do(Evas_Object *obj)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->file) return;
|
|
|
|
switch (sd->format)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
|
|
|
case ELM_TEXT_FORMAT_PLAIN_UTF8:
|
2012-08-30 09:45:15 -07:00
|
|
|
_utf8_plain_save(sd->file, elm_object_text_get(obj));
|
|
|
|
break;
|
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
case ELM_TEXT_FORMAT_MARKUP_UTF8:
|
2012-08-30 09:45:15 -07:00
|
|
|
_utf8_markup_save(sd->file, elm_object_text_get(obj));
|
|
|
|
break;
|
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
default:
|
2012-08-30 09:45:15 -07:00
|
|
|
break;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_delay_write(void *data)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
_save_do(data);
|
|
|
|
sd->delay_write = NULL;
|
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
2012-04-08 22:25:27 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_elm_entry_guide_update(Evas_Object *obj,
|
|
|
|
Eina_Bool has_text)
|
2012-04-08 22:25:27 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if ((has_text) && (!sd->has_text))
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,guide,disabled", "elm");
|
|
|
|
else if ((!has_text) && (sd->has_text))
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,guide,enabled", "elm");
|
|
|
|
|
|
|
|
sd->has_text = has_text;
|
2012-04-08 22:25:27 -07:00
|
|
|
}
|
|
|
|
|
2015-04-02 02:37:37 -07:00
|
|
|
static void
|
|
|
|
_validate(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
Eina_Bool res;
|
|
|
|
Elm_Validate_Content vc;
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
|
|
|
|
if (sd->validators == 0) return;
|
|
|
|
|
|
|
|
vc.text = edje_object_part_text_get(sd->entry_edje, "elm.text");
|
2016-08-22 15:40:39 -07:00
|
|
|
res = efl_event_callback_legacy_call(obj, ELM_ENTRY_EVENT_VALIDATE, (void *)&vc);
|
2015-04-02 02:37:37 -07:00
|
|
|
buf = eina_strbuf_new();
|
2016-06-20 07:31:31 -07:00
|
|
|
eina_strbuf_append_printf(buf, "validation,%s,%s", vc.signal, res == EINA_FALSE ? "fail" : "pass");
|
2015-04-02 02:37:37 -07:00
|
|
|
edje_object_signal_emit(sd->scr_edje, eina_strbuf_string_get(buf), "elm");
|
|
|
|
eina_tmpstr_del(vc.signal);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
}
|
|
|
|
|
2012-02-07 23:23:49 -08:00
|
|
|
static Elm_Entry_Markup_Filter *
|
2012-08-30 09:45:15 -07:00
|
|
|
_filter_new(Elm_Entry_Filter_Cb func,
|
|
|
|
void *data)
|
2011-02-14 00:45:26 -08:00
|
|
|
{
|
2012-02-07 23:23:49 -08:00
|
|
|
Elm_Entry_Markup_Filter *tf = ELM_NEW(Elm_Entry_Markup_Filter);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
if (!tf) return NULL;
|
2011-03-14 19:01:42 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
tf->func = func;
|
2013-05-16 02:10:13 -07:00
|
|
|
tf->orig_data = data;
|
2011-02-14 00:45:26 -08:00
|
|
|
if (func == elm_entry_filter_limit_size)
|
|
|
|
{
|
|
|
|
Elm_Entry_Filter_Limit_Size *lim = data, *lim2;
|
|
|
|
|
|
|
|
if (!data)
|
|
|
|
{
|
|
|
|
free(tf);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
lim2 = malloc(sizeof(Elm_Entry_Filter_Limit_Size));
|
|
|
|
if (!lim2)
|
|
|
|
{
|
|
|
|
free(tf);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
memcpy(lim2, lim, sizeof(Elm_Entry_Filter_Limit_Size));
|
|
|
|
tf->data = lim2;
|
|
|
|
}
|
|
|
|
else if (func == elm_entry_filter_accept_set)
|
|
|
|
{
|
|
|
|
Elm_Entry_Filter_Accept_Set *as = data, *as2;
|
2011-03-14 19:01:42 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
if (!data)
|
|
|
|
{
|
|
|
|
free(tf);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
as2 = malloc(sizeof(Elm_Entry_Filter_Accept_Set));
|
|
|
|
if (!as2)
|
|
|
|
{
|
|
|
|
free(tf);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (as->accepted)
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
as2->accepted = eina_stringshare_add(as->accepted);
|
2011-02-14 00:45:26 -08:00
|
|
|
else
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
as2->accepted = NULL;
|
2011-02-14 00:45:26 -08:00
|
|
|
if (as->rejected)
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
as2->rejected = eina_stringshare_add(as->rejected);
|
2011-02-14 00:45:26 -08:00
|
|
|
else
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
as2->rejected = NULL;
|
2011-02-14 00:45:26 -08:00
|
|
|
tf->data = as2;
|
|
|
|
}
|
|
|
|
else
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
tf->data = data;
|
2011-02-14 00:45:26 -08:00
|
|
|
return tf;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-02-07 23:23:49 -08:00
|
|
|
_filter_free(Elm_Entry_Markup_Filter *tf)
|
2011-02-14 00:45:26 -08:00
|
|
|
{
|
|
|
|
if (tf->func == elm_entry_filter_limit_size)
|
|
|
|
{
|
|
|
|
Elm_Entry_Filter_Limit_Size *lim = tf->data;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-01-21 18:08:47 -08:00
|
|
|
free(lim);
|
2011-02-14 00:45:26 -08:00
|
|
|
}
|
|
|
|
else if (tf->func == elm_entry_filter_accept_set)
|
|
|
|
{
|
|
|
|
Elm_Entry_Filter_Accept_Set *as = tf->data;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
if (as)
|
|
|
|
{
|
2014-01-21 17:12:44 -08:00
|
|
|
eina_stringshare_del(as->accepted);
|
|
|
|
eina_stringshare_del(as->rejected);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-02-14 00:45:26 -08:00
|
|
|
free(as);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(tf);
|
|
|
|
}
|
|
|
|
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_mirrored_set(Evas_Object *obj,
|
|
|
|
Eina_Bool rtl)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
edje_object_mirrored_set(sd->entry_edje, rtl);
|
|
|
|
|
|
|
|
if (sd->anchor_hover.hover)
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_set(sd->anchor_hover.hover, rtl);
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
|
|
|
|
2013-11-08 00:06:08 -08:00
|
|
|
static void
|
|
|
|
_hide_selection_handler(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2014-04-24 01:52:22 -07:00
|
|
|
if (!sd->start_handler) return;
|
|
|
|
|
2014-05-25 19:28:12 -07:00
|
|
|
if (sd->start_handler_shown)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(sd->start_handler, "elm,handler,hide", "elm");
|
|
|
|
sd->start_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (sd->end_handler_shown)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(sd->end_handler, "elm,handler,hide", "elm");
|
|
|
|
sd->end_handler_shown = EINA_FALSE;
|
|
|
|
}
|
2013-11-08 00:06:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-20 03:33:42 -07:00
|
|
|
static Eina_Rectangle *
|
|
|
|
_viewport_region_get(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
Eina_Rectangle *rect = eina_rectangle_new(0, 0, 0, 0);
|
|
|
|
Evas_Object *parent;
|
|
|
|
|
2016-01-10 23:42:05 -08:00
|
|
|
if (!rect) return NULL;
|
2014-03-20 03:33:42 -07:00
|
|
|
if (sd->scroll)
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, &rect->x, &rect->y, &rect->w, &rect->h);
|
2014-03-20 03:33:42 -07:00
|
|
|
else
|
|
|
|
evas_object_geometry_get(sd->entry_edje, &rect->x, &rect->y, &rect->w, &rect->h);
|
|
|
|
|
|
|
|
parent = elm_widget_parent_get(obj);
|
|
|
|
while (parent)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_isa(parent, ELM_INTERFACE_SCROLLABLE_MIXIN))
|
2014-03-20 03:33:42 -07:00
|
|
|
{
|
2015-06-22 02:47:22 -07:00
|
|
|
Eina_Rectangle r;
|
|
|
|
EINA_RECTANGLE_SET(&r, 0, 0, 0, 0);
|
|
|
|
evas_object_geometry_get(parent, &r.x, &r.y, &r.w, &r.h);
|
|
|
|
if (!eina_rectangle_intersection(rect, &r))
|
2014-03-20 03:33:42 -07:00
|
|
|
{
|
|
|
|
rect->x = rect->y = rect->w = rect->h = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
parent = elm_widget_parent_get(parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
2013-11-08 00:06:08 -08:00
|
|
|
static void
|
|
|
|
_update_selection_handler(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2014-03-06 02:33:05 -08:00
|
|
|
Evas_Coord sx, sy, sh;
|
2013-11-08 00:06:08 -08:00
|
|
|
Evas_Coord ent_x, ent_y;
|
2014-03-06 02:33:05 -08:00
|
|
|
Evas_Coord ex, ey, eh;
|
|
|
|
int start_pos, end_pos, last_pos;
|
2013-11-08 00:06:08 -08:00
|
|
|
|
|
|
|
if (!sd->sel_handler_disabled)
|
|
|
|
{
|
2014-03-20 03:33:42 -07:00
|
|
|
Eina_Rectangle *rect;
|
|
|
|
Evas_Coord hx, hy;
|
|
|
|
Eina_Bool hidden = EINA_FALSE;
|
|
|
|
|
2014-04-24 01:52:22 -07:00
|
|
|
if (!sd->start_handler)
|
|
|
|
_create_selection_handlers(obj, sd);
|
|
|
|
|
2014-03-20 03:33:42 -07:00
|
|
|
rect = _viewport_region_get(obj);
|
2013-11-08 00:06:08 -08:00
|
|
|
start_pos = edje_object_part_text_cursor_pos_get
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_SELECTION_BEGIN);
|
|
|
|
end_pos = edje_object_part_text_cursor_pos_get
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_SELECTION_END);
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->entry_edje, &ent_x, &ent_y, NULL, NULL);
|
2014-03-06 02:33:05 -08:00
|
|
|
last_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
2014-03-20 03:33:42 -07:00
|
|
|
EDJE_CURSOR_MAIN);
|
2013-11-08 00:06:08 -08:00
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, start_pos);
|
|
|
|
edje_object_part_text_cursor_geometry_get(sd->entry_edje, "elm.text",
|
2014-03-06 02:33:05 -08:00
|
|
|
&sx, &sy, NULL, &sh);
|
2013-11-08 00:06:08 -08:00
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, end_pos);
|
|
|
|
edje_object_part_text_cursor_geometry_get(sd->entry_edje, "elm.text",
|
2014-03-06 02:33:05 -08:00
|
|
|
&ex, &ey, NULL, &eh);
|
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, last_pos);
|
2014-03-20 03:33:42 -07:00
|
|
|
if (start_pos < end_pos)
|
|
|
|
{
|
|
|
|
hx = ent_x + sx;
|
|
|
|
hy = ent_y + sy + sh;
|
|
|
|
evas_object_move(sd->start_handler, hx, hy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hx = ent_x + ex;
|
|
|
|
hy = ent_y + ey + eh;
|
|
|
|
evas_object_move(sd->start_handler, hx, hy);
|
|
|
|
}
|
|
|
|
if (!eina_rectangle_xcoord_inside(rect, hx) ||
|
|
|
|
!eina_rectangle_ycoord_inside(rect, hy))
|
|
|
|
{
|
|
|
|
hidden = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (!sd->start_handler_shown && !hidden)
|
2013-11-08 00:06:08 -08:00
|
|
|
{
|
2013-11-08 00:18:28 -08:00
|
|
|
edje_object_signal_emit(sd->start_handler,
|
|
|
|
"elm,handler,show", "elm");
|
2013-11-08 00:06:08 -08:00
|
|
|
sd->start_handler_shown = EINA_TRUE;
|
|
|
|
}
|
2014-03-20 03:33:42 -07:00
|
|
|
else if (sd->start_handler_shown && hidden)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(sd->start_handler,
|
|
|
|
"elm,handler,hide", "elm");
|
|
|
|
sd->start_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
hidden = EINA_FALSE;
|
2014-03-06 02:33:05 -08:00
|
|
|
if (start_pos < end_pos)
|
2014-03-20 03:33:42 -07:00
|
|
|
{
|
|
|
|
hx = ent_x + ex;
|
|
|
|
hy = ent_y + ey + eh;
|
|
|
|
evas_object_move(sd->end_handler, hx, hy);
|
|
|
|
}
|
2014-03-06 02:33:05 -08:00
|
|
|
else
|
2014-03-20 03:33:42 -07:00
|
|
|
{
|
|
|
|
hx = ent_x + sx;
|
|
|
|
hy = ent_y + sy + sh;
|
|
|
|
evas_object_move(sd->end_handler, hx, hy);
|
|
|
|
}
|
|
|
|
if (!eina_rectangle_xcoord_inside(rect, hx) ||
|
|
|
|
!eina_rectangle_ycoord_inside(rect, hy))
|
|
|
|
{
|
|
|
|
hidden = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (!sd->end_handler_shown && !hidden)
|
2013-11-08 00:06:08 -08:00
|
|
|
{
|
2013-11-08 00:18:28 -08:00
|
|
|
edje_object_signal_emit(sd->end_handler,
|
|
|
|
"elm,handler,show", "elm");
|
2013-11-08 00:06:08 -08:00
|
|
|
sd->end_handler_shown = EINA_TRUE;
|
|
|
|
}
|
2014-03-20 03:33:42 -07:00
|
|
|
else if (sd->end_handler_shown && hidden)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(sd->end_handler,
|
|
|
|
"elm,handler,hide", "elm");
|
|
|
|
sd->end_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
eina_rectangle_free(rect);
|
2013-11-08 00:06:08 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->start_handler_shown)
|
|
|
|
{
|
2013-11-08 00:18:28 -08:00
|
|
|
edje_object_signal_emit(sd->start_handler,
|
|
|
|
"elm,handler,hide", "elm");
|
2013-11-08 00:06:08 -08:00
|
|
|
sd->start_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
if (sd->end_handler_shown)
|
|
|
|
{
|
2013-11-08 00:18:28 -08:00
|
|
|
edje_object_signal_emit(sd->end_handler,
|
|
|
|
"elm,handler,hide", "elm");
|
2013-11-08 00:06:08 -08:00
|
|
|
sd->end_handler_shown = EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
static const char *
|
|
|
|
_elm_entry_theme_group_get(Evas_Object *obj)
|
2008-10-14 01:05:30 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
2009-09-26 11:00:51 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->editable)
|
|
|
|
{
|
|
|
|
if (sd->password) return "base-password";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->single_line) return "base-single";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (sd->line_wrap)
|
|
|
|
{
|
|
|
|
case ELM_WRAP_CHAR:
|
|
|
|
return "base-charwrap";
|
2011-09-29 05:02:49 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
case ELM_WRAP_WORD:
|
|
|
|
return "base";
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
case ELM_WRAP_MIXED:
|
|
|
|
return "base-mixedwrap";
|
2010-02-08 19:27:11 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
case ELM_WRAP_NONE:
|
|
|
|
default:
|
|
|
|
return "base-nowrap";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-07 05:50:00 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
else
|
2012-02-07 23:23:49 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->password) return "base-password";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sd->single_line) return "base-single-noedit";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (sd->line_wrap)
|
|
|
|
{
|
|
|
|
case ELM_WRAP_CHAR:
|
|
|
|
return "base-noedit-charwrap";
|
2011-09-29 05:02:49 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
case ELM_WRAP_WORD:
|
|
|
|
return "base-noedit";
|
|
|
|
|
|
|
|
case ELM_WRAP_MIXED:
|
|
|
|
return "base-noedit-mixedwrap";
|
|
|
|
|
|
|
|
case ELM_WRAP_NONE:
|
|
|
|
default:
|
|
|
|
return "base-nowrap-noedit";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-10-14 01:05:30 -07:00
|
|
|
}
|
|
|
|
|
2015-06-16 06:41:55 -07:00
|
|
|
static void
|
|
|
|
_edje_entry_user_insert(Evas_Object *obj, const char *data)
|
|
|
|
{
|
|
|
|
if (!data) return;
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
sd->changed = EINA_TRUE;
|
|
|
|
edje_object_part_text_user_insert(sd->entry_edje, "elm.text", data);
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2015-06-09 01:04:48 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_selection_data_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj,
|
|
|
|
Elm_Selection_Data *sel_data)
|
|
|
|
{
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
if (!sel_data->data) return EINA_FALSE;
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
buf = malloc(sel_data->len + 1);
|
|
|
|
if (!buf)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate memory, obj: %p", obj);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
memcpy(buf, sel_data->data, sel_data->len);
|
|
|
|
buf[sel_data->len] = '\0';
|
|
|
|
|
|
|
|
if ((sel_data->format & ELM_SEL_FORMAT_IMAGE) &&
|
|
|
|
(sd->cnp_mode != ELM_CNP_MODE_NO_IMAGE))
|
|
|
|
{
|
|
|
|
char *entry_tag;
|
|
|
|
int len;
|
|
|
|
static const char *tag_string =
|
|
|
|
"<item absize=240x180 href=file://%s></item>";
|
|
|
|
|
|
|
|
len = strlen(tag_string) + strlen(buf);
|
|
|
|
entry_tag = alloca(len + 1);
|
|
|
|
snprintf(entry_tag, len + 1, tag_string, buf);
|
2015-06-16 06:41:55 -07:00
|
|
|
_edje_entry_user_insert(obj, entry_tag);
|
2015-06-09 01:04:48 -07:00
|
|
|
}
|
2017-12-10 18:44:15 -08:00
|
|
|
else if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
|
2015-06-09 01:04:48 -07:00
|
|
|
{
|
|
|
|
char *txt = _elm_util_text_to_mkup(buf);
|
|
|
|
if (txt)
|
|
|
|
{
|
2015-06-16 06:41:55 -07:00
|
|
|
_edje_entry_user_insert(obj, txt);
|
2015-06-09 01:04:48 -07:00
|
|
|
free(txt);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Failed to convert text to markup text!");
|
|
|
|
}
|
|
|
|
}
|
2017-12-10 18:44:15 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_edje_entry_user_insert(obj, buf);
|
|
|
|
}
|
2015-06-09 01:04:48 -07:00
|
|
|
free(buf);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-05-09 01:28:02 -07:00
|
|
|
static void
|
|
|
|
_dnd_enter_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj)
|
|
|
|
{
|
|
|
|
elm_object_focus_set(obj, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_dnd_leave_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj)
|
|
|
|
{
|
|
|
|
if (_elm_config->desktop_entry)
|
|
|
|
elm_object_focus_set(obj, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_dnd_pos_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj,
|
|
|
|
Evas_Coord x,
|
|
|
|
Evas_Coord y,
|
|
|
|
Elm_Xdnd_Action action EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int pos;
|
|
|
|
Evas_Coord ox, oy, ex, ey;
|
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
evas_object_geometry_get(obj, &ox, &oy, NULL, NULL);
|
|
|
|
evas_object_geometry_get(sd->entry_edje, &ex, &ey, NULL, NULL);
|
|
|
|
x = x + ox - ex;
|
|
|
|
y = y + oy - ey;
|
|
|
|
|
|
|
|
edje_object_part_text_cursor_coord_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_USER, x, y);
|
|
|
|
pos = edje_object_part_text_cursor_pos_get
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_USER);
|
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, pos);
|
|
|
|
}
|
|
|
|
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
static Eina_Bool
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_drop_cb(void *data EINA_UNUSED,
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
Evas_Object *obj,
|
|
|
|
Elm_Selection_Data *drop)
|
|
|
|
{
|
|
|
|
Eina_Bool rv;
|
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
rv = edje_object_part_text_cursor_coord_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, drop->x, drop->y);
|
|
|
|
|
|
|
|
if (!rv) WRN("Warning: Failed to position cursor: paste anyway");
|
|
|
|
|
2015-06-09 01:09:47 -07:00
|
|
|
rv = _selection_data_cb(NULL, obj, drop);
|
|
|
|
|
|
|
|
return rv;
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static Elm_Sel_Format
|
|
|
|
_get_drop_format(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if ((sd->editable) && (!sd->single_line) && (!sd->password) && (!sd->disabled))
|
|
|
|
return ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE;
|
|
|
|
return ELM_SEL_FORMAT_MARKUP;
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
/* we can't reuse layout's here, because it's on entry_edje only */
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_entry_efl_ui_widget_on_disabled_update(Eo *obj, Elm_Entry_Data *sd, Eina_Bool disabled)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2017-08-23 22:06:32 -07:00
|
|
|
const char *emission;
|
|
|
|
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
elm_drop_target_del(obj, sd->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2017-08-23 22:06:32 -07:00
|
|
|
|
|
|
|
emission = disabled ? "elm,state,disabled" : "elm,state,enabled";
|
|
|
|
edje_object_signal_emit(sd->entry_edje, emission, "elm");
|
|
|
|
if (sd->scroll)
|
2012-11-02 01:15:24 -07:00
|
|
|
{
|
2017-08-23 22:06:32 -07:00
|
|
|
edje_object_signal_emit(sd->scr_edje, emission, "elm");
|
|
|
|
elm_interface_scrollable_freeze_set(obj, disabled);
|
2012-11-02 01:15:24 -07:00
|
|
|
}
|
2017-08-23 22:06:32 -07:00
|
|
|
sd->disabled = disabled;
|
|
|
|
|
|
|
|
if (!disabled)
|
2012-11-02 01:15:24 -07:00
|
|
|
{
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
sd->drop_format = _get_drop_format(obj);
|
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2012-11-02 01:15:24 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return EINA_TRUE;
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2016-02-17 14:43:33 -08:00
|
|
|
/* It gets the background object from from_edje object and
|
|
|
|
* sets the background object to to_edje object.
|
|
|
|
* The background object has to be moved to proper Edje object
|
|
|
|
* when scrollable status is changed. */
|
|
|
|
static void
|
|
|
|
_elm_entry_background_switch(Evas_Object *from_edje, Evas_Object *to_edje)
|
|
|
|
{
|
|
|
|
Evas_Object *bg_obj;
|
|
|
|
|
|
|
|
if (!from_edje || !to_edje) return;
|
|
|
|
|
|
|
|
if (edje_object_part_exists(from_edje, "elm.swallow.background") &&
|
|
|
|
edje_object_part_exists(to_edje, "elm.swallow.background") &&
|
|
|
|
!edje_object_part_swallow_get(to_edje, "elm.swallow.background"))
|
|
|
|
{
|
|
|
|
bg_obj = edje_object_part_swallow_get(from_edje, "elm.swallow.background");
|
|
|
|
|
|
|
|
if (bg_obj)
|
|
|
|
{
|
|
|
|
edje_object_part_unswallow(from_edje, bg_obj);
|
|
|
|
edje_object_part_swallow(to_edje, "elm.swallow.background", bg_obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
/* we can't issue the layout's theming code here, cause it assumes an
|
|
|
|
* unique edje object, always */
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_entry_efl_ui_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
|
2008-11-15 05:58:50 -08:00
|
|
|
{
|
2013-07-09 02:40:47 -07:00
|
|
|
const char *str;
|
2009-02-25 07:54:26 -08:00
|
|
|
const char *t;
|
2016-11-01 10:54:16 -07:00
|
|
|
const char *stl_user;
|
2014-01-08 00:42:55 -08:00
|
|
|
const char *style = elm_widget_style_get(obj);
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply theme_apply;
|
2018-03-06 18:46:44 -08:00
|
|
|
int cursor_pos;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-02 05:15:50 -07:00
|
|
|
// Note: We are skipping elm_layout here! This is by design.
|
|
|
|
// This assumes the following inheritance: my_class -> layout -> widget ...
|
2018-01-07 20:55:35 -08:00
|
|
|
theme_apply = efl_ui_widget_theme_apply(efl_cast(obj, EFL_UI_WIDGET_CLASS));
|
2017-08-09 00:13:06 -07:00
|
|
|
if (!theme_apply) return EFL_UI_THEME_APPLY_FAILED;
|
2011-09-29 05:02:49 -07:00
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
edje_object_part_text_hide_visible_password(sd->entry_edje, "elm.text");
|
Edje, Elementary: Remove <password=off> tag when password mode is disabled
Summary:
When edje_password_show_last option is enabled, the edje_entry uses <password=off>
for showing last character. But, when password mode is disabled by the elm_entry,
<password=off> is remained in the text. It can cause some problems.
Because, there is no way to control password mode by API for the edje_entry.
The elm_entry can't remove <password=off> tag before getting text from the edje_entry.
So, the patch adds edje_object_part_text_hide_visible_password() function and
the elm_entry will use this when elm_layout_theme_apply() is called.
@fix
Test Plan:
1. Run "elementary_test".
2. Show "Entry Password" demo. (Newly added by this patch)
3. Password mode is enabled. Put some text.
4. Click "Show Password" check box to disable password mode.
5. Put more text.
6. Click "Hide Password" check box to enable password mode again.
7. See a character among the text is visible. (without this patch)
Reviewers: tasn, herdsman, cedric, jpeg, thiepha, raster
Reviewed By: raster
Subscribers: Blackmole, z-wony, woohyun
Differential Revision: https://phab.enlightenment.org/D3988
2016-06-20 05:11:25 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_mirrored_set
|
2017-06-13 03:41:15 -07:00
|
|
|
(wd->resize_obj, efl_ui_mirrored_get(obj));
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
edje_object_scale_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj,
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_scale_get(obj) * elm_config_scale_get());
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2009-09-26 11:00:51 -07:00
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
stl_user = eina_stringshare_add(edje_object_part_text_style_user_peek(sd->entry_edje, "elm.text"));
|
2011-12-30 02:02:19 -08:00
|
|
|
t = eina_stringshare_add(elm_object_text_get(obj));
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
elm_widget_theme_object_set
|
2014-01-08 00:42:55 -08:00
|
|
|
(obj, sd->entry_edje, "entry", _elm_entry_theme_group_get(obj), style);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2016-05-11 19:10:42 -07:00
|
|
|
if (sd->sel_allow && _elm_config->desktop_entry)
|
2017-09-19 09:36:43 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
2016-05-11 19:10:42 -07:00
|
|
|
(sd->entry_edje, "elm.text", EINA_TRUE);
|
|
|
|
else
|
2017-09-19 09:36:43 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
2016-05-11 19:10:42 -07:00
|
|
|
(sd->entry_edje, "elm.text", EINA_FALSE);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-06-09 07:55:40 -07:00
|
|
|
edje_object_part_text_style_user_push(sd->entry_edje, "elm.text", stl_user);
|
2016-11-01 10:54:16 -07:00
|
|
|
eina_stringshare_del(stl_user);
|
|
|
|
|
2018-03-06 18:46:44 -08:00
|
|
|
cursor_pos = sd->cursor_pos;
|
|
|
|
|
2011-12-30 02:02:19 -08:00
|
|
|
elm_object_text_set(obj, t);
|
2009-02-25 07:54:26 -08:00
|
|
|
eina_stringshare_del(t);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2010-10-07 00:44:50 -07:00
|
|
|
if (elm_widget_disabled_get(obj))
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,disabled", "elm");
|
|
|
|
|
|
|
|
edje_object_part_text_input_panel_layout_set
|
2013-06-26 09:54:26 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Input_Panel_Layout)sd->input_panel_layout);
|
2013-03-27 01:34:19 -07:00
|
|
|
edje_object_part_text_input_panel_layout_variation_set
|
|
|
|
(sd->entry_edje, "elm.text", sd->input_panel_layout_variation);
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_autocapital_type_set
|
2013-06-26 09:54:26 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Text_Autocapital_Type)sd->autocapital_type);
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_prediction_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", sd->prediction_allow);
|
2014-09-01 03:04:05 -07:00
|
|
|
edje_object_part_text_input_hint_set
|
2015-07-29 07:26:14 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Input_Hints)sd->input_hints);
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_enabled_set
|
|
|
|
(sd->entry_edje, "elm.text", sd->input_panel_enable);
|
|
|
|
edje_object_part_text_input_panel_imdata_set
|
|
|
|
(sd->entry_edje, "elm.text", sd->input_panel_imdata,
|
|
|
|
sd->input_panel_imdata_len);
|
|
|
|
edje_object_part_text_input_panel_return_key_type_set
|
2013-06-26 09:54:26 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Input_Panel_Return_Key_Type)sd->input_panel_return_key_type);
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_return_key_disabled_set
|
|
|
|
(sd->entry_edje, "elm.text", sd->input_panel_return_key_disabled);
|
2014-01-13 02:32:01 -08:00
|
|
|
edje_object_part_text_input_panel_show_on_demand_set
|
|
|
|
(sd->entry_edje, "elm.text", sd->input_panel_show_on_demand);
|
2017-06-25 21:44:58 -07:00
|
|
|
edje_object_part_text_prediction_hint_set
|
|
|
|
(sd->entry_edje, "elm.text", sd->prediction_hint);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-10-21 04:59:43 -07:00
|
|
|
evas_object_ref(obj);
|
|
|
|
|
2018-03-06 18:46:44 -08:00
|
|
|
if (cursor_pos) elm_entry_cursor_pos_set(obj, cursor_pos);
|
|
|
|
|
2017-11-29 00:39:42 -08:00
|
|
|
if (efl_ui_focus_object_focus_get(obj))
|
2016-02-26 06:25:31 -08:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,action,focus", "elm");
|
|
|
|
if (sd->scroll)
|
|
|
|
edje_object_signal_emit(sd->scr_edje, "elm,action,focus", "elm");
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
edje_object_message_signal_process(sd->entry_edje);
|
|
|
|
|
2015-07-28 12:00:58 -07:00
|
|
|
Evas_Object* clip = evas_object_clip_get(sd->entry_edje);
|
|
|
|
evas_object_clip_set(sd->hit_rect, clip);
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->scroll)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply ok = EFL_UI_THEME_APPLY_FAILED;
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2018-02-14 18:14:52 -08:00
|
|
|
efl_ui_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-03-11 06:17:53 -07:00
|
|
|
if (sd->single_line)
|
|
|
|
ok = elm_widget_theme_object_set
|
2014-01-08 00:42:55 -08:00
|
|
|
(obj, sd->scr_edje, "scroller", "entry_single", style);
|
2013-03-11 06:17:53 -07:00
|
|
|
if (!ok)
|
|
|
|
elm_widget_theme_object_set
|
2014-01-08 00:42:55 -08:00
|
|
|
(obj, sd->scr_edje, "scroller", "entry", style);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2016-02-17 14:43:33 -08:00
|
|
|
_elm_entry_background_switch(sd->entry_edje, sd->scr_edje);
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
str = edje_object_data_get(sd->scr_edje, "focus_highlight");
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
2013-07-09 02:40:47 -07:00
|
|
|
else
|
|
|
|
{
|
2016-02-17 14:43:33 -08:00
|
|
|
_elm_entry_background_switch(sd->scr_edje, sd->entry_edje);
|
|
|
|
|
2013-07-09 02:40:47 -07:00
|
|
|
str = edje_object_data_get(sd->entry_edje, "focus_highlight");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((str) && (!strcmp(str, "on")))
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
|
|
|
|
else
|
|
|
|
elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-04-24 01:52:22 -07:00
|
|
|
if (sd->start_handler)
|
|
|
|
{
|
2016-08-04 03:13:29 -07:00
|
|
|
_elm_theme_object_set(obj, sd->start_handler,
|
2014-04-24 01:52:22 -07:00
|
|
|
"entry", "handler/start", style);
|
2016-08-04 03:13:29 -07:00
|
|
|
_elm_theme_object_set(obj, sd->end_handler,
|
2014-04-24 01:52:22 -07:00
|
|
|
"entry", "handler/end", style);
|
|
|
|
}
|
2017-04-25 06:34:03 -07:00
|
|
|
elm_entry_icon_visible_set(obj, EINA_TRUE);
|
|
|
|
elm_entry_end_visible_set(obj, EINA_TRUE);
|
2013-11-08 00:06:08 -08:00
|
|
|
|
elementary entry: send a signal to edje for notifying scrollable mode
Summary:
If entry edje should be changed according to scrollable mode,
the signal will be used. The following signals are added.
"elm,scroll,enable"
"elm,scroll,disable"
Test Plan: N/A
Reviewers: raster, tasn, herdsman, cedric
Subscribers: minkyu, jpeg, akanad, z-wony, Blackmole
Differential Revision: https://phab.enlightenment.org/D4254
2016-09-26 06:03:45 -07:00
|
|
|
if (sd->scroll)
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, "elm,scroll,enable", "elm");
|
elementary entry: send a signal to edje for notifying scrollable mode
Summary:
If entry edje should be changed according to scrollable mode,
the signal will be used. The following signals are added.
"elm,scroll,enable"
"elm,scroll,disable"
Test Plan: N/A
Reviewers: raster, tasn, herdsman, cedric
Subscribers: minkyu, jpeg, akanad, z-wony, Blackmole
Differential Revision: https://phab.enlightenment.org/D4254
2016-09-26 06:03:45 -07:00
|
|
|
else
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_emit(sd->entry_edje, "elm,scroll,disable", "elm");
|
elementary entry: send a signal to edje for notifying scrollable mode
Summary:
If entry edje should be changed according to scrollable mode,
the signal will be used. The following signals are added.
"elm,scroll,enable"
"elm,scroll,disable"
Test Plan: N/A
Reviewers: raster, tasn, herdsman, cedric
Subscribers: minkyu, jpeg, akanad, z-wony, Blackmole
Differential Revision: https://phab.enlightenment.org/D4254
2016-09-26 06:03:45 -07:00
|
|
|
|
2013-03-11 06:17:53 -07:00
|
|
|
sd->changed = EINA_TRUE;
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
|
|
|
|
sd->has_text = !sd->has_text;
|
|
|
|
_elm_entry_guide_update(obj, !sd->has_text);
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2008-11-15 05:58:50 -08:00
|
|
|
|
2018-04-06 09:15:31 -07:00
|
|
|
efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_OBJECT_EVENT_THEME_CHANGED, NULL);
|
2009-09-26 11:00:51 -07:00
|
|
|
|
2013-10-21 04:59:43 -07:00
|
|
|
evas_object_unref(obj);
|
2013-10-21 03:45:53 -07:00
|
|
|
|
2017-08-02 05:15:50 -07:00
|
|
|
return theme_apply;
|
2009-08-26 05:51:27 -07:00
|
|
|
}
|
|
|
|
|
2011-06-17 02:44:31 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_cursor_geometry_recalc(Evas_Object *obj)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->deferred_recalc_job)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->cur_changed)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect sr = {};
|
2017-08-29 21:39:16 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->cur_changed = EINA_FALSE;
|
2017-08-29 21:39:16 -07:00
|
|
|
edje_object_part_text_cursor_geometry_get
|
|
|
|
(sd->entry_edje, "elm.text", &sr.x, &sr.y, &sr.w, &sr.h);
|
|
|
|
elm_widget_show_region_set(obj, sr, EINA_FALSE);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->deferred_cur = EINA_TRUE;
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
|
2008-10-17 20:55:44 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_deferred_recalc_job(void *data)
|
2008-10-17 20:55:44 -07:00
|
|
|
{
|
2011-07-21 04:02:07 -07:00
|
|
|
Evas_Coord minh = -1, resw = -1, minw = -1, fw = 0, fh = 0;
|
2011-04-28 10:50:26 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
sd->deferred_recalc_job = NULL;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->entry_edje, NULL, NULL, &resw, NULL);
|
|
|
|
edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, resw, 0);
|
2011-12-06 07:52:05 -08:00
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-04-28 08:47:01 -07:00
|
|
|
/* This is a hack to workaround the way min size hints are treated.
|
2012-08-30 09:45:15 -07:00
|
|
|
* If the minimum width is smaller than the restricted width, it
|
|
|
|
* means the minimum doesn't matter. */
|
2011-04-28 08:47:01 -07:00
|
|
|
if (minw <= resw)
|
|
|
|
{
|
|
|
|
Evas_Coord ominw = -1;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(data, &ominw, NULL);
|
2011-04-28 08:47:01 -07:00
|
|
|
minw = ominw;
|
|
|
|
}
|
2011-07-21 04:30:05 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->ent_mw = minw;
|
|
|
|
sd->ent_mh = minh;
|
2011-12-06 07:52:11 -08:00
|
|
|
|
2011-07-21 04:02:07 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &fw, 1, &fh);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->scroll)
|
2011-07-21 04:02:07 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vmw = 0, vmh = 0;
|
2011-07-21 04:30:05 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
|
|
|
|
if (sd->single_line)
|
2011-07-21 04:02:07 -07:00
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(data, vmw, minh + vmh);
|
|
|
|
evas_object_size_hint_max_set(data, -1, minh + vmh);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(data, vmw, vmh);
|
|
|
|
evas_object_size_hint_max_set(data, -1, -1);
|
|
|
|
}
|
|
|
|
}
|
2011-06-17 02:44:31 -07:00
|
|
|
else
|
2011-07-21 04:02:07 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->single_line)
|
2011-07-21 04:02:07 -07:00
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(data, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(data, -1, minh);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_size_hint_min_set(data, fw, minh);
|
|
|
|
evas_object_size_hint_max_set(data, -1, -1);
|
|
|
|
}
|
|
|
|
}
|
2011-04-07 01:47:18 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->deferred_cur)
|
2011-04-28 10:50:26 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->cur_changed)
|
2011-05-18 04:48:38 -07:00
|
|
|
{
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect sr = {};
|
2017-08-29 21:39:16 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->cur_changed = EINA_FALSE;
|
2017-08-29 21:39:16 -07:00
|
|
|
edje_object_part_text_cursor_geometry_get
|
|
|
|
(sd->entry_edje, "elm.text", &sr.x, &sr.y, &sr.w, &sr.h);
|
|
|
|
elm_widget_show_region_set(data, sr, EINA_FALSE);
|
2011-05-18 04:48:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_elm_layout_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
|
2008-10-14 01:05:30 -07:00
|
|
|
{
|
2011-04-07 01:47:18 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2010-03-09 03:42:53 -08:00
|
|
|
Evas_Coord resw, resh;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-06-17 02:44:31 -07:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &resw, &resh);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->line_wrap)
|
2008-10-17 07:40:54 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((resw == sd->last_w) && (!sd->changed))
|
2012-08-20 00:35:31 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->scroll)
|
2012-08-20 00:35:31 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vw = 0, vh = 0, w = 0, h = 0;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &vw, &vh);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
w = sd->ent_mw;
|
|
|
|
h = sd->ent_mh;
|
|
|
|
if (vw > sd->ent_mw) w = vw;
|
|
|
|
if (vh > sd->ent_mh) h = vh;
|
|
|
|
evas_object_resize(sd->entry_edje, w, h);
|
|
|
|
|
2012-08-20 00:35:31 -07:00
|
|
|
return;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-08-20 00:35:31 -07:00
|
|
|
return;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->changed = EINA_FALSE;
|
|
|
|
sd->last_w = resw;
|
|
|
|
if (sd->scroll)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_resize(sd->scr_edje, resw, resh);
|
|
|
|
edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &vw, &vh);
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_size_min_restricted_calc
|
|
|
|
(sd->entry_edje, &minw, &minh, vw, 0);
|
2011-12-06 07:52:11 -08:00
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
/* This is a hack to workaround the way min size hints
|
|
|
|
* are treated. If the minimum width is smaller than the
|
|
|
|
* restricted width, it means the minimum doesn't
|
|
|
|
* matter. */
|
2011-12-06 07:52:11 -08:00
|
|
|
if (minw <= vw)
|
|
|
|
{
|
|
|
|
Evas_Coord ominw = -1;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(sd->entry_edje, &ominw, NULL);
|
2011-12-06 07:52:11 -08:00
|
|
|
minw = ominw;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->ent_mw = minw;
|
|
|
|
sd->ent_mh = minh;
|
|
|
|
|
2011-06-17 02:44:31 -07:00
|
|
|
if ((minw > 0) && (vw < minw)) vw = minw;
|
|
|
|
if (minh > vh) vh = minh;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->single_line) h = vmh + minh;
|
2011-06-17 02:44:31 -07:00
|
|
|
else h = vmh;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
evas_object_resize(sd->entry_edje, vw, vh);
|
2011-06-17 02:44:31 -07:00
|
|
|
evas_object_size_hint_min_set(obj, w, h);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->single_line)
|
2011-07-11 21:51:39 -07:00
|
|
|
evas_object_size_hint_max_set(obj, -1, h);
|
2011-06-17 02:44:31 -07:00
|
|
|
else
|
2011-07-11 21:51:39 -07:00
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->deferred_recalc_job);
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->deferred_recalc_job =
|
|
|
|
ecore_job_add(_deferred_recalc_job, obj);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2008-10-17 07:40:54 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->changed) return;
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->changed = EINA_FALSE;
|
|
|
|
sd->last_w = resw;
|
|
|
|
if (sd->scroll)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
|
|
|
Evas_Coord vw = 0, vh = 0, vmw = 0, vmh = 0, w = -1, h = -1;
|
2011-07-03 00:49:02 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_size_min_calc(sd->entry_edje, &minw, &minh);
|
|
|
|
sd->ent_mw = minw;
|
|
|
|
sd->ent_mh = minh;
|
2011-06-17 02:44:31 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
2011-07-03 00:49:02 -07:00
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &vw, &vh);
|
2011-06-17 02:44:31 -07:00
|
|
|
|
2012-01-29 03:55:29 -08:00
|
|
|
if (minw > vw) vw = minw;
|
|
|
|
if (minh > vh) vh = minh;
|
2011-06-17 02:44:31 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_resize(sd->entry_edje, vw, vh);
|
|
|
|
edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
|
|
|
|
if (sd->single_line) h = vmh + minh;
|
2011-06-17 02:44:31 -07:00
|
|
|
else h = vmh;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-06-17 02:44:31 -07:00
|
|
|
evas_object_size_hint_min_set(obj, w, h);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->single_line)
|
2011-07-11 21:51:39 -07:00
|
|
|
evas_object_size_hint_max_set(obj, -1, h);
|
2011-06-17 02:44:31 -07:00
|
|
|
else
|
2011-07-11 21:51:39 -07:00
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_size_min_calc(sd->entry_edje, &minw, &minh);
|
|
|
|
sd->ent_mw = minw;
|
|
|
|
sd->ent_mh = minh;
|
2011-06-17 02:44:31 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->single_line)
|
2011-07-11 21:51:39 -07:00
|
|
|
evas_object_size_hint_max_set(obj, -1, minh);
|
2011-06-17 02:44:31 -07:00
|
|
|
else
|
2011-07-11 21:51:39 -07:00
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2008-10-17 07:40:54 -07:00
|
|
|
}
|
2011-05-18 04:48:38 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
_cursor_geometry_recalc(obj);
|
2008-10-14 01:05:30 -07:00
|
|
|
}
|
|
|
|
|
2012-02-27 17:50:19 -08:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_return_key_enabled_check(Evas_Object *obj)
|
2012-02-27 17:50:19 -08:00
|
|
|
{
|
|
|
|
Eina_Bool return_key_disabled = EINA_FALSE;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!sd->auto_return_key) return;
|
2012-02-27 17:50:19 -08:00
|
|
|
|
|
|
|
if (elm_entry_is_empty(obj) == EINA_TRUE)
|
|
|
|
return_key_disabled = EINA_TRUE;
|
|
|
|
|
|
|
|
elm_entry_input_panel_return_key_disabled_set(obj, return_key_disabled);
|
|
|
|
}
|
|
|
|
|
elementary entry: update focus state when editable state is changed
Summary:
To recieve keyboard events, the entry_edje should have Evas focus.
But, if a non editable Entry widget takes focus, it can't recieve
keyboard events even if it becomes editable after taking focus.
So, elm_entry_editable_set() function should update Entry's focus state.
@fix
Test Plan:
The code of elementary_test - entry is modified to test this issue.
Please, check the issue with the following steps.
1. Run "elementary_test entry"
2. Click "Unfocus" button to make entry to "unfocused" state.
3. Click "Edit" button to make entry to non-editable mode.
4. Click "Focus" button to make entry to "focused" state.
5. Click "Edit" button to make entry to editable mode.
6. See a cursor is blinking in entry.
=> But, you can't edit text without this patch.
Reviewers: raster, herdsman, cedric, jpeg, woohyun
Differential Revision: https://phab.enlightenment.org/D4858
2017-06-08 22:19:57 -07:00
|
|
|
static void
|
|
|
|
_elm_entry_focus_update(Eo *obj, Elm_Entry_Data *sd)
|
2008-10-14 01:05:30 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
Evas_Object *top;
|
2013-07-05 03:04:14 -07:00
|
|
|
Eina_Bool top_is_win = EINA_FALSE;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
top = elm_widget_top_get(obj);
|
2016-08-15 06:44:41 -07:00
|
|
|
if (top && efl_isa(top, EFL_UI_WIN_CLASS))
|
2012-09-28 07:07:16 -07:00
|
|
|
top_is_win = EINA_TRUE;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-10-20 02:45:07 -07:00
|
|
|
if (efl_ui_focus_object_focus_get(obj) && sd->editable)
|
2008-11-16 21:58:21 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_focus_set(sd->entry_edje, EINA_TRUE);
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,action,focus", "elm");
|
2016-02-26 06:25:31 -08:00
|
|
|
if (sd->scroll)
|
|
|
|
edje_object_signal_emit(sd->scr_edje, "elm,action,focus", "elm");
|
|
|
|
|
2014-01-13 02:32:01 -08:00
|
|
|
if (top && top_is_win && sd->input_panel_enable && !sd->input_panel_show_on_demand &&
|
2013-07-13 02:58:30 -07:00
|
|
|
!edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text"))
|
2011-10-26 22:43:08 -07:00
|
|
|
elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
|
2015-05-13 00:57:16 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_FOCUSED, EINA_TRUE);
|
2012-08-30 09:45:15 -07:00
|
|
|
_return_key_enabled_check(obj);
|
2015-04-02 02:37:37 -07:00
|
|
|
_validate(obj);
|
2008-11-16 21:58:21 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,action,unfocus", "elm");
|
2016-02-26 06:25:31 -08:00
|
|
|
if (sd->scroll)
|
|
|
|
edje_object_signal_emit(sd->scr_edje, "elm,action,unfocus", "elm");
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_focus_set(sd->entry_edje, EINA_FALSE);
|
2013-07-13 02:58:30 -07:00
|
|
|
if (top && top_is_win && sd->input_panel_enable &&
|
|
|
|
!edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text"))
|
2011-10-26 22:43:08 -07:00
|
|
|
elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_OFF);
|
2015-05-13 00:57:16 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(obj, EFL_ACCESS_STATE_FOCUSED, EINA_FALSE);
|
2012-11-29 00:58:49 -08:00
|
|
|
|
|
|
|
if (_elm_config->selection_clear_enable)
|
|
|
|
{
|
|
|
|
if ((sd->have_selection) && (!sd->hoversel))
|
|
|
|
{
|
|
|
|
sd->sel_mode = EINA_FALSE;
|
|
|
|
elm_widget_scroll_hold_pop(obj);
|
|
|
|
edje_object_part_text_select_allow_set(sd->entry_edje, "elm.text", EINA_FALSE);
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
|
|
|
|
edje_object_part_text_select_none(sd->entry_edje, "elm.text");
|
|
|
|
}
|
|
|
|
}
|
2018-01-15 22:12:49 -08:00
|
|
|
if (sd->scr_edje)
|
|
|
|
edje_object_signal_emit(sd->scr_edje, "validation,default", "elm");
|
2008-11-16 21:58:21 -08:00
|
|
|
}
|
elementary entry: update focus state when editable state is changed
Summary:
To recieve keyboard events, the entry_edje should have Evas focus.
But, if a non editable Entry widget takes focus, it can't recieve
keyboard events even if it becomes editable after taking focus.
So, elm_entry_editable_set() function should update Entry's focus state.
@fix
Test Plan:
The code of elementary_test - entry is modified to test this issue.
Please, check the issue with the following steps.
1. Run "elementary_test entry"
2. Click "Unfocus" button to make entry to "unfocused" state.
3. Click "Edit" button to make entry to non-editable mode.
4. Click "Focus" button to make entry to "focused" state.
5. Click "Edit" button to make entry to editable mode.
6. See a cursor is blinking in entry.
=> But, you can't edit text without this patch.
Reviewers: raster, herdsman, cedric, jpeg, woohyun
Differential Revision: https://phab.enlightenment.org/D4858
2017-06-08 22:19:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-01-19 00:25:47 -08:00
|
|
|
_elm_entry_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Entry_Data *sd)
|
elementary entry: update focus state when editable state is changed
Summary:
To recieve keyboard events, the entry_edje should have Evas focus.
But, if a non editable Entry widget takes focus, it can't recieve
keyboard events even if it becomes editable after taking focus.
So, elm_entry_editable_set() function should update Entry's focus state.
@fix
Test Plan:
The code of elementary_test - entry is modified to test this issue.
Please, check the issue with the following steps.
1. Run "elementary_test entry"
2. Click "Unfocus" button to make entry to "unfocused" state.
3. Click "Edit" button to make entry to non-editable mode.
4. Click "Focus" button to make entry to "focused" state.
5. Click "Edit" button to make entry to editable mode.
6. See a cursor is blinking in entry.
=> But, you can't edit text without this patch.
Reviewers: raster, herdsman, cedric, jpeg, woohyun
Differential Revision: https://phab.enlightenment.org/D4858
2017-06-08 22:19:57 -07:00
|
|
|
{
|
|
|
|
_elm_entry_focus_update(obj, sd);
|
2011-10-11 19:49:23 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return EINA_TRUE;
|
2011-08-18 21:21:36 -07:00
|
|
|
}
|
|
|
|
|
2017-09-13 19:59:44 -07:00
|
|
|
EOLIAN static Eina_Rect
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_ui_widget_interest_region_get(const Eo *obj, Elm_Entry_Data *sd)
|
2011-10-19 07:17:14 -07:00
|
|
|
{
|
2016-06-26 23:04:20 -07:00
|
|
|
Evas_Coord cx, cy, cw, ch;
|
|
|
|
Evas_Coord edx, edy;
|
|
|
|
Evas_Coord elx, ely, elw, elh;
|
2017-09-13 19:59:44 -07:00
|
|
|
Eina_Rect r;
|
Elm entry: fix returning wrong focus region
Summary:
In on_focus_region function,
entry returns relative x,y position from edje object.
It should be calculated from elm object's position.
@fix
Test Plan:
1. $elementary_test "Entry on Page Scroll"
2. click under button
3. click upper text in entry
4. page should not be scrolled
Reviewers: tasn, cedric, woohyun, Hermet, herdsman, raster
Subscribers: Blackmole, id213sin, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3923
2016-05-26 01:19:34 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_cursor_geometry_get
|
2016-06-26 23:04:20 -07:00
|
|
|
(sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
|
2015-11-23 08:44:57 -08:00
|
|
|
|
|
|
|
if (sd->single_line)
|
|
|
|
{
|
2016-06-26 23:04:20 -07:00
|
|
|
evas_object_geometry_get(sd->entry_edje, &edx, &edy, NULL, &ch);
|
|
|
|
cy = 0;
|
2015-11-23 08:44:57 -08:00
|
|
|
}
|
2016-06-26 23:04:20 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(sd->entry_edje, &edx, &edy, NULL, NULL);
|
|
|
|
}
|
|
|
|
evas_object_geometry_get(obj, &elx, &ely, &elw, &elh);
|
2015-11-23 08:44:57 -08:00
|
|
|
|
2017-08-29 19:29:08 -07:00
|
|
|
r.x = cx + edx - elx;
|
|
|
|
if ((cw < elw) && (r.x + cw > elw)) r.x = elw - cw;
|
|
|
|
r.y = cy + edy - ely;
|
|
|
|
if ((ch < elh) && (r.y + ch > elh)) r.y = elh - ch;
|
|
|
|
r.w = MAX(cw, 1);
|
|
|
|
r.h = MAX(ch, 1);
|
Elm entry: fix returning wrong focus region
Summary:
In on_focus_region function,
entry returns relative x,y position from edje object.
It should be calculated from elm object's position.
@fix
Test Plan:
1. $elementary_test "Entry on Page Scroll"
2. click under button
3. click upper text in entry
4. page should not be scrolled
Reviewers: tasn, cedric, woohyun, Hermet, herdsman, raster
Subscribers: Blackmole, id213sin, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3923
2016-05-26 01:19:34 -07:00
|
|
|
|
2017-08-29 19:29:08 -07:00
|
|
|
return r;
|
2010-06-15 08:04:05 -07:00
|
|
|
}
|
|
|
|
|
2010-10-22 11:29:51 -07:00
|
|
|
static void
|
2017-09-13 19:59:44 -07:00
|
|
|
_show_region_hook(void *data EINA_UNUSED, Evas_Object *obj, Eina_Rect r)
|
2010-10-22 11:29:51 -07:00
|
|
|
{
|
2017-08-21 23:16:54 -07:00
|
|
|
elm_interface_scrollable_content_region_show(obj, r.x, r.y, r.w, r.h);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_entry_efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Evas_Object *sobj)
|
2011-10-11 19:49:23 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2012-08-30 09:45:15 -07:00
|
|
|
/* unfortunately entry doesn't follow the signal pattern
|
|
|
|
* elm,state,icon,{visible,hidden}, so we have to replicate this
|
|
|
|
* smart function */
|
|
|
|
if (sobj == elm_layout_content_get(obj, "elm.swallow.icon"))
|
2011-10-11 19:49:23 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,action,hide,icon", "elm");
|
2011-10-11 19:49:23 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
else if (sobj == elm_layout_content_get(obj, "elm.swallow.end"))
|
2011-10-11 19:49:23 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,action,hide,end", "elm");
|
2011-10-11 19:49:23 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-23 04:41:37 -07:00
|
|
|
ret = elm_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj);
|
2014-03-22 10:44:29 -07:00
|
|
|
if (!ret) return EINA_FALSE;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return EINA_TRUE;
|
2011-10-11 19:49:23 -07:00
|
|
|
}
|
|
|
|
|
2009-03-19 06:36:46 -07:00
|
|
|
static void
|
|
|
|
_hoversel_position(Evas_Object *obj)
|
|
|
|
{
|
2016-01-04 15:08:49 -08:00
|
|
|
Evas_Coord cx, cy, cw, ch, x, y, mw, mh, w, h;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
elementary / entry, list, scroller, fileselector_button, config, photocam, map, pan, bg, store, priv, pager, conform, box, clock, flipselector
fixed indentation, removed white spaces.
SVN revision: 58267
2011-04-01 12:08:56 -07:00
|
|
|
|
2011-04-01 05:10:24 -07:00
|
|
|
cx = cy = 0;
|
|
|
|
cw = ch = 1;
|
2016-01-04 15:08:49 -08:00
|
|
|
evas_object_geometry_get(sd->entry_edje, &x, &y, &w, &h);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->use_down)
|
2011-04-01 05:10:24 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
cx = sd->downx - x;
|
|
|
|
cy = sd->downy - y;
|
2011-04-01 05:10:24 -07:00
|
|
|
cw = 1;
|
|
|
|
ch = 1;
|
|
|
|
}
|
|
|
|
else
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_cursor_geometry_get
|
|
|
|
(sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
|
|
|
|
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(sd->hoversel, &mw, &mh);
|
2016-01-04 15:08:49 -08:00
|
|
|
if (cx + mw > w)
|
|
|
|
cx = w - mw;
|
|
|
|
if (cy + mh > h)
|
|
|
|
cy = h - mh;
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_move(sd->hoversel, x + cx, y + cy);
|
2016-01-04 15:08:49 -08:00
|
|
|
evas_object_resize(sd->hoversel, mw, mh);
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_hover_del_job(void *data)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
2009-03-19 06:36:46 -07:00
|
|
|
|
2013-07-03 04:29:43 -07:00
|
|
|
ELM_SAFE_FREE(sd->hoversel, evas_object_del);
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->hov_deljob = NULL;
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_hover_dismissed_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
2010-06-23 19:54:03 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->use_down = 0;
|
|
|
|
if (sd->hoversel) evas_object_hide(sd->hoversel);
|
|
|
|
if (sd->sel_mode)
|
2010-03-25 21:45:11 -07:00
|
|
|
{
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->password)
|
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_TRUE);
|
2011-04-01 06:20:40 -07:00
|
|
|
}
|
2010-03-25 21:45:11 -07:00
|
|
|
}
|
2009-03-20 08:08:33 -07:00
|
|
|
elm_widget_scroll_freeze_pop(data);
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->hov_deljob);
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->hov_deljob = ecore_job_add(_hover_del_job, data);
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_hover_selected_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2016-05-11 19:10:42 -07:00
|
|
|
if (!sd->sel_allow) return;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->sel_mode = EINA_TRUE;
|
|
|
|
edje_object_part_text_select_none(sd->entry_edje, "elm.text");
|
|
|
|
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->password)
|
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_TRUE);
|
2011-04-01 06:20:40 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,select,on", "elm");
|
|
|
|
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
2011-04-21 19:29:54 -07:00
|
|
|
elm_widget_scroll_hold_push(data);
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
2016-05-10 10:20:56 -07:00
|
|
|
static char *
|
|
|
|
_item_tags_remove(const char *str)
|
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
|
|
|
|
if (!str)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
|
|
|
if (!buf)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (!eina_strbuf_append(buf, str))
|
|
|
|
{
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (EINA_TRUE)
|
|
|
|
{
|
|
|
|
const char *temp = eina_strbuf_string_get(buf);
|
|
|
|
char *start_tag = NULL;
|
|
|
|
char *end_tag = NULL;
|
|
|
|
size_t sindex;
|
|
|
|
size_t eindex;
|
|
|
|
|
|
|
|
start_tag = strstr(temp, "<item");
|
|
|
|
if (!start_tag)
|
|
|
|
start_tag = strstr(temp, "</item");
|
|
|
|
if (start_tag)
|
|
|
|
end_tag = strstr(start_tag, ">");
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
if (!end_tag || start_tag > end_tag)
|
|
|
|
break;
|
|
|
|
|
|
|
|
sindex = start_tag - temp;
|
|
|
|
eindex = end_tag - temp + 1;
|
|
|
|
if (!eina_strbuf_remove(buf, sindex, eindex))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = eina_strbuf_string_steal(buf);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_elm_entry_entry_paste(Evas_Object *obj,
|
|
|
|
const char *entry)
|
|
|
|
{
|
|
|
|
char *str = NULL;
|
|
|
|
|
|
|
|
if (!entry) return;
|
|
|
|
|
|
|
|
ELM_ENTRY_CHECK(obj);
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2016-05-10 10:20:56 -07:00
|
|
|
if (sd->cnp_mode == ELM_CNP_MODE_NO_IMAGE)
|
|
|
|
{
|
|
|
|
str = _item_tags_remove(entry);
|
|
|
|
if (!str) str = strdup(entry);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
str = strdup(entry);
|
|
|
|
if (!str) str = (char *)entry;
|
|
|
|
|
|
|
|
_edje_entry_user_insert(obj, str);
|
|
|
|
|
|
|
|
if (str != entry) free(str);
|
|
|
|
}
|
|
|
|
|
2009-03-19 06:36:46 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_paste_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2013-11-07 04:01:00 -08:00
|
|
|
Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(data, EFL_UI_EVENT_SELECTION_PASTE, NULL);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-11-07 04:01:00 -08:00
|
|
|
sd->selection_asked = EINA_TRUE;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-11-07 04:01:00 -08:00
|
|
|
if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
|
|
|
|
formats = ELM_SEL_FORMAT_TEXT;
|
|
|
|
else if (sd->cnp_mode != ELM_CNP_MODE_NO_IMAGE)
|
|
|
|
formats |= ELM_SEL_FORMAT_IMAGE;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-11-07 04:01:00 -08:00
|
|
|
elm_cnp_selection_get
|
2015-06-09 01:04:48 -07:00
|
|
|
(data, ELM_SEL_TYPE_CLIPBOARD, formats, _selection_data_cb, NULL);
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
2015-06-23 08:11:05 -07:00
|
|
|
static void
|
|
|
|
_selection_clear(void *data, Elm_Sel_Type selection)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2015-06-23 08:11:05 -07:00
|
|
|
if (!sd->have_selection) return;
|
|
|
|
if ((selection == ELM_SEL_TYPE_CLIPBOARD) ||
|
|
|
|
(selection == ELM_SEL_TYPE_PRIMARY))
|
|
|
|
{
|
|
|
|
elm_entry_select_none(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-19 06:36:46 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_selection_store(Elm_Sel_Type seltype,
|
|
|
|
Evas_Object *obj)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2010-06-05 21:09:56 -07:00
|
|
|
const char *sel;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
sel = edje_object_part_text_selection_get(sd->entry_edje, "elm.text");
|
|
|
|
if ((!sel) || (!sel[0])) return; /* avoid deleting our own selection */
|
|
|
|
|
|
|
|
elm_cnp_selection_set
|
|
|
|
(obj, seltype, ELM_SEL_FORMAT_MARKUP, sel, strlen(sel));
|
2015-06-23 08:11:05 -07:00
|
|
|
elm_cnp_selection_loss_callback_set(obj, seltype, _selection_clear, obj);
|
2011-12-27 03:24:13 -08:00
|
|
|
if (seltype == ELM_SEL_TYPE_CLIPBOARD)
|
2012-08-30 09:45:15 -07:00
|
|
|
eina_stringshare_replace(&sd->cut_sel, sel);
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_cut_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
2009-09-26 11:00:51 -07:00
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(data, EFL_UI_EVENT_SELECTION_CUT, NULL);
|
2010-06-17 01:50:43 -07:00
|
|
|
/* Store it */
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->sel_mode = EINA_FALSE;
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_FALSE);
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
|
|
|
|
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
2011-04-21 19:29:54 -07:00
|
|
|
elm_widget_scroll_hold_pop(data);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
_selection_store(ELM_SEL_TYPE_CLIPBOARD, data);
|
2015-06-16 06:41:55 -07:00
|
|
|
_edje_entry_user_insert(data, "");
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_copy_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(data, EFL_UI_EVENT_SELECTION_COPY, NULL);
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->sel_mode = EINA_FALSE;
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_FALSE);
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
|
2011-04-01 06:20:40 -07:00
|
|
|
elm_widget_scroll_hold_pop(data);
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
_selection_store(ELM_SEL_TYPE_CLIPBOARD, data);
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
2009-03-22 21:55:37 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_hover_cancel_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2009-03-22 21:55:37 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->sel_mode = EINA_FALSE;
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_FALSE);
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
2011-04-21 19:29:54 -07:00
|
|
|
elm_widget_scroll_hold_pop(data);
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_none(sd->entry_edje, "elm.text");
|
2009-03-22 21:55:37 -07:00
|
|
|
}
|
|
|
|
|
2009-09-02 05:48:00 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_hover_item_clicked_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2009-09-02 05:48:00 -07:00
|
|
|
{
|
|
|
|
Elm_Entry_Context_Menu_Item *it = data;
|
2013-02-27 04:06:05 -08:00
|
|
|
if (!it) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-02-27 04:06:05 -08:00
|
|
|
if (it->func) it->func(it->data, it->obj, it);
|
2009-09-02 05:48:00 -07:00
|
|
|
}
|
|
|
|
|
2011-04-01 05:10:24 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_menu_call(Evas_Object *obj)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2009-05-13 05:21:52 -07:00
|
|
|
Evas_Object *top;
|
2009-09-02 05:48:00 -07:00
|
|
|
const Eina_List *l;
|
|
|
|
const Elm_Entry_Context_Menu_Item *it;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-07-02 21:12:30 -07:00
|
|
|
if (sd->anchor_hover.hover) return;
|
2015-06-03 02:41:13 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_ENTRY_EVENT_CONTEXT_OPEN, NULL);
|
2015-06-03 02:41:13 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((sd->api) && (sd->api->obj_longpress))
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->api->obj_longpress(obj);
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
else if (sd->context_menu)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2010-01-18 02:28:00 -08:00
|
|
|
const char *context_menu_orientation;
|
2013-02-17 06:36:00 -08:00
|
|
|
Eina_Bool ownersel;
|
2010-02-08 19:27:11 -08:00
|
|
|
|
2013-02-17 06:36:00 -08:00
|
|
|
ownersel = elm_selection_selection_has_owner(obj);
|
|
|
|
if (!sd->items)
|
|
|
|
{
|
|
|
|
/* prevent stupid blank hoversel */
|
|
|
|
if (sd->have_selection && sd->password) return;
|
2014-05-14 05:26:33 -07:00
|
|
|
if (_elm_config->desktop_entry && (!sd->have_selection) && ((!sd->editable) || (!ownersel)))
|
|
|
|
return;
|
2013-02-17 06:36:00 -08:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->hoversel) evas_object_del(sd->hoversel);
|
2011-04-01 05:10:24 -07:00
|
|
|
else elm_widget_scroll_freeze_push(obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
sd->hoversel = elm_hoversel_add(obj);
|
2010-01-18 02:28:00 -08:00
|
|
|
context_menu_orientation = edje_object_data_get
|
2012-08-30 09:45:15 -07:00
|
|
|
(sd->entry_edje, "context_menu_orientation");
|
|
|
|
|
2010-01-18 02:28:00 -08:00
|
|
|
if ((context_menu_orientation) &&
|
|
|
|
(!strcmp(context_menu_orientation, "horizontal")))
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_hoversel_horizontal_set(sd->hoversel, EINA_TRUE);
|
|
|
|
|
|
|
|
elm_object_style_set(sd->hoversel, "entry");
|
|
|
|
elm_widget_sub_object_add(obj, sd->hoversel);
|
|
|
|
elm_object_text_set(sd->hoversel, "Text");
|
2011-04-01 05:10:24 -07:00
|
|
|
top = elm_widget_top_get(obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (top) elm_hoversel_hover_parent_set(sd->hoversel, top);
|
|
|
|
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-03-02 03:57:19 -08:00
|
|
|
(sd->hoversel, ELM_HOVERSEL_EVENT_DISMISSED, _hover_dismissed_cb, obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->have_selection)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->password)
|
2010-01-27 01:23:54 -08:00
|
|
|
{
|
2016-09-17 15:58:55 -07:00
|
|
|
if (sd->editable)
|
|
|
|
elm_hoversel_item_add
|
|
|
|
(sd->hoversel, E_("Cut"), NULL, ELM_ICON_NONE,
|
|
|
|
_cut_cb, obj);
|
2012-11-22 07:15:55 -08:00
|
|
|
elm_hoversel_item_add
|
|
|
|
(sd->hoversel, E_("Copy"), NULL, ELM_ICON_NONE,
|
|
|
|
_copy_cb, obj);
|
2016-09-17 15:58:55 -07:00
|
|
|
if (sd->editable && ownersel)
|
|
|
|
elm_hoversel_item_add
|
|
|
|
(sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
|
|
|
|
_paste_cb, obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_hoversel_item_add
|
|
|
|
(sd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE,
|
|
|
|
_hover_cancel_cb, obj);
|
2010-01-27 01:23:54 -08:00
|
|
|
}
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
2011-04-01 06:35:39 -07:00
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->sel_mode)
|
2011-04-01 06:35:39 -07:00
|
|
|
{
|
2016-05-11 19:10:42 -07:00
|
|
|
if (sd->sel_allow && !_elm_config->desktop_entry)
|
2011-04-01 06:35:39 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->password)
|
|
|
|
elm_hoversel_item_add
|
|
|
|
(sd->hoversel, E_("Select"), NULL, ELM_ICON_NONE,
|
|
|
|
_hover_selected_cb, obj);
|
2011-04-01 06:35:39 -07:00
|
|
|
}
|
2013-02-17 06:36:00 -08:00
|
|
|
if (ownersel)
|
2011-04-01 06:35:39 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->editable)
|
|
|
|
elm_hoversel_item_add
|
|
|
|
(sd->hoversel, E_("Paste"), NULL, ELM_ICON_NONE,
|
|
|
|
_paste_cb, obj);
|
2011-04-01 06:35:39 -07:00
|
|
|
}
|
|
|
|
}
|
2012-11-22 07:15:55 -08:00
|
|
|
else
|
|
|
|
elm_hoversel_item_add
|
|
|
|
(sd->hoversel, E_("Cancel"), NULL, ELM_ICON_NONE,
|
|
|
|
_hover_cancel_cb, obj);
|
2011-04-01 06:35:39 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->items, l, it)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_hoversel_item_add(sd->hoversel, it->label, it->icon_file,
|
|
|
|
it->icon_type, _hover_item_clicked_cb, it);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->hoversel)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2011-04-01 05:10:24 -07:00
|
|
|
_hoversel_position(obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_show(sd->hoversel);
|
|
|
|
elm_hoversel_hover_begin(sd->hoversel);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_FALSE);
|
|
|
|
edje_object_part_text_select_abort(sd->entry_edje, "elm.text");
|
2011-04-01 06:20:40 -07:00
|
|
|
}
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
2011-04-01 05:10:24 -07:00
|
|
|
}
|
|
|
|
|
2013-11-14 05:51:03 -08:00
|
|
|
static void
|
|
|
|
_magnifier_proxy_update(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
2016-02-04 22:05:57 -08:00
|
|
|
_magnifier_move(data);
|
2013-11-14 05:51:03 -08:00
|
|
|
}
|
|
|
|
|
2013-06-07 01:17:30 -07:00
|
|
|
static void
|
|
|
|
_magnifier_create(void *data)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-06-07 01:17:30 -07:00
|
|
|
double scale = _elm_config->magnifier_scale;
|
2013-11-12 20:29:28 -08:00
|
|
|
Evas *e;
|
2013-06-07 01:17:30 -07:00
|
|
|
Evas_Coord w, h, mw, mh;
|
|
|
|
|
2014-01-21 17:38:55 -08:00
|
|
|
evas_object_del(sd->mgf_proxy);
|
|
|
|
evas_object_del(sd->mgf_bg);
|
|
|
|
evas_object_del(sd->mgf_clip);
|
2013-06-07 01:17:30 -07:00
|
|
|
|
2013-11-12 20:29:28 -08:00
|
|
|
e = evas_object_evas_get(data);
|
|
|
|
|
2013-11-14 05:51:03 -08:00
|
|
|
//Bg
|
2013-11-12 20:29:28 -08:00
|
|
|
sd->mgf_bg = edje_object_add(e);
|
2013-06-07 01:17:30 -07:00
|
|
|
_elm_theme_object_set(data, sd->mgf_bg, "entry", "magnifier", "default");
|
|
|
|
evas_object_show(sd->mgf_bg);
|
|
|
|
|
2013-11-14 05:51:03 -08:00
|
|
|
//Proxy
|
|
|
|
sd->mgf_proxy = evas_object_image_add(e);
|
|
|
|
evas_object_event_callback_add(sd->mgf_proxy, EVAS_CALLBACK_RESIZE,
|
|
|
|
_magnifier_proxy_update, data);
|
|
|
|
evas_object_event_callback_add(sd->mgf_proxy, EVAS_CALLBACK_MOVE,
|
|
|
|
_magnifier_proxy_update, data);
|
|
|
|
edje_object_part_swallow(sd->mgf_bg, "elm.swallow.content", sd->mgf_proxy);
|
|
|
|
evas_object_image_source_set(sd->mgf_proxy, data);
|
|
|
|
evas_object_geometry_get(data, NULL, NULL, &w, &h);
|
|
|
|
|
|
|
|
//Clipper
|
2013-11-12 21:36:22 -08:00
|
|
|
sd->mgf_clip = evas_object_rectangle_add(e);
|
2016-02-04 22:05:57 -08:00
|
|
|
evas_object_color_set(sd->mgf_clip, 0, 0, 0, 0);
|
2013-11-14 05:51:03 -08:00
|
|
|
evas_object_show(sd->mgf_clip);
|
|
|
|
evas_object_clip_set(sd->mgf_proxy, sd->mgf_clip);
|
2013-06-07 01:17:30 -07:00
|
|
|
|
|
|
|
mw = (Evas_Coord)(scale * (float) w);
|
|
|
|
mh = (Evas_Coord)(scale * (float) h);
|
2013-11-12 20:29:28 -08:00
|
|
|
if ((mw <= 0) || (mh <= 0)) return;
|
2013-06-07 01:17:30 -07:00
|
|
|
|
|
|
|
evas_object_layer_set(sd->mgf_bg, EVAS_LAYER_MAX);
|
|
|
|
evas_object_layer_set(sd->mgf_proxy, EVAS_LAYER_MAX);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-02-04 22:05:57 -08:00
|
|
|
_magnifier_move(void *data)
|
2013-06-07 01:17:30 -07:00
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-06-07 01:17:30 -07:00
|
|
|
Evas_Coord x, y, w, h;
|
2013-11-14 05:51:03 -08:00
|
|
|
Evas_Coord px, py, pw, ph;
|
2016-02-04 22:05:57 -08:00
|
|
|
Evas_Coord cx, cy, ch;
|
|
|
|
Evas_Coord ex, ey;
|
|
|
|
Evas_Coord mx, my, mw, mh;
|
|
|
|
Evas_Coord diffx = 0;
|
|
|
|
Evas_Object *top;
|
2013-11-14 05:51:03 -08:00
|
|
|
double fx, fy, fw, fh;
|
2013-06-07 01:17:30 -07:00
|
|
|
double scale = _elm_config->magnifier_scale;
|
|
|
|
|
2016-02-04 22:05:57 -08:00
|
|
|
edje_object_part_text_cursor_geometry_get(sd->entry_edje, "elm.text",
|
|
|
|
&cx, &cy, NULL, &ch);
|
|
|
|
if (sd->scroll)
|
|
|
|
{
|
|
|
|
Evas_Coord ox, oy;
|
|
|
|
evas_object_geometry_get(sd->scr_edje, &ex, &ey, NULL, NULL);
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_content_pos_get(data, &ox, &oy);
|
2016-02-04 22:05:57 -08:00
|
|
|
ex -= ox;
|
|
|
|
ey -= oy;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(data, &ex, &ey, NULL, NULL);
|
|
|
|
}
|
|
|
|
cx += ex;
|
|
|
|
cy += ey;
|
|
|
|
|
2013-11-14 05:51:03 -08:00
|
|
|
//Move the Magnifier
|
2013-11-07 23:08:47 -08:00
|
|
|
edje_object_parts_extends_calc(sd->mgf_bg, &x, &y, &w, &h);
|
2013-11-14 05:51:03 -08:00
|
|
|
evas_object_move(sd->mgf_bg, cx - x - (w / 2), cy - y - h);
|
|
|
|
|
2016-02-04 22:05:57 -08:00
|
|
|
mx = cx - x - (w / 2);
|
|
|
|
my = cy - y - h;
|
|
|
|
mw = w;
|
|
|
|
mh = h;
|
|
|
|
|
|
|
|
// keep magnifier inside window
|
|
|
|
top = elm_widget_top_get(data);
|
2016-08-15 06:44:41 -07:00
|
|
|
if (top && efl_isa(top, EFL_UI_WIN_CLASS))
|
2016-02-04 22:05:57 -08:00
|
|
|
{
|
|
|
|
Evas_Coord wh, ww;
|
|
|
|
evas_object_geometry_get(top, NULL, NULL, &ww, &wh);
|
|
|
|
if (mx < 0)
|
|
|
|
{
|
|
|
|
diffx = mx;
|
|
|
|
mx = 0;
|
|
|
|
}
|
|
|
|
if (mx + mw > ww)
|
|
|
|
{
|
|
|
|
diffx = - (ww - (mx + mw));
|
|
|
|
mx = ww - mw;
|
|
|
|
}
|
|
|
|
if (my < 0)
|
|
|
|
my = 0;
|
|
|
|
if (my + mh > wh)
|
|
|
|
my = wh - mh;
|
|
|
|
evas_object_move(sd->mgf_bg, mx, my);
|
|
|
|
}
|
|
|
|
|
2013-11-14 05:51:03 -08:00
|
|
|
//Set the Proxy Render Area
|
|
|
|
evas_object_geometry_get(data, &x, &y, &w, &h);
|
|
|
|
evas_object_geometry_get(sd->mgf_proxy, &px, &py, &pw, &ph);
|
|
|
|
|
2016-02-04 22:05:57 -08:00
|
|
|
fx = -((cx - x) * scale) + (pw * 0.5) + diffx;
|
|
|
|
fy = -((cy - y) * scale) + (ph * 0.5) - (ch * 0.5 * scale);
|
2016-02-04 22:43:06 -08:00
|
|
|
fw = w * scale;
|
|
|
|
fh = h * scale;
|
2013-11-14 05:51:03 -08:00
|
|
|
evas_object_image_fill_set(sd->mgf_proxy, fx, fy, fw, fh);
|
|
|
|
|
|
|
|
//Update Clipper Area
|
|
|
|
int tx = fx;
|
|
|
|
int ty = fy;
|
|
|
|
int tw = fw;
|
|
|
|
int th = fh;
|
|
|
|
if (tx > 0) px += tx;
|
|
|
|
if (ty > 0) py += ty;
|
|
|
|
if (-(tx - pw) > tw) pw -= (-((tx - pw) + tw));
|
|
|
|
if (-(ty - ph) > th) ph -= (-((ty - ph) + th));
|
|
|
|
evas_object_move(sd->mgf_clip, px, py);
|
|
|
|
evas_object_resize(sd->mgf_clip, pw, ph);
|
2013-06-07 01:17:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_magnifier_hide(void *data)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-06-07 01:17:30 -07:00
|
|
|
edje_object_signal_emit(sd->mgf_bg, "elm,action,hide,magnifier", "elm");
|
|
|
|
elm_widget_scroll_freeze_pop(data);
|
2013-11-14 05:51:03 -08:00
|
|
|
evas_object_hide(sd->mgf_clip);
|
2013-06-07 01:17:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_magnifier_show(void *data)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-06-07 01:17:30 -07:00
|
|
|
edje_object_signal_emit(sd->mgf_bg, "elm,action,show,magnifier", "elm");
|
|
|
|
elm_widget_scroll_freeze_push(data);
|
2013-11-14 05:51:03 -08:00
|
|
|
evas_object_show(sd->mgf_clip);
|
2013-06-07 01:17:30 -07:00
|
|
|
}
|
|
|
|
|
2011-04-01 05:10:24 -07:00
|
|
|
static Eina_Bool
|
2012-08-30 09:45:15 -07:00
|
|
|
_long_press_cb(void *data)
|
2011-04-01 05:10:24 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return ECORE_CALLBACK_CANCEL;
|
2013-06-07 01:17:30 -07:00
|
|
|
if (_elm_config->magnifier_enable)
|
|
|
|
{
|
|
|
|
_magnifier_create(data);
|
|
|
|
_magnifier_show(data);
|
2016-02-04 22:05:57 -08:00
|
|
|
_magnifier_move(data);
|
2013-06-07 01:17:30 -07:00
|
|
|
}
|
2015-12-10 22:49:27 -08:00
|
|
|
/* Context menu will not appear if context menu disabled is set
|
|
|
|
* as false on a long press callback */
|
|
|
|
else if (!_elm_config->context_menu_disabled &&
|
|
|
|
(!_elm_config->desktop_entry))
|
2012-08-30 09:45:15 -07:00
|
|
|
_menu_call(data);
|
|
|
|
|
2013-06-07 01:17:30 -07:00
|
|
|
sd->long_pressed = EINA_TRUE;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->longpress_timer = NULL;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(data, EFL_UI_EVENT_LONGPRESSED, NULL);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
2013-04-02 10:23:20 -07:00
|
|
|
static void
|
|
|
|
_key_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2013-04-02 10:23:20 -07:00
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
2015-12-10 22:49:27 -08:00
|
|
|
/* First check if context menu disabled is false or not, and
|
|
|
|
* then check for key id */
|
|
|
|
if ((!_elm_config->context_menu_disabled) && !strcmp(ev->key, "Menu"))
|
2013-04-02 10:23:20 -07:00
|
|
|
_menu_call(data);
|
|
|
|
}
|
|
|
|
|
2009-03-19 06:36:46 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_mouse_down_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:15 -07:00
|
|
|
void *event_info)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->disabled) return;
|
2009-03-19 06:36:46 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->downx = ev->canvas.x;
|
|
|
|
sd->downy = ev->canvas.y;
|
2013-06-07 01:17:30 -07:00
|
|
|
sd->long_pressed = EINA_FALSE;
|
2013-09-30 03:21:31 -07:00
|
|
|
|
2013-06-07 01:17:30 -07:00
|
|
|
if (ev->button == 1)
|
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
|
|
|
sd->longpress_timer = ecore_timer_add
|
|
|
|
(_elm_config->longpress_timeout, _long_press_cb, data);
|
|
|
|
}
|
2015-12-10 22:49:27 -08:00
|
|
|
/* If right button is pressed and context menu disabled is true,
|
|
|
|
* then only context menu will appear */
|
|
|
|
else if (ev->button == 3 && (!_elm_config->context_menu_disabled))
|
2012-08-02 22:33:44 -07:00
|
|
|
{
|
|
|
|
if (_elm_config->desktop_entry)
|
2014-07-06 20:42:43 -07:00
|
|
|
{
|
|
|
|
sd->use_down = 1;
|
|
|
|
_menu_call(data);
|
|
|
|
}
|
2012-08-02 22:33:44 -07:00
|
|
|
}
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_mouse_up_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:15 -07:00
|
|
|
void *event_info)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
2014-01-13 02:32:01 -08:00
|
|
|
Eina_Bool top_is_win = EINA_FALSE;
|
|
|
|
Evas_Object *top;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->disabled) return;
|
2011-04-01 05:10:24 -07:00
|
|
|
if (ev->button == 1)
|
|
|
|
{
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
2015-12-10 22:49:27 -08:00
|
|
|
/* Since context menu disabled flag was checked at long press start while mouse
|
|
|
|
* down, hence the same should be checked at mouse up from a long press
|
|
|
|
* as well */
|
2015-12-23 05:03:45 -08:00
|
|
|
if ((sd->long_pressed) && (_elm_config->magnifier_enable))
|
2013-06-07 01:17:30 -07:00
|
|
|
{
|
|
|
|
_magnifier_hide(data);
|
2015-12-23 05:03:45 -08:00
|
|
|
if (!_elm_config->context_menu_disabled)
|
|
|
|
{
|
|
|
|
_menu_call(data);
|
|
|
|
}
|
2013-06-07 01:17:30 -07:00
|
|
|
}
|
2014-01-13 02:32:01 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
top = elm_widget_top_get(data);
|
|
|
|
if (top)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
if (efl_isa(top, EFL_UI_WIN_CLASS))
|
2014-01-13 02:32:01 -08:00
|
|
|
top_is_win = EINA_TRUE;
|
|
|
|
|
|
|
|
if (top_is_win && sd->input_panel_enable && sd->input_panel_show_on_demand &&
|
|
|
|
!edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text"))
|
|
|
|
elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
|
|
|
|
}
|
|
|
|
}
|
2011-04-01 05:10:24 -07:00
|
|
|
}
|
2015-12-10 22:49:27 -08:00
|
|
|
/* Since context menu disabled flag was checked at mouse right key down,
|
|
|
|
* hence the same should be stopped at mouse up of right key as well */
|
|
|
|
else if ((ev->button == 3) && (!_elm_config->context_menu_disabled) &&
|
|
|
|
(!_elm_config->desktop_entry))
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2015-12-10 22:49:27 -08:00
|
|
|
sd->use_down = 1;
|
|
|
|
_menu_call(data);
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_mouse_move_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:15 -07:00
|
|
|
void *event_info)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->disabled) return;
|
2013-06-07 01:17:30 -07:00
|
|
|
if (ev->buttons == 1)
|
|
|
|
{
|
|
|
|
if ((sd->long_pressed) && (_elm_config->magnifier_enable))
|
2013-06-21 20:24:30 -07:00
|
|
|
{
|
|
|
|
Evas_Coord x, y;
|
|
|
|
Eina_Bool rv;
|
|
|
|
|
|
|
|
evas_object_geometry_get(sd->entry_edje, &x, &y, NULL, NULL);
|
|
|
|
rv = edje_object_part_text_cursor_coord_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_USER,
|
|
|
|
ev->cur.canvas.x - x, ev->cur.canvas.y - y);
|
|
|
|
if (rv)
|
|
|
|
{
|
|
|
|
edje_object_part_text_cursor_copy
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_USER, EDJE_CURSOR_MAIN);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
WRN("Warning: Cannot move cursor");
|
|
|
|
|
2016-02-04 22:05:57 -08:00
|
|
|
_magnifier_move(data);
|
2013-06-21 20:24:30 -07:00
|
|
|
}
|
2013-06-07 01:17:30 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->sel_mode)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2011-03-14 19:01:42 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
{
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
2011-03-14 19:01:42 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
else if (sd->longpress_timer)
|
2011-03-14 19:01:42 -07:00
|
|
|
{
|
|
|
|
Evas_Coord dx, dy;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
dx = sd->downx - ev->cur.canvas.x;
|
2011-03-14 19:01:42 -07:00
|
|
|
dx *= dx;
|
2012-08-30 09:45:15 -07:00
|
|
|
dy = sd->downy - ev->cur.canvas.y;
|
2011-03-14 19:01:42 -07:00
|
|
|
dy *= dy;
|
|
|
|
if ((dx + dy) >
|
|
|
|
((_elm_config->finger_size / 2) *
|
|
|
|
(_elm_config->finger_size / 2)))
|
|
|
|
{
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
2011-03-14 19:01:42 -07:00
|
|
|
}
|
|
|
|
}
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
else if (sd->longpress_timer)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2011-03-14 19:01:42 -07:00
|
|
|
Evas_Coord dx, dy;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
dx = sd->downx - ev->cur.canvas.x;
|
2011-03-14 19:01:42 -07:00
|
|
|
dx *= dx;
|
2012-08-30 09:45:15 -07:00
|
|
|
dy = sd->downy - ev->cur.canvas.y;
|
2011-03-14 19:01:42 -07:00
|
|
|
dy *= dy;
|
|
|
|
if ((dx + dy) >
|
|
|
|
((_elm_config->finger_size / 2) *
|
|
|
|
(_elm_config->finger_size / 2)))
|
|
|
|
{
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
2011-03-14 19:01:42 -07:00
|
|
|
}
|
2008-11-15 05:58:50 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-16 02:17:57 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_changed_handle(void *data,
|
2016-08-10 07:23:04 -07:00
|
|
|
const Efl_Event_Description* event)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2011-05-01 02:40:19 -07:00
|
|
|
Evas_Coord minh;
|
2012-04-08 22:25:27 -07:00
|
|
|
const char *text;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(data));
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->changed = EINA_TRUE;
|
|
|
|
/* Reset the size hints which are no more relevant. Keep the
|
|
|
|
* height, this is a hack, but doesn't really matter cause we'll
|
|
|
|
* re-eval in a moment. */
|
2017-09-18 00:22:01 -07:00
|
|
|
evas_object_size_hint_combined_min_get(data, NULL, &minh);
|
2011-05-01 02:40:19 -07:00
|
|
|
evas_object_size_hint_min_set(data, -1, minh);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
elm_layout_sizing_eval(data);
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->text, eina_stringshare_del);
|
|
|
|
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(data));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(data));
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((sd->auto_save) && (sd->file))
|
2014-01-23 06:05:24 -08:00
|
|
|
sd->delay_write = ecore_timer_add(ELM_ENTRY_DELAY_WRITE_TIME,
|
|
|
|
_delay_write, data);
|
2013-01-18 22:17:05 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
_return_key_enabled_check(data);
|
|
|
|
text = edje_object_part_text_get(sd->entry_edje, "elm.text");
|
2012-04-08 22:25:27 -07:00
|
|
|
if (text)
|
|
|
|
{
|
|
|
|
if (text[0])
|
2012-08-30 09:45:15 -07:00
|
|
|
_elm_entry_guide_update(data, EINA_TRUE);
|
2012-04-08 22:25:27 -07:00
|
|
|
else
|
2012-08-30 09:45:15 -07:00
|
|
|
_elm_entry_guide_update(data, EINA_FALSE);
|
2012-04-08 22:25:27 -07:00
|
|
|
}
|
2015-04-02 02:37:37 -07:00
|
|
|
_validate(data);
|
|
|
|
|
2013-01-18 22:17:05 -08:00
|
|
|
/* callback - this could call callbacks that delete the
|
|
|
|
* entry... thus... any access to sd after this could be
|
|
|
|
* invalid */
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, event, NULL);
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
2011-06-24 01:44:39 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_changed_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-06-24 01:44:39 -07:00
|
|
|
{
|
2015-05-10 07:50:04 -07:00
|
|
|
_entry_changed_handle(data, ELM_ENTRY_EVENT_CHANGED);
|
2011-06-24 01:44:39 -07:00
|
|
|
}
|
|
|
|
|
2011-08-03 02:00:36 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_changed_user_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-08-03 02:00:36 -07:00
|
|
|
{
|
2011-11-14 05:56:02 -08:00
|
|
|
Elm_Entry_Change_Info info;
|
|
|
|
Edje_Entry_Change_Info *edje_info = (Edje_Entry_Change_Info *)
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_signal_callback_extra_data_get();
|
|
|
|
|
2011-11-14 05:56:02 -08:00
|
|
|
if (edje_info)
|
|
|
|
{
|
|
|
|
memcpy(&info, edje_info, sizeof(info));
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_CHANGED_USER, &info);
|
2011-11-14 05:56:02 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_CHANGED_USER, NULL);
|
2011-11-14 05:56:02 -08:00
|
|
|
}
|
2014-06-10 00:18:17 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
{
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Change_Info atspi_info;
|
2014-06-10 00:18:17 -07:00
|
|
|
if (edje_info && edje_info->insert)
|
|
|
|
{
|
|
|
|
atspi_info.content = edje_info->change.insert.content;
|
|
|
|
atspi_info.pos = edje_info->change.insert.pos;
|
|
|
|
atspi_info.len = edje_info->change.insert.plain_length;
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_event_emit(EFL_ACCESS_OBJECT_MIXIN, data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_INSERTED, &atspi_info);
|
2014-06-10 00:18:17 -07:00
|
|
|
}
|
|
|
|
else if (edje_info && !edje_info->insert)
|
|
|
|
{
|
|
|
|
atspi_info.content = edje_info->change.del.content;
|
|
|
|
atspi_info.pos = MIN(edje_info->change.del.start, edje_info->change.del.end);
|
2015-07-29 07:26:14 -07:00
|
|
|
atspi_info.len = MAX(edje_info->change.del.start, edje_info->change.del.end) - atspi_info.pos;
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_event_emit(EFL_ACCESS_OBJECT_MIXIN, data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_REMOVED, &atspi_info);
|
2014-06-10 00:18:17 -07:00
|
|
|
}
|
|
|
|
}
|
2011-08-03 02:00:36 -07:00
|
|
|
}
|
|
|
|
|
2011-06-24 01:44:39 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_preedit_changed_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-06-24 01:44:39 -07:00
|
|
|
{
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
char *text = NULL;
|
|
|
|
Edje_Entry_Change_Info *edje_info = (Edje_Entry_Change_Info *)
|
|
|
|
edje_object_signal_callback_extra_data_get();
|
2015-05-10 07:50:04 -07:00
|
|
|
_entry_changed_handle(data, ELM_ENTRY_EVENT_PREEDIT_CHANGED);
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
|
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
{
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Change_Info atspi_info;
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
if (edje_info && edje_info->insert)
|
|
|
|
{
|
|
|
|
text = elm_entry_markup_to_utf8(edje_info->change.insert.content);
|
|
|
|
atspi_info.content = text;
|
|
|
|
atspi_info.pos = edje_info->change.insert.pos;
|
|
|
|
atspi_info.len = edje_info->change.insert.plain_length;
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_event_emit(EFL_ACCESS_OBJECT_MIXIN,
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
data,
|
2017-09-25 01:15:44 -07:00
|
|
|
EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_INSERTED,
|
Accessibility: Read pre-edit text.
Summary:
Edje_entry: In order to read pre-edit characters as well,
send entry_change_info with preedit,changed
Elm_entry: In order to read pre-edit characters as well,
send text to screen reader on preedit,changed.
Test Plan:
1. Change keyboard language to korean/enable prediction
2. Check the reading, text should be read even before committing
Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>
Reviewers: thiepha, jihoon, cedric, raster
Reviewed By: raster
Subscribers: raster, kimcinoo, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4145
2016-07-10 18:36:38 -07:00
|
|
|
&atspi_info);
|
|
|
|
free(text);
|
|
|
|
}
|
|
|
|
}
|
2011-06-24 01:44:39 -07:00
|
|
|
}
|
|
|
|
|
2011-11-14 05:55:57 -08:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_undo_request_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-11-14 05:55:57 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_UNDO_REQUEST, NULL);
|
2011-11-14 05:55:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_redo_request_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-11-14 05:55:57 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_REDO_REQUEST, NULL);
|
2011-11-14 05:55:57 -08:00
|
|
|
}
|
|
|
|
|
2008-10-16 02:17:57 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_selection_start_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2009-02-25 11:50:45 -08:00
|
|
|
const Eina_List *l;
|
|
|
|
Evas_Object *entry;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(entries, l, entry)
|
2008-11-18 00:45:38 -08:00
|
|
|
{
|
2011-03-14 19:01:42 -07:00
|
|
|
if (entry != data) elm_entry_select_none(entry);
|
2008-11-18 00:45:38 -08:00
|
|
|
}
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(data, EFL_UI_EVENT_SELECTION_START, NULL);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2015-03-19 01:43:02 -07:00
|
|
|
elm_object_focus_set(data, EINA_TRUE);
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
2011-07-24 01:17:18 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_selection_all_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-07-24 01:17:18 -07:00
|
|
|
{
|
|
|
|
elm_entry_select_all(data);
|
|
|
|
}
|
|
|
|
|
2011-07-24 01:36:42 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_selection_none_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-07-24 01:36:42 -07:00
|
|
|
{
|
|
|
|
elm_entry_select_none(data);
|
|
|
|
}
|
|
|
|
|
2018-04-12 10:37:16 -07:00
|
|
|
// XXX: still try primary selection even if on wl in case it's
|
|
|
|
// supported
|
|
|
|
//static inline Eina_Bool
|
|
|
|
//_entry_win_is_wl(Evas_Object *obj)
|
|
|
|
//{
|
|
|
|
// Evas_Object *win = _entry_win_get(obj);
|
|
|
|
// /* primary selection does not exist (yet) */
|
|
|
|
// return win && elm_win_wl_window_get(win);
|
|
|
|
//}
|
2017-07-07 13:26:50 -07:00
|
|
|
|
2018-04-13 04:41:34 -07:00
|
|
|
static void
|
|
|
|
_entry_selection_changed_signal_cb(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->have_selection = EINA_TRUE;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(data, EFL_UI_EVENT_SELECTION_CHANGED, NULL);
|
2018-04-12 10:37:16 -07:00
|
|
|
// XXX: still try primary selection even if on wl in case it's
|
|
|
|
// supported
|
|
|
|
// if (!_entry_win_is_wl(data))
|
2017-07-07 13:26:50 -07:00
|
|
|
_selection_store(ELM_SEL_TYPE_PRIMARY, data);
|
2013-11-08 00:06:08 -08:00
|
|
|
_update_selection_handler(data);
|
2014-06-10 00:18:17 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_event_emit(EFL_ACCESS_OBJECT_MIXIN, data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_SELECTION_CHANGED, NULL);
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_selection_cleared_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->have_selection) return;
|
|
|
|
|
|
|
|
sd->have_selection = EINA_FALSE;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(data, EFL_UI_EVENT_SELECTION_CLEARED, NULL);
|
2018-04-12 10:37:16 -07:00
|
|
|
// XXX: still try primary selection even if on wl in case it's
|
|
|
|
// supported
|
|
|
|
// if (!_entry_win_is_wl(data))
|
2008-11-18 22:23:08 -08:00
|
|
|
{
|
2017-07-07 13:26:50 -07:00
|
|
|
if (sd->cut_sel)
|
|
|
|
{
|
|
|
|
elm_cnp_selection_set
|
|
|
|
(data, ELM_SEL_TYPE_PRIMARY, ELM_SEL_FORMAT_MARKUP,
|
|
|
|
sd->cut_sel, eina_stringshare_strlen(sd->cut_sel));
|
|
|
|
elm_cnp_selection_loss_callback_set(data, ELM_SEL_TYPE_PRIMARY, _selection_clear, data);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2017-07-07 13:26:50 -07:00
|
|
|
ELM_SAFE_FREE(sd->cut_sel, eina_stringshare_del);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_object_cnp_selection_clear(data, ELM_SEL_TYPE_PRIMARY);
|
|
|
|
}
|
2008-11-18 22:23:08 -08:00
|
|
|
}
|
2013-11-08 00:06:08 -08:00
|
|
|
_hide_selection_handler(data);
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_paste_request_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:15 -07:00
|
|
|
const char *emission,
|
2014-01-06 06:30:02 -08:00
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2013-11-07 04:01:00 -08:00
|
|
|
Evas_Object *top;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2011-12-27 03:24:13 -08:00
|
|
|
Elm_Sel_Type type = (emission[sizeof("ntry,paste,request,")] == '1') ?
|
|
|
|
ELM_SEL_TYPE_PRIMARY : ELM_SEL_TYPE_CLIPBOARD;
|
2012-03-29 14:24:00 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->editable) return;
|
2018-04-12 10:37:16 -07:00
|
|
|
// XXX: still try primary selection even if on wl in case it's
|
|
|
|
// supported
|
|
|
|
// if ((type == ELM_SEL_TYPE_PRIMARY) && _entry_win_is_wl(data)) return;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(data, EFL_UI_EVENT_SELECTION_PASTE, NULL);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2017-07-07 13:26:50 -07:00
|
|
|
top = _entry_win_get(data);
|
|
|
|
if (top)
|
2013-11-07 04:01:00 -08:00
|
|
|
{
|
2017-05-12 09:08:32 -07:00
|
|
|
Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_TEXT;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-11-07 04:01:00 -08:00
|
|
|
sd->selection_asked = EINA_TRUE;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-11-07 04:01:00 -08:00
|
|
|
if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
|
|
|
|
formats = ELM_SEL_FORMAT_TEXT;
|
|
|
|
else if (sd->cnp_mode != ELM_CNP_MODE_NO_IMAGE)
|
|
|
|
formats |= ELM_SEL_FORMAT_IMAGE;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2015-06-09 01:04:48 -07:00
|
|
|
elm_cnp_selection_get(data, type, formats, _selection_data_cb, NULL);
|
2008-11-18 22:23:08 -08:00
|
|
|
}
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_copy_notify_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
_copy_cb(data, NULL, NULL);
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_cut_notify_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
_cut_cb(data, NULL, NULL);
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_cursor_changed_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->cursor_pos = edje_object_part_text_cursor_pos_get
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
|
|
|
sd->cur_changed = EINA_TRUE;
|
2017-11-29 00:39:42 -08:00
|
|
|
if (efl_ui_focus_object_focus_get(data))
|
2013-11-07 23:56:24 -08:00
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,action,show,cursor", "elm");
|
2012-08-30 09:45:15 -07:00
|
|
|
_cursor_geometry_recalc(data);
|
2016-11-21 18:05:23 -08:00
|
|
|
|
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_CURSOR_CHANGED, NULL);
|
|
|
|
|
2014-06-10 00:18:17 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_event_emit(EFL_ACCESS_OBJECT_MIXIN, data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, NULL);
|
2008-10-16 23:41:07 -07:00
|
|
|
}
|
|
|
|
|
2011-12-15 06:42:22 -08:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_cursor_changed_manual_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-12-15 06:42:22 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 03:57:19 -08:00
|
|
|
(data, ELM_ENTRY_EVENT_CURSOR_CHANGED_MANUAL, NULL);
|
2014-06-10 00:18:17 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_event_emit(EFL_ACCESS_OBJECT_MIXIN, data, EFL_ACCESS_TEXT_EVENT_ACCESS_TEXT_CARET_MOVED, NULL);
|
2011-12-15 06:42:22 -08:00
|
|
|
}
|
|
|
|
|
2011-07-21 14:19:55 -07:00
|
|
|
static void
|
2014-03-22 10:44:29 -07:00
|
|
|
_signal_anchor_geoms_do_things_with_lol(Elm_Entry_Data *sd,
|
2012-08-30 09:45:15 -07:00
|
|
|
Elm_Entry_Anchor_Info *ei)
|
2011-07-21 14:19:55 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Rectangle *r;
|
2012-08-30 09:45:15 -07:00
|
|
|
const Eina_List *geoms, *l;
|
2011-07-21 14:19:55 -07:00
|
|
|
Evas_Coord px, py, x, y;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
geoms = edje_object_part_text_anchor_geometry_get
|
|
|
|
(sd->entry_edje, "elm.text", ei->name);
|
|
|
|
|
2011-07-21 14:19:55 -07:00
|
|
|
if (!geoms) return;
|
|
|
|
|
2014-01-28 06:36:38 -08:00
|
|
|
evas_object_geometry_get(
|
|
|
|
edje_object_part_object_get(sd->entry_edje, "elm.text"),
|
|
|
|
&x, &y, NULL, NULL);
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_pointer_canvas_xy_get
|
|
|
|
(evas_object_evas_get(sd->entry_edje), &px, &py);
|
2011-07-21 14:19:55 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(geoms, l, r)
|
2011-07-21 14:19:55 -07:00
|
|
|
{
|
|
|
|
if (((r->x + x) <= px) && ((r->y + y) <= py) &&
|
|
|
|
((r->x + x + r->w) > px) && ((r->y + y + r->h) > py))
|
|
|
|
{
|
|
|
|
ei->x = r->x + x;
|
|
|
|
ei->y = r->y + y;
|
|
|
|
ei->w = r->w;
|
|
|
|
ei->h = r->h;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-16 23:41:07 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_anchor_down_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 23:41:07 -07:00
|
|
|
{
|
2011-07-21 14:19:55 -07:00
|
|
|
Elm_Entry_Anchor_Info ei;
|
2011-07-22 21:00:49 -07:00
|
|
|
const char *p;
|
|
|
|
char *p2;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2011-07-22 21:00:49 -07:00
|
|
|
p = emission + sizeof("nchor,mouse,down,");
|
|
|
|
ei.button = strtol(p, &p2, 10);
|
2011-08-25 14:57:23 -07:00
|
|
|
ei.name = p2 + 1;
|
2011-07-21 14:19:55 -07:00
|
|
|
ei.x = ei.y = ei.w = ei.h = 0;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
_signal_anchor_geoms_do_things_with_lol(sd, &ei);
|
2011-07-21 14:19:55 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->disabled)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_ANCHOR_DOWN, &ei);
|
2008-10-16 23:41:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_anchor_up_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-03-10 02:15:58 -08:00
|
|
|
{
|
2011-07-21 14:19:55 -07:00
|
|
|
Elm_Entry_Anchor_Info ei;
|
2011-07-22 21:00:49 -07:00
|
|
|
const char *p;
|
|
|
|
char *p2;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2011-07-22 21:00:49 -07:00
|
|
|
p = emission + sizeof("nchor,mouse,up,");
|
|
|
|
ei.button = strtol(p, &p2, 10);
|
2011-08-25 14:57:23 -07:00
|
|
|
ei.name = p2 + 1;
|
2011-07-21 14:19:55 -07:00
|
|
|
ei.x = ei.y = ei.w = ei.h = 0;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
_signal_anchor_geoms_do_things_with_lol(sd, &ei);
|
2011-07-21 14:19:55 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->disabled)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_ANCHOR_UP, &ei);
|
2011-03-10 02:15:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_anchor_hover_del_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-07-03 04:29:43 -07:00
|
|
|
ELM_SAFE_FREE(sd->anchor_hover.pop, evas_object_del);
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->anchor_hover.hover, EVAS_CALLBACK_DEL, _anchor_hover_del_cb, obj);
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_anchor_hover_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
|
|
|
elm_entry_anchor_hover_end(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_entry_hover_anchor_clicked_do(Evas_Object *obj,
|
|
|
|
Elm_Entry_Anchor_Info *info)
|
|
|
|
{
|
|
|
|
Evas_Object *hover_parent;
|
|
|
|
Evas_Coord x, w, y, h, px, py;
|
|
|
|
Elm_Entry_Anchor_Hover_Info ei;
|
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-07-02 21:12:30 -07:00
|
|
|
if (sd->hoversel) return;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
ei.anchor_info = info;
|
|
|
|
|
|
|
|
sd->anchor_hover.pop = elm_icon_add(obj);
|
|
|
|
evas_object_move(sd->anchor_hover.pop, info->x, info->y);
|
|
|
|
evas_object_resize(sd->anchor_hover.pop, info->w, info->h);
|
|
|
|
|
|
|
|
sd->anchor_hover.hover = elm_hover_add(obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(sd->anchor_hover.hover, EVAS_CALLBACK_DEL, _anchor_hover_del_cb, obj);
|
2017-06-13 03:41:15 -07:00
|
|
|
efl_ui_mirrored_set
|
|
|
|
(sd->anchor_hover.hover, efl_ui_mirrored_get(obj));
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->anchor_hover.hover_style)
|
|
|
|
elm_object_style_set
|
|
|
|
(sd->anchor_hover.hover, sd->anchor_hover.hover_style);
|
|
|
|
|
|
|
|
hover_parent = sd->anchor_hover.hover_parent;
|
|
|
|
if (!hover_parent) hover_parent = obj;
|
|
|
|
elm_hover_parent_set(sd->anchor_hover.hover, hover_parent);
|
|
|
|
elm_hover_target_set(sd->anchor_hover.hover, sd->anchor_hover.pop);
|
|
|
|
ei.hover = sd->anchor_hover.hover;
|
|
|
|
|
|
|
|
evas_object_geometry_get(hover_parent, &x, &y, &w, &h);
|
|
|
|
ei.hover_parent.x = x;
|
|
|
|
ei.hover_parent.y = y;
|
|
|
|
ei.hover_parent.w = w;
|
|
|
|
ei.hover_parent.h = h;
|
|
|
|
px = info->x + (info->w / 2);
|
|
|
|
py = info->y + (info->h / 2);
|
|
|
|
ei.hover_left = 1;
|
|
|
|
if (px < (x + (w / 3))) ei.hover_left = 0;
|
|
|
|
ei.hover_right = 1;
|
|
|
|
if (px > (x + ((w * 2) / 3))) ei.hover_right = 0;
|
|
|
|
ei.hover_top = 1;
|
|
|
|
if (py < (y + (h / 3))) ei.hover_top = 0;
|
|
|
|
ei.hover_bottom = 1;
|
|
|
|
if (py > (y + ((h * 2) / 3))) ei.hover_bottom = 0;
|
|
|
|
|
|
|
|
/* Swap right and left because they switch sides in RTL */
|
2017-06-13 03:41:15 -07:00
|
|
|
if (efl_ui_mirrored_get(sd->anchor_hover.hover))
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
|
|
|
Eina_Bool tmp = ei.hover_left;
|
|
|
|
|
|
|
|
ei.hover_left = ei.hover_right;
|
|
|
|
ei.hover_right = tmp;
|
|
|
|
}
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_ENTRY_EVENT_ANCHOR_HOVER_OPENED, &ei);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add
|
2016-06-10 01:29:40 -07:00
|
|
|
(sd->anchor_hover.hover, EFL_UI_EVENT_CLICKED, _anchor_hover_clicked_cb, obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
/* FIXME: Should just check if there's any callback registered to
|
|
|
|
* the smart events instead. This is used to determine if anyone
|
|
|
|
* cares about the hover or not. */
|
|
|
|
if (!elm_layout_content_get(sd->anchor_hover.hover, "middle") &&
|
|
|
|
!elm_layout_content_get(sd->anchor_hover.hover, "left") &&
|
|
|
|
!elm_layout_content_get(sd->anchor_hover.hover, "right") &&
|
|
|
|
!elm_layout_content_get(sd->anchor_hover.hover, "top") &&
|
|
|
|
!elm_layout_content_get(sd->anchor_hover.hover, "bottom"))
|
|
|
|
{
|
2014-01-21 17:38:55 -08:00
|
|
|
ELM_SAFE_FREE(sd->anchor_hover.hover, evas_object_del);
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_show(sd->anchor_hover.hover);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_entry_anchor_clicked_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
2012-08-30 09:45:15 -07:00
|
|
|
const char *emission,
|
2014-01-06 06:30:02 -08:00
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 23:41:07 -07:00
|
|
|
{
|
2008-10-24 19:11:06 -07:00
|
|
|
Elm_Entry_Anchor_Info ei;
|
2011-07-22 21:00:49 -07:00
|
|
|
const char *p;
|
|
|
|
char *p2;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2011-07-22 21:00:49 -07:00
|
|
|
p = emission + sizeof("nchor,mouse,clicked,");
|
|
|
|
ei.button = strtol(p, &p2, 10);
|
2011-08-25 14:57:23 -07:00
|
|
|
ei.name = p2 + 1;
|
2011-07-21 13:54:54 -07:00
|
|
|
ei.x = ei.y = ei.w = ei.h = 0;
|
2011-03-14 19:01:42 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
_signal_anchor_geoms_do_things_with_lol(sd, &ei);
|
2011-07-21 14:19:55 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->disabled)
|
2012-03-06 02:09:13 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_ANCHOR_CLICKED, &ei);
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_hover_anchor_clicked_do(data, &ei);
|
2012-03-06 02:09:13 -08:00
|
|
|
}
|
2008-10-16 23:41:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-01-06 06:30:02 -08:00
|
|
|
_entry_anchor_move_signal_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 23:41:07 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_anchor_in_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 23:41:07 -07:00
|
|
|
{
|
2011-07-21 14:19:55 -07:00
|
|
|
Elm_Entry_Anchor_Info ei;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2011-07-22 02:08:58 -07:00
|
|
|
ei.name = emission + sizeof("nchor,mouse,in,");
|
2011-07-21 14:19:55 -07:00
|
|
|
ei.button = 0;
|
|
|
|
ei.x = ei.y = ei.w = ei.h = 0;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
_signal_anchor_geoms_do_things_with_lol(sd, &ei);
|
2011-07-21 14:19:55 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->disabled)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_ANCHOR_IN, &ei);
|
2008-10-16 23:41:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_anchor_out_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-16 23:41:07 -07:00
|
|
|
{
|
2011-07-21 14:19:55 -07:00
|
|
|
Elm_Entry_Anchor_Info ei;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2011-07-22 02:08:58 -07:00
|
|
|
ei.name = emission + sizeof("nchor,mouse,out,");
|
2011-07-21 14:19:55 -07:00
|
|
|
ei.button = 0;
|
|
|
|
ei.x = ei.y = ei.w = ei.h = 0;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
_signal_anchor_geoms_do_things_with_lol(sd, &ei);
|
2011-07-21 14:19:55 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->disabled)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_ANCHOR_OUT, &ei);
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
2008-10-22 01:58:56 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_key_enter_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2008-10-22 01:58:56 -07:00
|
|
|
{
|
2018-03-06 17:54:57 -08:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
if (sd->single_line)
|
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_ACTIVATED, NULL);
|
2008-10-22 01:58:56 -07:00
|
|
|
}
|
|
|
|
|
2012-08-14 03:47:26 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_key_escape_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2012-08-14 03:47:26 -07:00
|
|
|
{
|
2018-03-06 17:54:57 -08:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
|
|
|
if (sd->single_line)
|
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_ABORTED, NULL);
|
2012-08-14 03:47:26 -07:00
|
|
|
}
|
|
|
|
|
2009-12-01 03:03:14 -08:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_mouse_down_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(data, ELM_ENTRY_EVENT_PRESS, NULL);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_mouse_clicked_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(data, EFL_UI_EVENT_CLICKED, NULL);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_mouse_double_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(data, EFL_UI_EVENT_CLICKED_DOUBLE, NULL);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2011-07-25 07:08:38 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_mouse_triple_signal_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-07-25 07:08:38 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(data, EFL_UI_EVENT_CLICKED_TRIPLE, NULL);
|
2011-07-25 07:08:38 -07:00
|
|
|
}
|
|
|
|
|
2010-04-26 07:59:01 -07:00
|
|
|
static Evas_Object *
|
2012-08-30 09:45:15 -07:00
|
|
|
_item_get(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *edje EINA_UNUSED,
|
|
|
|
const char *part EINA_UNUSED,
|
2012-08-30 09:45:15 -07:00
|
|
|
const char *item)
|
2010-04-26 07:59:01 -07:00
|
|
|
{
|
2010-04-27 01:06:42 -07:00
|
|
|
Eina_List *l;
|
2012-08-30 09:45:15 -07:00
|
|
|
Evas_Object *o;
|
2010-04-27 01:06:42 -07:00
|
|
|
Elm_Entry_Item_Provider *ip;
|
2014-01-08 00:42:55 -08:00
|
|
|
const char *style = elm_widget_style_get(data);
|
2010-04-26 07:59:01 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return NULL;
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->item_providers, l, ip)
|
2010-04-27 01:06:42 -07:00
|
|
|
{
|
|
|
|
o = ip->func(ip->data, data, item);
|
|
|
|
if (o) return o;
|
|
|
|
}
|
2015-12-09 03:38:21 -08:00
|
|
|
if (item && !strncmp(item, "file://", 7))
|
2010-12-02 00:25:36 -08:00
|
|
|
{
|
2010-12-06 21:04:45 -08:00
|
|
|
const char *fname = item + 7;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-12-02 00:25:36 -08:00
|
|
|
o = evas_object_image_filled_add(evas_object_evas_get(data));
|
2016-08-18 04:09:16 -07:00
|
|
|
evas_object_image_load_orientation_set(o, EINA_TRUE);
|
2010-12-02 00:25:36 -08:00
|
|
|
evas_object_image_file_set(o, fname, NULL);
|
|
|
|
if (evas_object_image_load_error_get(o) == EVAS_LOAD_ERROR_NONE)
|
|
|
|
{
|
|
|
|
evas_object_show(o);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_del(o);
|
|
|
|
o = edje_object_add(evas_object_evas_get(data));
|
2016-08-04 03:13:29 -07:00
|
|
|
_elm_theme_object_set
|
2014-01-08 00:42:55 -08:00
|
|
|
(data, o, "entry/emoticon", "wtf", style);
|
2010-12-02 00:25:36 -08:00
|
|
|
}
|
|
|
|
return o;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2010-04-26 07:59:01 -07:00
|
|
|
o = edje_object_add(evas_object_evas_get(data));
|
2016-08-04 03:13:29 -07:00
|
|
|
if (!_elm_theme_object_set
|
2014-01-08 00:42:55 -08:00
|
|
|
(data, o, "entry", item, style))
|
2016-08-04 03:13:29 -07:00
|
|
|
_elm_theme_object_set
|
2014-01-08 00:42:55 -08:00
|
|
|
(data, o, "entry/emoticon", "wtf", style);
|
2010-04-26 07:59:01 -07:00
|
|
|
return o;
|
|
|
|
}
|
2010-04-12 01:12:02 -07:00
|
|
|
|
2015-12-21 06:41:28 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_entry_has_new_line(const char *text)
|
|
|
|
{
|
|
|
|
if (!text) return EINA_FALSE;
|
|
|
|
|
|
|
|
while (*text)
|
|
|
|
{
|
|
|
|
if (!strncmp(text, "<br", 3) || !strncmp(text, "<ps", 3))
|
|
|
|
{
|
|
|
|
if (text[4] == '>' || ((text[4] == '/') && (text[5] == '>')))
|
|
|
|
{
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
text++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
_entry_remove_new_line(const char *text)
|
|
|
|
{
|
|
|
|
Eina_Strbuf *str;
|
|
|
|
char *new_text;
|
|
|
|
|
|
|
|
if (!_entry_has_new_line(text)) return NULL;
|
|
|
|
|
|
|
|
str = eina_strbuf_new();
|
|
|
|
eina_strbuf_append(str, text);
|
|
|
|
eina_strbuf_replace_all(str, "<br>", "");
|
|
|
|
eina_strbuf_replace_all(str, "<br/>", "");
|
|
|
|
eina_strbuf_replace_all(str, "<ps>", "");
|
|
|
|
eina_strbuf_replace_all(str, "<ps/>", "");
|
|
|
|
new_text = eina_strbuf_string_steal(str);
|
|
|
|
eina_strbuf_free(str);
|
|
|
|
return new_text;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_entry_new_line_filter_init(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
const char *text;
|
|
|
|
char *text2 = NULL;
|
|
|
|
|
|
|
|
if (elm_entry_is_empty(obj)) return;
|
|
|
|
|
|
|
|
text = elm_entry_entry_get(obj);
|
|
|
|
text2 = _entry_remove_new_line(text);
|
|
|
|
if (text2)
|
|
|
|
{
|
|
|
|
elm_entry_entry_set(obj, text2);
|
|
|
|
free(text2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_entry_new_line_filter_cb(void *data EINA_UNUSED,
|
|
|
|
Evas_Object *entry EINA_UNUSED,
|
|
|
|
char **text)
|
|
|
|
{
|
2015-12-21 06:45:34 -08:00
|
|
|
char *ret;
|
2015-12-21 06:41:28 -08:00
|
|
|
|
|
|
|
if (!*text) return;
|
|
|
|
|
2015-12-21 06:45:34 -08:00
|
|
|
ret = _entry_remove_new_line(*text);
|
|
|
|
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
free(*text);
|
|
|
|
*text = ret;
|
|
|
|
}
|
2015-12-21 06:41:28 -08:00
|
|
|
}
|
|
|
|
|
2012-02-07 23:23:49 -08:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_markup_filter_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *edje EINA_UNUSED,
|
|
|
|
const char *part EINA_UNUSED,
|
2012-08-30 09:45:15 -07:00
|
|
|
char **text)
|
2012-02-07 23:23:49 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Entry_Markup_Filter *tf;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->markup_filters, l, tf)
|
2012-02-07 23:23:49 -08:00
|
|
|
{
|
|
|
|
tf->func(tf->data, data, text);
|
|
|
|
if (!*text)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-15 09:02:03 -07:00
|
|
|
/* This function is used to insert text by chunks in jobs */
|
|
|
|
static Eina_Bool
|
|
|
|
_text_append_idler(void *data)
|
|
|
|
{
|
|
|
|
int start;
|
|
|
|
char backup;
|
2012-08-30 09:45:15 -07:00
|
|
|
Evas_Object *obj = (Evas_Object *)data;
|
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return ECORE_CALLBACK_CANCEL;
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->text, eina_stringshare_del);
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->changed = EINA_TRUE;
|
2011-05-15 09:02:03 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
start = sd->append_text_position;
|
2014-01-23 06:09:28 -08:00
|
|
|
if ((start + ELM_ENTRY_CHUNK_SIZE) < sd->append_text_len)
|
2011-05-15 09:02:03 -07:00
|
|
|
{
|
2011-08-22 07:20:02 -07:00
|
|
|
int pos = start;
|
|
|
|
int tag_start, esc_start;
|
|
|
|
|
|
|
|
tag_start = esc_start = -1;
|
|
|
|
/* Find proper markup cut place */
|
2014-01-23 06:09:28 -08:00
|
|
|
while (pos - start < ELM_ENTRY_CHUNK_SIZE)
|
2011-08-22 07:20:02 -07:00
|
|
|
{
|
|
|
|
int prev_pos = pos;
|
|
|
|
Eina_Unicode tmp =
|
2013-01-21 18:00:55 -08:00
|
|
|
eina_unicode_utf8_next_get(sd->append_text_left, &pos);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-08-22 07:20:02 -07:00
|
|
|
if (esc_start == -1)
|
|
|
|
{
|
|
|
|
if (tmp == '<')
|
2012-08-30 09:45:15 -07:00
|
|
|
tag_start = prev_pos;
|
2011-08-22 07:20:02 -07:00
|
|
|
else if (tmp == '>')
|
2012-08-30 09:45:15 -07:00
|
|
|
tag_start = -1;
|
2011-08-22 07:20:02 -07:00
|
|
|
}
|
2011-09-22 04:31:22 -07:00
|
|
|
if (tag_start == -1)
|
2011-08-22 07:20:02 -07:00
|
|
|
{
|
|
|
|
if (tmp == '&')
|
2012-08-30 09:45:15 -07:00
|
|
|
esc_start = prev_pos;
|
2011-08-22 07:20:02 -07:00
|
|
|
else if (tmp == ';')
|
2012-08-30 09:45:15 -07:00
|
|
|
esc_start = -1;
|
2011-08-22 07:20:02 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tag_start >= 0)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->append_text_position = tag_start;
|
2011-08-22 07:20:02 -07:00
|
|
|
}
|
|
|
|
else if (esc_start >= 0)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->append_text_position = esc_start;
|
2011-08-22 07:20:02 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->append_text_position = pos;
|
2011-08-22 07:20:02 -07:00
|
|
|
}
|
2011-05-15 09:02:03 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->append_text_position = sd->append_text_len;
|
2011-05-15 09:02:03 -07:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
backup = sd->append_text_left[sd->append_text_position];
|
|
|
|
sd->append_text_left[sd->append_text_position] = '\0';
|
2011-05-15 09:02:03 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_append
|
|
|
|
(sd->entry_edje, "elm.text", sd->append_text_left + start);
|
2011-05-15 09:02:03 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->append_text_left[sd->append_text_position] = backup;
|
2011-05-15 09:02:03 -07:00
|
|
|
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
_elm_entry_guide_update(obj, EINA_TRUE);
|
|
|
|
|
2011-05-15 09:02:03 -07:00
|
|
|
/* If there's still more to go, renew the idler, else, cleanup */
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->append_text_position < sd->append_text_len)
|
2011-05-15 09:02:03 -07:00
|
|
|
{
|
|
|
|
return ECORE_CALLBACK_RENEW;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-16 22:34:21 -07:00
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, sd->cursor_pos);
|
2012-08-30 09:45:15 -07:00
|
|
|
free(sd->append_text_left);
|
|
|
|
sd->append_text_left = NULL;
|
|
|
|
sd->append_text_idler = NULL;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 03:57:19 -08:00
|
|
|
(obj, ELM_ENTRY_EVENT_TEXT_SET_DONE, NULL);
|
2011-05-15 09:02:03 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-14 02:50:05 -07:00
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_chars_add_till_limit(Evas_Object *obj,
|
|
|
|
char **text,
|
|
|
|
int can_add,
|
|
|
|
Length_Unit unit)
|
2011-06-14 02:50:05 -07:00
|
|
|
{
|
2011-09-24 19:56:54 -07:00
|
|
|
int i = 0, current_len = 0;
|
|
|
|
char *new_text;
|
|
|
|
|
|
|
|
if (!*text) return;
|
2011-06-14 02:50:05 -07:00
|
|
|
if (unit >= LENGTH_UNIT_LAST) return;
|
2013-01-07 03:37:53 -08:00
|
|
|
if (strstr(*text, "<preedit")) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-09-24 19:56:54 -07:00
|
|
|
new_text = *text;
|
|
|
|
current_len = strlen(*text);
|
2011-06-14 02:50:05 -07:00
|
|
|
while (*new_text)
|
|
|
|
{
|
2011-11-15 00:26:02 -08:00
|
|
|
int idx = 0, unit_size = 0;
|
|
|
|
char *markup, *utfstr;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-06-14 02:50:05 -07:00
|
|
|
if (*new_text == '<')
|
|
|
|
{
|
2011-11-15 00:26:02 -08:00
|
|
|
while (*(new_text + idx) != '>')
|
2011-06-14 02:50:05 -07:00
|
|
|
{
|
2011-11-15 00:26:02 -08:00
|
|
|
idx++;
|
|
|
|
if (!*(new_text + idx)) break;
|
2011-06-14 02:50:05 -07:00
|
|
|
}
|
|
|
|
}
|
2011-11-15 00:26:02 -08:00
|
|
|
else if (*new_text == '&')
|
2011-06-14 02:50:05 -07:00
|
|
|
{
|
2011-11-15 00:26:02 -08:00
|
|
|
while (*(new_text + idx) != ';')
|
2011-06-14 02:50:05 -07:00
|
|
|
{
|
2011-11-15 00:26:02 -08:00
|
|
|
idx++;
|
|
|
|
if (!*(new_text + idx)) break;
|
2011-06-14 02:50:05 -07:00
|
|
|
}
|
2011-11-15 00:26:02 -08:00
|
|
|
}
|
|
|
|
idx = evas_string_char_next_get(new_text, idx, NULL);
|
|
|
|
markup = malloc(idx + 1);
|
|
|
|
if (markup)
|
|
|
|
{
|
|
|
|
strncpy(markup, new_text, idx);
|
|
|
|
markup[idx] = 0;
|
|
|
|
utfstr = elm_entry_markup_to_utf8(markup);
|
|
|
|
if (utfstr)
|
2011-06-14 02:50:05 -07:00
|
|
|
{
|
2011-11-15 00:26:02 -08:00
|
|
|
if (unit == LENGTH_UNIT_BYTE)
|
|
|
|
unit_size = strlen(utfstr);
|
|
|
|
else if (unit == LENGTH_UNIT_CHAR)
|
|
|
|
unit_size = evas_string_char_len_get(utfstr);
|
2014-01-21 18:08:47 -08:00
|
|
|
ELM_SAFE_FREE(utfstr, free);
|
2011-06-14 02:50:05 -07:00
|
|
|
}
|
2014-01-21 18:08:47 -08:00
|
|
|
ELM_SAFE_FREE(markup, free);
|
2011-11-15 00:26:02 -08:00
|
|
|
}
|
|
|
|
if (can_add < unit_size)
|
|
|
|
{
|
|
|
|
if (!i)
|
2011-06-14 02:50:05 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 03:57:19 -08:00
|
|
|
(obj, ELM_ENTRY_EVENT_MAXLENGTH_REACHED, NULL);
|
2014-01-21 18:08:47 -08:00
|
|
|
ELM_SAFE_FREE(*text, free);
|
2011-11-15 00:26:02 -08:00
|
|
|
return;
|
2011-06-14 02:50:05 -07:00
|
|
|
}
|
2011-11-15 00:26:02 -08:00
|
|
|
can_add = 0;
|
2012-08-30 09:45:15 -07:00
|
|
|
strncpy(new_text, new_text + idx,
|
|
|
|
current_len - ((new_text + idx) - *text));
|
2011-11-15 00:26:02 -08:00
|
|
|
current_len -= idx;
|
|
|
|
(*text)[current_len] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
new_text += idx;
|
|
|
|
can_add -= unit_size;
|
2011-06-14 02:50:05 -07:00
|
|
|
}
|
2011-11-15 00:26:02 -08:00
|
|
|
i++;
|
2011-06-14 02:50:05 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_ENTRY_EVENT_MAXLENGTH_REACHED, NULL);
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2017-12-04 21:39:20 -08:00
|
|
|
_elm_entry_efl_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
|
|
|
/* always pass to both edje objs */
|
|
|
|
edje_object_signal_emit(sd->entry_edje, emission, source);
|
2013-07-09 02:31:22 -07:00
|
|
|
edje_object_message_signal_process(sd->entry_edje);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->scr_edje)
|
2013-07-09 02:31:22 -07:00
|
|
|
{
|
|
|
|
edje_object_signal_emit(sd->scr_edje, emission, source);
|
|
|
|
edje_object_message_signal_process(sd->scr_edje);
|
|
|
|
}
|
2011-06-14 02:50:05 -07:00
|
|
|
}
|
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-12-04 21:39:20 -08:00
|
|
|
_elm_entry_efl_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2017-08-03 01:24:50 -07:00
|
|
|
Eina_Bool ok;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-12-04 21:39:20 -08:00
|
|
|
ok = efl_layout_signal_callback_add(sd->entry_edje, emission, source, func_cb, data);
|
2017-08-03 01:24:50 -07:00
|
|
|
if (sd->scr_edje)
|
2017-12-04 21:39:20 -08:00
|
|
|
ok = efl_layout_signal_callback_add(sd->scr_edje, emission, source, func_cb, data);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
return ok;
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-12-04 21:39:20 -08:00
|
|
|
_elm_entry_efl_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
2017-08-03 01:24:50 -07:00
|
|
|
{
|
|
|
|
Eina_Bool ok;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-12-04 21:39:20 -08:00
|
|
|
ok = efl_layout_signal_callback_del(sd->entry_edje, emission, source, func_cb, data);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->scr_edje)
|
2017-12-04 21:39:20 -08:00
|
|
|
ok = efl_layout_signal_callback_del(sd->scr_edje, emission, source, func_cb, data);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
return ok;
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
// Legacy support... del() returns the user data.
|
|
|
|
void
|
|
|
|
_elm_entry_signal_callback_add_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2017-08-03 01:24:50 -07:00
|
|
|
Elm_Entry_Data *sd;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
_elm_layout_signal_callback_add_legacy(obj, sd->entry_edje, &sd->edje_signals,
|
|
|
|
emission, source, func_cb, data);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
if (sd->scr_edje)
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_callback_add(sd->scr_edje, emission, source, func_cb, data);
|
2017-08-03 01:24:50 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
void *
|
|
|
|
_elm_entry_signal_callback_del_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb)
|
|
|
|
{
|
|
|
|
Elm_Entry_Data *sd;
|
|
|
|
void *data;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
|
|
|
if (!sd) return NULL;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-03 01:24:50 -07:00
|
|
|
data = _elm_layout_signal_callback_del_legacy(obj, sd->entry_edje, &sd->edje_signals,
|
|
|
|
emission, source, func_cb);
|
|
|
|
|
|
|
|
if (sd->scr_edje)
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_callback_del(sd->scr_edje, emission, source, func_cb, data);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2016-08-05 10:31:49 -07:00
|
|
|
return data;
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_elm_entry_content_set(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, const char *part, Evas_Object *content)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
|
2014-03-22 10:44:29 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
/* too bad entry does not follow the pattern
|
|
|
|
* "elm,state,{icon,end},visible", we have to repeat ourselves */
|
|
|
|
if (!part || !strcmp(part, "icon") || !strcmp(part, "elm.swallow.icon"))
|
|
|
|
elm_entry_icon_visible_set(obj, EINA_TRUE);
|
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (part && (!strcmp(part, "end") || !strcmp(part, "elm.swallow.end")))
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_end_visible_set(obj, EINA_TRUE);
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return EINA_TRUE;
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
static Evas_Object*
|
|
|
|
_elm_entry_content_unset(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, const char *part)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2014-05-09 22:07:14 -07:00
|
|
|
Evas_Object *ret = NULL;
|
2016-08-15 06:44:41 -07:00
|
|
|
ret = efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part));
|
2014-05-09 22:07:14 -07:00
|
|
|
if (!ret) return NULL;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
/* too bad entry does not follow the pattern
|
|
|
|
* "elm,state,{icon,end},hidden", we have to repeat ourselves */
|
|
|
|
if (!part || !strcmp(part, "icon") || !strcmp(part, "elm.swallow.icon"))
|
|
|
|
elm_entry_icon_visible_set(obj, EINA_FALSE);
|
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (part && (!strcmp(part, "end") || !strcmp(part, "elm.swallow.end")))
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_end_visible_set(obj, EINA_FALSE);
|
|
|
|
|
2014-05-09 22:07:14 -07:00
|
|
|
return ret;
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2015-07-03 03:08:23 -07:00
|
|
|
static void
|
2015-07-13 09:38:45 -07:00
|
|
|
_entry_text_append(Evas_Object* obj, const char* entry, Eina_Bool set)
|
2015-07-03 03:08:23 -07:00
|
|
|
{
|
|
|
|
int len = 0;
|
|
|
|
if (!entry) return;
|
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2015-07-03 03:08:23 -07:00
|
|
|
len = strlen(entry);
|
|
|
|
|
|
|
|
if (sd->append_text_left)
|
|
|
|
{
|
|
|
|
char *tmpbuf;
|
|
|
|
|
|
|
|
tmpbuf = realloc(sd->append_text_left, sd->append_text_len + len + 1);
|
|
|
|
if (!tmpbuf)
|
|
|
|
{
|
|
|
|
/* Do something */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sd->append_text_left = tmpbuf;
|
|
|
|
memcpy(sd->append_text_left + sd->append_text_len, entry, len + 1);
|
|
|
|
sd->append_text_len += len;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (len > ELM_ENTRY_CHUNK_SIZE)
|
|
|
|
{
|
|
|
|
sd->append_text_left = (char *)malloc(len + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sd->append_text_left)
|
|
|
|
{
|
|
|
|
memcpy(sd->append_text_left, entry, len + 1);
|
|
|
|
sd->append_text_position = 0;
|
|
|
|
sd->append_text_len = len;
|
|
|
|
sd->append_text_idler = ecore_idler_add(_text_append_idler, obj);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-13 09:38:45 -07:00
|
|
|
if (set)
|
|
|
|
{
|
|
|
|
edje_object_part_text_set(sd->entry_edje, "elm.text", entry);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edje_object_part_text_append(sd->entry_edje, "elm.text", entry);
|
|
|
|
}
|
2015-08-16 22:34:21 -07:00
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, sd->cursor_pos);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(obj, ELM_ENTRY_EVENT_TEXT_SET_DONE, NULL);
|
2015-07-03 03:08:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-05 04:06:24 -07:00
|
|
|
static Eina_Bool
|
2017-06-04 07:25:36 -07:00
|
|
|
_elm_entry_text_set(Eo *obj, Elm_Entry_Data *sd, const char *part, const char *entry)
|
2011-07-04 03:40:13 -07:00
|
|
|
{
|
|
|
|
int len = 0;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2011-07-04 03:40:13 -07:00
|
|
|
if (!entry) entry = "";
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
if (strcmp(part, "elm.text"))
|
2011-10-27 07:16:31 -07:00
|
|
|
{
|
2017-06-29 03:32:19 -07:00
|
|
|
edje_object_part_text_set(sd->entry_edje, part, entry);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return EINA_TRUE;
|
2011-10-27 07:16:31 -07:00
|
|
|
}
|
|
|
|
|
2012-05-21 04:28:41 -07:00
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->text, eina_stringshare_del);
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->changed = EINA_TRUE;
|
2011-07-04 03:40:13 -07:00
|
|
|
|
|
|
|
/* Clear currently pending job if there is one */
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->append_text_idler)
|
2011-07-04 03:40:13 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ecore_idler_del(sd->append_text_idler);
|
2014-01-21 18:08:47 -08:00
|
|
|
ELM_SAFE_FREE(sd->append_text_left, free);
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->append_text_idler = NULL;
|
2011-07-04 03:40:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
len = strlen(entry);
|
2014-08-08 00:16:42 -07:00
|
|
|
if (sd->append_text_left)
|
|
|
|
{
|
|
|
|
free(sd->append_text_left);
|
|
|
|
sd->append_text_left = NULL;
|
|
|
|
}
|
2011-07-04 03:40:13 -07:00
|
|
|
|
2016-07-06 19:13:05 -07:00
|
|
|
/* Need to clear the entry first */
|
2016-12-08 18:33:26 -08:00
|
|
|
sd->cursor_pos = edje_object_part_text_cursor_pos_get
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2016-07-06 19:13:05 -07:00
|
|
|
edje_object_part_text_set(sd->entry_edje, "elm.text", "");
|
2015-07-13 09:38:45 -07:00
|
|
|
_entry_text_append(obj, entry, EINA_TRUE);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-12-06 23:12:58 -08:00
|
|
|
if (len > 0)
|
2012-08-30 09:45:15 -07:00
|
|
|
_elm_entry_guide_update(obj, EINA_TRUE);
|
2012-04-08 22:25:27 -07:00
|
|
|
else
|
2012-08-30 09:45:15 -07:00
|
|
|
_elm_entry_guide_update(obj, EINA_FALSE);
|
|
|
|
|
2011-09-29 05:02:49 -07:00
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
2014-03-22 10:44:29 -07:00
|
|
|
return EINA_TRUE;
|
2011-07-04 03:40:13 -07:00
|
|
|
}
|
|
|
|
|
2017-07-05 04:06:24 -07:00
|
|
|
static const char *
|
2017-06-04 07:25:36 -07:00
|
|
|
_elm_entry_text_get(Eo *obj, Elm_Entry_Data *sd, const char *item)
|
2011-07-04 03:40:13 -07:00
|
|
|
{
|
|
|
|
const char *text;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &item, EINA_TRUE))
|
|
|
|
return NULL;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-06-29 03:32:19 -07:00
|
|
|
if (strcmp(item, "elm.text"))
|
|
|
|
return edje_object_part_text_get(sd->entry_edje, item);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
text = edje_object_part_text_get(sd->entry_edje, "elm.text");
|
2011-07-04 03:40:13 -07:00
|
|
|
if (!text)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ERR("text=NULL for edje %p, part 'elm.text'", sd->entry_edje);
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return NULL;
|
2011-07-04 03:40:13 -07:00
|
|
|
}
|
2011-07-28 01:18:37 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->append_text_len > 0)
|
2011-07-28 01:18:37 -07:00
|
|
|
{
|
|
|
|
char *tmpbuf;
|
2014-01-21 04:00:29 -08:00
|
|
|
size_t len, tlen;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-07-05 06:32:19 -07:00
|
|
|
tlen = strlen(text);
|
2014-01-21 04:00:29 -08:00
|
|
|
len = tlen + sd->append_text_len - sd->append_text_position;
|
2013-11-21 18:06:37 -08:00
|
|
|
/* FIXME: need that or we do copy uninitialised data */
|
2014-01-21 04:00:29 -08:00
|
|
|
tmpbuf = calloc(1, len + 1);
|
2011-07-28 01:18:37 -07:00
|
|
|
if (!tmpbuf)
|
|
|
|
{
|
|
|
|
ERR("Failed to allocate memory for entry's text %p", obj);
|
2014-03-22 10:44:29 -07:00
|
|
|
return NULL;
|
2011-07-28 01:18:37 -07:00
|
|
|
}
|
|
|
|
memcpy(tmpbuf, text, tlen);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->append_text_left)
|
|
|
|
memcpy(tmpbuf + tlen, sd->append_text_left
|
|
|
|
+ sd->append_text_position, sd->append_text_len
|
|
|
|
- sd->append_text_position);
|
2014-01-21 04:00:29 -08:00
|
|
|
tmpbuf[len] = '\0';
|
2012-08-30 09:45:15 -07:00
|
|
|
eina_stringshare_replace(&sd->text, tmpbuf);
|
2011-07-28 01:18:37 -07:00
|
|
|
free(tmpbuf);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
eina_stringshare_replace(&sd->text, text);
|
2011-07-28 01:18:37 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->text;
|
2011-07-04 03:40:13 -07:00
|
|
|
}
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
const char *txt;
|
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return NULL;
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->password) return NULL;
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
txt = elm_widget_access_info_get(obj);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2015-04-30 22:32:34 -07:00
|
|
|
if (!txt)
|
2015-05-18 03:31:27 -07:00
|
|
|
return _elm_util_mkup_to_text(elm_entry_entry_get(obj));
|
2015-04-30 22:32:34 -07:00
|
|
|
else return strdup(txt);
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_state_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
Eina_Strbuf *buf;
|
2013-01-31 02:56:18 -08:00
|
|
|
char *ret;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return NULL;
|
2013-01-31 03:07:26 -08:00
|
|
|
ret = NULL;
|
2012-08-18 06:52:03 -07:00
|
|
|
buf = eina_strbuf_new();
|
|
|
|
|
|
|
|
if (elm_widget_disabled_get(obj))
|
|
|
|
eina_strbuf_append(buf, "State: Disabled");
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!sd->editable)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
if (!eina_strbuf_length_get(buf))
|
|
|
|
eina_strbuf_append(buf, "State: Not Editable");
|
|
|
|
else eina_strbuf_append(buf, ", Not Editable");
|
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->password)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
if (!eina_strbuf_length_get(buf))
|
|
|
|
eina_strbuf_append(buf, "State: Password");
|
|
|
|
else eina_strbuf_append(buf, ", Password");
|
|
|
|
}
|
|
|
|
|
2013-01-31 02:56:18 -08:00
|
|
|
if (!eina_strbuf_length_get(buf)) goto buf_free;
|
2012-08-18 06:52:03 -07:00
|
|
|
|
2013-01-31 02:56:18 -08:00
|
|
|
ret = eina_strbuf_string_steal(buf);
|
|
|
|
|
|
|
|
buf_free:
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
2012-08-18 06:52:03 -07:00
|
|
|
}
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
static void
|
|
|
|
_entry_selection_callbacks_unregister(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "selection,start", "elm.text",
|
|
|
|
_entry_selection_start_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "selection,changed", "elm.text",
|
|
|
|
_entry_selection_changed_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "entry,selection,all,request",
|
|
|
|
"elm.text", _entry_selection_all_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "entry,selection,none,request",
|
|
|
|
"elm.text", _entry_selection_none_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "selection,cleared", "elm.text",
|
|
|
|
_entry_selection_cleared_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "entry,paste,request,*", "elm.text",
|
|
|
|
_entry_paste_request_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "entry,copy,notify", "elm.text",
|
|
|
|
_entry_copy_notify_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "entry,cut,notify", "elm.text",
|
|
|
|
_entry_cut_notify_signal_cb, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_entry_selection_callbacks_register(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(sd->entry_edje, "selection,start", "elm.text",
|
|
|
|
_entry_selection_start_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(sd->entry_edje, "selection,changed", "elm.text",
|
|
|
|
_entry_selection_changed_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(sd->entry_edje, "entry,selection,all,request",
|
|
|
|
"elm.text", _entry_selection_all_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(sd->entry_edje, "entry,selection,none,request",
|
|
|
|
"elm.text", _entry_selection_none_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(sd->entry_edje, "selection,cleared", "elm.text",
|
|
|
|
_entry_selection_cleared_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(sd->entry_edje, "entry,paste,request,*", "elm.text",
|
|
|
|
_entry_paste_request_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(sd->entry_edje, "entry,copy,notify", "elm.text",
|
|
|
|
_entry_copy_notify_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(sd->entry_edje, "entry,cut,notify", "elm.text",
|
|
|
|
_entry_cut_notify_signal_cb, obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-01-09 23:37:55 -08:00
|
|
|
_elm_entry_resize_internal(Evas_Object *obj)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2014-01-09 23:37:55 -08:00
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->line_wrap)
|
|
|
|
{
|
2014-01-09 23:37:55 -08:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
else if (sd->scroll)
|
|
|
|
{
|
|
|
|
Evas_Coord vw = 0, vh = 0;
|
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_content_viewport_geometry_get
|
|
|
|
(obj, NULL, NULL, &vw, &vh);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (vw < sd->ent_mw) vw = sd->ent_mw;
|
|
|
|
if (vh < sd->ent_mh) vh = sd->ent_mh;
|
|
|
|
evas_object_resize(sd->entry_edje, vw, vh);
|
|
|
|
}
|
|
|
|
|
2014-01-09 23:37:55 -08:00
|
|
|
if (sd->hoversel) _hoversel_position(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_resize_cb(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_elm_entry_resize_internal(data);
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2016-01-14 08:05:08 -08:00
|
|
|
static void
|
|
|
|
_selection_handlers_offset_calc(Evas_Object *obj, Evas_Object *handler, Evas_Coord canvasx, Evas_Coord canvasy)
|
|
|
|
{
|
|
|
|
Evas_Coord ex, ey;
|
|
|
|
Evas_Coord cx, cy, cw, ch;
|
|
|
|
Evas_Coord hh;
|
|
|
|
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2016-01-14 08:05:08 -08:00
|
|
|
evas_object_geometry_get(sd->entry_edje, &ex, &ey, NULL, NULL);
|
|
|
|
edje_object_part_text_cursor_geometry_get(sd->entry_edje, "elm.text",
|
|
|
|
&cx, &cy, &cw, &ch);
|
|
|
|
edje_object_size_min_calc(handler, NULL, &hh);
|
|
|
|
|
|
|
|
sd->ox = canvasx - (ex + cx + (cw / 2));
|
|
|
|
if (ch > hh)
|
|
|
|
sd->oy = canvasy - (ey + cy + ch);
|
|
|
|
else
|
|
|
|
sd->oy = canvasy - (ey + cy + (ch / 2));
|
|
|
|
|
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
|
|
|
sd->long_pressed = EINA_FALSE;
|
|
|
|
if (_elm_config->magnifier_enable)
|
|
|
|
{
|
|
|
|
_magnifier_create(obj);
|
|
|
|
_magnifier_show(obj);
|
2016-02-04 22:05:57 -08:00
|
|
|
_magnifier_move(obj);
|
2016-01-14 08:05:08 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-08 00:06:08 -08:00
|
|
|
static void
|
|
|
|
_start_handler_mouse_down_cb(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-11-08 00:06:08 -08:00
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
2014-03-06 02:33:05 -08:00
|
|
|
int start_pos, end_pos, main_pos, pos;
|
2013-11-08 00:06:08 -08:00
|
|
|
|
2013-11-08 00:18:28 -08:00
|
|
|
sd->start_handler_down = EINA_TRUE;
|
2014-03-06 02:33:05 -08:00
|
|
|
start_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
2013-11-08 00:06:08 -08:00
|
|
|
EDJE_CURSOR_SELECTION_BEGIN);
|
2014-03-06 02:33:05 -08:00
|
|
|
end_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_SELECTION_END);
|
2013-11-08 00:06:08 -08:00
|
|
|
main_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN);
|
2014-03-06 02:33:05 -08:00
|
|
|
if (start_pos <= end_pos)
|
|
|
|
{
|
|
|
|
pos = start_pos;
|
|
|
|
sd->sel_handler_cursor = EDJE_CURSOR_SELECTION_BEGIN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pos = end_pos;
|
|
|
|
sd->sel_handler_cursor = EDJE_CURSOR_SELECTION_END;
|
|
|
|
}
|
2013-11-08 00:06:08 -08:00
|
|
|
if (pos != main_pos)
|
2013-11-08 00:18:28 -08:00
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, pos);
|
2016-01-14 08:05:08 -08:00
|
|
|
_selection_handlers_offset_calc(data, sd->start_handler, ev->canvas.x, ev->canvas.y);
|
2013-11-08 00:06:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_start_handler_mouse_up_cb(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-11-08 00:18:28 -08:00
|
|
|
sd->start_handler_down = EINA_FALSE;
|
2013-11-08 00:06:08 -08:00
|
|
|
if (_elm_config->magnifier_enable)
|
|
|
|
_magnifier_hide(data);
|
2015-12-10 22:49:27 -08:00
|
|
|
/* Context menu should not appear, even in case of selector mode, if the
|
|
|
|
* flag is false (disabled) */
|
|
|
|
if ((!_elm_config->context_menu_disabled) &&
|
|
|
|
(!_elm_config->desktop_entry) && (sd->long_pressed))
|
2013-11-08 00:06:08 -08:00
|
|
|
_menu_call(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_start_handler_mouse_move_cb(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-11-08 00:18:28 -08:00
|
|
|
if (!sd->start_handler_down) return;
|
2013-11-08 00:06:08 -08:00
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
|
|
|
Evas_Coord ex, ey;
|
2016-02-04 22:05:57 -08:00
|
|
|
Evas_Coord cx, cy;
|
2014-03-06 02:33:05 -08:00
|
|
|
int pos;
|
2013-11-08 00:06:08 -08:00
|
|
|
|
|
|
|
evas_object_geometry_get(sd->entry_edje, &ex, &ey, NULL, NULL);
|
2014-03-06 02:33:05 -08:00
|
|
|
cx = ev->cur.canvas.x - sd->ox - ex;
|
|
|
|
cy = ev->cur.canvas.y - sd->oy - ey;
|
2013-11-08 00:06:08 -08:00
|
|
|
if (cx <= 0) cx = 1;
|
2014-03-06 02:33:05 -08:00
|
|
|
|
2013-11-08 00:06:08 -08:00
|
|
|
edje_object_part_text_cursor_coord_set(sd->entry_edje, "elm.text",
|
2014-03-06 02:33:05 -08:00
|
|
|
sd->sel_handler_cursor, cx, cy);
|
|
|
|
pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
|
|
|
sd->sel_handler_cursor);
|
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, pos);
|
2014-03-06 03:12:58 -08:00
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
|
|
|
sd->long_pressed = EINA_FALSE;
|
2013-11-08 00:06:08 -08:00
|
|
|
if (_elm_config->magnifier_enable)
|
2016-02-04 22:05:57 -08:00
|
|
|
_magnifier_move(data);
|
2013-11-08 00:06:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_end_handler_mouse_down_cb(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-11-08 00:06:08 -08:00
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
2014-03-06 02:33:05 -08:00
|
|
|
int pos, start_pos, end_pos, main_pos;
|
2013-11-08 00:06:08 -08:00
|
|
|
|
2013-11-08 00:18:28 -08:00
|
|
|
sd->end_handler_down = EINA_TRUE;
|
2014-03-06 02:33:05 -08:00
|
|
|
start_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_SELECTION_BEGIN);
|
|
|
|
end_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
2013-11-08 00:06:08 -08:00
|
|
|
EDJE_CURSOR_SELECTION_END);
|
2014-03-06 02:33:05 -08:00
|
|
|
if (start_pos < end_pos)
|
|
|
|
{
|
|
|
|
pos = end_pos;
|
|
|
|
sd->sel_handler_cursor = EDJE_CURSOR_SELECTION_END;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pos = start_pos;
|
|
|
|
sd->sel_handler_cursor = EDJE_CURSOR_SELECTION_BEGIN;
|
|
|
|
}
|
2013-11-08 00:06:08 -08:00
|
|
|
main_pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN);
|
|
|
|
if (pos != main_pos)
|
2013-11-08 00:18:28 -08:00
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, pos);
|
2016-01-14 08:05:08 -08:00
|
|
|
_selection_handlers_offset_calc(data, sd->end_handler, ev->canvas.x, ev->canvas.y);
|
2013-11-08 00:06:08 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_end_handler_mouse_up_cb(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-11-08 00:18:28 -08:00
|
|
|
sd->end_handler_down = EINA_FALSE;
|
2013-11-08 00:06:08 -08:00
|
|
|
if (_elm_config->magnifier_enable)
|
|
|
|
_magnifier_hide(data);
|
2015-12-10 22:49:27 -08:00
|
|
|
/* Context menu appear was checked in case of selector start, and hence
|
|
|
|
* the same should be checked at selector end as well */
|
|
|
|
if ((!_elm_config->context_menu_disabled) &&
|
|
|
|
(!_elm_config->desktop_entry) && (sd->long_pressed))
|
2013-11-08 00:06:08 -08:00
|
|
|
_menu_call(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_end_handler_mouse_move_cb(void *data,
|
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
|
|
|
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2013-11-08 00:18:28 -08:00
|
|
|
if (!sd->end_handler_down) return;
|
2013-11-08 00:06:08 -08:00
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
|
|
|
Evas_Coord ex, ey;
|
2016-02-04 22:05:57 -08:00
|
|
|
Evas_Coord cx, cy;
|
2014-03-06 02:33:05 -08:00
|
|
|
int pos;
|
2013-11-08 00:06:08 -08:00
|
|
|
|
|
|
|
evas_object_geometry_get(sd->entry_edje, &ex, &ey, NULL, NULL);
|
2014-03-06 02:33:05 -08:00
|
|
|
cx = ev->cur.canvas.x - sd->ox - ex;
|
|
|
|
cy = ev->cur.canvas.y - sd->oy - ey;
|
2013-11-08 00:06:08 -08:00
|
|
|
if (cx <= 0) cx = 1;
|
2013-11-21 18:06:37 -08:00
|
|
|
|
2014-03-06 02:33:05 -08:00
|
|
|
edje_object_part_text_cursor_coord_set(sd->entry_edje, "elm.text",
|
|
|
|
sd->sel_handler_cursor, cx, cy);
|
|
|
|
pos = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text",
|
|
|
|
sd->sel_handler_cursor);
|
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text",
|
|
|
|
EDJE_CURSOR_MAIN, pos);
|
2014-03-06 03:12:58 -08:00
|
|
|
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
|
|
|
|
sd->long_pressed = EINA_FALSE;
|
2013-11-08 00:06:08 -08:00
|
|
|
if (_elm_config->magnifier_enable)
|
2016-02-04 22:05:57 -08:00
|
|
|
_magnifier_move(data);
|
2013-11-08 00:06:08 -08:00
|
|
|
}
|
|
|
|
|
2016-07-28 02:48:07 -07:00
|
|
|
static void
|
|
|
|
_entry_on_size_evaluate_signal(void *data,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
|
|
|
{
|
2016-08-08 06:41:06 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
2018-02-17 01:00:19 -08:00
|
|
|
if (!sd) return;
|
2016-08-08 06:41:06 -07:00
|
|
|
sd->cur_changed = EINA_TRUE;
|
2016-07-28 02:48:07 -07:00
|
|
|
elm_entry_calc_force(data);
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_entry_efl_canvas_group_group_add(Eo *obj, Elm_Entry_Data *priv)
|
2008-10-14 01:05:30 -07:00
|
|
|
{
|
2013-10-05 01:14:12 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-12-06 00:33:50 -08:00
|
|
|
if (!elm_widget_theme_klass_get(obj))
|
|
|
|
elm_widget_theme_klass_set(obj, "entry");
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 08:29:45 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
priv->entry_edje = wd->resize_obj;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
priv->cnp_mode = ELM_CNP_MODE_MARKUP;
|
|
|
|
priv->line_wrap = ELM_WRAP_WORD;
|
|
|
|
priv->context_menu = EINA_TRUE;
|
|
|
|
priv->auto_save = EINA_TRUE;
|
|
|
|
priv->editable = EINA_TRUE;
|
2017-02-07 13:42:45 -08:00
|
|
|
priv->sel_allow = _elm_config->entry_select_allow;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
priv->drop_format = ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE;
|
|
|
|
elm_drop_target_add(obj, priv->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
|
2017-12-06 00:33:50 -08:00
|
|
|
if (!elm_widget_theme_object_set(obj, wd->resize_obj,
|
|
|
|
elm_widget_theme_klass_get(obj),
|
|
|
|
elm_widget_theme_element_get(obj),
|
|
|
|
elm_widget_theme_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
priv->hit_rect = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_data_set(priv->hit_rect, "_elm_leaveme", obj);
|
2015-07-28 12:00:58 -07:00
|
|
|
|
|
|
|
Evas_Object* clip = evas_object_clip_get(priv->entry_edje);
|
|
|
|
evas_object_clip_set(priv->hit_rect, clip);
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_smart_member_add(priv->hit_rect, obj);
|
|
|
|
elm_widget_sub_object_add(obj, priv->hit_rect);
|
|
|
|
|
|
|
|
/* common scroller hit rectangle setup */
|
|
|
|
evas_object_color_set(priv->hit_rect, 0, 0, 0, 0);
|
|
|
|
evas_object_show(priv->hit_rect);
|
|
|
|
evas_object_repeat_events_set(priv->hit_rect, EINA_TRUE);
|
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_objects_set(obj, priv->entry_edje, priv->hit_rect);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
edje_object_item_provider_set(priv->entry_edje, _item_get, obj);
|
|
|
|
|
|
|
|
edje_object_text_markup_filter_callback_add
|
|
|
|
(priv->entry_edje, "elm.text", _markup_filter_cb, obj);
|
|
|
|
|
2013-04-02 10:23:20 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(priv->entry_edje, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_event_callback_add
|
|
|
|
(priv->entry_edje, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down_cb, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(priv->entry_edje, EVAS_CALLBACK_MOUSE_UP, _mouse_up_cb, obj);
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(priv->entry_edje, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move_cb, obj);
|
|
|
|
|
|
|
|
/* this code can't go in smart_resize. sizing gets wrong */
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
|
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "entry,changed", "elm.text",
|
|
|
|
_entry_changed_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "entry,changed,user", "elm.text",
|
|
|
|
_entry_changed_user_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "preedit,changed", "elm.text",
|
|
|
|
_entry_preedit_changed_signal_cb, obj);
|
|
|
|
|
|
|
|
_entry_selection_callbacks_register(obj);
|
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "cursor,changed", "elm.text",
|
|
|
|
_entry_cursor_changed_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "cursor,changed,manual", "elm.text",
|
|
|
|
_entry_cursor_changed_manual_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "anchor,mouse,down,*", "elm.text",
|
|
|
|
_entry_anchor_down_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "anchor,mouse,up,*", "elm.text",
|
|
|
|
_entry_anchor_up_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "anchor,mouse,clicked,*", "elm.text",
|
|
|
|
_entry_anchor_clicked_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "anchor,mouse,move,*", "elm.text",
|
|
|
|
_entry_anchor_move_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "anchor,mouse,in,*", "elm.text",
|
|
|
|
_entry_anchor_in_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "anchor,mouse,out,*", "elm.text",
|
|
|
|
_entry_anchor_out_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "entry,key,enter", "elm.text",
|
|
|
|
_entry_key_enter_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "entry,key,escape", "elm.text",
|
|
|
|
_entry_key_escape_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "mouse,down,1", "elm.text",
|
|
|
|
_entry_mouse_down_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "mouse,clicked,1", "elm.text",
|
|
|
|
_entry_mouse_clicked_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "mouse,down,1,double", "elm.text",
|
|
|
|
_entry_mouse_double_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "mouse,down,1,triple", "elm.text",
|
|
|
|
_entry_mouse_triple_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "entry,undo,request", "elm.text",
|
|
|
|
_entry_undo_request_signal_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "entry,redo,request", "elm.text",
|
|
|
|
_entry_redo_request_signal_cb, obj);
|
|
|
|
|
|
|
|
elm_layout_text_set(obj, "elm.text", "");
|
|
|
|
|
|
|
|
elm_object_sub_cursor_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, obj, ELM_CURSOR_XTERM);
|
2010-09-27 21:28:14 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2017-02-07 13:42:45 -08:00
|
|
|
if (priv->sel_allow && _elm_config->desktop_entry)
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(priv->entry_edje, "elm.text", EINA_TRUE);
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2008-11-18 22:23:08 -08:00
|
|
|
|
2011-08-25 00:25:37 -07:00
|
|
|
elm_entry_input_panel_layout_set(obj, ELM_INPUT_PANEL_LAYOUT_NORMAL);
|
2012-02-02 20:51:38 -08:00
|
|
|
elm_entry_input_panel_enabled_set(obj, EINA_TRUE);
|
2012-02-13 20:54:19 -08:00
|
|
|
elm_entry_prediction_allow_set(obj, EINA_TRUE);
|
2014-09-01 03:04:05 -07:00
|
|
|
elm_entry_input_hint_set(obj, ELM_INPUT_HINT_AUTO_COMPLETE);
|
2011-08-25 00:25:37 -07:00
|
|
|
|
2013-06-26 09:54:26 -07:00
|
|
|
priv->autocapital_type = (Elm_Autocapital_Type)edje_object_part_text_autocapital_type_get
|
2012-08-30 09:45:15 -07:00
|
|
|
(priv->entry_edje, "elm.text");
|
2011-10-26 22:43:08 -07:00
|
|
|
|
2008-11-18 00:45:38 -08:00
|
|
|
entries = eina_list_prepend(entries, obj);
|
2010-02-08 19:27:11 -08:00
|
|
|
|
2009-12-01 03:03:14 -08:00
|
|
|
// module - find module for entry
|
2012-08-30 09:45:15 -07:00
|
|
|
priv->api = _module_find(obj);
|
2009-12-01 03:03:14 -08:00
|
|
|
// if found - hook in
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((priv->api) && (priv->api->obj_hook)) priv->api->obj_hook(obj);
|
2010-02-08 19:27:11 -08:00
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
_mirrored_set(obj, efl_ui_mirrored_get(obj));
|
2012-08-18 06:52:03 -07:00
|
|
|
|
|
|
|
// access
|
2012-08-30 09:45:15 -07:00
|
|
|
_elm_access_object_register(obj, priv->entry_edje);
|
2012-08-18 06:52:03 -07:00
|
|
|
_elm_access_text_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Entry"));
|
2012-08-18 06:52:03 -07:00
|
|
|
_elm_access_callback_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
2012-08-18 06:52:03 -07:00
|
|
|
_elm_access_callback_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, NULL);
|
2013-11-08 00:06:08 -08:00
|
|
|
|
2014-04-24 01:52:22 -07:00
|
|
|
if (_elm_config->desktop_entry)
|
|
|
|
priv->sel_handler_disabled = EINA_TRUE;
|
2016-07-28 02:48:07 -07:00
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(priv->entry_edje, "size,eval", "elm",
|
|
|
|
_entry_on_size_evaluate_signal, obj);
|
2014-04-24 01:52:22 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_create_selection_handlers(Evas_Object *obj, Elm_Entry_Data *sd)
|
|
|
|
{
|
|
|
|
Evas_Object *handle;
|
2015-01-19 17:32:06 -08:00
|
|
|
const char *style = elm_widget_style_get(obj);
|
2014-04-24 01:52:22 -07:00
|
|
|
|
|
|
|
handle = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
sd->start_handler = handle;
|
2015-01-19 17:32:06 -08:00
|
|
|
_elm_theme_object_set(obj, handle, "entry", "handler/start", style);
|
2014-04-24 01:52:22 -07:00
|
|
|
evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_DOWN,
|
2013-11-08 00:06:08 -08:00
|
|
|
_start_handler_mouse_down_cb, obj);
|
2014-04-24 01:52:22 -07:00
|
|
|
evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_MOVE,
|
2013-11-08 00:06:08 -08:00
|
|
|
_start_handler_mouse_move_cb, obj);
|
2014-04-24 01:52:22 -07:00
|
|
|
evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_UP,
|
2013-11-08 00:06:08 -08:00
|
|
|
_start_handler_mouse_up_cb, obj);
|
2014-04-24 01:52:22 -07:00
|
|
|
evas_object_show(handle);
|
2013-11-08 00:06:08 -08:00
|
|
|
|
2014-04-24 01:52:22 -07:00
|
|
|
handle = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
sd->end_handler = handle;
|
2015-01-19 17:32:06 -08:00
|
|
|
_elm_theme_object_set(obj, handle, "entry", "handler/end", style);
|
2014-04-24 01:52:22 -07:00
|
|
|
evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_DOWN,
|
2013-11-08 00:06:08 -08:00
|
|
|
_end_handler_mouse_down_cb, obj);
|
2014-04-24 01:52:22 -07:00
|
|
|
evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_MOVE,
|
2013-11-08 00:06:08 -08:00
|
|
|
_end_handler_mouse_move_cb, obj);
|
2014-04-24 01:52:22 -07:00
|
|
|
evas_object_event_callback_add(handle, EVAS_CALLBACK_MOUSE_UP,
|
2013-11-08 00:06:08 -08:00
|
|
|
_end_handler_mouse_up_cb, obj);
|
2014-04-24 01:52:22 -07:00
|
|
|
evas_object_show(handle);
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_entry_efl_canvas_group_group_del(Eo *obj, Elm_Entry_Data *sd)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
|
|
|
Elm_Entry_Context_Menu_Item *it;
|
|
|
|
Elm_Entry_Item_Provider *ip;
|
|
|
|
Elm_Entry_Markup_Filter *tf;
|
|
|
|
|
|
|
|
if (sd->delay_write)
|
|
|
|
{
|
2013-11-15 20:21:36 -08:00
|
|
|
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->auto_save) _save_do(obj);
|
|
|
|
}
|
|
|
|
|
2016-07-28 02:48:07 -07:00
|
|
|
edje_object_signal_callback_del_full
|
|
|
|
(sd->entry_edje, "size,eval", "elm",
|
|
|
|
_entry_on_size_evaluate_signal, obj);
|
|
|
|
|
2014-01-09 23:37:55 -08:00
|
|
|
if (sd->scroll)
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_content_viewport_resize_cb_set(obj, NULL);
|
2014-01-09 23:37:55 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_anchor_hover_end(obj);
|
|
|
|
elm_entry_anchor_hover_parent_set(obj, NULL);
|
|
|
|
|
|
|
|
evas_event_freeze(evas_object_evas_get(obj));
|
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
eina_stringshare_del(sd->file);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_job_del(sd->hov_deljob);
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((sd->api) && (sd->api->obj_unhook))
|
|
|
|
sd->api->obj_unhook(obj); // module - unhook
|
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
evas_object_del(sd->mgf_proxy);
|
|
|
|
evas_object_del(sd->mgf_bg);
|
|
|
|
evas_object_del(sd->mgf_clip);
|
2013-06-07 01:17:30 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
entries = eina_list_remove(entries, obj);
|
2014-01-21 06:16:41 -08:00
|
|
|
eina_stringshare_del(sd->cut_sel);
|
|
|
|
eina_stringshare_del(sd->text);
|
|
|
|
ecore_job_del(sd->deferred_recalc_job);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->append_text_idler)
|
|
|
|
{
|
|
|
|
ecore_idler_del(sd->append_text_idler);
|
2014-01-21 18:08:47 -08:00
|
|
|
ELM_SAFE_FREE(sd->append_text_left, free);
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->append_text_idler = NULL;
|
|
|
|
}
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_timer_del(sd->longpress_timer);
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->items, it)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_del(it->label);
|
|
|
|
eina_stringshare_del(it->icon_file);
|
|
|
|
eina_stringshare_del(it->icon_group);
|
|
|
|
free(it);
|
|
|
|
}
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->item_providers, ip)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
|
|
|
free(ip);
|
|
|
|
}
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->markup_filters, tf)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
|
|
|
_filter_free(tf);
|
|
|
|
}
|
2013-11-15 20:21:36 -08:00
|
|
|
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
|
2014-01-21 17:12:44 -08:00
|
|
|
free(sd->input_panel_imdata);
|
2017-06-25 21:44:58 -07:00
|
|
|
|
|
|
|
if (sd->prediction_hint)
|
|
|
|
{
|
|
|
|
ELM_SAFE_FREE(sd->prediction_hint, free);
|
|
|
|
}
|
|
|
|
|
2014-01-21 17:12:44 -08:00
|
|
|
eina_stringshare_del(sd->anchor_hover.hover_style);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
evas_event_thaw(evas_object_evas_get(obj));
|
|
|
|
evas_event_thaw_eval(evas_object_evas_get(obj));
|
|
|
|
|
2014-04-24 01:52:22 -07:00
|
|
|
if (sd->start_handler)
|
|
|
|
{
|
|
|
|
evas_object_del(sd->start_handler);
|
|
|
|
evas_object_del(sd->end_handler);
|
|
|
|
}
|
2013-11-08 00:06:08 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_entry_efl_gfx_entity_position_set(Eo *obj, Elm_Entry_Data *sd, Eina_Position2D pos)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2017-09-14 20:14:32 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, pos.x, pos.y))
|
2016-10-10 20:39:05 -07:00
|
|
|
return;
|
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_position_set(efl_super(obj, MY_CLASS), pos);
|
|
|
|
efl_gfx_entity_position_set(sd->hit_rect, pos);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->hoversel) _hoversel_position(obj);
|
2013-11-08 00:06:08 -08:00
|
|
|
|
|
|
|
if (edje_object_part_text_selection_get(sd->entry_edje, "elm.text"))
|
|
|
|
_update_selection_handler(obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_entry_efl_gfx_entity_size_set(Eo *obj, Elm_Entry_Data *sd, Eina_Size2D sz)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2017-09-15 02:37:25 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_RESIZE, 0, sz.w, sz.h))
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
return;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(sd->hit_rect, sz);
|
2015-05-19 05:13:55 -07:00
|
|
|
if (sd->have_selection)
|
|
|
|
_update_selection_handler(obj);
|
evas/elm: Remove function group_resize
This is an override of efl_gfx_size_set. Same as before, the
order of operations matter so it is possible that a corner
case will break. In particular, legacy code was:
- intercept
- smart resize (do stuff), super, super, super
- evas object resize
The new code is more like:
- intercept
- super, super, super, evas object resize
- do stuff
But unfortunately this broke elm_widget (read: all widgets) as
the internal resize was done before the object resize. So,
inside the resize event cb, the resize_obj size would not match
the smart object size. >_<
2016-10-11 00:54:31 -07:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), sz);
|
2014-05-25 19:28:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-04-05 01:47:26 -07:00
|
|
|
_elm_entry_efl_gfx_entity_visible_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool vis)
|
2014-05-25 19:28:12 -07:00
|
|
|
{
|
2016-10-10 02:59:42 -07:00
|
|
|
if (_evas_object_intercept_call(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
|
|
|
|
return;
|
2014-05-25 19:28:12 -07:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(efl_super(obj, MY_CLASS), vis);
|
2014-05-25 19:28:12 -07:00
|
|
|
|
|
|
|
if (sd->have_selection)
|
2016-10-10 02:59:42 -07:00
|
|
|
{
|
|
|
|
if (vis) _update_selection_handler(obj);
|
|
|
|
else _hide_selection_handler(obj);
|
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_entry_efl_canvas_group_group_member_add(Eo *obj, Elm_Entry_Data *sd, Evas_Object *member)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_member_add(efl_super(obj, MY_CLASS), member);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->hit_rect)
|
|
|
|
evas_object_raise(sd->hit_rect);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_entry_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_cb_added(void *data EINA_UNUSED, const Efl_Event *ev)
|
2015-04-02 02:37:37 -07:00
|
|
|
{
|
2018-02-27 04:19:17 -08:00
|
|
|
const Efl_Callback_Array_Item_Full *event = ev->info;
|
2015-04-02 02:37:37 -07:00
|
|
|
|
2016-05-18 08:17:36 -07:00
|
|
|
ELM_ENTRY_DATA_GET(ev->object, sd);
|
2018-02-27 04:19:17 -08:00
|
|
|
// XXX: BUG - not walking the array until a NULL entry
|
2015-04-02 02:37:37 -07:00
|
|
|
if (event->desc == ELM_ENTRY_EVENT_VALIDATE)
|
|
|
|
sd->validators++;
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_cb_deleted(void *data EINA_UNUSED, const Efl_Event *ev)
|
2015-04-02 02:37:37 -07:00
|
|
|
{
|
2018-02-27 04:19:17 -08:00
|
|
|
const Efl_Callback_Array_Item_Full *event = ev->info;
|
2015-04-02 02:37:37 -07:00
|
|
|
|
2016-05-18 08:17:36 -07:00
|
|
|
ELM_ENTRY_DATA_GET(ev->object, sd);
|
2018-02-27 04:19:17 -08:00
|
|
|
// XXX: BUG - not walking the array until a NULL entry
|
2015-04-02 02:37:37 -07:00
|
|
|
if (event->desc == ELM_ENTRY_EVENT_VALIDATE)
|
|
|
|
sd->validators--;
|
2016-06-20 07:31:31 -07:00
|
|
|
return;
|
2015-04-02 02:37:37 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_entry_efl_object_constructor(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_add(obj, EFL_EVENT_CALLBACK_ADD, _cb_added, NULL);
|
|
|
|
efl_event_callback_add(obj, EFL_EVENT_CALLBACK_DEL, _cb_deleted, NULL);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2008-10-14 01:05:30 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_text_style_user_push(Eo *obj, Elm_Entry_Data *sd, const char *style)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_style_user_push(sd->entry_edje, "elm.text", style);
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2012-05-30 05:18:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_text_style_user_pop(Eo *obj, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_style_user_pop(sd->entry_edje, "elm.text");
|
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2012-05-30 05:18:48 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static const char*
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_entry_text_style_user_peek(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_style_user_peek(sd->entry_edje, "elm.text");
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_single_line_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool single_line)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->single_line == single_line) return;
|
|
|
|
|
|
|
|
sd->single_line = single_line;
|
|
|
|
sd->line_wrap = ELM_WRAP_NONE;
|
2013-02-06 21:55:49 -08:00
|
|
|
if (elm_entry_cnp_mode_get(obj) == ELM_CNP_MODE_MARKUP)
|
|
|
|
elm_entry_cnp_mode_set(obj, ELM_CNP_MODE_NO_IMAGE);
|
2015-12-21 06:41:28 -08:00
|
|
|
if (sd->single_line)
|
|
|
|
{
|
|
|
|
_entry_new_line_filter_init(obj);
|
|
|
|
elm_entry_markup_filter_append(obj, _entry_new_line_filter_cb, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elm_entry_markup_filter_remove(obj, _entry_new_line_filter_cb, NULL);
|
|
|
|
}
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->scroll)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->single_line)
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_policy_set(obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
2011-06-17 02:44:31 -07:00
|
|
|
else
|
|
|
|
{
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_policy_set(obj, sd->policy_h, sd->policy_v);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
2008-10-22 01:58:56 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_single_line_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2008-10-22 01:58:56 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->single_line;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_password_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool password)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
password = !!password;
|
|
|
|
|
|
|
|
if (sd->password == password) return;
|
|
|
|
sd->password = password;
|
|
|
|
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
elm_drop_target_del(obj, sd->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2011-12-03 14:16:14 -08:00
|
|
|
if (password)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->single_line = EINA_TRUE;
|
|
|
|
sd->line_wrap = ELM_WRAP_NONE;
|
2014-09-01 03:04:05 -07:00
|
|
|
elm_entry_input_hint_set(obj, ((sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA));
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_selection_callbacks_unregister(obj);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PASSWORD_TEXT);
|
2011-12-03 14:16:14 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
sd->drop_format = _get_drop_format(obj);
|
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2013-05-13 04:18:24 -07:00
|
|
|
|
2014-09-01 03:04:05 -07:00
|
|
|
elm_entry_input_hint_set(obj, ((sd->input_hints | ELM_INPUT_HINT_AUTO_COMPLETE) & ~ELM_INPUT_HINT_SENSITIVE_DATA));
|
2012-08-30 09:45:15 -07:00
|
|
|
_entry_selection_callbacks_register(obj);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_ENTRY);
|
2012-08-30 09:45:15 -07:00
|
|
|
}
|
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2008-10-22 01:58:56 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_password_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->password;
|
2010-03-25 10:27:00 -07:00
|
|
|
}
|
|
|
|
|
2018-02-14 18:14:52 -08:00
|
|
|
EAPI void
|
|
|
|
elm_entry_calc_force(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
efl_layout_calc_force(obj);
|
|
|
|
}
|
|
|
|
|
2012-01-02 03:17:29 -08:00
|
|
|
EAPI void
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_entry_set(Evas_Object *obj,
|
|
|
|
const char *entry)
|
2008-10-14 01:05:30 -07:00
|
|
|
{
|
2012-10-18 17:56:03 -07:00
|
|
|
ELM_ENTRY_CHECK(obj);
|
2017-07-28 02:33:55 -07:00
|
|
|
efl_text_set(efl_part(obj, "elm.text"), entry);
|
2008-10-14 01:05:30 -07:00
|
|
|
}
|
2008-10-15 02:58:44 -07:00
|
|
|
|
2012-01-02 03:17:29 -08:00
|
|
|
EAPI const char *
|
|
|
|
elm_entry_entry_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-10-18 17:56:03 -07:00
|
|
|
ELM_ENTRY_CHECK(obj) NULL;
|
2014-04-03 08:02:32 -07:00
|
|
|
const char *text = NULL;
|
2017-06-04 07:25:36 -07:00
|
|
|
text = efl_text_get(efl_part(obj, "elm.text"));
|
2012-11-25 22:32:53 -08:00
|
|
|
return text;
|
2012-01-02 03:17:29 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_entry_append(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *entry)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2011-06-13 04:07:43 -07:00
|
|
|
if (!entry) entry = "";
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
sd->changed = EINA_TRUE;
|
2015-07-13 09:38:45 -07:00
|
|
|
_entry_text_append(obj, entry, EINA_FALSE);
|
2011-06-13 04:07:43 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_entry_is_empty(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-01-12 05:25:12 -08:00
|
|
|
edje_object_part_text_cursor_copy
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, EDJE_CURSOR_USER);
|
|
|
|
edje_object_part_text_cursor_pos_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_USER, 1);
|
|
|
|
if (edje_object_part_text_cursor_pos_get
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_USER) == 1)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_textblock_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return (Evas_Object *)edje_object_part_object_get
|
2013-12-30 18:23:28 -08:00
|
|
|
(sd->entry_edje, "elm.text");
|
2011-11-14 05:56:06 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_entry_efl_layout_calc_calc_force(Eo *obj, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_calc_force(sd->entry_edje);
|
|
|
|
sd->changed = EINA_TRUE;
|
|
|
|
elm_layout_sizing_eval(obj);
|
2011-11-14 05:56:06 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static const char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_selection_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2013-11-08 00:06:08 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
if ((sd->password)) return NULL;
|
|
|
|
return edje_object_part_text_selection_get(sd->entry_edje, "elm.text");
|
2013-11-08 00:06:08 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_selection_handler_disabled_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool disabled)
|
2013-11-08 00:06:08 -08:00
|
|
|
{
|
|
|
|
if (sd->sel_handler_disabled == disabled) return;
|
|
|
|
sd->sel_handler_disabled = disabled;
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_selection_handler_disabled_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2008-10-16 02:17:57 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->sel_handler_disabled;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_entry_insert(Eo *obj, Elm_Entry_Data *sd, const char *entry)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_insert(sd->entry_edje, "elm.text", entry);
|
|
|
|
sd->changed = EINA_TRUE;
|
|
|
|
elm_layout_sizing_eval(obj);
|
2008-10-16 02:17:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_line_wrap_set(Eo *obj, Elm_Entry_Data *sd, Elm_Wrap_Type wrap)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->line_wrap == wrap) return;
|
|
|
|
sd->last_w = -1;
|
|
|
|
sd->line_wrap = wrap;
|
2014-03-14 23:36:41 -07:00
|
|
|
if (wrap == ELM_WRAP_NONE)
|
2014-03-15 11:08:19 -07:00
|
|
|
ELM_SAFE_FREE(sd->deferred_recalc_job, ecore_job_del);
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2008-10-24 19:11:06 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Elm_Wrap_Type
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_line_wrap_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2008-10-24 19:11:06 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->line_wrap;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2016-03-22 04:17:48 -07:00
|
|
|
_elm_entry_editable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool editable)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->editable == editable) return;
|
|
|
|
sd->editable = editable;
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
elementary entry: update focus state when editable state is changed
Summary:
To recieve keyboard events, the entry_edje should have Evas focus.
But, if a non editable Entry widget takes focus, it can't recieve
keyboard events even if it becomes editable after taking focus.
So, elm_entry_editable_set() function should update Entry's focus state.
@fix
Test Plan:
The code of elementary_test - entry is modified to test this issue.
Please, check the issue with the following steps.
1. Run "elementary_test entry"
2. Click "Unfocus" button to make entry to "unfocused" state.
3. Click "Edit" button to make entry to non-editable mode.
4. Click "Focus" button to make entry to "focused" state.
5. Click "Edit" button to make entry to editable mode.
6. See a cursor is blinking in entry.
=> But, you can't edit text without this patch.
Reviewers: raster, herdsman, cedric, jpeg, woohyun
Differential Revision: https://phab.enlightenment.org/D4858
2017-06-08 22:19:57 -07:00
|
|
|
_elm_entry_focus_update(obj, sd);
|
2010-09-06 23:56:16 -07:00
|
|
|
|
2017-11-20 13:38:08 -08:00
|
|
|
//legacy focus event emission
|
|
|
|
if (efl_ui_focus_object_focus_get(obj))
|
|
|
|
evas_object_smart_callback_call(obj, "focused", NULL);
|
|
|
|
else
|
|
|
|
evas_object_smart_callback_call(obj, "unfocused", NULL);
|
|
|
|
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
elm_drop_target_del(obj, sd->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2010-09-06 23:56:16 -07:00
|
|
|
if (editable)
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
{
|
|
|
|
sd->drop_format = _get_drop_format(obj);
|
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
}
|
2008-10-17 07:40:54 -07:00
|
|
|
}
|
2008-11-18 00:45:38 -08:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_editable_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2008-11-18 00:45:38 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->editable;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_select_none(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((sd->password)) return;
|
|
|
|
if (sd->sel_mode)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->sel_mode = EINA_FALSE;
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_FALSE);
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
2014-03-07 10:51:25 -08:00
|
|
|
if (sd->have_selection)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:58:17 -07:00
|
|
|
(obj, EFL_UI_EVENT_SELECTION_CLEARED, NULL);
|
2014-03-07 10:51:25 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->have_selection = EINA_FALSE;
|
|
|
|
edje_object_part_text_select_none(sd->entry_edje, "elm.text");
|
2013-11-08 00:06:08 -08:00
|
|
|
|
|
|
|
_hide_selection_handler(obj);
|
2008-11-18 00:45:38 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2017-05-11 23:10:37 -07:00
|
|
|
_elm_entry_select_all(Eo *obj, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2017-05-11 23:10:37 -07:00
|
|
|
if (elm_entry_is_empty(obj)) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((sd->password)) return;
|
|
|
|
if (sd->sel_mode)
|
2009-03-19 06:36:46 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->sel_mode = EINA_FALSE;
|
2011-04-01 06:20:40 -07:00
|
|
|
if (!_elm_config->desktop_entry)
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_FALSE);
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
|
2009-03-19 06:36:46 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_all(sd->entry_edje, "elm.text");
|
2008-11-18 00:45:38 -08:00
|
|
|
}
|
2009-01-26 16:44:29 -08:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2017-05-11 23:10:37 -07:00
|
|
|
_elm_entry_select_region_set(Eo *obj, Elm_Entry_Data *sd, int start, int end)
|
2014-02-05 02:16:13 -08:00
|
|
|
{
|
2017-05-11 23:10:37 -07:00
|
|
|
if (elm_entry_is_empty(obj)) return;
|
2014-02-05 02:16:13 -08:00
|
|
|
if ((sd->password)) return;
|
|
|
|
if (sd->sel_mode)
|
|
|
|
{
|
|
|
|
sd->sel_mode = EINA_FALSE;
|
|
|
|
if (!_elm_config->desktop_entry)
|
|
|
|
edje_object_part_text_select_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", EINA_FALSE);
|
|
|
|
edje_object_signal_emit(sd->entry_edje, "elm,state,select,off", "elm");
|
|
|
|
}
|
|
|
|
|
2014-08-15 01:44:13 -07:00
|
|
|
/* Set have selection false to not be cleared handler in
|
|
|
|
selection_cleared_signal_cb() since that callback will be called while
|
|
|
|
resetting edje text. */
|
|
|
|
sd->have_selection = EINA_FALSE;
|
|
|
|
|
2014-02-05 02:16:13 -08:00
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, start);
|
|
|
|
edje_object_part_text_select_begin(sd->entry_edje, "elm.text");
|
|
|
|
edje_object_part_text_cursor_pos_set(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, end);
|
|
|
|
edje_object_part_text_select_extend(sd->entry_edje, "elm.text");
|
|
|
|
}
|
|
|
|
|
2016-02-12 03:18:05 -08:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_select_region_get(const Eo *obj, Elm_Entry_Data *sd, int *start, int *end)
|
2016-02-12 03:18:05 -08:00
|
|
|
{
|
|
|
|
if (!elm_entry_selection_get(obj))
|
|
|
|
{
|
|
|
|
if (start) *start = -1;
|
|
|
|
if (end) *end = -1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (start)
|
|
|
|
*start = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text", EDJE_CURSOR_SELECTION_BEGIN);
|
|
|
|
if (end)
|
|
|
|
*end = edje_object_part_text_cursor_pos_get(sd->entry_edje, "elm.text", EDJE_CURSOR_SELECTION_END);
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_textblock_cursor_geometry_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
2011-01-23 19:01:33 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_cursor_geometry_get
|
|
|
|
(sd->entry_edje, "elm.text", x, y, w, h);
|
2014-03-22 10:44:29 -07:00
|
|
|
return EINA_TRUE;
|
2011-01-23 19:01:33 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_entry_cursor_next(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_cursor_next
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_entry_cursor_prev(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_cursor_prev
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_entry_cursor_up(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_cursor_up
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_entry_cursor_down(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_cursor_down
|
2012-08-30 09:45:15 -07:00
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_cursor_begin_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
edje_object_part_text_cursor_begin_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_cursor_end_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
edje_object_part_text_cursor_end_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_cursor_line_begin_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
edje_object_part_text_cursor_line_begin_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_cursor_line_end_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_cursor_line_end_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_cursor_selection_begin(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_begin(sd->entry_edje, "elm.text");
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_cursor_selection_end(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_select_extend(sd->entry_edje, "elm.text");
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_cursor_is_format_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_cursor_is_format_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_cursor_is_visible_format_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_cursor_is_visible_format_get
|
2012-08-30 09:45:15 -07:00
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2016-06-30 04:32:02 -07:00
|
|
|
EOLIAN static char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_textblock_cursor_content_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_cursor_content_get
|
2012-08-30 09:45:15 -07:00
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_cursor_pos_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, int pos)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_cursor_pos_set
|
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN, pos);
|
|
|
|
edje_object_message_signal_process(sd->entry_edje);
|
2011-02-27 02:25:45 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_cursor_pos_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_cursor_pos_get
|
2012-08-30 09:45:15 -07:00
|
|
|
(sd->entry_edje, "elm.text", EDJE_CURSOR_MAIN);
|
2011-02-27 02:25:45 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_selection_cut(Eo *obj, Elm_Entry_Data *sd)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((sd->password)) return;
|
|
|
|
_cut_cb(obj, NULL, NULL);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_selection_copy(Eo *obj, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((sd->password)) return;
|
|
|
|
_copy_cb(obj, NULL, NULL);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_selection_paste(Eo *obj, Elm_Entry_Data *sd)
|
2009-12-01 03:03:14 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if ((sd->password)) return;
|
|
|
|
_paste_cb(obj, NULL, NULL);
|
2009-12-01 03:03:14 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_context_menu_clear(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2009-09-02 05:48:00 -07:00
|
|
|
{
|
|
|
|
Elm_Entry_Context_Menu_Item *it;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2013-03-08 20:23:42 -08:00
|
|
|
EINA_LIST_FREE(sd->items, it)
|
2009-09-02 05:48:00 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_del(it->label);
|
|
|
|
eina_stringshare_del(it->icon_file);
|
|
|
|
eina_stringshare_del(it->icon_group);
|
|
|
|
free(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_context_menu_item_add(Eo *obj, Elm_Entry_Data *sd, const char *label, const char *icon_file, Elm_Icon_Type icon_type, Evas_Smart_Cb func, const void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2009-09-02 05:48:00 -07:00
|
|
|
Elm_Entry_Context_Menu_Item *it;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2009-09-02 05:48:00 -07:00
|
|
|
it = calloc(1, sizeof(Elm_Entry_Context_Menu_Item));
|
|
|
|
if (!it) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
sd->items = eina_list_append(sd->items, it);
|
2009-09-02 05:48:00 -07:00
|
|
|
it->obj = obj;
|
|
|
|
it->label = eina_stringshare_add(label);
|
|
|
|
it->icon_file = eina_stringshare_add(icon_file);
|
|
|
|
it->icon_type = icon_type;
|
|
|
|
it->func = func;
|
|
|
|
it->data = (void *)data;
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_context_menu_disabled_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool disabled)
|
2009-10-10 22:48:24 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->context_menu == !disabled) return;
|
|
|
|
sd->context_menu = !disabled;
|
2009-10-10 22:48:24 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_context_menu_disabled_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2009-10-10 22:48:24 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return !sd->context_menu;
|
2009-10-10 22:48:24 -07:00
|
|
|
}
|
|
|
|
|
2013-02-27 04:06:05 -08:00
|
|
|
EAPI const char *
|
|
|
|
elm_entry_context_menu_item_label_get(const Elm_Entry_Context_Menu_Item *item)
|
|
|
|
{
|
2014-05-10 07:15:54 -07:00
|
|
|
if (!item) return NULL;
|
2013-02-27 04:06:05 -08:00
|
|
|
return item->label;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_entry_context_menu_item_icon_get(const Elm_Entry_Context_Menu_Item *item,
|
|
|
|
const char **icon_file,
|
|
|
|
const char **icon_group,
|
|
|
|
Elm_Icon_Type *icon_type)
|
|
|
|
{
|
2014-05-10 07:15:54 -07:00
|
|
|
if (!item) return;
|
2013-02-27 04:06:05 -08:00
|
|
|
if (icon_file) *icon_file = item->icon_file;
|
|
|
|
if (icon_group) *icon_group = item->icon_group;
|
|
|
|
if (icon_type) *icon_type = item->icon_type;
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_item_provider_append(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Entry_Item_Provider_Cb func, void *data)
|
2010-04-27 01:06:42 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
Elm_Entry_Item_Provider *ip;
|
|
|
|
|
2010-12-03 06:08:33 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
|
2010-04-27 01:06:42 -07:00
|
|
|
if (!ip) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2010-04-27 01:06:42 -07:00
|
|
|
ip->func = func;
|
|
|
|
ip->data = data;
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->item_providers = eina_list_append(sd->item_providers, ip);
|
2010-04-27 01:06:42 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_item_provider_prepend(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Entry_Item_Provider_Cb func, void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
Elm_Entry_Item_Provider *ip;
|
|
|
|
|
2010-12-03 06:08:33 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ip = calloc(1, sizeof(Elm_Entry_Item_Provider));
|
2010-04-27 01:06:42 -07:00
|
|
|
if (!ip) return;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2010-04-27 01:06:42 -07:00
|
|
|
ip->func = func;
|
|
|
|
ip->data = data;
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->item_providers = eina_list_prepend(sd->item_providers, ip);
|
2010-04-27 01:06:42 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_item_provider_remove(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Entry_Item_Provider_Cb func, void *data)
|
2010-04-27 01:06:42 -07:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Entry_Item_Provider *ip;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2010-12-03 06:08:33 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->item_providers, l, ip)
|
2010-04-27 01:06:42 -07:00
|
|
|
{
|
2011-02-14 00:47:19 -08:00
|
|
|
if ((ip->func == func) && ((!data) || (ip->data == data)))
|
2010-04-27 01:06:42 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->item_providers = eina_list_remove_list(sd->item_providers, l);
|
2010-04-27 01:06:42 -07:00
|
|
|
free(ip);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_markup_filter_append(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Entry_Filter_Cb func, void *data)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-02-07 23:23:49 -08:00
|
|
|
Elm_Entry_Markup_Filter *tf;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
|
|
|
|
|
|
|
tf = _filter_new(func, data);
|
|
|
|
if (!tf) return;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->markup_filters = eina_list_append(sd->markup_filters, tf);
|
2012-02-07 23:23:49 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_markup_filter_prepend(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Entry_Filter_Cb func, void *data)
|
2012-02-07 23:23:49 -08:00
|
|
|
{
|
|
|
|
Elm_Entry_Markup_Filter *tf;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
|
|
|
|
|
|
|
tf = _filter_new(func, data);
|
|
|
|
if (!tf) return;
|
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->markup_filters = eina_list_prepend(sd->markup_filters, tf);
|
2012-02-07 23:23:49 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_markup_filter_remove(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Entry_Filter_Cb func, void *data)
|
2012-02-07 23:23:49 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Elm_Entry_Markup_Filter *tf;
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->markup_filters, l, tf)
|
2012-02-07 23:23:49 -08:00
|
|
|
{
|
2013-05-16 02:10:13 -07:00
|
|
|
if ((tf->func == func) && ((!data) || (tf->orig_data == data)))
|
2012-02-07 23:23:49 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->markup_filters = eina_list_remove_list(sd->markup_filters, l);
|
2012-02-07 23:23:49 -08:00
|
|
|
_filter_free(tf);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-26 16:44:29 -08:00
|
|
|
EAPI char *
|
|
|
|
elm_entry_markup_to_utf8(const char *s)
|
|
|
|
{
|
2010-12-19 22:05:59 -08:00
|
|
|
char *ss = _elm_util_mkup_to_text(s);
|
2010-03-24 22:13:59 -07:00
|
|
|
if (!ss) ss = strdup("");
|
|
|
|
return ss;
|
2009-01-26 16:44:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI char *
|
|
|
|
elm_entry_utf8_to_markup(const char *s)
|
|
|
|
{
|
2010-12-19 22:05:59 -08:00
|
|
|
char *ss = _elm_util_text_to_mkup(s);
|
2010-03-24 22:13:59 -07:00
|
|
|
if (!ss) ss = strdup("");
|
|
|
|
return ss;
|
2009-01-26 16:44:29 -08:00
|
|
|
}
|
2010-09-06 23:56:16 -07:00
|
|
|
|
2011-12-30 02:02:19 -08:00
|
|
|
static const char *
|
|
|
|
_text_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return elm_object_text_get(obj);
|
|
|
|
}
|
|
|
|
|
2010-10-07 05:50:00 -07:00
|
|
|
EAPI void
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_filter_limit_size(void *data,
|
|
|
|
Evas_Object *entry,
|
|
|
|
char **text)
|
2010-10-07 05:50:00 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
const char *(*text_get)(const Evas_Object *);
|
2010-10-07 05:50:00 -07:00
|
|
|
Elm_Entry_Filter_Limit_Size *lim = data;
|
2011-09-24 21:14:17 -07:00
|
|
|
char *current, *utfstr;
|
2010-10-07 05:50:00 -07:00
|
|
|
int len, newlen;
|
|
|
|
|
2010-12-03 06:08:33 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(data);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(entry);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(text);
|
2010-10-07 05:50:00 -07:00
|
|
|
|
|
|
|
/* hack. I don't want to copy the entire function to work with
|
|
|
|
* scrolled_entry */
|
2011-12-30 02:02:19 -08:00
|
|
|
text_get = _text_get;
|
2010-10-07 05:50:00 -07:00
|
|
|
|
|
|
|
current = elm_entry_markup_to_utf8(text_get(entry));
|
2011-09-24 21:14:17 -07:00
|
|
|
utfstr = elm_entry_markup_to_utf8(*text);
|
2010-10-07 05:50:00 -07:00
|
|
|
|
|
|
|
if (lim->max_char_count > 0)
|
|
|
|
{
|
|
|
|
len = evas_string_char_len_get(current);
|
2012-04-06 01:13:41 -07:00
|
|
|
newlen = evas_string_char_len_get(utfstr);
|
|
|
|
if ((len >= lim->max_char_count) && (newlen > 0))
|
2010-10-07 05:50:00 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 03:57:19 -08:00
|
|
|
(entry, ELM_ENTRY_EVENT_MAXLENGTH_REACHED, NULL);
|
2014-01-21 18:08:47 -08:00
|
|
|
ELM_SAFE_FREE(*text, free);
|
2011-09-24 21:14:17 -07:00
|
|
|
free(current);
|
|
|
|
free(utfstr);
|
2010-10-07 05:50:00 -07:00
|
|
|
return;
|
|
|
|
}
|
2011-06-14 02:50:05 -07:00
|
|
|
if ((len + newlen) > lim->max_char_count)
|
2012-08-30 09:45:15 -07:00
|
|
|
_chars_add_till_limit
|
|
|
|
(entry, text, (lim->max_char_count - len), LENGTH_UNIT_CHAR);
|
2010-10-07 05:50:00 -07:00
|
|
|
}
|
2011-06-14 02:50:05 -07:00
|
|
|
else if (lim->max_byte_count > 0)
|
2010-10-07 05:50:00 -07:00
|
|
|
{
|
|
|
|
len = strlen(current);
|
2012-04-06 01:13:41 -07:00
|
|
|
newlen = strlen(utfstr);
|
|
|
|
if ((len >= lim->max_byte_count) && (newlen > 0))
|
2010-10-07 05:50:00 -07:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 03:57:19 -08:00
|
|
|
(entry, ELM_ENTRY_EVENT_MAXLENGTH_REACHED, NULL);
|
2014-01-21 18:08:47 -08:00
|
|
|
ELM_SAFE_FREE(*text, free);
|
2011-09-24 21:14:17 -07:00
|
|
|
free(current);
|
|
|
|
free(utfstr);
|
2010-10-07 05:50:00 -07:00
|
|
|
return;
|
|
|
|
}
|
2011-06-14 02:50:05 -07:00
|
|
|
if ((len + newlen) > lim->max_byte_count)
|
2012-08-30 09:45:15 -07:00
|
|
|
_chars_add_till_limit
|
|
|
|
(entry, text, (lim->max_byte_count - len), LENGTH_UNIT_BYTE);
|
2010-10-07 05:50:00 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2010-10-07 05:50:00 -07:00
|
|
|
free(current);
|
2011-09-24 21:14:17 -07:00
|
|
|
free(utfstr);
|
2010-10-07 05:50:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_filter_accept_set(void *data,
|
2013-12-30 01:25:15 -08:00
|
|
|
Evas_Object *entry,
|
2012-08-30 09:45:15 -07:00
|
|
|
char **text)
|
2010-10-07 05:50:00 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
int read_idx, last_read_idx = 0, read_char;
|
2010-10-07 05:50:00 -07:00
|
|
|
Elm_Entry_Filter_Accept_Set *as = data;
|
2012-08-30 09:45:15 -07:00
|
|
|
Eina_Bool goes_in;
|
2013-12-30 01:25:15 -08:00
|
|
|
Eina_Bool rejected = EINA_FALSE;
|
2010-10-07 05:50:00 -07:00
|
|
|
const char *set;
|
|
|
|
char *insert;
|
|
|
|
|
2010-12-03 06:08:33 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(data);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(text);
|
|
|
|
|
|
|
|
if ((!as->accepted) && (!as->rejected))
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
return;
|
2010-10-07 05:50:00 -07:00
|
|
|
|
|
|
|
if (as->accepted)
|
|
|
|
{
|
|
|
|
set = as->accepted;
|
|
|
|
goes_in = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
set = as->rejected;
|
|
|
|
goes_in = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
insert = *text;
|
|
|
|
read_idx = evas_string_char_next_get(*text, 0, &read_char);
|
|
|
|
while (read_char)
|
|
|
|
{
|
|
|
|
int cmp_idx, cmp_char;
|
|
|
|
Eina_Bool in_set = EINA_FALSE;
|
|
|
|
|
2013-05-01 22:49:45 -07:00
|
|
|
if (read_char == '<')
|
2010-10-07 05:50:00 -07:00
|
|
|
{
|
2013-05-01 22:49:45 -07:00
|
|
|
while (read_char && (read_char != '>'))
|
|
|
|
read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
|
|
|
|
|
|
|
|
if (goes_in) in_set = EINA_TRUE;
|
|
|
|
else in_set = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (read_char == '&')
|
2010-10-07 05:50:00 -07:00
|
|
|
{
|
2013-05-01 22:49:45 -07:00
|
|
|
while (read_char && (read_char != ';'))
|
|
|
|
read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
|
|
|
|
|
|
|
|
if (!read_char)
|
|
|
|
{
|
|
|
|
if (goes_in) in_set = EINA_TRUE;
|
|
|
|
else in_set = EINA_FALSE;
|
|
|
|
goto inserting;
|
|
|
|
}
|
|
|
|
if (read_char == ';')
|
|
|
|
{
|
|
|
|
char *tag;
|
2013-06-27 00:30:54 -07:00
|
|
|
int utf8 = 0;
|
2013-05-01 22:49:45 -07:00
|
|
|
tag = malloc(read_idx - last_read_idx + 1);
|
|
|
|
if (tag)
|
|
|
|
{
|
2013-06-27 00:30:54 -07:00
|
|
|
char *markup;
|
2013-05-01 22:49:45 -07:00
|
|
|
strncpy(tag, (*text) + last_read_idx, read_idx - last_read_idx);
|
2013-06-27 00:30:54 -07:00
|
|
|
tag[read_idx - last_read_idx] = 0;
|
|
|
|
markup = elm_entry_markup_to_utf8(tag);
|
2013-05-01 22:49:45 -07:00
|
|
|
free(tag);
|
2013-06-27 00:30:54 -07:00
|
|
|
if (markup)
|
|
|
|
{
|
|
|
|
utf8 = *markup;
|
|
|
|
free(markup);
|
|
|
|
}
|
2013-05-05 23:51:54 -07:00
|
|
|
if (!utf8)
|
|
|
|
{
|
|
|
|
in_set = EINA_FALSE;
|
|
|
|
goto inserting;
|
|
|
|
}
|
|
|
|
read_char = utf8;
|
2013-05-01 22:49:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
cmp_idx = evas_string_char_next_get(set, 0, &cmp_char);
|
|
|
|
while (cmp_char)
|
|
|
|
{
|
|
|
|
if (read_char == cmp_char)
|
|
|
|
{
|
|
|
|
in_set = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
cmp_idx = evas_string_char_next_get(set, cmp_idx, &cmp_char);
|
2010-10-07 05:50:00 -07:00
|
|
|
}
|
|
|
|
}
|
2013-05-01 22:49:45 -07:00
|
|
|
|
|
|
|
inserting:
|
|
|
|
|
2010-10-07 05:50:00 -07:00
|
|
|
if (in_set == goes_in)
|
|
|
|
{
|
|
|
|
int size = read_idx - last_read_idx;
|
|
|
|
const char *src = (*text) + last_read_idx;
|
|
|
|
if (src != insert)
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
memcpy(insert, *text + last_read_idx, size);
|
2010-10-07 05:50:00 -07:00
|
|
|
insert += size;
|
|
|
|
}
|
2013-12-30 01:25:15 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
rejected = EINA_TRUE;
|
|
|
|
}
|
2013-05-01 22:49:45 -07:00
|
|
|
|
|
|
|
if (read_char)
|
|
|
|
{
|
|
|
|
last_read_idx = read_idx;
|
|
|
|
read_idx = evas_string_char_next_get(*text, read_idx, &read_char);
|
|
|
|
}
|
2010-10-07 05:50:00 -07:00
|
|
|
}
|
|
|
|
*insert = 0;
|
2013-12-30 01:25:15 -08:00
|
|
|
if (rejected)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(entry, ELM_ENTRY_EVENT_REJECTED, NULL);
|
2010-10-07 05:50:00 -07:00
|
|
|
}
|
2010-09-06 23:56:16 -07:00
|
|
|
|
2015-07-01 10:30:23 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_file_text_format_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Text_Format format)
|
|
|
|
{
|
|
|
|
sd->format = format;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_entry_file_set(Evas_Object *obj, const char *file, Elm_Text_Format format)
|
|
|
|
{
|
|
|
|
Eina_Bool ret;
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_obj_entry_file_text_format_set(obj, format);
|
|
|
|
ret = efl_file_set(obj, file, NULL);
|
2015-07-01 10:30:23 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2015-07-01 10:30:23 -07:00
|
|
|
_elm_entry_efl_file_file_set(Eo *obj, Elm_Entry_Data *sd, const char *file, const char *group EINA_UNUSED)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->auto_save) _save_do(obj);
|
|
|
|
eina_stringshare_replace(&sd->file, file);
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = _load_do(obj);
|
2014-03-22 10:44:29 -07:00
|
|
|
return int_ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2015-07-01 10:30:23 -07:00
|
|
|
EAPI void
|
|
|
|
elm_entry_file_get(const Evas_Object *obj, const char **file, Elm_Text_Format *format)
|
|
|
|
{
|
2016-03-02 03:57:19 -08:00
|
|
|
efl_file_get(obj, file, NULL);
|
2015-07-01 10:30:23 -07:00
|
|
|
if (format)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
if (!sd) return;
|
|
|
|
*format = sd->format;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_file_file_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char **file, const char **group)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (file) *file = sd->file;
|
2015-07-01 10:30:23 -07:00
|
|
|
if (group) *group = NULL;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_file_save(Eo *obj, Elm_Entry_Data *sd)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
2013-05-29 04:51:06 -07:00
|
|
|
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
|
2012-08-30 09:45:15 -07:00
|
|
|
_save_do(obj);
|
2014-01-23 06:05:24 -08:00
|
|
|
sd->delay_write = ecore_timer_add(ELM_ENTRY_DELAY_WRITE_TIME,
|
|
|
|
_delay_write, obj);
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_autosave_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool auto_save)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->auto_save = !!auto_save;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_autosave_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->auto_save;
|
Remove elm_notepad
Notepad had a big issue: users couldn't access the entry, so notepad
was something near to an useless widget.
We needed to choose between wrap all entry functions or add these file
save / load and autosave features to entries.
As discussed on the emails list, we decided to go with the second
option, so we won't have an extra widget with lots of wrap functions.
Notepad was internally just an elm_entry with a scroll, so using
a scrolled entry with a file set will do the job.
I've added a test called Entry Notepad that looks like the removed
Notepad test. But we will see the improvements - you can clear the entry
or whatever you want, because the entry is the object you are creating.
If you were using elm_notepad before, just s/notepad/scrolled_entry
and almost everything should work fine. Another change was the function
file_save(obj, file, format), is now just file_save(obj), and the
file and format used are defined by file_set().
At last, some getters were added.
SVN revision: 54145
2010-11-04 04:56:15 -07:00
|
|
|
}
|
2011-01-13 15:04:25 -08:00
|
|
|
|
2012-03-05 00:31:58 -08:00
|
|
|
EINA_DEPRECATED EAPI void
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_cnp_textonly_set(Evas_Object *obj,
|
|
|
|
Eina_Bool textonly)
|
2012-03-05 00:26:09 -08:00
|
|
|
{
|
2012-03-05 00:34:56 -08:00
|
|
|
Elm_Cnp_Mode cnp_mode = ELM_CNP_MODE_MARKUP;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
ELM_ENTRY_CHECK(obj);
|
|
|
|
|
2012-03-05 00:26:09 -08:00
|
|
|
if (textonly)
|
|
|
|
cnp_mode = ELM_CNP_MODE_NO_IMAGE;
|
|
|
|
elm_entry_cnp_mode_set(obj, cnp_mode);
|
|
|
|
}
|
|
|
|
|
2012-03-05 00:31:58 -08:00
|
|
|
EINA_DEPRECATED EAPI Eina_Bool
|
2012-03-05 00:26:09 -08:00
|
|
|
elm_entry_cnp_textonly_get(const Evas_Object *obj)
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_CHECK(obj) EINA_FALSE;
|
|
|
|
|
2012-03-05 00:26:09 -08:00
|
|
|
return elm_entry_cnp_mode_get(obj) != ELM_CNP_MODE_MARKUP;
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_cnp_mode_set(Eo *obj, Elm_Entry_Data *sd, Elm_Cnp_Mode cnp_mode)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2011-01-13 15:04:25 -08:00
|
|
|
Elm_Sel_Format format = ELM_SEL_FORMAT_MARKUP;
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
if (sd->cnp_mode == cnp_mode) return;
|
|
|
|
sd->cnp_mode = cnp_mode;
|
|
|
|
if (sd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
|
2012-03-05 00:26:09 -08:00
|
|
|
format = ELM_SEL_FORMAT_TEXT;
|
2012-08-30 09:45:15 -07:00
|
|
|
else if (cnp_mode == ELM_CNP_MODE_MARKUP)
|
|
|
|
format |= ELM_SEL_FORMAT_IMAGE;
|
2013-11-07 04:01:00 -08:00
|
|
|
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
elm_drop_target_del(obj, sd->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
[Dnd] Fix double text insert issue in elm_entry, drop at disable, non-editable entry
Summary:
Issue 1: If you drop text to elm_entry, text is inserted twice.
Reason: Drop callbacks are registered multiple times in elm_entry.
Resolve: Register only one drop callback at entry side.
Issue 2: Even thought entry is disabled, non-editable, you still can drop text, image file. (Example, run Entry Scrolled and drop text, image file to disabled or non-editable entries).
Reason: Drop callback are registered but not remove when entry is set to disabled, non-editable mode.
Resolve: Correct registering and removing drop callbacks in entry.
Reviewers: JackDanielZ, raster
Reviewed By: raster
CC: woohyun
Differential Revision: https://phab.enlightenment.org/D565
2014-02-18 19:25:08 -08:00
|
|
|
sd->drop_format = format;
|
|
|
|
elm_drop_target_add(obj, sd->drop_format,
|
2016-05-09 01:28:02 -07:00
|
|
|
_dnd_enter_cb, NULL,
|
|
|
|
_dnd_leave_cb, NULL,
|
|
|
|
_dnd_pos_cb, NULL,
|
|
|
|
_dnd_drop_cb, NULL);
|
2011-01-13 15:04:25 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Elm_Cnp_Mode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_cnp_mode_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->cnp_mode;
|
2011-01-13 15:04:25 -08:00
|
|
|
}
|
|
|
|
|
2014-01-09 23:37:55 -08:00
|
|
|
static void
|
|
|
|
_elm_entry_content_viewport_resize_cb(Evas_Object *obj,
|
|
|
|
Evas_Coord w EINA_UNUSED, Evas_Coord h EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_elm_entry_resize_internal(obj);
|
|
|
|
}
|
|
|
|
|
2014-03-20 03:33:42 -07:00
|
|
|
static void
|
|
|
|
_scroll_cb(Evas_Object *obj, void *data EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
2014-05-22 14:33:46 -07:00
|
|
|
/* here we need to emit the signal that the elm_scroller would have done */
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:51:20 -07:00
|
|
|
(obj, EFL_UI_EVENT_SCROLL, NULL);
|
2014-05-22 14:33:46 -07:00
|
|
|
|
2014-03-20 03:33:42 -07:00
|
|
|
if (sd->have_selection)
|
|
|
|
_update_selection_handler(obj);
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_scrollable_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool scroll)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
|
|
|
scroll = !!scroll;
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->scroll == scroll) return;
|
|
|
|
sd->scroll = scroll;
|
|
|
|
|
|
|
|
if (sd->scroll)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
/* we now must re-theme ourselves to a scroller decoration
|
|
|
|
* and move the entry looking object to be the content of the
|
|
|
|
* scrollable view */
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, NULL);
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_widget_sub_object_add(obj, sd->entry_edje);
|
|
|
|
|
|
|
|
if (!sd->scr_edje)
|
2011-12-05 17:07:04 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->scr_edje = edje_object_add(evas_object_evas_get(obj));
|
|
|
|
|
|
|
|
elm_widget_theme_object_set
|
|
|
|
(obj, sd->scr_edje, "scroller", "entry",
|
|
|
|
elm_widget_style_get(obj));
|
|
|
|
|
|
|
|
evas_object_size_hint_weight_set
|
|
|
|
(sd->scr_edje, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set
|
|
|
|
(sd->scr_edje, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
|
|
|
|
evas_object_propagate_events_set(sd->scr_edje, EINA_TRUE);
|
2011-12-05 17:07:04 -08:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, sd->scr_edje);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_objects_set(obj, sd->scr_edje, sd->hit_rect);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_scroll_cb_set(obj, _scroll_cb);
|
2014-03-20 03:33:42 -07:00
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(obj, sd->h_bounce, sd->v_bounce);
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->single_line)
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_policy_set(obj, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
2011-12-05 18:19:43 -08:00
|
|
|
else
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_policy_set(obj, sd->policy_h, sd->policy_v);
|
|
|
|
elm_interface_scrollable_content_set(obj, sd->entry_edje);
|
|
|
|
elm_interface_scrollable_content_viewport_resize_cb_set(obj, _elm_entry_content_viewport_resize_cb);
|
2017-08-21 23:16:54 -07:00
|
|
|
elm_widget_on_show_region_hook_set(obj, NULL, _show_region_hook, NULL);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->scr_edje)
|
2011-12-05 17:07:04 -08:00
|
|
|
{
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_content_set(obj, NULL);
|
2012-08-30 09:45:15 -07:00
|
|
|
evas_object_hide(sd->scr_edje);
|
2011-12-05 17:07:04 -08:00
|
|
|
}
|
2017-08-08 05:06:43 -07:00
|
|
|
elm_widget_resize_object_set(obj, sd->entry_edje);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
|
|
|
if (sd->scr_edje)
|
|
|
|
elm_widget_sub_object_add(obj, sd->scr_edje);
|
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_objects_set(obj, sd->entry_edje, sd->hit_rect);
|
2012-08-30 09:45:15 -07:00
|
|
|
|
2017-08-21 23:16:54 -07:00
|
|
|
elm_widget_on_show_region_hook_set(obj, NULL, NULL, NULL);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->last_w = -1;
|
2017-10-23 22:03:46 -07:00
|
|
|
efl_ui_widget_theme_apply(obj);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_scrollable_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->scroll;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_icon_visible_set(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Eina_Bool setting)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (!elm_layout_content_get(obj, "elm.swallow.icon")) return;
|
2011-10-27 07:16:31 -07:00
|
|
|
|
2011-06-17 02:44:31 -07:00
|
|
|
if (setting)
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,action,show,icon", "elm");
|
2011-06-17 02:44:31 -07:00
|
|
|
else
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,action,hide,icon", "elm");
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_end_visible_set(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Eina_Bool setting)
|
2012-08-30 09:45:15 -07:00
|
|
|
{
|
2013-07-09 00:57:16 -07:00
|
|
|
if (!elm_layout_content_get(obj, "elm.swallow.end")) return;
|
2011-10-27 07:16:26 -07:00
|
|
|
|
2011-06-17 02:44:31 -07:00
|
|
|
if (setting)
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,action,show,end", "elm");
|
2011-06-17 02:44:31 -07:00
|
|
|
else
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,action,hide,end", "elm");
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_scrollbar_policy_set(Evas_Object *obj,
|
|
|
|
Elm_Scroller_Policy h,
|
|
|
|
Elm_Scroller_Policy v)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_CHECK(obj);
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_policy_set(obj, h, v);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_elm_interface_scrollable_policy_set(Eo *obj, Elm_Entry_Data *sd, Elm_Scroller_Policy h, Elm_Scroller_Policy v)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->policy_h = h;
|
|
|
|
sd->policy_v = v;
|
2016-08-15 06:44:41 -07:00
|
|
|
elm_interface_scrollable_policy_set(efl_super(obj, MY_CLASS), sd->policy_h, sd->policy_v);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_bounce_set(Evas_Object *obj,
|
|
|
|
Eina_Bool h_bounce,
|
|
|
|
Eina_Bool v_bounce)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_CHECK(obj);
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_set(obj, h_bounce, v_bounce);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_elm_interface_scrollable_bounce_allow_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool h_bounce, Eina_Bool v_bounce)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->h_bounce = h_bounce;
|
|
|
|
sd->v_bounce = v_bounce;
|
2016-08-15 06:44:41 -07:00
|
|
|
elm_interface_scrollable_bounce_allow_set(efl_super(obj, MY_CLASS), h_bounce, v_bounce);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-08-30 09:45:15 -07:00
|
|
|
elm_entry_bounce_get(const Evas_Object *obj,
|
|
|
|
Eina_Bool *h_bounce,
|
|
|
|
Eina_Bool *v_bounce)
|
2011-06-17 02:44:31 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_CHECK(obj);
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_interface_scrollable_bounce_allow_get((Eo *) obj, h_bounce, v_bounce);
|
2011-06-17 02:44:31 -07:00
|
|
|
}
|
2011-08-25 00:25:37 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_layout_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Input_Panel_Layout layout)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->input_panel_layout = layout;
|
2011-08-25 00:25:37 -07:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_layout_set
|
2013-06-26 09:54:26 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Input_Panel_Layout)layout);
|
2014-09-01 03:04:05 -07:00
|
|
|
|
2016-12-07 22:54:48 -08:00
|
|
|
switch (layout)
|
|
|
|
{
|
|
|
|
case ELM_INPUT_PANEL_LAYOUT_URL:
|
|
|
|
case ELM_INPUT_PANEL_LAYOUT_EMAIL:
|
|
|
|
case ELM_INPUT_PANEL_LAYOUT_PASSWORD:
|
|
|
|
elm_entry_autocapital_type_set(obj, ELM_AUTOCAPITAL_TYPE_NONE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
elm_entry_autocapital_type_set(obj, ELM_AUTOCAPITAL_TYPE_SENTENCE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-09-01 03:04:05 -07:00
|
|
|
if (layout == ELM_INPUT_PANEL_LAYOUT_PASSWORD)
|
|
|
|
elm_entry_input_hint_set(obj, ((sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE) | ELM_INPUT_HINT_SENSITIVE_DATA));
|
|
|
|
else if (layout == ELM_INPUT_PANEL_LAYOUT_TERMINAL)
|
|
|
|
elm_entry_input_hint_set(obj, (sd->input_hints & ~ELM_INPUT_HINT_AUTO_COMPLETE));
|
2011-08-25 00:25:37 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Elm_Input_Panel_Layout
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_input_panel_layout_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->input_panel_layout;
|
2011-08-25 00:25:37 -07:00
|
|
|
}
|
2011-10-26 22:43:08 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_layout_variation_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, int variation)
|
2013-03-27 01:34:19 -07:00
|
|
|
{
|
|
|
|
sd->input_panel_layout_variation = variation;
|
|
|
|
|
|
|
|
edje_object_part_text_input_panel_layout_variation_set
|
|
|
|
(sd->entry_edje, "elm.text", variation);
|
2016-12-07 22:54:48 -08:00
|
|
|
|
|
|
|
if (sd->input_panel_layout == ELM_INPUT_PANEL_LAYOUT_NORMAL &&
|
|
|
|
variation == ELM_INPUT_PANEL_LAYOUT_NORMAL_VARIATION_PERSON_NAME)
|
|
|
|
elm_entry_autocapital_type_set(obj, ELM_AUTOCAPITAL_TYPE_WORD);
|
2013-03-27 01:34:19 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_input_panel_layout_variation_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2013-03-27 01:34:19 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->input_panel_layout_variation;
|
2013-03-27 01:34:19 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_autocapital_type_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Autocapital_Type autocapital_type)
|
2011-10-26 22:43:08 -07:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->autocapital_type = autocapital_type;
|
|
|
|
edje_object_part_text_autocapital_type_set
|
2013-06-26 09:54:26 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Text_Autocapital_Type)autocapital_type);
|
2011-10-26 22:43:08 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Elm_Autocapital_Type
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_autocapital_type_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2011-10-26 22:43:08 -07:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->autocapital_type;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_prediction_allow_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool prediction)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->prediction_allow = prediction;
|
|
|
|
edje_object_part_text_prediction_allow_set
|
|
|
|
(sd->entry_edje, "elm.text", prediction);
|
2012-02-13 20:54:19 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_prediction_allow_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-02-13 03:43:58 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->prediction_allow;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-09-01 03:04:05 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_hint_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Input_Hints hints)
|
|
|
|
{
|
|
|
|
sd->input_hints = hints;
|
|
|
|
|
|
|
|
edje_object_part_text_input_hint_set
|
2015-07-29 07:26:14 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Input_Hints)hints);
|
2014-09-01 03:04:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Elm_Input_Hints
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_input_hint_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2014-09-01 03:04:05 -07:00
|
|
|
{
|
|
|
|
return sd->input_hints;
|
|
|
|
}
|
|
|
|
|
2017-06-25 21:44:58 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_prediction_hint_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *prediction_hint)
|
|
|
|
{
|
|
|
|
if (sd->prediction_hint)
|
|
|
|
free(sd->prediction_hint);
|
|
|
|
|
|
|
|
sd->prediction_hint = strdup(prediction_hint);
|
|
|
|
|
|
|
|
edje_object_part_text_prediction_hint_set
|
|
|
|
(sd->entry_edje, "elm.text", prediction_hint);
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_imf_context_reset(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_imf_context_reset(sd->entry_edje, "elm.text");
|
2012-02-13 03:43:58 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_enabled_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool enabled)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->input_panel_enable = enabled;
|
|
|
|
edje_object_part_text_input_panel_enabled_set
|
|
|
|
(sd->entry_edje, "elm.text", enabled);
|
2011-10-26 22:43:08 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_input_panel_enabled_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->input_panel_enable;
|
2012-02-02 23:32:40 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_show(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-02-12 22:50:45 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_show(sd->entry_edje, "elm.text");
|
2012-02-12 22:50:45 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_hide(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-02-12 22:50:45 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_hide(sd->entry_edje, "elm.text");
|
2012-02-12 22:50:45 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_language_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Input_Panel_Lang lang)
|
2012-02-15 00:42:46 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->input_panel_lang = lang;
|
|
|
|
edje_object_part_text_input_panel_language_set
|
2013-06-26 09:54:26 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Input_Panel_Lang)lang);
|
2012-02-15 00:42:46 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Elm_Input_Panel_Lang
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_input_panel_language_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-02-15 00:42:46 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->input_panel_lang;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_imdata_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const void *data, int len)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-01-21 18:08:47 -08:00
|
|
|
free(sd->input_panel_imdata);
|
2012-02-15 00:42:46 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->input_panel_imdata = calloc(1, len);
|
|
|
|
sd->input_panel_imdata_len = len;
|
|
|
|
memcpy(sd->input_panel_imdata, data, len);
|
2012-02-15 00:42:46 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_imdata_set
|
|
|
|
(sd->entry_edje, "elm.text", sd->input_panel_imdata,
|
|
|
|
sd->input_panel_imdata_len);
|
2012-02-15 00:42:46 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
2015-06-25 04:21:00 -07:00
|
|
|
_elm_entry_input_panel_imdata_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, void *data, int *len)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_imdata_get
|
|
|
|
(sd->entry_edje, "elm.text", data, len);
|
2012-02-15 00:42:46 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_return_key_type_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Elm_Input_Panel_Return_Key_Type return_key_type)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->input_panel_return_key_type = return_key_type;
|
2012-02-15 00:42:46 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_return_key_type_set
|
2013-06-26 09:54:26 -07:00
|
|
|
(sd->entry_edje, "elm.text", (Edje_Input_Panel_Return_Key_Type)return_key_type);
|
2012-02-15 00:42:46 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Elm_Input_Panel_Return_Key_Type
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_input_panel_return_key_type_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-02-15 00:42:46 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->input_panel_return_key_type;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_return_key_disabled_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool disabled)
|
2012-02-15 00:42:46 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->input_panel_return_key_disabled = disabled;
|
2012-02-15 00:42:46 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
edje_object_part_text_input_panel_return_key_disabled_set
|
|
|
|
(sd->entry_edje, "elm.text", disabled);
|
2012-02-15 00:42:46 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_input_panel_return_key_disabled_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-02-27 17:50:19 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->input_panel_return_key_disabled;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_return_key_autoenabled_set(Eo *obj, Elm_Entry_Data *sd, Eina_Bool enabled)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->auto_return_key = enabled;
|
|
|
|
_return_key_enabled_check(obj);
|
2012-02-27 17:50:19 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_input_panel_show_on_demand_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool ondemand)
|
2014-01-13 02:32:01 -08:00
|
|
|
{
|
|
|
|
sd->input_panel_show_on_demand = ondemand;
|
|
|
|
|
|
|
|
edje_object_part_text_input_panel_show_on_demand_set
|
|
|
|
(sd->entry_edje, "elm.text", ondemand);
|
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_input_panel_show_on_demand_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2014-01-13 02:32:01 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->input_panel_show_on_demand;
|
2014-01-13 02:32:01 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_imf_context_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2014-01-13 02:32:01 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
if (!sd) return NULL;
|
2014-01-13 02:32:01 -08:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return edje_object_part_text_imf_context_get(sd->entry_edje, "elm.text");
|
2012-03-02 02:34:58 -08:00
|
|
|
}
|
2012-03-06 02:09:13 -08:00
|
|
|
|
|
|
|
/* START - ANCHOR HOVER */
|
|
|
|
static void
|
2012-08-30 09:45:15 -07:00
|
|
|
_anchor_parent_del_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas *e EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
2012-03-06 02:09:13 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
ELM_ENTRY_DATA_GET(data, sd);
|
2012-03-06 02:09:13 -08:00
|
|
|
|
2012-08-30 09:45:15 -07:00
|
|
|
sd->anchor_hover.hover_parent = NULL;
|
2012-04-25 04:34:28 -07:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_anchor_hover_parent_set(Eo *obj, Elm_Entry_Data *sd, Evas_Object *parent)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
if (sd->anchor_hover.hover_parent)
|
|
|
|
evas_object_event_callback_del_full
|
|
|
|
(sd->anchor_hover.hover_parent, EVAS_CALLBACK_DEL,
|
|
|
|
_anchor_parent_del_cb, obj);
|
|
|
|
sd->anchor_hover.hover_parent = parent;
|
|
|
|
if (sd->anchor_hover.hover_parent)
|
|
|
|
evas_object_event_callback_add
|
|
|
|
(sd->anchor_hover.hover_parent, EVAS_CALLBACK_DEL,
|
|
|
|
_anchor_parent_del_cb, obj);
|
2012-03-06 02:09:13 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_anchor_hover_parent_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-03-06 02:09:13 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->anchor_hover.hover_parent;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_anchor_hover_style_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *style)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-08-30 09:45:15 -07:00
|
|
|
eina_stringshare_replace(&sd->anchor_hover.hover_style, style);
|
2012-03-06 02:09:13 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static const char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_anchor_hover_style_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-03-06 02:09:13 -08:00
|
|
|
{
|
2014-03-22 10:44:29 -07:00
|
|
|
return sd->anchor_hover.hover_style;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_anchor_hover_end(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2013-07-03 04:29:43 -07:00
|
|
|
ELM_SAFE_FREE(sd->anchor_hover.hover, evas_object_del);
|
|
|
|
ELM_SAFE_FREE(sd->anchor_hover.pop, evas_object_del);
|
2012-03-06 02:09:13 -08:00
|
|
|
}
|
2013-04-16 04:05:04 -07:00
|
|
|
/* END - ANCHOR HOVER */
|
2012-03-06 02:09:13 -08:00
|
|
|
|
2017-11-27 16:56:32 -08:00
|
|
|
static void
|
|
|
|
_activate(Evas_Object *obj)
|
2014-01-20 01:45:51 -08:00
|
|
|
{
|
|
|
|
ELM_ENTRY_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (!elm_widget_disabled_get(obj) &&
|
|
|
|
!evas_object_freeze_events_get(obj))
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-06-10 01:29:40 -07:00
|
|
|
(obj, EFL_UI_EVENT_CLICKED, NULL);
|
2014-01-20 01:45:51 -08:00
|
|
|
if (sd->editable && sd->input_panel_enable)
|
|
|
|
edje_object_part_text_input_panel_show(sd->entry_edje, "elm.text");
|
|
|
|
}
|
2017-11-27 16:56:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_entry_efl_ui_widget_on_access_activate(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Efl_Ui_Activate act)
|
2017-11-27 16:56:32 -08:00
|
|
|
{
|
|
|
|
if (act != EFL_UI_ACTIVATE_DEFAULT) return EINA_FALSE;
|
|
|
|
_activate(obj);
|
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
return EINA_TRUE;
|
2014-01-20 01:45:51 -08:00
|
|
|
}
|
|
|
|
|
2016-05-11 19:10:42 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_entry_select_allow_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, Eina_Bool allow)
|
|
|
|
{
|
|
|
|
if (sd->sel_allow == allow) return;
|
|
|
|
sd->sel_allow = allow;
|
|
|
|
|
2017-09-19 09:36:43 -07:00
|
|
|
edje_object_part_text_select_allow_set(sd->entry_edje, "elm.text", allow);
|
2016-05-11 19:10:42 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_select_allow_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
|
2016-05-11 19:10:42 -07:00
|
|
|
{
|
|
|
|
return sd->sel_allow;
|
|
|
|
}
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_entry_class_constructor(Efl_Class *klass)
|
2014-03-22 10:44:29 -07:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-06-10 00:18:17 -07:00
|
|
|
// ATSPI Accessibility
|
|
|
|
|
|
|
|
EOLIAN static Eina_Unicode
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_character_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
char *txt;
|
2014-06-19 02:30:21 -07:00
|
|
|
int idx = 0;
|
2014-06-10 00:18:17 -07:00
|
|
|
Eina_Unicode ret = 0;
|
|
|
|
if (offset < 0) return ret;
|
|
|
|
|
|
|
|
txt = _elm_util_mkup_to_text(elm_entry_entry_get(obj));
|
|
|
|
if (!txt) return ret;
|
|
|
|
|
2014-06-19 02:30:21 -07:00
|
|
|
ret = eina_unicode_utf8_next_get(txt, &idx);
|
|
|
|
while (offset--) ret = eina_unicode_utf8_next_get(txt, &idx);
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
free(txt);
|
|
|
|
|
2015-06-03 08:36:42 -07:00
|
|
|
if (_pd->password)
|
|
|
|
ret = ENTRY_PASSWORD_MASK_CHARACTER;
|
|
|
|
|
2014-06-10 00:18:17 -07:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_character_count_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
char *txt;
|
|
|
|
int ret = -1;
|
|
|
|
|
|
|
|
txt = _elm_util_mkup_to_text(elm_entry_entry_get(obj));
|
|
|
|
if (!txt) return ret;
|
|
|
|
|
|
|
|
ret = eina_unicode_utf8_get_len(txt);
|
|
|
|
free(txt);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_string_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Efl_Access_Text_Granularity granularity, int *start_offset, int *end_offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cur = NULL, *cur2 = NULL;
|
|
|
|
Evas_Object *tblk;
|
|
|
|
char *ret = NULL;
|
|
|
|
|
|
|
|
tblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!tblk) goto fail;
|
|
|
|
|
|
|
|
cur = evas_object_textblock_cursor_new(tblk);
|
|
|
|
cur2 = evas_object_textblock_cursor_new(tblk);
|
2014-06-11 00:05:54 -07:00
|
|
|
if (!cur || !cur2) goto fail;
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur, *start_offset);
|
|
|
|
if (evas_textblock_cursor_pos_get(cur) != *start_offset) goto fail;
|
|
|
|
|
|
|
|
switch (granularity)
|
|
|
|
{
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_CHAR:
|
2014-06-10 00:18:17 -07:00
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_WORD:
|
2014-06-10 00:18:17 -07:00
|
|
|
evas_textblock_cursor_word_start(cur);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_SENTENCE:
|
2014-06-10 00:18:17 -07:00
|
|
|
// TODO - add sentence support in textblock first
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_LINE:
|
2014-06-10 00:18:17 -07:00
|
|
|
evas_textblock_cursor_line_char_first(cur);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_PARAGRAPH:
|
2014-06-10 00:18:17 -07:00
|
|
|
evas_textblock_cursor_paragraph_char_first(cur);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
*start_offset = evas_textblock_cursor_pos_get(cur);
|
|
|
|
evas_textblock_cursor_copy(cur, cur2);
|
|
|
|
|
|
|
|
switch (granularity)
|
|
|
|
{
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_CHAR:
|
2014-06-10 00:18:17 -07:00
|
|
|
evas_textblock_cursor_char_next(cur2);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_WORD:
|
2014-06-10 00:18:17 -07:00
|
|
|
evas_textblock_cursor_word_end(cur2);
|
|
|
|
// since word_end sets cursor position ON (before) last
|
|
|
|
// char of word, we need to manually advance cursor to get
|
|
|
|
// proper string from function range_text_get
|
|
|
|
evas_textblock_cursor_char_next(cur2);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_SENTENCE:
|
2014-06-10 00:18:17 -07:00
|
|
|
// TODO - add sentence support in textblock first
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_LINE:
|
2014-06-10 00:18:17 -07:00
|
|
|
evas_textblock_cursor_line_char_last(cur2);
|
|
|
|
break;
|
2017-09-25 01:15:44 -07:00
|
|
|
case EFL_ACCESS_TEXT_GRANULARITY_PARAGRAPH:
|
2014-06-10 00:18:17 -07:00
|
|
|
evas_textblock_cursor_paragraph_char_last(cur2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (end_offset) *end_offset = evas_textblock_cursor_pos_get(cur2);
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_range_text_get(cur, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
2015-06-03 08:36:42 -07:00
|
|
|
if (ret && _pd->password)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
while (ret[i] != '\0')
|
|
|
|
ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER;
|
|
|
|
}
|
|
|
|
|
2014-06-10 00:18:17 -07:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (start_offset) *start_offset = -1;
|
|
|
|
if (end_offset) *end_offset = -1;
|
|
|
|
if (cur) evas_textblock_cursor_free(cur);
|
|
|
|
if (cur2) evas_textblock_cursor_free(cur2);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_access_text_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int start_offset, int end_offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Textblock_Cursor *cur = NULL, *cur2 = NULL;
|
|
|
|
Evas_Object *tblk;
|
|
|
|
char *ret = NULL;
|
|
|
|
|
|
|
|
tblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!tblk) goto fail;
|
|
|
|
|
|
|
|
cur = evas_object_textblock_cursor_new(tblk);
|
|
|
|
cur2 = evas_object_textblock_cursor_new(tblk);
|
2014-06-11 00:05:54 -07:00
|
|
|
if (!cur || !cur2) goto fail;
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur, start_offset);
|
|
|
|
if (evas_textblock_cursor_pos_get(cur) != start_offset) goto fail;
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur2, end_offset);
|
|
|
|
if (evas_textblock_cursor_pos_get(cur2) != end_offset) goto fail;
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_range_text_get(cur, cur2, EVAS_TEXTBLOCK_TEXT_PLAIN);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
2015-06-03 08:36:42 -07:00
|
|
|
if (ret && _pd->password)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
while (ret[i] != '\0')
|
|
|
|
ret[i++] = ENTRY_PASSWORD_MASK_CHARACTER;
|
|
|
|
}
|
|
|
|
|
2014-06-10 00:18:17 -07:00
|
|
|
return ret;
|
|
|
|
|
|
|
|
fail:
|
|
|
|
if (cur) evas_textblock_cursor_free(cur);
|
|
|
|
if (cur2) evas_textblock_cursor_free(cur2);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_caret_offset_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
return elm_entry_cursor_pos_get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-09-25 01:15:44 -07:00
|
|
|
_elm_entry_efl_access_text_caret_offset_set(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
elm_entry_cursor_pos_set(obj, offset);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_selections_count_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
return elm_entry_selection_get(obj) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_access_selection_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int selection_number, int *start_offset, int *end_offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
if (selection_number != 0) return;
|
|
|
|
|
2016-03-02 03:57:19 -08:00
|
|
|
elm_obj_entry_select_region_get(obj, start_offset, end_offset);
|
2014-06-10 00:18:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_entry_efl_access_text_access_selection_set(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int selection_number, int start_offset, int end_offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
if (selection_number != 0) return EINA_FALSE;
|
|
|
|
|
|
|
|
elm_entry_select_region_set(obj, start_offset, end_offset);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-09-25 01:15:44 -07:00
|
|
|
_elm_entry_efl_access_text_selection_remove(Eo *obj, Elm_Entry_Data *pd EINA_UNUSED, int selection_number)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
if (selection_number != 0) return EINA_FALSE;
|
|
|
|
elm_entry_select_none(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-09-25 01:15:44 -07:00
|
|
|
_elm_entry_efl_access_text_selection_add(Eo *obj, Elm_Entry_Data *pd EINA_UNUSED, int start_offset, int end_offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
elm_entry_select_region_set(obj, start_offset, end_offset);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_List*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_bounded_ranges_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *_pd EINA_UNUSED, Eina_Bool screen_coods EINA_UNUSED, Eina_Rect rect EINA_UNUSED, Efl_Access_Text_Clip_Type xclip EINA_UNUSED, Efl_Access_Text_Clip_Type yclip EINA_UNUSED)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static int
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_offset_at_point_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Eina_Bool screen_coods, int x, int y)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *txtblk;
|
|
|
|
Evas_Textblock_Cursor *cur;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
txtblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!txtblk) return -1;
|
|
|
|
|
|
|
|
cur = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur) return -1;
|
|
|
|
|
|
|
|
if (screen_coods)
|
|
|
|
{
|
|
|
|
int ee_x, ee_y;
|
|
|
|
Ecore_Evas *ee= ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
|
|
|
ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
|
|
|
|
x -= ee_x;
|
|
|
|
y -= ee_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!evas_textblock_cursor_char_coord_set(cur, x, y))
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_pos_get(cur);
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_character_extents_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int offset, Eina_Bool screen_coods, Eina_Rect *rect)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *txtblk;
|
|
|
|
Evas_Textblock_Cursor *cur;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
txtblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!txtblk) return EINA_FALSE;
|
|
|
|
|
|
|
|
cur = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur) return EINA_FALSE;
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur, offset);
|
|
|
|
|
|
|
|
ret = evas_textblock_cursor_char_geometry_get(cur, &rect->x, &rect->y, &rect->w, &rect->h);
|
|
|
|
evas_textblock_cursor_free(cur);
|
|
|
|
|
|
|
|
if (ret == -1) return EINA_FALSE;
|
|
|
|
|
|
|
|
if (screen_coods)
|
|
|
|
{
|
|
|
|
int ee_x, ee_y;
|
|
|
|
Ecore_Evas *ee= ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
|
|
|
ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
|
|
|
|
rect->x += ee_x;
|
|
|
|
rect->y += ee_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_range_extents_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, Eina_Bool screen_coods, int start_offset, int end_offset, Eina_Rect *rect)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *txtblk;
|
|
|
|
Evas_Textblock_Cursor *cur1, *cur2;
|
|
|
|
int ret;
|
2014-06-19 02:30:21 -07:00
|
|
|
int x, xx, y, yy;
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
txtblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!txtblk) return EINA_FALSE;
|
|
|
|
|
|
|
|
cur1 = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur1) return EINA_FALSE;
|
|
|
|
|
|
|
|
cur2 = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur2)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur1, start_offset);
|
|
|
|
evas_textblock_cursor_pos_set(cur2, end_offset);
|
|
|
|
|
2014-06-19 02:30:21 -07:00
|
|
|
ret = evas_textblock_cursor_char_geometry_get(cur1, &x, &y, NULL, NULL);
|
|
|
|
ret += evas_textblock_cursor_char_geometry_get(cur2, &xx, &yy, NULL, NULL);
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
|
|
|
if (ret != 0) return EINA_FALSE;
|
|
|
|
|
2014-06-19 02:30:21 -07:00
|
|
|
rect->x = x < xx ? x : xx;
|
|
|
|
rect->y = y < yy ? y : yy;
|
|
|
|
rect->w = abs(x - xx);
|
|
|
|
rect->h = abs(y - yy);
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
if (screen_coods)
|
|
|
|
{
|
|
|
|
int ee_x, ee_y;
|
|
|
|
Ecore_Evas *ee= ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
|
|
|
ecore_evas_geometry_get(ee, &ee_x, &ee_y, NULL, NULL);
|
|
|
|
rect->x += ee_x;
|
|
|
|
rect->y += ee_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-09-25 01:15:44 -07:00
|
|
|
static Efl_Access_Text_Attribute*
|
2014-06-10 00:18:17 -07:00
|
|
|
_textblock_node_format_to_atspi_text_attr(const Evas_Object_Textblock_Node_Format *format)
|
|
|
|
{
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Attribute *ret = NULL;
|
2014-06-10 00:18:17 -07:00
|
|
|
const char *txt;
|
|
|
|
|
|
|
|
txt = evas_textblock_node_format_text_get(format);
|
|
|
|
if (!txt) return NULL;
|
|
|
|
|
|
|
|
if (txt[0] == '-') return NULL; // skip closing format
|
|
|
|
|
|
|
|
if (!strncmp(txt, "+ ", 2))
|
|
|
|
{
|
|
|
|
const char *tmp = &txt[2];
|
|
|
|
|
|
|
|
while (*tmp != '\0' && *tmp != '=') tmp++;
|
|
|
|
if (*tmp++ != '=') return NULL;
|
|
|
|
|
2017-09-25 01:15:44 -07:00
|
|
|
ret = calloc(1, sizeof(Efl_Access_Text_Attribute));
|
2014-06-10 00:18:17 -07:00
|
|
|
if (!ret) return NULL;
|
|
|
|
|
|
|
|
ret->value = eina_stringshare_add(tmp);
|
|
|
|
int size = &txt[2] - tmp + 1;
|
|
|
|
ret->name = eina_stringshare_add_length(&txt[2], size > 0 ? size : -size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_attribute_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, const char *attr_name EINA_UNUSED, int *start_offset, int *end_offset, char **value)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *txtblk;
|
|
|
|
Evas_Textblock_Cursor *cur1, *cur2;
|
|
|
|
Eina_List *formats, *l;
|
|
|
|
Evas_Object_Textblock_Node_Format *format;
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Attribute *attr;
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
txtblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!txtblk) return EINA_FALSE;
|
|
|
|
|
|
|
|
cur1 = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur1) return EINA_FALSE;
|
|
|
|
|
|
|
|
cur2 = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur2)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur1, *start_offset);
|
|
|
|
evas_textblock_cursor_pos_set(cur2, *end_offset);
|
|
|
|
|
|
|
|
formats = evas_textblock_cursor_range_formats_get(cur1, cur2);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
|
|
|
if (!formats) return EINA_FALSE;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(formats, l , format)
|
|
|
|
{
|
|
|
|
attr = _textblock_node_format_to_atspi_text_attr(format);
|
|
|
|
if (!attr) continue;
|
|
|
|
if (!strcmp(attr->name, attr_name))
|
|
|
|
{
|
|
|
|
*value = attr->value ? strdup(attr->value) : NULL;
|
|
|
|
elm_atspi_text_text_attribute_free(attr);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
elm_atspi_text_text_attribute_free(attr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_List*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_text_attributes_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int *start_offset, int *end_offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *txtblk;
|
|
|
|
Evas_Textblock_Cursor *cur1, *cur2;
|
|
|
|
Eina_List *formats, *ret = NULL, *l;
|
|
|
|
Evas_Object_Textblock_Node_Format *format;
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Attribute *attr;
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
txtblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!txtblk) return NULL;
|
|
|
|
|
|
|
|
cur1 = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur1) return NULL;
|
|
|
|
|
|
|
|
cur2 = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur2)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur1, *start_offset);
|
|
|
|
evas_textblock_cursor_pos_set(cur2, *end_offset);
|
|
|
|
|
|
|
|
formats = evas_textblock_cursor_range_formats_get(cur1, cur2);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
2014-08-22 01:20:57 -07:00
|
|
|
if (!formats) return NULL;
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
EINA_LIST_FOREACH(formats, l , format)
|
|
|
|
{
|
|
|
|
attr = _textblock_node_format_to_atspi_text_attr(format);
|
|
|
|
if (!attr) continue;
|
|
|
|
ret = eina_list_append(ret, attr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_List*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_text_default_attributes_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *_pd EINA_UNUSED)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *txtblk;
|
|
|
|
Eina_List *ret = NULL;
|
|
|
|
const Evas_Object_Textblock_Node_Format *format;
|
2017-09-25 01:15:44 -07:00
|
|
|
Efl_Access_Text_Attribute *attr;
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
txtblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!txtblk) return NULL;
|
|
|
|
|
|
|
|
format = evas_textblock_node_format_first_get(txtblk);
|
2014-08-22 01:20:57 -07:00
|
|
|
if (!format) return NULL;
|
2014-06-10 00:18:17 -07:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
attr = _textblock_node_format_to_atspi_text_attr(format);
|
|
|
|
if (!attr) continue;
|
|
|
|
ret = eina_list_append(ret, attr);
|
|
|
|
}
|
|
|
|
while ((format = evas_textblock_node_format_next_get(format)) != NULL);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-02-14 18:14:52 -08:00
|
|
|
_elm_entry_efl_access_editable_text_text_content_set(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, const char *content)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
elm_entry_entry_set(obj, content);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-09-25 01:15:44 -07:00
|
|
|
_elm_entry_efl_access_editable_text_insert(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, const char *string, int position)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
elm_entry_cursor_pos_set(obj, position);
|
|
|
|
elm_entry_entry_insert(obj, string);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-09-25 01:15:44 -07:00
|
|
|
_elm_entry_efl_access_editable_text_copy(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int start, int end)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
elm_entry_select_region_set(obj, start, end);
|
|
|
|
elm_entry_selection_copy(obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-09-25 01:15:44 -07:00
|
|
|
_elm_entry_efl_access_editable_text_delete(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int start_offset, int end_offset)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
Evas_Object *txtblk;
|
|
|
|
Evas_Textblock_Cursor *cur1, *cur2;
|
|
|
|
|
|
|
|
txtblk = elm_entry_textblock_get(obj);
|
|
|
|
if (!txtblk) return EINA_FALSE;
|
|
|
|
|
|
|
|
cur1 = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur1) return EINA_FALSE;
|
|
|
|
|
|
|
|
cur2 = evas_object_textblock_cursor_new(txtblk);
|
|
|
|
if (!cur2)
|
|
|
|
{
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
evas_textblock_cursor_pos_set(cur1, start_offset);
|
|
|
|
evas_textblock_cursor_pos_set(cur2, end_offset);
|
|
|
|
|
|
|
|
evas_textblock_cursor_range_delete(cur1, cur2);
|
|
|
|
|
|
|
|
evas_textblock_cursor_free(cur1);
|
|
|
|
evas_textblock_cursor_free(cur2);
|
|
|
|
|
|
|
|
elm_entry_calc_force(obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-09-25 01:15:44 -07:00
|
|
|
_elm_entry_efl_access_editable_text_paste(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int position)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
elm_entry_cursor_pos_set(obj, position);
|
|
|
|
elm_entry_selection_paste(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2017-09-25 01:15:44 -07:00
|
|
|
_elm_entry_efl_access_editable_text_cut(Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED, int start, int end)
|
2014-06-10 00:18:17 -07:00
|
|
|
{
|
|
|
|
elm_entry_select_region_set(obj, start, end);
|
|
|
|
elm_entry_selection_cut(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN static Efl_Access_State_Set
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_entry_efl_access_object_state_set_get(const Eo *obj, Elm_Entry_Data *_pd EINA_UNUSED)
|
2014-10-24 04:12:51 -07:00
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_State_Set ret;
|
2018-04-03 04:27:30 -07:00
|
|
|
ret = efl_access_object_state_set_get(efl_super(obj, ELM_ENTRY_CLASS));
|
2014-10-24 04:12:51 -07:00
|
|
|
|
|
|
|
if (elm_entry_editable_get(obj))
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(ret, EFL_ACCESS_STATE_EDITABLE);
|
2014-10-24 04:12:51 -07:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-11-09 17:58:41 -08:00
|
|
|
EOLIAN static const char*
|
2018-04-03 04:27:30 -07:00
|
|
|
_elm_entry_efl_access_object_i18n_name_get(const Eo *obj, Elm_Entry_Data *sd)
|
2015-06-03 08:36:42 -07:00
|
|
|
{
|
2016-11-09 17:58:41 -08:00
|
|
|
const char *name;
|
2018-04-03 04:27:30 -07:00
|
|
|
name = efl_access_object_i18n_name_get(efl_super(obj, ELM_ENTRY_CLASS));
|
2015-12-17 00:36:02 -08:00
|
|
|
if (name && strncmp("", name, 1)) return name;
|
2017-09-05 17:58:07 -07:00
|
|
|
|
|
|
|
if (sd->password) return NULL;
|
|
|
|
|
2017-09-06 03:54:59 -07:00
|
|
|
name = _elm_widget_accessible_plain_name_get(obj, elm_entry_entry_get(obj));
|
2017-09-05 17:58:07 -07:00
|
|
|
if (name && strncmp("", name, 1)) return name;
|
|
|
|
|
2015-06-03 08:36:42 -07:00
|
|
|
const char *ret = edje_object_part_text_get(sd->entry_edje, "elm.guide");
|
2017-09-06 03:54:59 -07:00
|
|
|
return _elm_widget_accessible_plain_name_get(obj, ret);
|
2015-06-03 08:36:42 -07:00
|
|
|
}
|
|
|
|
|
2017-11-27 16:56:32 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_activate(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN const Efl_Access_Action_Data *
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_entry_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Elm_Entry_Data *sd EINA_UNUSED)
|
2017-11-27 16:56:32 -08:00
|
|
|
{
|
|
|
|
static Efl_Access_Action_Data atspi_actions[] = {
|
|
|
|
{ "activate", "activate", NULL, _action_activate },
|
|
|
|
{ NULL, NULL, NULL, NULL}
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2018-04-01 11:55:34 -07:00
|
|
|
EOLIAN static Efl_Ui_Focus_Manager*
|
|
|
|
_elm_entry_efl_ui_widget_focus_manager_create(Eo *obj, Elm_Entry_Data *pd EINA_UNUSED, Efl_Ui_Focus_Object *root)
|
|
|
|
{
|
|
|
|
return efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, obj,
|
|
|
|
efl_ui_focus_manager_root_set(efl_added, root)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
/* Efl.Part begin */
|
|
|
|
|
2017-09-19 04:02:26 -07:00
|
|
|
ELM_PART_OVERRIDE(elm_entry, ELM_ENTRY, Elm_Entry_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET(elm_entry, ELM_ENTRY, Elm_Entry_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_UNSET(elm_entry, ELM_ENTRY, Elm_Entry_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_SET(elm_entry, ELM_ENTRY, Elm_Entry_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_GET(elm_entry, ELM_ENTRY, Elm_Entry_Data)
|
2017-11-28 20:43:21 -08:00
|
|
|
ELM_PART_CONTENT_DEFAULT_GET(elm_entry, "icon")
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_entry_part.eo.c"
|
2016-05-24 04:40:18 -07:00
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
|
|
|
ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
2017-07-27 23:35:10 -07:00
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
#define ELM_ENTRY_EXTRA_OPS \
|
2017-06-29 04:02:59 -07:00
|
|
|
ELM_PART_CONTENT_DEFAULT_OPS(elm_entry), \
|
2017-07-27 23:35:10 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(elm_entry), \
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
|
|
|
|
ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \
|
2017-08-07 00:13:38 -07:00
|
|
|
ELM_LAYOUT_SIZING_EVAL_OPS(elm_entry)
|
2017-05-18 01:52:17 -07:00
|
|
|
|
2014-03-22 10:44:29 -07:00
|
|
|
#include "elm_entry.eo.c"
|