2017-11-22 00:14:55 -08:00
|
|
|
#define EFL_CXX_WREF_EASY
|
|
|
|
|
2014-12-16 13:04:43 -08:00
|
|
|
#include <Elementary.hh>
|
|
|
|
|
2017-11-01 06:42:04 -07:00
|
|
|
using efl::eo::instantiate;
|
2017-11-22 00:14:55 -08:00
|
|
|
using namespace std::placeholders;
|
2017-11-01 06:42:04 -07:00
|
|
|
|
2017-11-22 00:14:55 -08:00
|
|
|
struct appData
|
2014-12-16 13:04:43 -08:00
|
|
|
{
|
2017-11-22 00:14:55 -08:00
|
|
|
appData() : m_win(nullptr) {}
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-22 00:14:55 -08:00
|
|
|
~appData() {
|
|
|
|
std::cout << "Good bye!" << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void create() {
|
|
|
|
std::cout << "Hello!" << std::endl;
|
|
|
|
|
|
|
|
instantiate(m_win);
|
|
|
|
m_win.text_set("Calendar Layout Formatting Example");
|
|
|
|
m_win.delete_request_event_cb_add([&](){ destroy(); });
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-22 00:14:55 -08:00
|
|
|
efl::ui::Calendar cal(instantiate, m_win);
|
|
|
|
m_win.content_set(cal);
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-22 00:14:55 -08:00
|
|
|
auto wcal(cal._get_wref());
|
2014-12-16 13:04:43 -08:00
|
|
|
|
2017-11-22 00:14:55 -08:00
|
|
|
// FIXME: How does one figure out the argument types for the function?
|
|
|
|
auto cb_a = std::bind([=](
|
|
|
|
efl::eina::strbuf_wrapper& sb,
|
|
|
|
efl::eina::value_view const& value) {
|
|
|
|
try {
|
|
|
|
sb.append_strftime("%b. %y", efl::eina::get<tm>(value));
|
|
|
|
} catch (std::system_error const&) {
|
|
|
|
sb.append(value.to_string());
|
|
|
|
}
|
|
|
|
std::cout << "Month: " << std::string(sb) << std::endl;
|
|
|
|
}, _1, _2);
|
|
|
|
cal.format_cb_set(cb_a);
|
|
|
|
}
|
|
|
|
|
|
|
|
void destroy() {
|
|
|
|
// FIXME: need del() function and no error on unref().
|
|
|
|
::efl_allow_parent_unref_set(m_win._eo_ptr(), true);
|
|
|
|
m_win = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
efl::ui::Win m_win;
|
|
|
|
};
|
|
|
|
|
|
|
|
static appData app;
|
|
|
|
|
|
|
|
static void
|
|
|
|
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
|
|
|
app.create();
|
2014-12-16 13:04:43 -08:00
|
|
|
}
|
2017-11-01 06:42:04 -07:00
|
|
|
EFL_MAIN()
|