static void st_collections_group_parts_part_source5(void);
static void st_collections_group_parts_part_source6(void);
static void st_collections_group_parts_part_entry_mode(void);
+static void st_collections_group_parts_part_select_mode(void);
static void st_collections_group_parts_part_multiline(void);
static void st_collections_group_parts_part_dragable_x(void);
static void st_collections_group_parts_part_dragable_y(void);
{"collections.group.parts.part.dragable.confine", st_collections_group_parts_part_dragable_confine},
{"collections.group.parts.part.dragable.events", st_collections_group_parts_part_dragable_events},
{"collections.group.parts.part.entry_mode", st_collections_group_parts_part_entry_mode},
+ {"collections.group.parts.part.select_mode", st_collections_group_parts_part_select_mode},
{"collections.group.parts.part.multiline", st_collections_group_parts_part_multiline},
{"collections.group.parts.part.image", st_images_image}, /* dup */
{"collections.group.parts.part.images.image", st_images_image}, /* dup */
/**
@page edcref
@property
+ select_mode
+ @parameters
+ Sets the selection mode for a textblock part to one of:
+ @li DEFAULT
+ @li EXPLICIT
+ @effect
+ DEFAULT selection mode is what you would expect on any desktop. Press
+ mouse, drag and release to end. EXPLICIT mode requires the application
+ controlling the edje object has to explicitly begin and end selection
+ modes, and the selection itself is dragable at both ends.
+ @endproperty
+*/
+static void
+st_collections_group_parts_part_select_mode(void)
+{
+ Edje_Part_Collection *pc;
+ Edje_Part *ep;
+
+ check_arg_count(1);
+
+ pc = eina_list_data_get(eina_list_last(edje_collections));
+ ep = eina_list_data_get(eina_list_last(pc->parts));
+ ep->select_mode = parse_enum(0,
+ "DEFAULT", EDJE_ENTRY_SELECTION_MODE_DEFAULT,
+ "EXPLICIT", EDJE_ENTRY_SELECTION_MODE_EXPLICIT,
+ NULL);
+}
+
+/**
+ @page edcref
+ @property
multiline
@parameters
0 or 1 (boolean) off/on
char *selection;
Evas_Bool selecting : 1;
Evas_Bool have_selection : 1;
+ Evas_Bool select_allow : 1;
};
struct _Sel
Evas_Coord x, y, w, h;
Evas_Bool multiline;
Evas_Textblock_Cursor *tc;
+ Evas_Bool dosel = 0;
if (!rp) return;
en = rp->entry_data;
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
return;
}
if (ev->button != 1) return;
- // double click -> select word
- // triple click -> select line
+ if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_DEFAULT)
+ dosel = 1;
+ else if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
+ {
+ if (en->select_allow) dosel = 1;
+ }
+ if (dosel)
+ {
+ // double click -> select word
+ // triple click -> select line
+ }
tc = evas_object_textblock_cursor_new(rp->object);
evas_textblock_cursor_copy(en->cursor, tc);
multiline = rp->part->multiline;
en->cy = ev->canvas.y - y;
if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy))
{
- Evas_Coord lx, ly, lw, lh;
+ Evas_Coord lx, ly, lw, lh;
int line;
-
- line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
+
+ line = evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
if (line == -1)
_curs_end(en->cursor, rp->object, en);
else
_curs_lin_end(en->cursor, rp->object, en);
}
}
- en->selecting = 1;
- _sel_clear(en->cursor, rp->object, en);
- _sel_start(en->cursor, rp->object, en);
+ if (dosel)
+ {
+ if ((en->have_selection) &&
+ (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT))
+ {
+ printf("have selection.. do nothing\n");
+ }
+ else
+ {
+ en->selecting = 1;
+ _sel_clear(en->cursor, rp->object, en);
+ _sel_start(en->cursor, rp->object, en);
+ }
+ }
if (evas_textblock_cursor_compare(tc, en->cursor))
_edje_emit(rp->edje, "cursor,changed", rp->part->name);
evas_textblock_cursor_free(tc);
Evas_Coord x, y, w, h;
Evas_Bool multiline;
Evas_Textblock_Cursor *tc;
+ Evas_Bool dosel = 0;
if (ev->button != 1) return;
if (!rp) return;
en = rp->entry_data;
en->cy = ev->canvas.y - y;
if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy))
{
- Evas_Coord lx, ly, lw, lh;
-
- evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
- evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
- if (en->cx <= lx)
- _curs_lin_start(en->cursor, rp->object, en);
- else
- _curs_lin_end(en->cursor, rp->object, en);
+ Evas_Coord lx, ly, lw, lh;
+
+ evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
+ evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
+ if (en->cx <= lx)
+ _curs_lin_start(en->cursor, rp->object, en);
+ else
+ _curs_lin_end(en->cursor, rp->object, en);
+ }
+ if (rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT)
+ {
+ if (en->select_allow)
+ evas_textblock_cursor_copy(en->cursor, en->sel_end);
}
- evas_textblock_cursor_copy(en->cursor, en->sel_end);
+ else
+ evas_textblock_cursor_copy(en->cursor, en->sel_end);
en->selecting = 0;
if (evas_textblock_cursor_compare(tc, en->cursor))
_edje_emit(rp->edje, "cursor,changed", rp->part->name);
Entry *en;
Evas_Coord x, y, w, h;
Evas_Textblock_Cursor *tc;
- if (!rp) return;
Evas_Bool multiline;
+ if (!rp) return;
en = rp->entry_data;
if ((!en) || (rp->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
(rp->part->entry_mode < EDJE_ENTRY_EDIT_MODE_SELECTABLE))
return;
- tc = evas_object_textblock_cursor_new(rp->object);
- evas_textblock_cursor_copy(en->cursor, tc);
- multiline = rp->part->multiline;
- if (!en->selecting) return;
- evas_object_geometry_get(rp->object, &x, &y, &w, &h);
- en->cx = ev->cur.canvas.x - x;
- en->cy = ev->cur.canvas.y - y;
- if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy))
+ if (en->selecting)
{
- Evas_Coord lx, ly, lw, lh;
-
- evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
- evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
- if (en->cx <= lx)
- _curs_lin_start(en->cursor, rp->object, en);
- else
- _curs_lin_end(en->cursor, rp->object, en);
+ tc = evas_object_textblock_cursor_new(rp->object);
+ evas_textblock_cursor_copy(en->cursor, tc);
+ multiline = rp->part->multiline;
+ evas_object_geometry_get(rp->object, &x, &y, &w, &h);
+ en->cx = ev->cur.canvas.x - x;
+ en->cy = ev->cur.canvas.y - y;
+ if (!evas_textblock_cursor_char_coord_set(en->cursor, en->cx, en->cy))
+ {
+ Evas_Coord lx, ly, lw, lh;
+
+ evas_textblock_cursor_line_coord_set(en->cursor, en->cy);
+ evas_textblock_cursor_line_geometry_get(en->cursor, &lx, &ly, &lw, &lh);
+ if (en->cx <= lx)
+ _curs_lin_start(en->cursor, rp->object, en);
+ else
+ _curs_lin_end(en->cursor, rp->object, en);
+ }
+ if ((rp->part->select_mode == EDJE_ENTRY_SELECTION_MODE_EXPLICIT) &&
+ (en->select_allow))
+ {
+ _sel_extend(en->cursor, rp->object, en);
+ }
+ else
+ {
+ _sel_extend(en->cursor, rp->object, en);
+ }
+ if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) != 0)
+ _sel_enable(en->cursor, rp->object, en);
+ if (en->have_selection)
+ _sel_update(en->cursor, rp->object, en);
+ if (evas_textblock_cursor_compare(tc, en->cursor))
+ _edje_emit(rp->edje, "cursor,changed", rp->part->name);
+ evas_textblock_cursor_free(tc);
+ _edje_entry_real_part_configure(rp);
}
- _sel_extend(en->cursor, rp->object, en);
- if (evas_textblock_cursor_compare(en->sel_start, en->sel_end) != 0)
- _sel_enable(en->cursor, rp->object, en);
- if (en->have_selection)
- _sel_update(en->cursor, rp->object, en);
- if (evas_textblock_cursor_compare(tc, en->cursor))
- _edje_emit(rp->edje, "cursor,changed", rp->part->name);
- evas_textblock_cursor_free(tc);
- _edje_entry_real_part_configure(rp);
}
/***************************************************************/
if (cw) *cw = ww;
if (ch) *ch = hh;
}
+
+void
+_edje_entry_select_allow_set(Edje_Real_Part *rp, Evas_Bool allow)
+{
+ Entry *en = rp->entry_data;
+ en->select_allow = allow;
+}