forked from enlightenment/efl
elm_win: Replace elm_win_constructor by constructing properties
Removed the constructing method elm_obj_win_constructor. Now "name" and "type" are properties that must be set at creation, like this: eo_add(ELM_WIN_CLASS, NULL, elm_obj_win_name_set("example"), elm_obj_win_type_set(ELM_WIN_BASIC)); Also, the "title" property can be set at creation now.
This commit is contained in:
parent
fd06107d07
commit
7d21b7beb1
|
@ -176,6 +176,7 @@ struct _Elm_Win_Data
|
|||
const char *title;
|
||||
const char *icon_name;
|
||||
const char *role;
|
||||
Eina_Stringshare *name;
|
||||
|
||||
Evas_Object *main_menu;
|
||||
|
||||
|
@ -1806,6 +1807,7 @@ _elm_win_evas_object_smart_del(Eo *obj, Elm_Win_Data *sd)
|
|||
eina_stringshare_del(sd->title);
|
||||
eina_stringshare_del(sd->icon_name);
|
||||
eina_stringshare_del(sd->role);
|
||||
eina_stringshare_del(sd->name);
|
||||
evas_object_del(sd->icon);
|
||||
evas_object_del(sd->main_menu);
|
||||
|
||||
|
@ -2958,7 +2960,9 @@ elm_win_add(Evas_Object *parent,
|
|||
const char *name,
|
||||
Elm_Win_Type type)
|
||||
{
|
||||
Evas_Object *obj = eo_add(MY_CLASS, parent, elm_obj_win_constructor(name, type));
|
||||
Evas_Object *obj = eo_add(MY_CLASS, parent,
|
||||
elm_obj_win_name_set(name),
|
||||
elm_obj_win_type_set(type));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -2967,7 +2971,8 @@ elm_win_fake_add(Ecore_Evas *ee)
|
|||
{
|
||||
return eo_add(MY_CLASS, NULL,
|
||||
elm_obj_win_fake_canvas_set(ee),
|
||||
elm_obj_win_constructor(NULL, ELM_WIN_FAKE));
|
||||
elm_obj_win_name_set(NULL),
|
||||
elm_obj_win_type_set(ELM_WIN_FAKE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3118,8 +3123,8 @@ _cb_deled(void *_data,
|
|||
return EO_CALLBACK_CONTINUE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type type)
|
||||
static void
|
||||
_elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type type)
|
||||
{
|
||||
sd->obj = obj; // in ctor
|
||||
|
||||
|
@ -3586,6 +3591,7 @@ _elm_win_constructor(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_Type t
|
|||
}
|
||||
|
||||
TRAP(sd, name_class_set, name, _elm_appname);
|
||||
TRAP(sd, title_set, sd->title);
|
||||
ecore_evas_callback_delete_request_set(sd->ee, _elm_win_delete_request);
|
||||
ecore_evas_callback_state_change_set(sd->ee, _elm_win_state_change);
|
||||
ecore_evas_callback_focus_in_set(sd->ee, _elm_win_focus_in);
|
||||
|
@ -3705,18 +3711,50 @@ _elm_win_eo_base_constructor(Eo *obj EINA_UNUSED, Elm_Win_Data *_pd EINA_UNUSED)
|
|||
/* Do nothing. */
|
||||
}
|
||||
|
||||
EOLIAN static Eo *
|
||||
_elm_win_eo_base_finalize(Eo *obj, Elm_Win_Data *_pd)
|
||||
{
|
||||
_elm_win_finalize_internal(obj, _pd, _pd->name, _pd->type);
|
||||
eo_do_super(obj, MY_CLASS, obj = eo_finalize());
|
||||
return obj;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_win_fake_canvas_set(Eo *obj EINA_UNUSED, Elm_Win_Data *pd, Ecore_Evas *oee)
|
||||
{
|
||||
pd->ee = oee;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_win_type_set(Eo *obj, Elm_Win_Data *sd, Elm_Win_Type type)
|
||||
{
|
||||
Eina_Bool finalized;
|
||||
if (eo_do_ret(obj, finalized, eo_finalized_get()))
|
||||
{
|
||||
ERR("This function is only allowed during construction.");
|
||||
return;
|
||||
}
|
||||
sd->type = type;
|
||||
}
|
||||
|
||||
EOLIAN static Elm_Win_Type
|
||||
_elm_win_type_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
|
||||
{
|
||||
return sd->type;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_win_name_set(Eo *obj, Elm_Win_Data *sd, const char *name)
|
||||
{
|
||||
Eina_Bool finalized;
|
||||
if (eo_do_ret(obj, finalized, eo_finalized_get()))
|
||||
{
|
||||
ERR("This function is only allowed during construction.");
|
||||
return;
|
||||
}
|
||||
sd->name = eina_stringshare_add(name);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_win_noblank_set(Eo *obj EINA_UNUSED, Elm_Win_Data *pd, Eina_Bool noblank)
|
||||
{
|
||||
|
@ -3806,7 +3844,8 @@ _elm_win_title_set(Eo *obj EINA_UNUSED, Elm_Win_Data *sd, const char *title)
|
|||
{
|
||||
if (!title) return;
|
||||
eina_stringshare_replace(&(sd->title), title);
|
||||
TRAP(sd, title_set, sd->title);
|
||||
if (sd->ee)
|
||||
TRAP(sd, title_set, sd->title);
|
||||
if (sd->frame_obj)
|
||||
edje_object_part_text_escaped_set
|
||||
(sd->frame_obj, "elm.text.title", sd->title);
|
||||
|
|
|
@ -1131,15 +1131,70 @@ class Elm.Win (Elm.Widget, Elm_Interface_Atspi_Window,
|
|||
return: Evas_Object *;
|
||||
}
|
||||
}
|
||||
@property type {
|
||||
get {
|
||||
/*@
|
||||
Get the type of a window.
|
||||
@property name {
|
||||
/*@
|
||||
The window name.
|
||||
|
||||
@return The type of a window object. If the object is not window object, return #ELM_WIN_UNKNOWN.
|
||||
The meaning of name depends on the underlying windowing system.
|
||||
|
||||
The window name is a constructing property that need to be set at
|
||||
creation within @ref eo_add.
|
||||
|
||||
Example:
|
||||
@code
|
||||
win = eo_add(ELM_WIN_CLASS, NULL, elm_obj_win_name_set(ELM_WIN_BASIC));
|
||||
@endcode
|
||||
|
||||
@note Once set, it can NOT be modified afterward.
|
||||
|
||||
@ingroup Win */
|
||||
|
||||
set {
|
||||
/*@
|
||||
Can only be used at creation time, within @ref eo_add.
|
||||
|
||||
@ingroup Win */
|
||||
return: Elm_Win_Type(-1);
|
||||
}
|
||||
values {
|
||||
const(char)* name @nullable;
|
||||
}
|
||||
}
|
||||
@property type {
|
||||
/*@
|
||||
The type of the window.
|
||||
|
||||
It is a hint of how the Window Manager should handle it.
|
||||
|
||||
The window type is a constructing property that need to be set at
|
||||
creation within @ref eo_add.
|
||||
|
||||
Example:
|
||||
@code
|
||||
win = eo_add(ELM_WIN_CLASS, NULL, elm_obj_win_type_set(ELM_WIN_BASIC));
|
||||
@endcode
|
||||
|
||||
@note Once set, it can NOT be modified afterward.
|
||||
|
||||
@see Elm_Win_Type
|
||||
|
||||
@ingroup Win */
|
||||
|
||||
set {
|
||||
/*@
|
||||
Can only be used at creation time, within @ref eo_add.
|
||||
|
||||
@see Elm_Win_Type
|
||||
|
||||
@ingroup Win */
|
||||
}
|
||||
get {
|
||||
/*@
|
||||
If the object is not window object, return #ELM_WIN_UNKNOWN.
|
||||
|
||||
@ingroup Win */
|
||||
}
|
||||
values {
|
||||
Elm_Win_Type type(-1);
|
||||
}
|
||||
}
|
||||
@property noblank {
|
||||
|
@ -1193,14 +1248,6 @@ class Elm.Win (Elm.Widget, Elm_Interface_Atspi_Window,
|
|||
Ecore_Evas *oee;
|
||||
}
|
||||
}
|
||||
constructor {
|
||||
/*@ No description supplied by the EAPI. */
|
||||
legacy: null;
|
||||
params {
|
||||
@in const(char)* name;
|
||||
@in Elm_Win_Type type;
|
||||
}
|
||||
}
|
||||
wm_manual_rotation_done_manual {
|
||||
/*@
|
||||
To notify the rotation done to WM manually.
|
||||
|
@ -1352,6 +1399,7 @@ class Elm.Win (Elm.Widget, Elm_Interface_Atspi_Window,
|
|||
implements {
|
||||
class.constructor;
|
||||
Eo.Base.constructor;
|
||||
Eo.Base.finalize;
|
||||
Evas.Object_Smart.hide;
|
||||
Evas.Object_Smart.show;
|
||||
Evas.Object_Smart.move;
|
||||
|
@ -1369,7 +1417,8 @@ class Elm.Win (Elm.Widget, Elm_Interface_Atspi_Window,
|
|||
Elm_Interface_Atspi_Widget_Action.elm_actions.get;
|
||||
}
|
||||
constructors {
|
||||
.constructor;
|
||||
.name;
|
||||
.type;
|
||||
}
|
||||
events {
|
||||
delete,request;
|
||||
|
|
Loading…
Reference in New Issue