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-09-07 02:02:43 -07:00
|
|
|
#define ELM_WIDGET_PROTECTED
|
|
|
|
#define ELM_WIDGET_CLASS_PROTECTED
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2017-11-01 06:42:04 -07:00
|
|
|
#warning This example requires yet unfinished EO APIs
|
|
|
|
|
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>
|
2017-09-07 02:02:43 -07:00
|
|
|
|
|
|
|
EAPI int
|
2019-06-19 01:19:49 -07:00
|
|
|
elm_main(int argc EINA_UNUSED, char* argv[] EINA_UNUSED)
|
2017-09-07 02:02:43 -07:00
|
|
|
{
|
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
|
|
|
|
|
|
|
|
using efl::eo::instantiate;
|
2017-09-11 11:12:30 -07:00
|
|
|
|
2017-09-07 02:02:43 -07:00
|
|
|
efl::ui::Win win_1
|
|
|
|
(instantiate,
|
|
|
|
[&]
|
|
|
|
{
|
|
|
|
win_1.text_set("Toolbar");
|
2017-11-16 02:00:48 -08:00
|
|
|
win_1.win_name_set("toolbar");
|
2019-03-04 10:37:24 -08:00
|
|
|
win_1.win_type_set(EFL_UI_WIN_TYPE_BASIC);
|
2017-09-07 02:02:43 -07:00
|
|
|
});
|
|
|
|
|
2017-11-01 06:42:04 -07:00
|
|
|
#if 0
|
2017-09-18 23:23:48 -07:00
|
|
|
win_1.eo_cxx::efl::Gfx::size_set({320, 300});
|
2017-09-07 02:02:43 -07:00
|
|
|
|
|
|
|
efl::ui::Box box_1(instantiate, win_1);
|
|
|
|
box_1.hint_weight_set(1.0, 1.0);
|
|
|
|
box_1.visible_set(true);
|
|
|
|
|
|
|
|
elm::Toolbar toolbar_1(instantiate, win_1);
|
|
|
|
toolbar_1.shrink_mode_set(ELM_TOOLBAR_SHRINK_MENU);
|
|
|
|
toolbar_1.hint_weight_set(0, 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
|
|
|
toolbar_1.hint_align_set(0.5, 0);
|
|
|
|
toolbar_1.hint_fill_set(ture, false);
|
2017-09-07 02:02:43 -07:00
|
|
|
toolbar_1.menu_parent_set(win_1);
|
|
|
|
elm::toolbar::Item item_1 = efl::eo::downcast<elm::toolbar::Item>
|
|
|
|
(toolbar_1.item_append("document-print", "Hello", nullptr, nullptr));
|
|
|
|
item_1.disabled_set(true);
|
|
|
|
item_1.priority_set(100);
|
|
|
|
elm::toolbar::Item item_2 = efl::eo::downcast<elm::toolbar::Item>
|
|
|
|
(toolbar_1.item_append("folder-new", "World", nullptr, nullptr));
|
|
|
|
item_2.priority_set(100);
|
|
|
|
elm::toolbar::Item item_3 = efl::eo::downcast<elm::toolbar::Item>
|
|
|
|
(toolbar_1.item_append("object-rotate-right", "H", nullptr, nullptr));
|
|
|
|
item_3.priority_set(150);
|
|
|
|
elm::toolbar::Item item_4 = efl::eo::downcast<elm::toolbar::Item>
|
|
|
|
(toolbar_1.item_append("mail-send", "Comes", nullptr, nullptr));
|
|
|
|
item_4.priority_set(0);
|
|
|
|
elm::toolbar::Item item_5 = efl::eo::downcast<elm::toolbar::Item>
|
|
|
|
(toolbar_1.item_append("clock", "Elementary", nullptr, nullptr));
|
|
|
|
item_5.priority_set(200);
|
|
|
|
elm::toolbar::Item item_6 = efl::eo::downcast<elm::toolbar::Item>
|
|
|
|
(toolbar_1.item_append("refresh", "Menu", nullptr, nullptr));
|
|
|
|
item_6.menu_set(true);
|
|
|
|
item_6.priority_set(9999);
|
|
|
|
elm::Menu menu_1 = efl::eo::downcast<elm::Menu>
|
|
|
|
(item_6.menu_get());
|
|
|
|
elm::menu::Item item_7 = efl::eo::downcast<elm::menu::Item>
|
|
|
|
(menu_1.item_add(nullptr, "edit-cut", "Shrink", nullptr, nullptr));
|
|
|
|
elm::menu::Item item_8 = efl::eo::downcast<elm::menu::Item>
|
|
|
|
(menu_1.item_add(nullptr, "edit-copy", "Mode", nullptr, nullptr));
|
|
|
|
elm::menu::Item item_9 = efl::eo::downcast<elm::menu::Item>
|
|
|
|
(menu_1.item_add(item_8, "edit-paste", "is set to", nullptr, nullptr));
|
|
|
|
elm::menu::Item item_10 = efl::eo::downcast<elm::menu::Item>
|
|
|
|
(menu_1.item_add(nullptr, "edit-delete", "Menu", nullptr, nullptr));
|
|
|
|
|
|
|
|
box_1.pack_end(toolbar_1);
|
|
|
|
elm::Widget table_1(elm_table_add(win_1._eo_ptr()));
|
|
|
|
table_1.hint_weight_set(0.0, 1.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
|
|
|
table_1.hint_fill_set(true, true);
|
2017-09-07 02:02:43 -07:00
|
|
|
table_1.visible_set(true);
|
|
|
|
|
|
|
|
elm::Widget photo_1(elm_photo_add(win_1._eo_ptr()));
|
|
|
|
elm_photo_size_set(photo_1._eo_ptr(), 40);
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(photo_1._eo_ptr(), "/opt/e/share/elementary/images/plant_01.jpg", nullptr);
|
2017-09-07 02:02:43 -07:00
|
|
|
photo_1.hint_weight_set(1, 1);
|
|
|
|
photo_1.hint_align_set(0.5, 0.5);
|
|
|
|
photo_1.visible_set(true);
|
|
|
|
|
|
|
|
elm_table_pack(table_1._eo_ptr(), photo_1._eo_ptr(), 0, 0, 1, 1);
|
|
|
|
elm::Widget photo_2(elm_photo_add(win_1._eo_ptr()));
|
|
|
|
elm_photo_size_set(photo_2._eo_ptr(), 80);
|
|
|
|
photo_2.hint_weight_set(1, 1);
|
|
|
|
photo_2.hint_align_set(0.5, 0.5);
|
|
|
|
photo_2.visible_set(true);
|
|
|
|
|
|
|
|
elm_table_pack(table_1._eo_ptr(), photo_2._eo_ptr(), 1, 0, 1, 1);
|
|
|
|
elm::Widget photo_3(elm_photo_add(win_1._eo_ptr()));
|
|
|
|
elm_photo_size_set(photo_3._eo_ptr(), 20);
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(photo_3._eo_ptr(), "/opt/e/share/elementary/images/sky_01.jpg", nullptr);
|
2017-09-07 02:02:43 -07:00
|
|
|
photo_3.hint_weight_set(1, 1);
|
|
|
|
photo_3.hint_align_set(0.5, 0.5);
|
|
|
|
photo_3.visible_set(true);
|
|
|
|
|
|
|
|
elm_table_pack(table_1._eo_ptr(), photo_3._eo_ptr(), 0, 1, 1, 1);
|
|
|
|
elm::Widget photo_4(elm_photo_add(win_1._eo_ptr()));
|
|
|
|
elm_photo_size_set(photo_4._eo_ptr(), 60);
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(photo_4._eo_ptr(), "/opt/e/share/elementary/images/sky_02.jpg", nullptr);
|
2017-09-07 02:02:43 -07:00
|
|
|
photo_4.hint_weight_set(1, 1);
|
|
|
|
photo_4.hint_align_set(0.5, 0.5);
|
|
|
|
photo_4.visible_set(true);
|
|
|
|
|
|
|
|
elm_table_pack(table_1._eo_ptr(), photo_4._eo_ptr(), 1, 1, 1, 1);
|
|
|
|
box_1.pack_end(table_1);
|
|
|
|
|
|
|
|
win_1.content_set(box_1);
|
|
|
|
|
|
|
|
auto _item_2_selected_cb = std::bind([&] () {
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(photo_1._eo_ptr(), "/opt/e/share/elementary/images/rock_01.jpg", nullptr);
|
2017-09-07 02:02:43 -07:00
|
|
|
});
|
|
|
|
efl::eolian::event_add(efl::ui::Selectable::selected_event, item_2, _item_2_selected_cb);
|
|
|
|
|
|
|
|
auto _item_3_selected_cb = std::bind([&] () {
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(photo_4._eo_ptr(), "/opt/e/share/elementary/images/wood_01.jpg", nullptr);
|
2017-09-07 02:02:43 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
efl::eolian::event_add(efl::ui::Selectable::selected_event, item_3, _item_3_selected_cb);
|
|
|
|
auto _item_4_selected_cb = std::bind([&] () {
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(photo_4._eo_ptr(), "/opt/e/share/elementary/images/sky_03.jpg", nullptr);
|
2017-09-07 02:02:43 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
efl::eolian::event_add(efl::ui::Selectable::selected_event, item_4, _item_4_selected_cb);
|
|
|
|
auto _item_5_selected_cb = std::bind([&] () {
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(photo_4._eo_ptr(), nullptr, nullptr);
|
2017-09-07 02:02:43 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
efl::eolian::event_add(efl::ui::Selectable::selected_event, item_5, _item_5_selected_cb);
|
2017-11-01 06:42:04 -07:00
|
|
|
|
|
|
|
#endif
|
2017-09-07 02:02:43 -07:00
|
|
|
|
|
|
|
elm_run();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
ELM_MAIN()
|