2012-08-30 09:46:12 -07:00
|
|
|
#ifndef ELM_WIDGET_MULTIBUTTONENTRY_H
|
|
|
|
#define ELM_WIDGET_MULTIBUTTONENTRY_H
|
|
|
|
|
|
|
|
#include "elm_widget_layout.h"
|
2014-09-27 22:15:07 -07:00
|
|
|
|
2014-08-07 09:26:47 -07:00
|
|
|
/* DO NOT USE THIS HEADER UNLESS YOU ARE PREPARED FOR BREAKING OF YOUR
|
|
|
|
* CODE. THIS IS ELEMENTARY'S INTERNAL WIDGET API (for now) AND IS NOT
|
|
|
|
* FINAL. CALL elm_widget_api_check(ELM_INTERNAL_API_VERSION) TO CHECK
|
|
|
|
* IT AT RUNTIME.
|
|
|
|
*/
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
/**
|
|
|
|
* @addtogroup Widget
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @section elm-multibuttonentry-class The Elementary Multi Button Entry Class
|
|
|
|
*
|
|
|
|
* Elementary, besides having the @ref Multibuttonentry widget,
|
|
|
|
* exposes its foundation -- the Elementary Multi Button Entry Class --
|
|
|
|
* in order to create other widgets which are a multi button entry with
|
|
|
|
* some more logic on top.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base widget smart data extended with multibuttonentry instance data.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum _Multibuttonentry_Pos
|
|
|
|
{
|
|
|
|
MULTIBUTTONENTRY_POS_START,
|
|
|
|
MULTIBUTTONENTRY_POS_END,
|
|
|
|
MULTIBUTTONENTRY_POS_BEFORE,
|
|
|
|
MULTIBUTTONENTRY_POS_AFTER,
|
|
|
|
} Multibuttonentry_Pos;
|
|
|
|
|
|
|
|
typedef enum _Multibuttonentry_Button_State
|
|
|
|
{
|
|
|
|
MULTIBUTTONENTRY_BUTTON_STATE_DEFAULT,
|
|
|
|
MULTIBUTTONENTRY_BUTTON_STATE_SELECTED,
|
|
|
|
} Multibuttonentry_Button_State;
|
|
|
|
|
|
|
|
typedef enum _MultiButtonEntry_Closed_Button_Type
|
|
|
|
{
|
|
|
|
MULTIBUTTONENTRY_CLOSED_IMAGE,
|
|
|
|
MULTIBUTTONENTRY_CLOSED_LABEL
|
|
|
|
} MultiButtonEntry_Closed_Button_Type;
|
|
|
|
|
|
|
|
typedef enum _Multibuttonentry_View_State
|
|
|
|
{
|
|
|
|
MULTIBUTTONENTRY_VIEW_NONE,
|
|
|
|
MULTIBUTTONENTRY_VIEW_GUIDETEXT,
|
|
|
|
MULTIBUTTONENTRY_VIEW_ENTRY,
|
|
|
|
MULTIBUTTONENTRY_VIEW_SHRINK
|
|
|
|
} Multibuttonentry_View_State;
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
typedef struct _Multibuttonentry_Item Elm_Multibuttonentry_Item_Data;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
struct _Multibuttonentry_Item
|
|
|
|
{
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Widget_Item_Data *base;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
Evas_Coord vw, rw; // vw: visual width, real width
|
|
|
|
Eina_Bool visible : 1;
|
|
|
|
Evas_Smart_Cb func;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _Elm_Multibuttonentry_Item_Filter
|
|
|
|
{
|
|
|
|
Elm_Multibuttonentry_Item_Filter_Cb callback_func;
|
|
|
|
void *data;
|
|
|
|
} Elm_Multibuttonentry_Item_Filter;
|
|
|
|
|
2018-04-19 06:20:29 -07:00
|
|
|
typedef struct _Elm_Multibuttonentry_Data
|
|
|
|
Elm_Multibuttonentry_Data;
|
|
|
|
struct _Elm_Multibuttonentry_Data
|
2012-08-30 09:46:12 -07:00
|
|
|
{
|
2012-12-07 00:44:47 -08:00
|
|
|
Evas_Object *parent;
|
2012-08-30 09:46:12 -07:00
|
|
|
Evas_Object *box;
|
|
|
|
Evas_Object *entry;
|
|
|
|
Evas_Object *label;
|
|
|
|
Evas_Object *guide_text;
|
|
|
|
Evas_Object *end; /* used to represent the
|
|
|
|
* total number of
|
|
|
|
* invisible buttons */
|
|
|
|
|
|
|
|
Eina_List *items;
|
|
|
|
Eina_List *filter_list;
|
2014-09-27 22:15:07 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *selected_it; /* selected item */
|
2017-08-30 22:01:04 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *focused_it;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2018-04-19 06:20:29 -07:00
|
|
|
Elm_Multibuttonentry_Format_Cb format_func;
|
|
|
|
const void *format_func_data;
|
|
|
|
|
2012-08-30 09:46:12 -07:00
|
|
|
const char *label_str, *guide_text_str;
|
|
|
|
|
|
|
|
int n_str;
|
|
|
|
Multibuttonentry_View_State view_state;
|
|
|
|
|
|
|
|
Evas_Coord w_box, h_box;
|
|
|
|
int shrink;
|
|
|
|
|
|
|
|
Elm_Multibuttonentry_Item_Filter_Cb add_callback;
|
|
|
|
void *add_callback_data;
|
2017-10-25 23:36:07 -07:00
|
|
|
Ecore_Timer *longpress_timer;
|
|
|
|
|
Efl.Ui.Format revamp
This class helps widgets which contain a numerical value and must display it,
like Progressbar (units label), Spin, Spin_Button, Slider (both units and popup
labels, in legacy), Tags (when in shrunk mode) or Calendar (year_month label).
Previously this was a mix of interface and mixin: widgets had to support setting a
formatting func, and the mixin offered support for formatting strings, by setting
an internal formatting func. On top of that, the spinner widget supported "special
values", a list of values that should be shown as certain strings instead.
This has now been simplified and unified:
Widgets including this mixin can use the formatted_value_get() method which accepts
an Eina_Value and returns a string. Thats's it.
The mixin adds three properties to the widget (format_values, format_func and
format_string) which users can use to tailor formatting. The widget does not need
to know which method has been used, it just retrieves the resulting string.
This removes a lot of duplicated widget code, and adds functionality which was
missing before. For example, all widgets support passing a list of values now.
Widgets must implement the apply_formatted_value() method so they are notified
of changes in the format and they can redraw anything they need.
Tests have been added to the Elementary Spec suite for all cases.
Legacy widgets behavior has not been modified, although a few needed some code
changes.
2019-07-02 05:40:06 -07:00
|
|
|
Efl_Ui_Format_Func format_cb;
|
2017-10-25 23:36:07 -07:00
|
|
|
Eina_Free_Cb format_free_cb;
|
|
|
|
void *format_cb_data;
|
|
|
|
Eina_Strbuf *format_strbuf;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
2015-02-09 21:22:43 -08:00
|
|
|
Eina_Bool last_it_select : 1;
|
2012-08-30 09:46:12 -07:00
|
|
|
Eina_Bool editable : 1;
|
2018-04-19 06:20:29 -07:00
|
|
|
Eina_Bool focused : 1; // avoids infinite loop on focus in/out
|
2015-07-28 14:34:40 -07:00
|
|
|
Eina_Bool label_packed : 1;
|
2012-08-30 09:46:12 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2018-04-19 06:20:29 -07:00
|
|
|
#define ELM_MULTIBUTTONENTRY_DATA_GET(o, sd) \
|
|
|
|
Elm_Multibuttonentry_Data *sd = efl_data_scope_get(o, ELM_MULTIBUTTONENTRY_CLASS);
|
2015-03-27 23:05:44 -07:00
|
|
|
|
2018-04-19 06:20:29 -07:00
|
|
|
#define ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(o, ptr) \
|
|
|
|
ELM_MULTIBUTTONENTRY_DATA_GET(o, ptr); \
|
2014-01-15 10:33:40 -08:00
|
|
|
if (EINA_UNLIKELY(!ptr)) \
|
2012-08-30 09:46:12 -07:00
|
|
|
{ \
|
2018-01-31 19:16:28 -08:00
|
|
|
ERR("No widget data for object %p (%s)", \
|
2014-01-15 10:33:40 -08:00
|
|
|
o, evas_object_type_get(o)); \
|
2012-08-30 09:46:12 -07:00
|
|
|
return; \
|
|
|
|
}
|
|
|
|
|
2018-04-19 06:20:29 -07:00
|
|
|
#define ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
|
|
|
|
Elm_Multibuttonentry_Data * ptr = efl_data_scope_get(o, ELM_MULTIBUTTONENTRY_CLASS); \
|
2014-01-15 10:33:40 -08:00
|
|
|
if (EINA_UNLIKELY(!ptr)) \
|
2012-08-30 09:46:12 -07:00
|
|
|
{ \
|
2018-01-31 19:16:28 -08:00
|
|
|
ERR("No widget data for object %p (%s)", \
|
2014-01-15 10:33:40 -08:00
|
|
|
o, evas_object_type_get(o)); \
|
2012-08-30 09:46:12 -07:00
|
|
|
return val; \
|
|
|
|
}
|
|
|
|
|
2014-09-27 22:15:07 -07:00
|
|
|
#define ELM_MULTIBUTTONENTRY_ITEM_DATA_GET(o, sd) \
|
2016-08-15 06:44:41 -07:00
|
|
|
Elm_Multibuttonentry_Item_Data *sd = efl_data_scope_get(o, ELM_MULTIBUTTONENTRY_ITEM_CLASS)
|
2014-09-27 22:15:07 -07:00
|
|
|
|
2014-01-15 10:33:40 -08:00
|
|
|
#define ELM_MULTIBUTTONENTRY_CHECK(obj) \
|
2016-08-15 06:44:41 -07:00
|
|
|
if (EINA_UNLIKELY(!efl_isa((obj), ELM_MULTIBUTTONENTRY_CLASS))) \
|
2012-08-30 09:46:12 -07:00
|
|
|
return
|
|
|
|
|
|
|
|
#define ELM_MULTIBUTTONENTRY_ITEM_CHECK(it) \
|
2016-08-15 06:44:41 -07:00
|
|
|
if (EINA_UNLIKELY(!efl_isa((it->base->eo_obj), ELM_MULTIBUTTONENTRY_ITEM_CLASS))) \
|
2014-09-27 22:15:07 -07:00
|
|
|
return
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
#define ELM_MULTIBUTTONENTRY_ITEM_CHECK_OR_RETURN(it, ...) \
|
2016-08-15 06:44:41 -07:00
|
|
|
if (EINA_UNLIKELY(!efl_isa((it->base->eo_obj), ELM_MULTIBUTTONENTRY_ITEM_CLASS))) \
|
2014-09-27 22:15:07 -07:00
|
|
|
return __VA_ARGS__;
|
2012-08-30 09:46:12 -07:00
|
|
|
|
|
|
|
#endif
|