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` radio_cxx_example_01.cc -o radio_cxx_example_01
|
|
|
|
|
2017-11-22 00:17:04 -08:00
|
|
|
#define EFL_CXXPERIMENTAL
|
2019-03-11 08:34:45 -07:00
|
|
|
#define EFL_BETA_API_SUPPORT
|
2019-05-02 11:08:04 -07:00
|
|
|
#include <Efl_Ui.hh>
|
2017-11-05 21:25:22 -08:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
using efl::eo::instantiate;
|
2014-12-16 13:04:43 -08:00
|
|
|
|
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
|
|
|
{
|
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Win win(instantiate);
|
|
|
|
win.text_set("Radio Example");
|
2014-12-16 13:04:43 -08:00
|
|
|
win.autohide_set(true);
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Box bx(instantiate, win);
|
2019-05-24 09:30:31 -07:00
|
|
|
bx.orientation_set(EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
|
2017-11-05 21:25:22 -08:00
|
|
|
win.content_set(bx);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Radio radio(instantiate, win);
|
|
|
|
efl::ui::Radio group = radio;
|
|
|
|
radio.text_set("Radio 1");
|
2014-12-16 13:04:43 -08:00
|
|
|
radio.state_value_set(1);
|
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Image ic(instantiate, win);
|
|
|
|
ic.icon_set("home");
|
|
|
|
radio.content_set(ic);
|
|
|
|
bx.pack_end(radio);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
auto cb_val = std::bind([] (efl::ui::Radio &obj)
|
efl_ui_check: make it undependend of nstate
Summary:
check can only display 2 states, and is only designed to do so.
Additionally, nstate inherits from button, which
brings in autorepeat, which is hileriously broken on check and cannot
really work.
Right now there is not even support in the theme for clickable. So its a
good idea to get rid of this for now IMO.
ref T7865
Reviewers: stefan_schmidt, zmike, segfaultxavi, akanad, YOhoho
Reviewed By: zmike
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7865, T7867
Differential Revision: https://phab.enlightenment.org/D9018
2019-06-13 06:21:38 -07:00
|
|
|
{ std::cout << "val is now: " << obj.group_value_get() << std::endl; },
|
2017-11-05 21:25:22 -08:00
|
|
|
std::placeholders::_1);
|
2017-12-18 21:18:25 -08:00
|
|
|
efl::eolian::event_add(efl::ui::Nstate::changed_event, radio, cb_val);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Radio radio2(instantiate, win);
|
|
|
|
radio2.text_set("Radio 2");
|
2014-12-16 13:04:43 -08:00
|
|
|
radio2.state_value_set(2);
|
|
|
|
radio2.group_add(group);
|
2017-11-05 21:25:22 -08:00
|
|
|
|
|
|
|
efl::ui::Image ic2(instantiate, win);
|
|
|
|
ic2.icon_set("file");
|
|
|
|
radio2.content_set(ic2);
|
2014-12-16 13:04:43 -08:00
|
|
|
bx.pack_end(radio2);
|
2017-12-18 21:18:25 -08:00
|
|
|
efl::eolian::event_add(efl::ui::Nstate::changed_event, radio2, cb_val);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Radio radio3(instantiate, win);
|
|
|
|
radio3.text_set("Radio 3");
|
2014-12-16 13:04:43 -08:00
|
|
|
radio3.state_value_set(3);
|
|
|
|
radio3.group_add(group);
|
|
|
|
bx.pack_end(radio3);
|
2017-12-18 21:18:25 -08:00
|
|
|
efl::eolian::event_add(efl::ui::Nstate::changed_event, radio3, cb_val);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-05 21:25:22 -08:00
|
|
|
efl::ui::Radio radio4(instantiate, win);
|
|
|
|
radio4.text_set("Radio 4");
|
2014-12-16 13:04:43 -08:00
|
|
|
radio4.state_value_set(4);
|
|
|
|
radio4.group_add(group);
|
|
|
|
bx.pack_end(radio4);
|
2017-12-18 21:18:25 -08:00
|
|
|
efl::eolian::event_add(efl::ui::Nstate::changed_event, radio4, cb_val);
|
2014-12-16 13:04:43 -08:00
|
|
|
}
|
2017-11-05 21:25:22 -08:00
|
|
|
EFL_MAIN()
|