2019-10-24 06:36:42 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2019 by its authors. See AUTHORS.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2017-11-05 21:25:22 -08:00
|
|
|
// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` slider_cxx_example.cc -o slider_cxx_example
|
|
|
|
|
2017-11-27 02:52:44 -08:00
|
|
|
#define EFL_CXXPERIMENTAL
|
2019-07-09 01:13:27 -07:00
|
|
|
#ifndef EFL_BETA_API_SUPPORT
|
2019-03-11 08:34:45 -07:00
|
|
|
#define EFL_BETA_API_SUPPORT
|
2019-07-09 01:13:27 -07:00
|
|
|
#endif
|
2019-05-02 11:08:04 -07:00
|
|
|
#include <Efl_Ui.hh>
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-28 00:24:06 -08:00
|
|
|
using namespace std::placeholders;
|
2017-11-05 21:25:22 -08:00
|
|
|
using efl::eo::instantiate;
|
|
|
|
|
2017-11-20 03:39:54 -08:00
|
|
|
static efl::ui::Win win;
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
static void
|
|
|
|
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
2014-12-16 13:04:43 -08:00
|
|
|
{
|
2017-11-28 00:24:06 -08:00
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
|
|
|
|
2017-11-20 03:39:54 -08:00
|
|
|
win = efl::ui::Win(instantiate);
|
2017-11-05 21:25:22 -08:00
|
|
|
win.text_set("Slider example");
|
2017-11-28 00:24:06 -08:00
|
|
|
win.delete_request_event_cb_add([](){ win._delete(); });
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Box bx(instantiate, win);
|
|
|
|
win.content_set(bx);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Slider sl(instantiate, win);
|
gfx: Add size hint fill (EO)
Summary:
If widget use both hint_align(HINT_FILL) and hint_max together, there is no way
to set to hint_align. See, elementary_test -to 'efl.ui.box' -
"Button with a quite long text." button. you can control button position
using "Box align" slider, but this is not proper implementation. When there are
two widget which have hint_align(HINT_FILL) and hint_max, those positions are
determined by box_align rather than hint_align. it means widget align cannot be
set individually.
To solve this problem, this patch add hint_fill property. in order to avoid
conflict with legacy API named evas_object_size_hint_fill_set(), it only works
for EO widgets(made by efl_add).
Also, EFL_GFX_SIZE_HINT_FILL is removed.
@feature
Test Plan:
elementary_test -to 'efl.ui.box'
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Hermet, Jaehyun_Cho, raster, barbieri
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T3912
Differential Revision: https://phab.enlightenment.org/D7409
2019-01-15 23:47:51 -08:00
|
|
|
sl.hint_fill_set(true, false);
|
2014-12-16 13:04:43 -08:00
|
|
|
bx.pack_end(sl);
|
2017-11-05 21:25:22 -08:00
|
|
|
|
|
|
|
efl::ui::Slider sl2(instantiate, win);
|
|
|
|
efl::ui::Image ic(instantiate, win);
|
2019-01-28 20:51:47 -08:00
|
|
|
ic.icon_set("folder");
|
2019-08-23 02:08:39 -07:00
|
|
|
ic.can_upscale_set(false);
|
|
|
|
ic.can_downscale_set(false);
|
2017-11-07 05:21:13 -08:00
|
|
|
// FIXME: C++ part API needs special reference handling! This will show ERR!
|
2018-05-07 13:35:07 -07:00
|
|
|
efl::eo::downcast<efl::Content>(sl2.part_get("elm.swallow.end"))
|
2019-01-28 20:51:47 -08:00
|
|
|
.content_set(ic);
|
2017-11-05 21:25:22 -08:00
|
|
|
|
gfx: Add size hint fill (EO)
Summary:
If widget use both hint_align(HINT_FILL) and hint_max together, there is no way
to set to hint_align. See, elementary_test -to 'efl.ui.box' -
"Button with a quite long text." button. you can control button position
using "Box align" slider, but this is not proper implementation. When there are
two widget which have hint_align(HINT_FILL) and hint_max, those positions are
determined by box_align rather than hint_align. it means widget align cannot be
set individually.
To solve this problem, this patch add hint_fill property. in order to avoid
conflict with legacy API named evas_object_size_hint_fill_set(), it only works
for EO widgets(made by efl_add).
Also, EFL_GFX_SIZE_HINT_FILL is removed.
@feature
Test Plan:
elementary_test -to 'efl.ui.box'
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Hermet, Jaehyun_Cho, raster, barbieri
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T3912
Differential Revision: https://phab.enlightenment.org/D7409
2019-01-15 23:47:51 -08:00
|
|
|
sl2.hint_fill_set(true, false);
|
2014-12-16 13:04:43 -08:00
|
|
|
bx.pack_end(sl2);
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Slider sl3(instantiate, win);
|
|
|
|
sl3.range_value_set(1);
|
2019-02-22 08:09:18 -08:00
|
|
|
sl3.hint_size_min_set({220, 0});
|
gfx: Add size hint fill (EO)
Summary:
If widget use both hint_align(HINT_FILL) and hint_max together, there is no way
to set to hint_align. See, elementary_test -to 'efl.ui.box' -
"Button with a quite long text." button. you can control button position
using "Box align" slider, but this is not proper implementation. When there are
two widget which have hint_align(HINT_FILL) and hint_max, those positions are
determined by box_align rather than hint_align. it means widget align cannot be
set individually.
To solve this problem, this patch add hint_fill property. in order to avoid
conflict with legacy API named evas_object_size_hint_fill_set(), it only works
for EO widgets(made by efl_add).
Also, EFL_GFX_SIZE_HINT_FILL is removed.
@feature
Test Plan:
elementary_test -to 'efl.ui.box'
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Hermet, Jaehyun_Cho, raster, barbieri
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T3912
Differential Revision: https://phab.enlightenment.org/D7409
2019-01-15 23:47:51 -08:00
|
|
|
sl3.hint_fill_set(true, false);
|
2014-12-16 13:04:43 -08:00
|
|
|
bx.pack_end(sl3);
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Slider sl4(instantiate, win);
|
2019-06-19 00:55:51 -07:00
|
|
|
sl4.range_limits_set(0, 100);
|
gfx: Add size hint fill (EO)
Summary:
If widget use both hint_align(HINT_FILL) and hint_max together, there is no way
to set to hint_align. See, elementary_test -to 'efl.ui.box' -
"Button with a quite long text." button. you can control button position
using "Box align" slider, but this is not proper implementation. When there are
two widget which have hint_align(HINT_FILL) and hint_max, those positions are
determined by box_align rather than hint_align. it means widget align cannot be
set individually.
To solve this problem, this patch add hint_fill property. in order to avoid
conflict with legacy API named evas_object_size_hint_fill_set(), it only works
for EO widgets(made by efl_add).
Also, EFL_GFX_SIZE_HINT_FILL is removed.
@feature
Test Plan:
elementary_test -to 'efl.ui.box'
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Hermet, Jaehyun_Cho, raster, barbieri
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T3912
Differential Revision: https://phab.enlightenment.org/D7409
2019-01-15 23:47:51 -08:00
|
|
|
sl4.hint_fill_set(true, false);
|
2014-12-16 13:04:43 -08:00
|
|
|
bx.pack_end(sl4);
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Slider sl5(instantiate, win);
|
2019-06-19 00:55:51 -07:00
|
|
|
sl5.range_limits_set(0, 100);
|
2018-03-07 02:25:19 -08:00
|
|
|
sl5.range_step_set(1);
|
2019-05-24 09:30:31 -07:00
|
|
|
sl5.orientation_set((Efl_Ui_Layout_Orientation)(EFL_UI_LAYOUT_ORIENTATION_VERTICAL | EFL_UI_LAYOUT_ORIENTATION_INVERTED));
|
gfx: Add size hint fill (EO)
Summary:
If widget use both hint_align(HINT_FILL) and hint_max together, there is no way
to set to hint_align. See, elementary_test -to 'efl.ui.box' -
"Button with a quite long text." button. you can control button position
using "Box align" slider, but this is not proper implementation. When there are
two widget which have hint_align(HINT_FILL) and hint_max, those positions are
determined by box_align rather than hint_align. it means widget align cannot be
set individually.
To solve this problem, this patch add hint_fill property. in order to avoid
conflict with legacy API named evas_object_size_hint_fill_set(), it only works
for EO widgets(made by efl_add).
Also, EFL_GFX_SIZE_HINT_FILL is removed.
@feature
Test Plan:
elementary_test -to 'efl.ui.box'
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Hermet, Jaehyun_Cho, raster, barbieri
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T3912
Differential Revision: https://phab.enlightenment.org/D7409
2019-01-15 23:47:51 -08:00
|
|
|
sl5.hint_fill_set(true, false);
|
2019-02-22 08:09:18 -08:00
|
|
|
sl5.hint_size_min_set({0, 120});
|
2014-12-16 13:04:43 -08:00
|
|
|
bx.pack_end(sl5);
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Slider sl6(instantiate, win);
|
2019-05-24 09:30:31 -07:00
|
|
|
sl6.orientation_set(EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
2019-06-19 00:55:51 -07:00
|
|
|
sl6.range_limits_set(0, 10);
|
gfx: Add size hint fill (EO)
Summary:
If widget use both hint_align(HINT_FILL) and hint_max together, there is no way
to set to hint_align. See, elementary_test -to 'efl.ui.box' -
"Button with a quite long text." button. you can control button position
using "Box align" slider, but this is not proper implementation. When there are
two widget which have hint_align(HINT_FILL) and hint_max, those positions are
determined by box_align rather than hint_align. it means widget align cannot be
set individually.
To solve this problem, this patch add hint_fill property. in order to avoid
conflict with legacy API named evas_object_size_hint_fill_set(), it only works
for EO widgets(made by efl_add).
Also, EFL_GFX_SIZE_HINT_FILL is removed.
@feature
Test Plan:
elementary_test -to 'efl.ui.box'
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Hermet, Jaehyun_Cho, raster, barbieri
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T3912
Differential Revision: https://phab.enlightenment.org/D7409
2019-01-15 23:47:51 -08:00
|
|
|
sl6.hint_fill_set(false, true);
|
2019-02-21 09:19:45 -08:00
|
|
|
sl6.hint_weight_set(0, EFL_GFX_HINT_EXPAND);
|
2014-12-16 13:04:43 -08:00
|
|
|
bx.pack_end(sl6);
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Slider sl7(instantiate, win);
|
gfx: Add size hint fill (EO)
Summary:
If widget use both hint_align(HINT_FILL) and hint_max together, there is no way
to set to hint_align. See, elementary_test -to 'efl.ui.box' -
"Button with a quite long text." button. you can control button position
using "Box align" slider, but this is not proper implementation. When there are
two widget which have hint_align(HINT_FILL) and hint_max, those positions are
determined by box_align rather than hint_align. it means widget align cannot be
set individually.
To solve this problem, this patch add hint_fill property. in order to avoid
conflict with legacy API named evas_object_size_hint_fill_set(), it only works
for EO widgets(made by efl_add).
Also, EFL_GFX_SIZE_HINT_FILL is removed.
@feature
Test Plan:
elementary_test -to 'efl.ui.box'
elementary_test -to 'efl.ui.table'
Reviewers: jpeg, Hermet, Jaehyun_Cho, raster, barbieri
Reviewed By: Jaehyun_Cho
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T3912
Differential Revision: https://phab.enlightenment.org/D7409
2019-01-15 23:47:51 -08:00
|
|
|
sl7.hint_fill_set(true, false);
|
2014-12-16 13:04:43 -08:00
|
|
|
bx.pack_end(sl7);
|
|
|
|
|
2019-07-31 01:57:26 -07:00
|
|
|
auto changed = std::bind ( [] (efl::ui::Range_Display obj)
|
2017-11-05 21:25:22 -08:00
|
|
|
{ std::cout << "Changed to " << obj.range_value_get() << std::endl; }
|
|
|
|
, std::placeholders::_1);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2019-07-31 05:38:13 -07:00
|
|
|
auto steady = std::bind ( [] (efl::ui::Range_Interactive obj)
|
2019-06-14 09:03:32 -07:00
|
|
|
{ std::cout << "Steady to " << obj.range_value_get() << std::endl; }
|
2017-11-05 21:25:22 -08:00
|
|
|
, std::placeholders::_1);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2019-07-31 01:57:26 -07:00
|
|
|
efl::eo::downcast<efl::ui::Range_Display>(sl7).changed_event_cb_add(changed);
|
2019-07-31 05:38:13 -07:00
|
|
|
efl::eo::downcast<efl::ui::Range_Interactive>(sl7).steady_event_cb_add(steady);
|
2014-12-16 13:04:43 -08:00
|
|
|
}
|
2017-11-05 21:25:22 -08:00
|
|
|
EFL_MAIN()
|