/**
 * @brief Cuts text content from entry to clipboard
 *
 * @param text an AtkEditableText
 * @param start_pos start position of cursor
 * @param end_pos end position of cursor
 */
static void
eail_multibuttonentry_cut_text(AtkEditableText *text,
                    gint             start_pos,
                    gint             end_pos)
{
   Evas_Object *widget;
   Evas_Object *entry;
   const char *entry_text;
   char *tmp;
   GString *s;


   widget = eail_widget_get_widget(EAIL_WIDGET(text));
   if (!widget || !elm_multibuttonentry_editable_get(widget)) return;

   entry = elm_multibuttonentry_entry_get(widget);
   entry_text = elm_entry_entry_get(entry);
   tmp = eail_get_substring(entry_text, start_pos, end_pos);
   eail_clipboard_set_text(tmp);
   g_free(tmp);

   s = g_string_new(entry_text);
   s = g_string_erase(s, start_pos, end_pos - start_pos);

   elm_entry_entry_set(entry, s->str);
   g_string_free(s, TRUE);
}
/**
 * @brief Gets text bounded by start_offset and end_offset
 *
 * Use g_free() to free the returned string
 *
 * @param text an AtkText
 * @param start_offset start position
 * @param end_offset end position, -1 for the end of the string
 * @return string containing text from start_offset up to, but not including
 * end_offset
 */
static gchar*
eail_multibuttonentry_get_text(AtkText   *text,
                   gint       start_offset,
                   gint       end_offset)
{
   const gchar *string = NULL;

   string = _eail_multibuttonentry_get_entry_string(text);

   return eail_get_substring(string, start_offset, end_offset);
}
Exemple #3
0
/**
 * @brief Gets text bounded by start_offset and end_offset
 *
 * Use g_free() to free the returned string.
 *
 * @param text AtkText instance
 * @param start_offset start position
 * @param end_offset end position, -1 for the end of the string
 *
 * @return string containing the text from start_offset up to,
 * but not including end_offset
 */
static gchar*
eail_button_get_text(AtkText   *text,
                     gint       start_offset,
                     gint       end_offset)
{
   gchar *string = NULL;
   Evas_Object *widget = eail_widget_get_widget(EAIL_WIDGET(text));

   if (widget)
     string = (gchar *)elm_object_text_get(widget);

   return eail_get_substring(string, start_offset, end_offset);
}
/**
 * @brief Copies text content from entry to clipboard
 *
 * @param text an AtkEditableText
 * @param start_pos start position of cursor
 * @param end_pos end position of cursor
 */
static void
eail_multibuttonentry_copy_text(AtkEditableText *text,
                     gint             start_pos,
                     gint             end_pos)
{
   Evas_Object *widget;
   Evas_Object *entry;
   const char *entry_text;
   char *tmp;


   widget = eail_widget_get_widget(EAIL_WIDGET(text));
   if (!widget) return;

   entry = elm_multibuttonentry_entry_get(widget);
   entry_text = elm_entry_entry_get(entry);
   tmp = eail_get_substring(entry_text, start_pos, end_pos);
   eail_clipboard_set_text(tmp);
   g_free(tmp);
}