Commit Graph

184 Commits

Author SHA1 Message Date
Marcel Hollerbach 65aff8c82c elm_widget: use the user_manager for setting focus 2017-10-10 19:28:47 +02:00
Jean-Philippe Andre f75d2e6be2 widget: Make focus_mouse_up_handle internal
I don't think this belongs to the public EO API.

Ref T5363
2017-10-10 18:53:43 +09:00
Carsten Haitzler 4a9d168ac3 elm widget - event legacy propagation - remove coverity warning
fix CID 1379920 - event_flags is actually never NULL or undefined in
the function logic. it's always set to point to the specific event
flags field depending on struct type or the function will return
before using the pointer.
2017-09-29 09:09:04 +09:00
Carsten Haitzler dea4e5aa46 elm widget - fix possible null ptr access found by coverity
_propagate_event_legacy checked event_flags ptr for null then just
derefs it anyway... so check everywhere. fixes CID 1379920
2017-09-28 15:28:00 +09:00
Jean-Philippe Andre 5f96c6fb4b widget: Remove domain_part_text_translatable from EO
This removes the last remaining legacy-style part API from Widget.
I think this is redundant with the property "translatable_text"
introduced in Efl.Ui.Translatable.

Ref T5363
2017-09-26 17:58:07 +09:00
Jean-Philippe Andre e9dfcb44ff widget: Implement translation API in layout
This moves the API entry points from Widget to Layout parts. I don't
think the other widgets support translation, but that is easy to fix.
The actual code implementation remains in elm_widget.c.

Legacy-only widgets are covered by Part_Legacy, while all EO widgets
that have text inherit from Layout (except Win but I don't think the
window title was translatable in legacy).

This removes 2/3 remaining part APIs from Widget.

Ref T5363
2017-09-26 17:58:07 +09:00
Jean-Philippe Andre 839c4ed395 elm: Introduce interface Efl.Ui.Translatable
This will be used to replace the part translation API in Elm.Widget. It
should work for both parts and non-parts (ie. the main text of a button,
for instance).

For now I'm taking the following approach:
 - All efl_text_set/get strings are untranslatable, i.e. get() returns
   the visible string, set replaces and can not be translated.
 - translatable_text_set/get needs to be used to enable automatic
   translation, which in turns calls efl_text_set to modify the visible
   string. Thus, translatable applications will have to use
   efl_ui_translatable_text_set a lot more than efl_text_set, unless
   they translate strings application-side.

Note that some other frameworks take a simpler approach equivalent to
calling efl_text_set() with an already translated text. This prevents
runtime language changes of the application, unless the application
handles them specifically.
2017-09-26 17:58:07 +09:00
Marcel Hollerbach 884bf2d06b elm_widget: abort is probebly a bit too much 2017-09-23 22:34:08 +02:00
Jean-Philippe Andre 282928465c elm: Resolve part alias in legacy APIs only
This fixes make check.
2017-09-21 12:28:20 +09:00
Jean-Philippe Andre 28b387821d elm: Split off text and content for efl_part
This is VERY tricky.
For legacy, just create an internal class that has both. It's easier
this way. For parts that are handled by Layout directly, we know from
Edje which type to return.

For EO objects we should know from the part name which kind of part we
are dealing with:
 - text (overridden by the widget)
 - content (overridden by the widget)
 - special (new efl_part based functions)
 - generic (handled by Layout)

Note: Efl.Ui.Slider was handling "span size" on ALL parts. That's bad...
This is now limited to "span" only.
2017-09-21 12:27:34 +09:00
Jean-Philippe Andre 0339ad7740 elm: Move base implementation for efl_part in widget
This means that ALL part handles inherit from the base part class
Efl.Ui.Widget.Part. Layout is the only exception where Efl.Part is
specially overridden.

This is a first step towards generic part APIs, including background in
all widgets.
2017-09-21 12:27:33 +09:00
Marcel Hollerbach 97d150daad elm_widget: eval the manager after the logicals are evalulated
for the obj is the only child of parent this would have lead to manager
  beeing NULL.
2017-09-18 15:49:43 +02:00
Marcel Hollerbach dcedaf8e09 elm_widget: also update if visible set is intersected
the error case is when a element is shown, but its parent was not.
In that case intersect returns immidiatly, without evalulating the focus
state again.
2017-09-18 15:49:43 +02:00
Jean-Philippe Andre 4c634ed78e efl: Use Eina.Size2D for Efl.Gfx.size
Big patch as a lot of things call or reimplement size_set. Hopefully I
got it right... fingers crossed.
2017-09-18 13:34:50 +09:00
Jean-Philippe Andre 8fb194d969 efl: Use Eina.Position2D for Efl.Gfx.position
Note: This is a little bit more cumbersome in some places but in most
it's more convenient than (x,y).
2017-09-18 13:22:54 +09:00
Jean-Philippe Andre f3eff6eb3e efl: Introduce Eina.Rect and switch EO APIs to it
It's a complex struct but defined in EO as a simple struct. ABI-wise
it's equivalent to Eina_Rectangle. Some macros that use Eina_Rectangle
also work on Eina_Rect out of the box, most of the code dealing with
x,y,w,h will require no modifications either.

But Eina_Rect provides direct access to a size or position 2d component,
as well as the usual x,y,w,h. The field "rect" is provided as a
convenience for code dealing with both Eina_Rectangle and Eina_Rect. We
may or may not require it.

Note: Size2D could use unsigned values but I have spotted a few places
in the code that actually use -1 to indicate invalid size (as opposed to
0x0).

@feature
2017-09-18 13:22:52 +09:00
Jean-Philippe Andre 58c2c50dcc efl_access: Use Eina.Rectangle (EO) 2017-09-13 18:20:45 +09:00
Jean-Philippe Andre 13da5e980e efl_gfx: Use Eina.Rectangle for geometry (EO)
This saves a few lines already (without even having the proper helpers
for stack rectangles).
2017-09-13 18:03:34 +09:00
Jean-Philippe Andre 8da23c4247 widget: Make part_text_translate internal 2017-09-13 13:43:55 +09:00
Jean-Philippe Andre 6d0957b0a5 widget: Rename focus_manager_factory to create
factory is not a verb :)

Ref T5363
2017-09-13 13:43:55 +09:00
Jean-Philippe Andre 7ef714924a evas: Fix crash with smart objects
This is due to the previous patches.
2017-09-13 09:57:05 +09:00
Jean-Philippe Andre f5a56789e0 evas: Add internal API to make smart obj (un)clipped
Introduction to the problem:
 - Efl.Canvas.Group has a method member_add() to add sub objects.
 - Efl.Canvas.Group (simple smart object) does NOT actually delete the
   objects on deletion. But:
 - Efl.Canvas.Group.Clipped is a direct subclass and WILL delete the sub
   objects on deletion.

Semantically, all smart objects (at least in EO and Elementary) will own
and delete sub objects automatically. Some exceptions are:
 - Edje object (smart clipped) does not delete swallowed objects.
   Edje object is a "clipped" smart object but it pops out all swallowed
   children before getting deleted.
 - Evas box/table/grid also pop out their children before deletion.
   Those classes are all legacy & internal only.
 - Elm.Widget will "manually" delete all its sub objects at deletion, as
   it inherits from Efl.Canvas.Group but basically takes full ownership
   of the sub objects. Note that member_add shouldn't be used on a
   widget, the widgets do it themselves.

Also, smart clipped objects are much more convenient to use as they will
handle some things for you: color, visibility, moving and ownership.

So, the API member_add needs to be marked as own(). But right now
Efl.Canvas.Group does not own. Thus, here's the plan:
 - Mark clipped objects as such with an internal API
 - Merge clipped smart object features directly inside the standard
   smart object.
 - Get rid of Efl.Canvas.Group.Clipped entirely and watch all hell break
   loose.

Ref T5301
2017-09-13 09:57:05 +09:00
Lukasz Stanislawski 9cf8e75668 elm: rename Elm.Interface.Atspi.Component => Efl.Access.Component
Reviewers: jpeg, cedric

Differential Revision: https://phab.enlightenment.org/D5164
2017-09-12 15:49:29 +09:00
Shinwoo Kim 2f6e28881e elementary: atspi accessible name uses plain text
The markup information of accessible name is not necessary.
2017-09-06 19:54:59 +09:00
Marcel Hollerbach c51f35d42a elm_widget: move the complete regsiter/unregister logic
We had here a little problem, state focus_state_eval function handled
the unregisteration and consideration of the focus flags and then only
called a helper function (which was a widget function), that then did
the registeration in logical or regular mode.

Elm scroller for example took that function overwrote it and did onyl
permit logical registrations. Then again a evaluation of the focus state
and flags took place, and the function considered elm_scroller should be
registered as regular object, but found it to be logical. This lead to
the problem that we permantently unregistered Elm.Scroller and
registered it again as logical just to unregister it again. This was on
the one side a performance downside. But also a bug since all items from
within the Elm_Scrollers sub manager are getting reparent onto the
parent, which means not the root of the scroller (the scroller itself)
is the logical entrypoint to the widget but rather this reparented
widget, which led to unexpected focus  warps like described in T5923.

tldr: this fixes T5923
2017-09-02 21:10:56 +02:00
Marcel Hollerbach e265dc285a elm_widget: eval everything when the parent changes 2017-09-02 20:06:15 +02:00
Jean-Philippe Andre 4e81df7cb2 widget: Forward focus_highlight_style to win
See the previous commits. All focus_highlight APIs are defined in the
Widget class but only implemented at the Window level. For consistency I
believe this call should also be forwarded to the window. The previous
logic had absolutely no effect at all, except storing a stringshare.

The day focus_highlight becomes widget-specific (i.e. each widget has
its own highlight style) then this can be changed.

Note: This will apply to legacy API as well.

Ref T5363
2017-09-01 10:09:37 +09:00
Jean-Philippe Andre b40d8296ff win: Move focus_highlight_animate to widget (EO)
Similar to the previous commits. Moved for consistency.

Ref T5363
Ref T5322
2017-09-01 10:09:37 +09:00
Jean-Philippe Andre 94632f8a44 win: Move focus_highlight_enabled to widget (EO)
This was actually declared in the internal legacy API in widget.
Forwards the calls to the window.

Ref T
2017-09-01 10:09:37 +09:00
Jean-Philippe Andre c0d7ea4af0 widget: Rename on_focus to on_focus_update (EO)
on_focus seems to imply that focus was just given to the widget, but
that function is called on any focus change (in and out).

Ref T5363
2017-09-01 10:09:37 +09:00
Jean-Philippe Andre 94d671c971 widget: Fix legacy for focus_mouse_up_handle (EO)
This removes the special code in the legacy API for
elm_widget_focus_mouse_up_handle. Add an internal helper to find the
first widget parent. And mark as protected.
Apparently this functions is still required for the new focus manager.

Ref T5363
2017-08-31 13:48:05 +09:00
Jean-Philippe Andre b6bab481aa widget: Mark old focus API as beta.
It's not beta. It's about to die.
Also, move #define ELM_WIDGET_BETA to the common header file, as it is
consequently required by ALL widgets. :(

Ping @bu5hm4n :)

Ref T5363
2017-08-31 11:22:04 +09:00
Jean-Philippe Andre f90d0d1501 widget: Simplify & document "translate"
This is a protected function. It doesn't need to return anything, as all
implementation just returned true, always. Also, the legacy API was just
a wrapper doing nothing special (except verify that we have a widget,
which the recursive code already does).

Tested with fr_FR :)

Ref T5363
2017-08-30 18:54:59 +09:00
Jean-Philippe Andre a2729d119d widget: Remove part_text from EO
It should be implemented as a efl_part() API.

For now I've only done a quick hack, as the only overrides were:

 - notify: already a Part implementation. Also it turns out the default
   theme does not even have any text part in the notify group.

 - combobox: not a Part implementation, but also very badly defined wrt.
   parts in general. efl_part() is handled by the parent class (button)
   which makes it tricky to override just for one function.

With this patch I'm trying to keep the same behaviour as earlier (where
efl_part() is used for layouts and there is a special path for
combobox).

Ref T5363
2017-08-30 18:33:15 +09:00
Jean-Philippe Andre 692282e67a widget: Move item_loop_enabled to scrollable (EO)
I was told that the scrollable interface is being redesigned for EO.
This API definitely does not belong to the base Widget class, as it's
quite specific to item-based scrollable widgets, such as lists and
grids. Since Elm.Interface_Scrollable is itself being revamped, it is a
good place to move that EO API for now.

Ref T5363
2017-08-30 17:29:52 +09:00
Jean-Philippe Andre a82ab33bed widget: Use rectangle in show_region
Also make it a property. It's asymmetric because of the force show
argument, but the get is much cleaner.

Ref T5363
2017-08-30 17:29:52 +09:00
Jean-Philippe Andre 6bb9f4fd16 widget: Remove scroll_lock from EO
1. Uniformize the API, which is now for internal use:
   This uses the same enum as scroller "movement_block" instead
   of 2 separate properties. Less APIs, more consistence.

2. Remove scroll_lock x/y from EO widget. I was told it is not going to
   exist in the upcoming scrollable interface.

3. Remove scroll hold/freeze getters.
   scroll hold/freeze push/pop are still there but it remains to be seen
   how the EO scrollable interface will exploit them. Right now they are
   full of bugs.

Ref T5363
2017-08-30 17:29:52 +09:00
Jean-Philippe Andre c690469fcc widget: Rename drag_lock to scroll_lock (EO)
This also includes the drag_child_lock APIs. This had nothing to do with
dragging beyond maybe the case where scrolling is done by thumbscroll
(ie. finger drag).

Note that the EAPI were called already scroll_lock, not drag_lock.

Ref T5363
2017-08-30 17:29:52 +09:00
Jean-Philippe Andre ac215dba0f widget: Remove drag_child_locked APIs (EO)
These are just internal helper functions for the scrollable mixin. I
don't think they need to appear in the external API.

Ref T5363
2017-08-30 17:29:52 +09:00
Jean-Philippe Andre 00862c3c9c widget: Use rectangle on the stack for region_show
Follow @k-s recommendation and simply use rectangles on the stack rather
than by pointer.

Ref T5363
2017-08-30 17:29:52 +09:00
Jean-Philippe Andre 8c1f771a67 widget: Use rectangle for focus_hilight
Ref T5363
2017-08-29 16:22:47 +09:00
Jean-Philippe Andre c6c1751fe3 widget: Mark focus_region_show as protected (EO)
This function is meant to be used by the widgets themselves, or internal
features such as elm_access.

Also remove const tag: this function call is definitely modifying the
widget (panning around and all that).

Ref T5363
2017-08-29 14:50:36 +09:00
Jean-Philippe Andre 233068c30c widget: Simplify code with rectangle (EO)
This replaces x,y,w,h with a rectangle in parts of the focus_region
code.

Ref T5363
2017-08-29 14:30:39 +09:00
Jean-Philippe Andre d928ba989a widget: Merge on_focus_region and focus_region_get
This simplifies code and API.

Ref T5363
2017-08-29 14:30:35 +09:00
Jean-Philippe Andre 0a0bbe5fda widget: Rename hook "access" (EO)
This is also another protected and beta API. Meant to be overridden by
subclasses, but belongs to a still unstable API.

The difference between the internal legacy and the EO API is really bad.
Same as with activate (previous commit).

Ref T5363
2017-08-29 10:40:53 +09:00
Jean-Philippe Andre 0e98f57d6d widget: Rename hook "activate" (EO)
This is for accessibility only. Protected function.

Also marked as beta as elm_access isn't going to be stable in EO (yet).

Ref T5363
2017-08-29 10:40:53 +09:00
Jean-Philippe Andre 1610ed12a8 widget: Make theme_apply a protected function (EO)
This is a strange function but absolutely necessary to implement a
widget. Even non-layout widgets may override this.

Ref T5363
2017-08-29 10:40:53 +09:00
Jean-Philippe Andre 6aa309ffb8 widget: Rename hook "disable" (EO)
Renamed to on_disabled_update.
Also passed in the new state of disabled. It's more convenient this way,
than having the subclasses call disabled_get.

Also simplify some code...

Ref T5363
2017-08-29 10:40:53 +09:00
Jean-Philippe Andre 6e5e8e567b widget: Rename hook "orientation" (EO)
Renamed to on_orientation_update

This internal / virtual function is in fact not overridden anywhere. Not
sure it is necessary to expose it in EO API?

Ref T5363
2017-08-29 10:40:53 +09:00
WooHyun Jung 7738ba5b37 elm_widget: remove redundant null check 2017-08-24 13:29:39 +09:00