cxx: Added examples and tutorial for C++ binding

Summary:
Added the following examples:
* bg_cxx_example_01
* bg_cxx_example_02
* bubble_cxx_example_01
* button_cxx_example_00
* button_cxx_example_01
* calendar_cxx_example_01
* calendar_cxx_example_02
* calendar_cxx_example_03
* calendar_cxx_example_04
* calendar_cxx_example_05
* clock_cxx_example
* datetime_cxx_example
* glview_cxx_example_01
* hoversel_cxx_example_01
* icon_cxx_example_01
* location_cxx_example_01
* menu_cxx_example_01
* popup_cxx_example_01
* radio_cxx_example_01
* separator_cxx_example_01
* slider_cxx_example
* spinner_cxx_example
* table_cxx_example_01
* table_cxx_example_02
* thumb_cxx_example_01

Added documentation for the above examples, as well as how using lambdas
with C++ elm binding. How to use autohide feature and how to use the C++
wrappers to create windows, widgets and call Eo functions from them with
automatic C++ type conversion and how to use signals from C++.
This commit is contained in:
Luciana Magno de Almeida 2014-12-16 19:04:43 -02:00 committed by Felipe Magno de Almeida
parent 8c5e840278
commit 4517e70a5e
38 changed files with 7428 additions and 422 deletions

View File

@ -1,11 +1,6 @@
if HAVE_EOLIAN_CXX
EOLIAN_CXX = @eolian_cxx@
_EOLIAN_CXX_DEP = @eolian_cxx@
else
EOLIAN_CXX = EFL_RUN_IN_TREE=1 $(top_builddir)/src/bin/eolian_cxx/eolian_cxx${EXEEXT}
_EOLIAN_CXX_DEP = bin/eolian_cxx/eolian_cxx${EXEEXT}
endif
AM_V_EOLCXX = $(am__v_EOLCXX_@AM_V@)
am__v_EOLCXX_ = $(am__v_EOLCXX_@AM_DEFAULT_V@)
@ -13,6 +8,7 @@ am__v_EOLCXX_0 = @echo " EOLCXX " $@;
SUFFIXES += .eo.hh
%.eo.hh: %.eo $(_EOLIAN_CXX_DEP)
$(AM_V_EOLCXX)$(EOLIAN_CXX) $(EOLIAN_FLAGS) -o $@ $<
%.eo.impl.hh %.eo.hh: %.eo $(_EOLIAN_CXX_DEP)
$(AM_V_EOLCXX) \
$(MKDIR_P) $(dir $@); \
$(EOLIAN_CXX) $(EOLIAN_FLAGS) -o $@ $<

View File

@ -31,10 +31,10 @@ EFL_INIT
# C++ bindings
AC_ARG_ENABLE([cxx-bindings],
[AS_HELP_STRING([--enable-cxx-bindings],
[enable C++11 bindings. @<:@default=disabled@:>@])],
[AS_HELP_STRING([--disable-cxx-bindings],
[Disable C++11 bindings. @<:@default=enabled@:>@])],
[want_cxx11="${enableval}"],
[want_cxx11="no"])
[want_cxx11="yes"])
# Tests
@ -271,6 +271,7 @@ if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then
eina-cxx >= efl_version
evas-cxx >= efl_version
eio-cxx >= efl_version
edje-cxx >= efl_version
],
[
requirement_elm_pc="${requirement_elm_pc} \
@ -279,10 +280,12 @@ if test "x${HAVE_CXX11}" = "x1" -a "x${want_cxx11}" = "xyes"; then
eina-cxx >= efl_version \
evas-cxx >= efl_version \
eio-cxx >= efl_version \
edje-cxx >= efl_version \
"
have_cxx11="yes"
LDFLAGS="${LDFLAGS} -fPIC -DPIC"
CXXFLAGS="${CXXFLAGS} -fPIC -DPIC"
AC_CONFIG_FILES([src/lib/Elementary.hh])
],
[have_cxx11="no"]
)

View File

@ -1,7 +1,7 @@
PROJECT_NAME = Elementary
PROJECT_NUMBER = @PACKAGE_VERSION@
OUTPUT_DIRECTORY = .
INPUT = @srcdir@/examples.dox @top_srcdir@/src/lib @srcdir@/index.doxy @top_srcdir@/src/bin/elm_prefs_cc_handlers.c
INPUT = @srcdir@/examples.dox @srcdir@/examples-cxx.dox @top_srcdir@/src/lib @srcdir@/index.doxy @top_srcdir@/src/bin/elm_prefs_cc_handlers.c
IMAGE_PATH = @srcdir@/img
OUTPUT_LANGUAGE = English
GENERATE_HTML = YES

File diff suppressed because it is too large Load Diff

View File

@ -6552,6 +6552,7 @@
* @example bg_example_01.c
*/
/**
* @page bg_example_02_c bg_example_02.c
* @include bg_example_02.c

View File

@ -118,3 +118,38 @@
/evas3d_map_example
/sphere_hunter/sphere_hunter
/performance/performance
/bg_cxx_example_01
/bg_cxx_example_02
/bubble_cxx_example_01
/button_cxx_example_00
/button_cxx_example_01
/calendar_cxx_example_01
/calendar_cxx_example_02
/calendar_cxx_example_03
/calendar_cxx_example_04
/calendar_cxx_example_05
/check_cxx_example_01
/clock_cxx_example
/conformant_cxx_example_01
/conformant_cxx_example_02
/datetime_cxx_example
/frame_cxx_example_01
/glview_cxx_example_01
/hoversel_cxx_example_01
/icon_cxx_example_01
/image_cxx_example_01
/label_cxx_example_01
/location_cxx_example_01
/menu_cxx_example_01
/notify_cxx_example_01
/panel_cxx_example_01
/panes_cxx_example
/popup_cxx_example_01
/popup_cxx_example_02
/radio_cxx_example_01
/separator_cxx_example_01
/slider_cxx_example
/spinner_cxx_example
/table_cxx_example_01
/table_cxx_example_02
/thumb_cxx_example_01

View File

@ -21,6 +21,10 @@ AM_CPPFLAGS = \
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
@ELEMENTARY_CFLAGS@
AM_CXXFLAGS = \
@ELEMENTARY_CFLAGS@ \
@ELEMENTARY_CXX_CFLAGS@
LDADD = \
@ELEMENTARY_LIBS@ \
$(top_builddir)/src/lib/libelementary.la
@ -146,7 +150,32 @@ track_example_01.c
if HAVE_CXX11
SRCS += \
box_cxx_example_02.cc
thumb_cxx_example_01.cc \
table_cxx_example_02.cc \
table_cxx_example_01.cc \
spinner_cxx_example.cc \
slider_cxx_example.cc \
separator_cxx_example_01.cc \
radio_cxx_example_01.cc \
popup_cxx_example_01.cc \
menu_cxx_example_01.cc \
location_cxx_example_01.cc \
icon_cxx_example_01.cc \
hoversel_cxx_example_01.cc \
glview_cxx_example_01.cc \
datetime_cxx_example.cc \
clock_cxx_example.cc \
calendar_cxx_example_05.cc \
calendar_cxx_example_04.cc \
calendar_cxx_example_03.cc \
calendar_cxx_example_02.cc \
calendar_cxx_example_01.cc \
button_cxx_example_01.cc \
button_cxx_example_00.cc \
bubble_cxx_example_01.cc \
box_cxx_example_02.cc \
bg_cxx_example_02.cc \
bg_cxx_example_01.cc
endif
.edc.edj:
@ -297,7 +326,32 @@ track_example_01
if HAVE_CXX11
examples_PROGRAMS += \
box_cxx_example_02
thumb_cxx_example_01 \
table_cxx_example_02 \
table_cxx_example_01 \
spinner_cxx_example \
slider_cxx_example \
separator_cxx_example_01 \
radio_cxx_example_01 \
popup_cxx_example_01 \
menu_cxx_example_01 \
location_cxx_example_01 \
icon_cxx_example_01 \
hoversel_cxx_example_01 \
glview_cxx_example_01 \
datetime_cxx_example \
clock_cxx_example \
calendar_cxx_example_05 \
calendar_cxx_example_04 \
calendar_cxx_example_03 \
calendar_cxx_example_02 \
calendar_cxx_example_01 \
button_cxx_example_01 \
button_cxx_example_00 \
bubble_cxx_example_01 \
box_cxx_example_02 \
bg_cxx_example_02 \
bg_cxx_example_01
endif
if ELEMENTARY_WINDOWS_BUILD
@ -313,10 +367,32 @@ efl_thread_4_SOURCES = efl_thread_4.c
endif
if HAVE_CXX11
thumb_cxx_example_01_SOURCES = thumb_cxx_example_01.cc
table_cxx_example_02_SOURCES = table_cxx_example_02.cc
table_cxx_example_01_SOURCES = table_cxx_example_01.cc
spinner_cxx_example_SOURCES = spinner_cxx_example.cc
slider_cxx_example_SOURCES = slider_cxx_example.cc
separator_cxx_example_01_SOURCES = separator_cxx_example_01.cc
radio_cxx_example_01_SOURCES = radio_cxx_example_01.cc
popup_cxx_example_01_SOURCES = popup_cxx_example_01.cc
menu_cxx_example_01_SOURCES = menu_cxx_example_01.cc
location_cxx_example_01_SOURCES = location_cxx_example_01.cc
icon_cxx_example_01_SOURCES = icon_cxx_example_01.cc
hoversel_cxx_example_01_SOURCES = hoversel_cxx_example_01.cc
glview_cxx_example_01_SOURCES = glview_cxx_example_01.cc
datetime_cxx_example_SOURCES = datetime_cxx_example.cc
clock_cxx_example_SOURCES = clock_cxx_example.cc
calendar_cxx_example_05_SOURCES = calendar_cxx_example_05.cc
calendar_cxx_example_04_SOURCES = calendar_cxx_example_04.cc
calendar_cxx_example_03_SOURCES = calendar_cxx_example_03.cc
calendar_cxx_example_02_SOURCES = calendar_cxx_example_02.cc
calendar_cxx_example_01_SOURCES = calendar_cxx_example_01.cc
button_cxx_example_01_SOURCES = button_cxx_example_01.cc
button_cxx_example_00_SOURCES = button_cxx_example_00.cc
bubble_cxx_example_01_SOURCES = bubble_cxx_example_01.cc
box_cxx_example_02_SOURCES = box_cxx_example_02.cc
box_cxx_example_02_CXXFLAGS = \
@ELEMENTARY_CFLAGS@ \
@ELEMENTARY_CXX_CFLAGS@
bg_cxx_example_02_SOURCES = bg_cxx_example_02.cc
bg_cxx_example_01_SOURCES = bg_cxx_example_01.cc
endif
# This variable will hold the list of screenshots that will be made
@ -406,7 +482,30 @@ menu_example_01:menu_example_01.png:0.5
if HAVE_CXX11
SCREENSHOTS += \
box_cxx_example_02:box_cxx_example_02.png:1.3
bg_cxx_example_02:bg_cxx_example_02.png:0.0 \
box_cxx_example_02:box_cxx_example_02.png:1.3 \
bubble_cxx_example_01:bubble_cxx_example_01.png:0.0 \
button_cxx_example_00:button_cxx_example_00.png:0.0 \
button_cxx_example_01:button_cxx_example_01.png:0.0 \
calendar_cxx_example_01:calendar_cxx_example_01.png:0.0 \
calendar_cxx_example_02:calendar_cxx_example_02.png:0.0 \
calendar_cxx_example_03:calendar_cxx_example_03.png:0.0 \
calendar_cxx_example_04:calendar_cxx_example_04.png:0.0 \
calendar_cxx_example_05:calendar_cxx_example_05.png:0.0 \
clock_cxx_example:clock_cxx_example.png:0.5 \
datetime_cxx_example:datetime_cxx_example.png:0.0 \
hoversel_cxx_example_01:hoversel_cxx_example_01.png:0.0 \
icon_cxx_example_01:icon_cxx_example_01.png:0.0 \
menu_cxx_example_01:menu_cxx_example_01.png:0.5 \
popup_cxx_example_01:popup_cxx_example_01.png:1.0 \
popup_cxx_example_01:popup_cxx_example_01_a.png:6.0 \
radio_cxx_example_01:radio_cxx_example_01.png:0.0 \
separator_cxx_example_01:separator_cxx_example_01.png:0.0 \
slider_cxx_example:slider_cxx_example.png:0.0 \
spinner_cxx_example:spinner_cxx_example.png:0.0 \
table_cxx_example_01:table_cxx_example_01.png:0.0 \
table_cxx_example_02:table_cxx_example_02.png:0.0 \
thumb_cxx_example_01:thumb_cxx_example_01.png:0.5
endif
HTML_SS_DIR=$(top_builddir)/doc/html/screenshots

View File

@ -0,0 +1,23 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Bg Plain");
win.autohide_set(true);
::elm::bg bg(efl::eo::parent = win);
bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bg);
bg.visible_set(true);
win.size_set(320,320);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,33 @@
#include <Elementary.hh>
#include <sstream>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Bg Image");
win.autohide_set(true);
elm_app_compile_data_dir_set("/usr/share/elementary");
elm_app_info_set(reinterpret_cast<void*>(elm_main), "elementary", "images/plant_01.jpg");
::elm::bg bg(efl::eo::parent = win);
bg.load_size_set(20,20);
bg.option_set(ELM_BG_OPTION_CENTER);
std::stringstream ss;
ss << elm_app_data_dir_get() << "/images/plant_01.jpg";
bg.file_set(ss.str(), nullptr);
bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bg);
bg.visible_set(true);
win.size_set(320, 320);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -1,52 +1,15 @@
//Compile with:
//gcc -g box_example_02.c -o box_example_02 `pkg-config --cflags --libs elementary`
extern "C"
{
#ifdef HAVE_CONFIG_H
# include <elementary_config.h>
#endif
#define ELM_INTERNAL_API_ARGESFSDFEFC
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED
#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED
#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED
#define ELM_INTERFACE_ATSPI_EDITABLE_TEXT_PROTECTED
#define ELM_INTERFACE_ATSPI_TEXT_PROTECTED
#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
#define ELM_INTERFACE_ATSPI_IMAGE_PROTECTED
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
#include <Elementary.h>
#include <Eo.h>
#include <Evas.h>
#include <Elementary.h>
#include <elm_widget.h>
#include "elm_interface_atspi_accessible.h"
#include "elm_interface_atspi_accessible.eo.h"
#include "elm_interface_atspi_widget_action.h"
#include "elm_interface_atspi_widget_action.eo.h"
}
#include <iostream>
#include <elm_win.eo.hh>
#include <elm_box.eo.hh>
#include <elm_button.eo.hh>
#include <Elementary.hh>
#include <Eina.hh>
#include <deque>
#include <iostream>
struct Transitions_Data
{
efl::eo::wref<elm_box> box;
efl::eo::wref<elm::box> box;
std::deque<Evas_Object_Box_Layout> transitions;
Evas_Object_Box_Layout last_layout;
};
@ -61,7 +24,7 @@ _test_box_transition_change(void *data)
assert (!!data);
assert (!tdata->transitions.empty());
if(efl::eina::optional<elm_box> box = tdata->box.lock())
if(efl::eina::optional<elm::box> box = tdata->box.lock())
{
next_layout = tdata->transitions.front();
layout_data = elm_box_transition_new(2.0, tdata->transitions.back(),
@ -70,149 +33,110 @@ _test_box_transition_change(void *data)
box->layout_set(elm_box_layout_transition, layout_data,
elm_box_transition_free);
tdata->last_layout = next_layout;
tdata->transitions.push_back(tdata->transitions[0]);
tdata->transitions.pop_front();
}
}
struct clean_ref
{
clean_ref(efl::eo::base base)
: _ref(base._eo_ptr())
{}
template <typename T>
void operator()(T const&, Eo_Event_Description const&, void*) const
{
if(_ref)
eo_unref(_ref);
}
Eo* _ref;
};
EAPI_MAIN int
elm_main(int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
Transitions_Data tdata;
Eo* test;
{
::elm_win win (elm_win_util_standard_add("box-transition", "Box Transition"));
win.autodel_set(true);
::elm::win_standard win;
win.title_set("Box Transition");
win.autohide_set(true);
elm_box bigbox ( efl::eo::parent = win );
bigbox.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bigbox);
bigbox.visibility_set(true);
win.callback_del_add(clean_ref(bigbox));
elm::box bigbox ( efl::eo::parent = win );
bigbox.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bigbox);
bigbox.visible_set(true);
elm_box buttons ( efl::eo::parent = win );
buttons.horizontal_set(EINA_TRUE);
bigbox.pack_end(buttons);
buttons.visibility_set(true);
win.callback_del_add(clean_ref(buttons));
elm::box buttons ( efl::eo::parent = win );
buttons.horizontal_set(EINA_TRUE);
bigbox.pack_end(buttons);
buttons.visible_set(true);
elm_button add ( efl::eo::parent = win );
add.text_set("elm.text", "Add");
buttons.pack_end(add);
add.visibility_set(true);
add.callback_clicked_add
(std::bind([&tdata]
{
if(efl::eina::optional<elm_box> box = tdata.box.lock())
{
elm_button btn ( efl::eo::parent = *box );
btn.text_set("elm.text", "I do nothing");
efl::eina::list<evas::object> childrens(box->children_get());
if (!childrens.empty())
{
box->pack_after(btn, childrens.front());
}
else
box->pack_end(btn);
btn.visibility_set(true);
}
}));
win.callback_del_add(clean_ref(add));
elm::button add ( efl::eo::parent = win );
add.text_set("elm.text", "Add");
buttons.pack_end(add);
add.visible_set(true);
add.callback_clicked_add
(std::bind([&tdata]
{
if(efl::eina::optional<elm::box> box = tdata.box.lock())
{
elm::button btn ( efl::eo::parent = *box );
btn.text_set(nullptr, "I do nothing");
box->pack_end(btn);
btn.visible_set(true);
}
}));
elm_button clear ( efl::eo::parent = win );
clear.text_set("elm.text", "Clear");
buttons.pack_end(clear);
clear.visibility_set(true);
clear.callback_clicked_add(std::bind([&tdata] { tdata.box.lock()->clear(); }));
win.callback_del_add(clean_ref(clear));
elm::button clear ( efl::eo::parent = win );
clear.text_set("elm.text", "Clear");
buttons.pack_end(clear);
clear.visible_set(true);
clear.callback_clicked_add(std::bind([&tdata] { tdata.box.lock()->clear(); }));
elm_box dynamic ( efl::eo::parent = win );
dynamic.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
dynamic.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
bigbox.pack_end(dynamic);
dynamic.visibility_set(true);
win.callback_del_add(clean_ref(dynamic));
elm::box dynamic ( efl::eo::parent = win );
dynamic.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
dynamic.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
bigbox.pack_end(dynamic);
dynamic.visible_set(true);
auto unpack = std::bind([&tdata] (evas::clickable_interface obj)
{
elm_button btn = efl::eo::downcast<elm_button>(obj);
tdata.box.lock()->unpack(btn);
btn.position_set(0, 50);
btn.color_set(128, 64, 0, 128);
}, std::placeholders::_1)
;
auto unpack = std::bind([&tdata] (evas::clickable_interface obj)
{
elm::button btn = efl::eo::downcast<elm::button>(obj);
tdata.box.lock()->unpack(btn);
btn.position_set(0, 50);
btn.object_smart::color_set(128, 64, 0, 128);
}, std::placeholders::_1)
;
elm_button bt1 ( efl::eo::parent = win );
bt1.text_set("elm.text", "Button 1");
bt1.callback_clicked_add(unpack);
bt1.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
bt1.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
dynamic.pack_end(bt1);
bt1.visibility_set(true);
win.callback_del_add(clean_ref(bt1));
elm::button bt1 ( efl::eo::parent = win );
bt1.text_set("elm.text", "Button 1");
bt1.callback_clicked_add(unpack);
bt1.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
bt1.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
dynamic.pack_end(bt1);
bt1.visible_set(true);
elm_button bt2 ( efl::eo::parent = win );
bt2.text_set("elm.text", "Button 2");
bt2.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
bt2.size_hint_align_set(1.0, 0.5);
bt2.callback_clicked_add(unpack);
dynamic.pack_end(bt2);
bt2.visibility_set(true);
win.callback_del_add(clean_ref(bt2));
elm::button bt2 ( efl::eo::parent = win );
bt2.text_set("elm.text", "Button 2");
bt2.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
bt2.size_hint_align_set(1.0, 0.5);
bt2.callback_clicked_add(unpack);
dynamic.pack_end(bt2);
bt2.visible_set(true);
elm_button bt3 ( efl::eo::parent = win );
bt3.text_set("elm.text", "Button 3");
bt3.callback_clicked_add(unpack);
dynamic.pack_end(bt3);
bt3.visibility_set(true);
win.callback_del_add(clean_ref(bt3));
elm::button bt3 ( efl::eo::parent = win );
bt3.text_set("elm.text", "Button 3");
bt3.callback_clicked_add(unpack);
dynamic.pack_end(bt3);
bt3.visible_set(true);
tdata.box = dynamic;
tdata.last_layout = evas_object_box_layout_horizontal;
tdata.transitions.push_back(evas_object_box_layout_vertical);
tdata.transitions.push_back(evas_object_box_layout_horizontal);
tdata.transitions.push_back(evas_object_box_layout_stack);
tdata.transitions.push_back(evas_object_box_layout_homogeneous_vertical);
tdata.transitions.push_back(evas_object_box_layout_homogeneous_horizontal);
tdata.transitions.push_back(evas_object_box_layout_flow_vertical);
tdata.transitions.push_back(evas_object_box_layout_flow_horizontal);
tdata.transitions.push_back(evas_object_box_layout_stack);
tdata.box = dynamic;
tdata.last_layout = evas_object_box_layout_horizontal;
tdata.transitions.push_back(evas_object_box_layout_vertical);
tdata.transitions.push_back(evas_object_box_layout_horizontal);
tdata.transitions.push_back(evas_object_box_layout_stack);
tdata.transitions.push_back(evas_object_box_layout_homogeneous_vertical);
tdata.transitions.push_back(evas_object_box_layout_homogeneous_horizontal);
tdata.transitions.push_back(evas_object_box_layout_flow_vertical);
tdata.transitions.push_back(evas_object_box_layout_flow_horizontal);
tdata.transitions.push_back(evas_object_box_layout_stack);
dynamic.layout_set(evas_object_box_layout_horizontal, nullptr, nullptr);
_test_box_transition_change(&tdata);
win.size_set(300, 320);
win.visibility_set(true);
dynamic.layout_set(evas_object_box_layout_horizontal, nullptr, nullptr);
_test_box_transition_change(&tdata);
win.size_set(300, 320);
win.visible_set(true);
std::cout << "references to win " << win.ref_get() << std::endl;
test = win._eo_ptr();
win._release();
}
std::cout << "references to win " << ::eo_ref_get(test) << std::endl;
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,62 @@
#include <Elementary.hh>
#include <Evas.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Bg Plain");
win.autohide_set(true);
::elm::bg bg(efl::eo::parent = win);
bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bg);
bg.visible_set(true);
::elm::label label1(efl::eo::parent = win);
label1.text_set(nullptr, "Bubble with no icon, info or label");
label1.visible_set(true);
evas::rectangle icon(efl::eo::parent = win);
icon.color_set( 0, 0, 255, 255);
icon.visible_set(true);
::elm::bubble bubble1(efl::eo::parent = win);
bubble1.content_set("icon", icon);
bubble1.text_set("info", "INFO");
bubble1.text_set(nullptr, "LABEL");
bubble1.content_set(nullptr, label1);
bubble1.size_set(300, 100);
bubble1.visible_set(true);
auto on_click = std::bind([&] ()
{
static unsigned char corner = 0;
++corner;
if (corner > 3)
bubble1.pos_set(ELM_BUBBLE_POS_TOP_LEFT);
else
bubble1.pos_set(static_cast<Elm_Bubble_Pos>(corner));
});
bubble1.callback_clicked_add(on_click);
::elm::label label2(efl::eo::parent = win);
label2.text_set(nullptr, "Bubble with no icon, info or label");
label2.visible_set(true);
::elm::bubble bubble2(efl::eo::parent = win);
bubble2.content_set(nullptr, label2);
bubble2.size_set(200, 50);
bubble2.position_set(0, 110);
bubble2.visible_set(true);
win.size_set(300, 200);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,35 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Hello, World!");
win.autohide_set(true);
::elm::bg bg(efl::eo::parent = win);
bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bg);
bg.visible_set(true);
::elm::button btn(efl::eo::parent = win);
btn.text_set("elm.text","Good-Bye, World!");
btn.size_set(120, 30);
btn.position_set(60, 15);
btn.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
btn.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
btn.visible_set(true);
auto on_click = std::bind([] () { elm_exit(); });
btn.callback_clicked_add( on_click );
win.size_set(240, 60);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,233 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main(int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Button example");
win.autohide_set(true);
::evas::object icon_still(nullptr);
::elm::button mid(efl::eo::parent = win);
::elm::button up(efl::eo::parent = win);
::elm::button down(efl::eo::parent = win);
::elm::button left(efl::eo::parent = win);
::elm::button right(efl::eo::parent = win);
::elm::box box(efl::eo::parent = win);
box.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(box);
box.visible_set(true);
::elm::box box_initial(efl::eo::parent = win);
box_initial.horizontal_set(true);
box_initial.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
box.pack_end(box_initial);
box_initial.visible_set(true);
::elm::button btn(efl::eo::parent = win);
btn.text_set("elm.text", "Initial: 0.0");
box_initial.pack_end(btn);
btn.visible_set(true);
auto btn_options = std::bind([&] (evas::clickable_interface ci)
{
::elm::button b(eo_ref(ci._eo_ptr()));
std::string::size_type ptr;
efl::eina::optional<std::string> lbl = b.text_get("elm.text");
ptr = lbl->find(":");
ptr += 2;
double t = std::stod(lbl->substr(ptr));
if (lbl->compare(0,7,"Initial") == 0)
{
up.autorepeat_initial_timeout_set(t);
down.autorepeat_initial_timeout_set(t);
left.autorepeat_initial_timeout_set(t);
right.autorepeat_initial_timeout_set(t);
}
else if (lbl->compare(0,3,"Gap") == 0)
{
up.autorepeat_gap_timeout_set(t);
down.autorepeat_gap_timeout_set(t);
left.autorepeat_gap_timeout_set(t);
right.autorepeat_gap_timeout_set(t);
}
}, std::placeholders::_1);
btn.callback_clicked_add(btn_options);
::elm::button btn2(efl::eo::parent = win);
btn2.text_set("elm.text", "Initial: 1.0");
box_initial.pack_end(btn2);
btn2.visible_set(true);
btn2.callback_clicked_add(btn_options);
::elm::button btn3(efl::eo::parent = win);
btn3.text_set("elm.text", "Initial: 5.0");
box_initial.pack_end(btn3);
btn3.visible_set(true);
btn3.callback_clicked_add(btn_options);
::elm::box box_gap(efl::eo::parent = win);
box_gap.horizontal_set(true);
box_gap.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
box.pack_end(box_gap);
box_gap.visible_set(true);
::elm::button btn4(efl::eo::parent = win);
btn4.text_set("elm.text", "Gap: 0.1");
box_gap.pack_end(btn4);
btn4.visible_set(true);
btn4.callback_clicked_add(btn_options);
::elm::button btn5(efl::eo::parent = win);
btn5.text_set("elm.text", "Gap: 0.5");
box_gap.pack_end(btn5);
btn5.visible_set(true);
btn5.callback_clicked_add(btn_options);
::elm::button btn6(efl::eo::parent = win);
btn6.text_set("elm.text", "Gap: 1.0");
box_gap.pack_end(btn6);
btn6.visible_set(true);
btn6.callback_clicked_add(btn_options);
up.autorepeat_set(true);
up.autorepeat_initial_timeout_set(1.0);
up.autorepeat_gap_timeout_set(0.5);
up.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
up.size_hint_align_set(EVAS_HINT_FILL, 0.0);
box.pack_end(up);
up.visible_set(true);
auto btn_cursors_move = std::bind([&] (evas::clickable_interface ci2)
{
::elm::button button = efl::eo::downcast<elm::button>(ci2);
double ax, ay;
if (!icon_still)
{
::elm::icon obj(efl::eo::parent = mid);
efl::eina::optional<evas::object> icon_still_p = mid.content_unset("icon");
if(icon_still_p)
{
icon_still = *icon_still_p;
icon_still.visible_set(false);
}
obj.standard_set("chat");
mid.content_set("icon", obj);
}
mid.size_hint_align_get(&ax, &ay);
if (button == up)
{
ay -= 0.05;
if (ay < 0.0)
ay = 0.0;
}
else if (button == down)
{
ay += 0.05;
if (ay > 1.0)
ay = 1.0;
}
else if (button == left)
{
ax -= 0.05;
if (ax < 0.0)
ax = 0.0;
}
else if (button == right)
{
ax += 0.05;
if (ax > 1.0)
ax = 1.0;
}
mid.size_hint_align_set(ax, ay);
}, std::placeholders::_1);
up.callback_repeated_add(btn_cursors_move);
auto btn_cursors_release = std::bind([&] ()
{
if (icon_still)
{
mid.content_set("icon", icon_still);
icon_still = evas::object(nullptr);
}
});
up.callback_unpressed_add(btn_cursors_release);
::elm::icon icon_up(efl::eo::parent = win);
icon_up.standard_set("arrow_up");
up.content_set("icon", icon_up);
::elm::box box_inferior(efl::eo::parent = win);
box_inferior.horizontal_set(true);
box_inferior.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
box_inferior.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
box.pack_end(box_inferior);
box_inferior.visible_set(true);
left.autorepeat_set(true);
left.autorepeat_initial_timeout_set(1.0);
left.autorepeat_gap_timeout_set(0.5);
left.size_hint_weight_set(0.0, EVAS_HINT_EXPAND);
left.size_hint_align_set(0.0, EVAS_HINT_FILL);
box_inferior.pack_end(left);
left.visible_set(true);
left.callback_repeated_add(btn_cursors_move);
left.callback_unpressed_add(btn_cursors_release);
::elm::icon icon_left(efl::eo::parent = win);
icon_left.standard_set("arrow_left");
left.content_set("icon", icon_left);
mid.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
box_inferior.pack_end(mid);
mid.visible_set(true);
::elm::icon icon_mid(efl::eo::parent = win);
icon_mid.standard_set("close");
mid.content_set("icon", icon_mid);
right.autorepeat_set(true);
right.autorepeat_initial_timeout_set(1.0);
right.autorepeat_gap_timeout_set(0.5);
right.size_hint_weight_set(0.0, EVAS_HINT_EXPAND);
right.size_hint_align_set(0.0, EVAS_HINT_FILL);
box_inferior.pack_end(right);
right.visible_set(true);
right.callback_repeated_add(btn_cursors_move);
right.callback_unpressed_add(btn_cursors_release);
::elm::icon icon_right(efl::eo::parent = win);
icon_right.standard_set("arrow_right");
right.content_set("icon", icon_right);
down.autorepeat_set(true);
down.autorepeat_initial_timeout_set(1.0);
down.autorepeat_gap_timeout_set(0.5);
down.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
down.size_hint_align_set(EVAS_HINT_FILL, 0.0);
box.pack_end(down);
down.visible_set(true);
down.callback_repeated_add(btn_cursors_move);
down.callback_unpressed_add(btn_cursors_release);
::elm::icon icon_down(efl::eo::parent = win);
icon_down.standard_set("arrow_down");
down.content_set("icon", icon_down);
win.size_set(300, 320);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,21 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Calendar Creation Example");
win.autohide_set(true);
::elm::calendar cal(efl::eo::parent = win);
cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(cal);
cal.visible_set(true);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,38 @@
#include <Elementary.hh>
static char *
_format_month_year(struct tm *format_time)
{
char buf[32];
if (!strftime(buf, sizeof(buf), "%b %y", format_time)) return NULL;
return strdup(buf);
}
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
const char *weekdays[] =
{
"S", "M", "T", "W", "T", "F", "S"
};
::elm::win_standard win;
win.title_set("Calendar Layout Formatting Example");
win.autohide_set(true);
::elm::calendar cal(efl::eo::parent = win);
cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(cal);
cal.format_function_set(_format_month_year);
cal.weekdays_names_set(weekdays);
cal.visible_set(true);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,23 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Calendar Min/Max Year Example");
win.autohide_set(true);
::elm::calendar cal(efl::eo::parent = win);
cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(cal);
cal.min_max_year_set(2020, 2022);
cal.visible_set(true);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,43 @@
#include <Elementary.hh>
#define SECS_DAY 86400
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
struct tm selected_time;
time_t current_time;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Calendar Day Selection Example");
win.autohide_set(true);
::elm::box bx(efl::eo::parent = win);
bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bx);
bx.visible_set(true);
::elm::calendar cal(efl::eo::parent = win);
cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
cal.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
cal.select_mode_set(ELM_CALENDAR_SELECT_MODE_NONE);
cal.visible_set(true);
bx.pack_end(cal);
::elm::calendar cal2(efl::eo::parent = win);
cal2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
cal2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
current_time = time(NULL) +2 * SECS_DAY;
localtime_r(&current_time, &selected_time);
cal2.selected_time_set(&selected_time);
cal2.visible_set(true);
bx.pack_end(cal2);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,50 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Calendar Getters Example");
win.autohide_set(true);
::elm::calendar cal(efl::eo::parent = win);
cal.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(cal);
auto print_cal_info = std::bind([] (::elm::calendar obj)
{
int year_min, year_max;
bool sel_enabled;
const char **wds;
struct tm sel_time;
double interval;
if (!obj.selected_time_get(&sel_time))
return;
interval = obj.interval_get();
obj.min_max_year_get(&year_min, &year_max);
sel_enabled = (obj.select_mode_get() != ELM_CALENDAR_SELECT_MODE_NONE);
wds = obj.weekdays_names_get();
std::cout << "Day: " << sel_time.tm_mday << ", Mon: " << sel_time.tm_mon << ", Year " <<
sel_time.tm_year + 1900 << ", WeekDay: " << sel_time.tm_wday << "<br>" << std::endl;
std::cout << "Interval: " << interval << ", Year_Min: " << year_min << ", Year_Max " <<
year_max << ", Sel Enabled: " << sel_enabled << "<br>" << std::endl;
std::cout << "Weekdays: " << wds[0] << ", " << wds[1] << ", " << wds[2] << ", " << wds[3] <<
", " << wds[4] << ", " << wds[5] << ", " << wds[6] << "<br>" << std::endl << std::endl;
} , std::placeholders::_1 );
cal.callback_changed_add(print_cal_info);
cal.visible_set(true);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,53 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Clock Example");
win.autohide_set(true);
::elm::box bx(efl::eo::parent = win);
bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bx);
bx.visible_set(true);
::elm::clock ck(efl::eo::parent = win);
bx.pack_end(ck);
ck.visible_set(true);
::elm::clock ck2(efl::eo::parent = win);
ck2.show_am_pm_set(true);
bx.pack_end(ck2);
ck2.visible_set(true);
::elm::clock ck3(efl::eo::parent = win);
ck3.show_seconds_set(true);
ck3.time_set(10, 11, 12);
bx.pack_end(ck3);
ck3.visible_set(true);
::elm::clock ck4(efl::eo::parent = win);
ck4.edit_set(true);
ck4.show_seconds_set(true);
ck4.show_am_pm_set(true);
ck4.time_set(10, 11, 12);
bx.pack_end(ck4);
ck4.visible_set(true);
::elm::clock ck5(efl::eo::parent = win);
ck5.show_seconds_set(true);
ck5.edit_set(true);
int digedit = ELM_CLOCK_EDIT_HOUR_UNIT | ELM_CLOCK_EDIT_MIN_UNIT | ELM_CLOCK_EDIT_SEC_UNIT;
ck5.edit_mode_set(static_cast<Elm_Clock_Edit_Mode>(digedit));
bx.pack_end(ck5);
ck5.visible_set(true);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,51 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Datetime");
win.autohide_set(true);
::elm::bg bg(efl::eo::parent = win);
bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bg);
bg.visible_set(true);
::elm::box bx(efl::eo::parent = win);
bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bx);
bx.visible_set(true);
::elm::datetime datetime(efl::eo::parent = bx);
datetime.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
datetime.size_hint_align_set(EVAS_HINT_FILL, 0.5);
datetime.field_visible_set(ELM_DATETIME_HOUR, false);
datetime.field_visible_set(ELM_DATETIME_MINUTE, false);
datetime.field_visible_set(ELM_DATETIME_AMPM, false);
bx.pack_end(datetime);
datetime.visible_set(true);
::elm::datetime datetime2(efl::eo::parent = bx);
datetime2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
datetime2.size_hint_align_set(EVAS_HINT_FILL, 0.5);
datetime2.field_visible_set(ELM_DATETIME_YEAR, false);
datetime2.field_visible_set(ELM_DATETIME_MONTH, false);
datetime2.field_visible_set(ELM_DATETIME_DATE, false);
bx.pack_end(datetime2);
datetime2.visible_set(true);
::elm::datetime datetime3(efl::eo::parent = bx);
datetime3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
datetime3.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(datetime3);
datetime3.visible_set(true);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,263 @@
#include <Elementary.hh>
#include <Evas_GL.h>
#include <stdio.h>
typedef struct _GLData GLData;
struct _GLData
{
Evas_GL_API *glapi;
GLuint program;
GLuint vtx_shader;
GLuint fgmt_shader;
GLuint vbo;
int initialized : 1;
};
static float red = 1.0;
static GLuint
load_shader(GLData *gld, GLenum type, const char *shader_src )
{
Evas_GL_API *gl = gld->glapi;
GLuint shader;
GLint compiled;
shader = gl->glCreateShader(type);
if (shader==0)
return 0;
gl->glShaderSource(shader, 1, &shader_src, NULL);
gl->glCompileShader(shader);
gl->glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
if (!compiled)
{
GLint info_len = 0;
gl->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &info_len);
if (info_len > 1)
{
char* info_log = new char[sizeof(char) * info_len];
gl->glGetShaderInfoLog(shader, info_len, NULL, info_log);
printf("Error compiling shader:\n%s\n======\n%s\n======\n", info_log, shader_src );
free(info_log);
}
gl->glDeleteShader(shader);
return 0;
}
return shader;
}
static int
init_shaders(GLData *gld)
{
Evas_GL_API *gl = gld->glapi;
GLbyte vShaderStr[] =
"attribute vec4 vPosition; \n"
"void main() \n"
"{ \n"
" gl_Position = vPosition; \n"
"} \n";
GLbyte fShaderStr[] =
"#ifdef GL_ES \n"
"precision mediump float; \n"
"#endif \n"
"void main() \n"
"{ \n"
" gl_FragColor = vec4 ( 1.0, 0.0, 0.0, 1.0 );\n"
"} \n";
GLint linked;
gld->vtx_shader = load_shader(gld, GL_VERTEX_SHADER, (const char*)vShaderStr);
gld->fgmt_shader = load_shader(gld, GL_FRAGMENT_SHADER, (const char*)fShaderStr);
gld->program = gl->glCreateProgram( );
if (gld->program==0)
return 0;
gl->glAttachShader(gld->program, gld->vtx_shader);
gl->glAttachShader(gld->program, gld->fgmt_shader);
gl->glBindAttribLocation(gld->program, 0, "vPosition");
gl->glLinkProgram(gld->program);
gl->glGetProgramiv(gld->program, GL_LINK_STATUS, &linked);
if (!linked)
{
GLint info_len = 0;
gl->glGetProgramiv(gld->program, GL_INFO_LOG_LENGTH, &info_len);
if (info_len > 1)
{
char* info_log = new char[sizeof(char) * info_len];
gl->glGetProgramInfoLog(gld->program, info_len, NULL, info_log);
printf("Error linking program:\n%s\n", info_log);
free(info_log);
}
gl->glDeleteProgram(gld->program);
return 0;
}
return 1;
}
static void
_init_gl(Evas_Object *obj)
{
GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
assert(gld != 0);
::elm::glview glv(eo_ref(obj));
Evas_GL_API *gl = glv.gl_api_get();
GLfloat vVertices[] = {
0.0f, 0.5f, 0.0f,
-0.5f, -0.5f, 0.0f,
0.5f, -0.5f, 0.0f };
if (!init_shaders(gld))
{
std::cout << "Error Initializing Shaders" << std::endl;
return;
}
gl->glGenBuffers(1, &gld->vbo);
gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo);
gl->glBufferData(GL_ARRAY_BUFFER, 3 * 3 * 4, vVertices, GL_STATIC_DRAW);
}
static void
_del_gl(Evas_Object *obj)
{
GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
if (!gld)
{
std::cout << "Unable to get GLData. " << std::endl;
return;
}
::elm::glview glv(eo_ref(obj));
Evas_GL_API *gl = glv.gl_api_get();
gl->glDeleteShader(gld->vtx_shader);
gl->glDeleteShader(gld->fgmt_shader);
gl->glDeleteProgram(gld->program);
gl->glDeleteBuffers(1, &gld->vbo);
evas_object_data_del(obj, "..gld");
free(gld);
}
static void
_resize_gl(Evas_Object *obj)
{
int w, h;
::elm::glview glv(eo_ref(obj));
Evas_GL_API *gl = glv.gl_api_get();
glv.size_get(&w, &h);
gl->glViewport(0, 0, w, h);
}
static void
_draw_gl(Evas_Object *obj)
{
GLData *gld = static_cast<GLData*>(evas_object_data_get(obj, "gld"));
::elm::glview glv(eo_ref(obj));
Evas_GL_API *gl = glv.gl_api_get();
if (!gld) return;
int w, h;
glv.size_get(&w, &h);
gl->glViewport(0, 0, w, h);
gl->glClearColor(red,0.8,0.3,1);
gl->glClear(GL_COLOR_BUFFER_BIT);
gl->glEnable(GL_BLEND);
gl->glUseProgram(gld->program);
gl->glBindBuffer(GL_ARRAY_BUFFER, gld->vbo);
gl->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
gl->glEnableVertexAttribArray(0);
gl->glDrawArrays(GL_TRIANGLES, 0, 3);
gl->glFinish();
red -= 0.1;
if (red < 0.0) red = 1.0;
}
static Eina_Bool
_anim(void* data)
{
static_cast<elm::glview*>(data)->changed_set();
return EINA_TRUE;
}
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
GLData *gld = NULL;
if (!(gld = static_cast<GLData*>(calloc(1, sizeof(GLData))))) return 1;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win win(elm_win_util_standard_add("glview simple", "GLView Simple"));
win.autohide_set(true);
::elm::box bx(efl::eo::parent = win);
bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bx);
bx.visible_set(true);
::elm::glview gl(efl::eo::parent = win,
gl.version_constructor(EVAS_GL_GLES_2_X));
gld->glapi = gl.gl_api_get();
gl.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
gl.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
int gl_mode = ELM_GLVIEW_ALPHA | ELM_GLVIEW_DEPTH;
gl.mode_set(static_cast<Elm_GLView_Mode>(gl_mode));
gl.resize_policy_set(ELM_GLVIEW_RESIZE_POLICY_RECREATE);
gl.render_policy_set(ELM_GLVIEW_RENDER_POLICY_ON_DEMAND);
gl.init_func_set(_init_gl);
gl.del_func_set(_del_gl);
gl.resize_func_set(_resize_gl);
gl.render_func_set(_draw_gl);
bx.pack_end(gl);
gl.visible_set(true);
gl.object::focus_set(true);
Ecore_Animator *ani = ecore_animator_add(_anim, &gl);
evas_object_data_set(gl._eo_ptr(), "ani", ani);
evas_object_data_set(gl._eo_ptr(), "gld", gld);
gl.object::callback_del_add(std::bind([&] () { ecore_animator_del(ani); }));
::elm::button bt(efl::eo::parent = win);
bt.text_set(nullptr, "OK");
bt.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
bt.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
bx.pack_end(bt);
bt.visible_set(true);
bt.callback_clicked_add(std::bind([] () { elm_exit(); }));
win.size_set(320, 480);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,84 @@
#include <Elementary.hh>
#include <Eina.hh>
#include <Evas.hh>
static void _print_items(void *data, Evas_Object *obj, void *event_info);
static void _free(void *data, Evas_Object *obj, void *event_info);
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
efl::eina::eina_init eina_init;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Hoversel");
win.autohide_set(true);
evas::rectangle rect(efl::eo::parent = win);
rect.color_set(255, 0, 0, 255);
rect.visible_set(true);
::elm::hoversel hoversel(efl::eo::parent = win);
hoversel.horizontal_set(false);
hoversel.text_set("elm.text", "Add an item to Hoversel");
hoversel.content_set(nullptr, rect);
hoversel.item_add("Print items", nullptr, ELM_ICON_NONE, &_print_items, NULL);
hoversel.item_add( "Option 2", "home", ELM_ICON_STANDARD, NULL,NULL);
auto add_item = std::bind([] (::elm::hoversel obj)
{
static int num = 0;
char *str = new char[sizeof(char) * 10];
snprintf(str, 10, "item %d", ++num);
elm::widget_item hoversel_item = obj.item_add(str, nullptr, ELM_ICON_NONE, NULL, str);
elm_object_item_del_cb_set(hoversel_item._eo_ptr(), &_free);
}, std::placeholders::_1);
hoversel.callback_clicked_add(add_item);
hoversel.size_set(180, 30);
hoversel.position_set( 10, 10);
hoversel.visible_set(true);
::elm::button btn(efl::eo::parent = win);
btn.text_set("elm.text", "Clear all Items");
auto clear_btn_clicked = std::bind([&] () { hoversel.clear(); });
btn.callback_clicked_add(clear_btn_clicked);
btn.size_set(180, 30);
btn.position_set(10, 50);
btn.visible_set(true);
win.size_set(200, 300);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()
static void
_print_items(void *data, Evas_Object *obj, void *event_info)
{
efl::eina::range_list<const elm::hoversel_item> items(elm_hoversel_items_get(obj));
for (auto i : items)
try
{
std::cout << i.part_text_get(nullptr) << std::endl;
}
catch (std::logic_error const&) {}
}
static void
_free(void *data, Evas_Object *obj, void *event_info)
{
delete[] static_cast<char *>(data);
}

View File

@ -0,0 +1,38 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win win(elm_win_util_standard_add("icon", "Icon"));
win.autohide_set(true);
::elm::icon icon(efl::eo::parent = win);
icon.order_lookup_set(ELM_ICON_LOOKUP_THEME_FDO);
icon.standard_set("home");
const char *path, *group;
icon.file_get(&path, &group);
std::cout << "path = " << path << ", group = "<< group;
efl::eina::optional<std::string> name;
name = icon.standard_get();
std::cout << ", name = " << *name << std::endl;
icon.no_scale_set(true);
icon.resizable_set(false, true);
icon.smooth_set(false);
icon.fill_outside_set(true);
icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(icon);
icon.visible_set(true);
win.size_set(320, 320);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,82 @@
#include <Elementary.hh>
#ifdef ELM_ELOCATION
#include <Elocation.h>
#endif
#ifdef ELM_ELOCATION
static void
_print_position(Elocation_Position *position, ::elm::label label)
{
char buffer[1024];
if (!position) return;
snprintf(buffer, sizeof(buffer),
"<b>GeoClue position reply with data from timestamp</b> %i<br/>"
"<b>Latitude:</b> %f<br/>"
"<b>Longitude:</b> %f<br/>"
"<b>Altitude:</b> %f<br/>"
"<b>Accuracy level:</b> %i<br/>"
"<b>Accuracy horizontal:</b> %f<br/>"
"<b>Accuracy vertical:</b> %f",
position->timestamp, position->latitude, position->longitude,
position->altitude, position->accur->level,
position->accur->horizontal, position->accur->vertical);
label.text_set("elm.text", buffer);
}
static Eina_Bool
_position_changed(void *data, int ev_type, void *event)
{
Elocation_Position *position;
position = static_cast<Elocation_Position*>(event);
_print_position(position, *static_cast<::elm::label*>(data));
return ECORE_CALLBACK_DONE;
}
#endif
EAPI_MAIN int
elm_main(int argc, char *argv[])
{
#ifdef ELM_ELOCATION
Elocation_Address *address;
Elocation_Position *position;
#endif
if (elm_need_elocation() == false)
return -1;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win win(elm_win_util_standard_add("elocation", "Elocation example"));
win.autohide_set(true);
::elm::label label(efl::eo::parent = win);
label.line_wrap_set(ELM_WRAP_CHAR);
label.text_set("elm.text", "Getting location ...");
label.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0);
label.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
label.slide_mode_set(ELM_LABEL_SLIDE_MODE_ALWAYS);
label.size_set(600, 480);
label.visible_set(true);
#ifdef ELM_ELOCATION
address = elocation_address_new();
position = elocation_position_new();
ecore_event_handler_add(ELOCATION_EVENT_POSITION, _position_changed, &label);
elocation_position_get(position);
_print_position(position, label);
#endif
win.size_set(600, 480);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,69 @@
#include <Elementary.hh>
#include <Eina.hh>
#include <Evas.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
efl::eina::eina_init eina_init;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Menu");
win.autohide_set(true);
evas::rectangle rect(efl::eo::parent = win);
win.resize_object_add(rect);
rect.size_hint_min_set(0, 0);
rect.color_set( 0, 0, 0, 0);
rect.visible_set(true);
::elm::widget_item no_parent(nullptr);
::elm::menu menu(efl::eo::parent = win);
menu.item_add(no_parent, nullptr, "first item", nullptr, nullptr);
elm::widget_item
menu_it = menu.item_add(no_parent, "mail-reply-all", "second item", nullptr, nullptr);
menu.item_add(menu_it, "object-rotate-left", "menu 1", NULL, NULL);
::elm::button button(efl::eo::parent = win);
button.text_set("elm.text", "button - delete items");
elm::widget_item menu_it1
= menu.item_add(menu_it, nullptr, nullptr, NULL, NULL);
menu_it1.part_content_set(nullptr, button);
auto del_it = std::bind([&] ()
{
auto list = efl::eo::downcast<elm::menu_item>(menu_it).subitems_get();
for(auto& item : list)
{
elm_object_item_del(item._eo_ptr());
}
});
button.callback_clicked_add(del_it);
menu.item_separator_add(menu_it);
menu.item_add(menu_it, nullptr, "third item", NULL, NULL);
menu.item_add(menu_it, nullptr, "fourth item", NULL, NULL);
menu.item_add(menu_it, "window-new", "sub menu", NULL, NULL);
elm::widget_item menu_it2 = menu.item_add(no_parent, nullptr, "third item", nullptr, nullptr);
menu_it2.disabled_set(EINA_TRUE);
auto show = std::bind([&] (void *event_info)
{
Evas_Event_Mouse_Down *ev = static_cast<Evas_Event_Mouse_Down*>(event_info);
menu.move(ev->canvas.x, ev->canvas.y);
menu.visible_set(true);
}, std::placeholders::_3);
rect.callback_mouse_down_add( show );
menu.visible_set(true);
win.size_set(250, 350);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,32 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main(int argc, char **argv)
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Popup");
win.autohide_set(true);
::elm::popup popup(efl::eo::parent = win);
popup.timeout_set(3.0);
popup.text_set(nullptr, "Title");
popup.visible_set(true);
auto popup_hide = std::bind ( [&] ()
{
popup.visible_set(false);
});
popup.callback_timeout_add(popup_hide);
popup.callback_block_clicked_add(popup_hide);
win.size_set(480, 800);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,79 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
static int val = 1;
::elm::win_standard win;
win.title_set("Radio");
win.autohide_set(true);
::elm::box bx(efl::eo::parent = win);
bx.horizontal_set(true);
bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bx);
bx.visible_set(true);
::elm::radio radio(efl::eo::parent = win);
::elm::radio group(efl::eo::parent = win);
group = radio;
radio.text_set("elm.text", "Radio 1");
radio.state_value_set(1);
radio.value_pointer_set(&val);
::elm::icon ic(efl::eo::parent = win);
ic.standard_set("home");
radio.content_set("icon", ic);
bx.pack_end(radio);
radio.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
radio.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
radio.visible_set(true);
auto cb_val = std::bind([] () { std::cout << "val is now: " << val << std::endl; });
radio.callback_changed_add(cb_val);
::elm::radio radio2(efl::eo::parent = win);
radio2.text_set("elm.text", "Radio 2");
radio2.state_value_set(2);
radio2.value_pointer_set(&val);
radio2.group_add(group);
::elm::icon ic2(efl::eo::parent = win);
ic2.standard_set("file");
radio2.content_set("icon", ic2);
bx.pack_end(radio2);
radio2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
radio2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
radio2.visible_set(true);
radio2.callback_changed_add(cb_val);
::elm::radio radio3(efl::eo::parent = win);
radio3.text_set("elm.text", "Radio 3");
radio3.state_value_set(3);
radio3.value_pointer_set(&val);
radio3.group_add(group);
bx.pack_end(radio3);
radio3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
radio3.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
radio3.visible_set(true);
radio3.callback_changed_add(cb_val);
::elm::radio radio4(efl::eo::parent = win);
radio4.text_set("elm.text", "Radio 4");
radio4.state_value_set(4);
radio4.value_pointer_set(&val);
radio4.group_add(group);
bx.pack_end(radio4);
radio4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
radio4.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
radio4.visible_set(true);
radio4.callback_changed_add(cb_val);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,51 @@
#include <Elementary.hh>
#include <Evas.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Separator");
win.autohide_set(true);
::elm::bg bg(efl::eo::parent = win);
bg.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bg);
bg.visible_set(true);
::elm::box bx(efl::eo::parent = win);
bx.horizontal_set(true);
bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bx);
bx.visible_set(true);
evas::rectangle rect(efl::eo::parent = win);
rect.color_set( 0, 255, 0, 255);
rect.size_hint_min_set( 90, 200);
rect.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
rect.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
rect.visible_set(true);
bx.pack_end(rect);
::elm::separator separator(efl::eo::parent = win);
separator.horizontal_set(true);
separator.visible_set(true);
bx.pack_end(separator);
evas::rectangle rect2(efl::eo::parent = win);
rect2.color_set( 0, 0, 255, 255);
rect2.size_hint_min_set( 90, 200);
rect2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
rect2.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL);
rect2.visible_set(true);
bx.pack_end(rect2);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,109 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win win(elm_win_util_standard_add("slider", "Slider Example"));
win.autohide_set(true);
::elm::box bx(efl::eo::parent = win);
bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bx);
bx.visible_set(true);
::elm::slider sl(efl::eo::parent = win);
sl.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sl.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(sl);
sl.visible_set(true);
::elm::slider sl2(efl::eo::parent = win);
sl2.text_set("elm.text", "Counter");
::elm::icon ic(efl::eo::parent = win);
ic.standard_set("home");
ic.resizable_set(false, false);
sl2.content_set("icon", ic);
::elm::icon ic2(efl::eo::parent = win);
ic2.standard_set("folder");
ic2.resizable_set(false, false);
sl2.content_set("end", ic2);
sl2.size_hint_align_set(EVAS_HINT_FILL, 0.5);
sl2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
bx.pack_end(sl2);
sl2.visible_set(true);
::elm::slider sl3(efl::eo::parent = win);
sl3.value_set(1);
sl3.span_size_set(200);
sl3.size_hint_align_set(EVAS_HINT_FILL, 0.5);
sl3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
bx.pack_end(sl3);
sl3.visible_set(true);
::elm::slider sl4(efl::eo::parent = win);
sl4.unit_format_set("%1.0f units");
sl4.min_max_set(0, 100);
sl4.size_hint_align_set(EVAS_HINT_FILL, 0.5);
sl4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
bx.pack_end(sl4);
sl4.visible_set(true);
::elm::slider sl5(efl::eo::parent = win);
sl5.indicator_format_set("%1.2f");
sl5.inverted_set(true);
sl5.size_hint_align_set(EVAS_HINT_FILL, 0.5);
sl5.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
bx.pack_end(sl5);
sl5.visible_set(true);
::elm::slider sl6(efl::eo::parent = win);
sl6.horizontal_set(false);
auto indicator_format = [] (double val) {
char *indicator = new char[32];
snprintf(indicator, 32, "%1.2f u", val);
return indicator;
};
auto indicator_free = [] (char *obj) {delete obj;} ;
sl6.indicator_format_function_set(indicator_format, indicator_free);
sl6.size_hint_align_set(0.5, EVAS_HINT_FILL);
sl6.size_hint_weight_set(0, EVAS_HINT_EXPAND);
bx.pack_end(sl6);
sl6.visible_set(true);
::elm::slider sl7(efl::eo::parent = win);
sl7.unit_format_set("%1.3f units");
sl7.indicator_format_function_set(indicator_format, indicator_free);
sl7.size_hint_align_set(EVAS_HINT_FILL, 0.5);
sl7.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
bx.pack_end(sl7);
sl7.visible_set(true);
auto changed = std::bind ( [] (::elm::slider obj)
{
double val = obj.value_get();
std::cout << "Changed to " << val << std::endl;
} , std::placeholders::_1 );
auto delay = std::bind ( [] (::elm::slider obj)
{
double val = obj.value_get();
std::cout << "Delay changed to " << val << std::endl;
} , std::placeholders::_1 );
sl7.callback_changed_add(changed);
sl7.callback_delay_changed_add(delay);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,95 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win win(elm_win_util_standard_add("spinner", "Spinner Example"));
win.autohide_set(true);
::elm::box bx(efl::eo::parent = win);
bx.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(bx);
bx.visible_set(true);
::elm::spinner sp(efl::eo::parent = win);
sp.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sp.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(sp);
sp.visible_set(true);
::elm::spinner sp2(efl::eo::parent = win);
sp2.label_format_set("Percentage %%%1.2f something");
sp2.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sp2.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(sp2);
sp2.visible_set(true);
::elm::spinner sp3(efl::eo::parent = win);
sp3.label_format_set("%1.1f units");
sp3.step_set(1.5);
sp3.wrap_set(true);
sp3.min_max_set(-50.0, 250.0);
sp3.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sp3.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(sp3);
sp3.visible_set(true);
::elm::spinner sp4(efl::eo::parent = win);
sp4.style_set("vertical");
sp4.interval_set(0.2);
sp4.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sp4.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(sp4);
sp4.visible_set(true);
::elm::spinner sp5(efl::eo::parent = win);
sp5.editable_set(false);
sp5.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sp5.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(sp5);
sp5.visible_set(true);
::elm::spinner sp6(efl::eo::parent = win);
sp6.editable_set(false);
sp6.min_max_set(1, 12);
sp6.special_value_add(1, "January");
sp6.special_value_add(2, "February");
sp6.special_value_add(3, "March");
sp6.special_value_add(4, "April");
sp6.special_value_add(5, "May");
sp6.special_value_add(6, "June");
sp6.special_value_add(7, "July");
sp6.special_value_add(8, "August");
sp6.special_value_add(9, "September");
sp6.special_value_add(10, "October");
sp6.special_value_add(11, "November");
sp6.special_value_add(12, "December");
sp6.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sp6.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(sp6);
sp6.visible_set(true);
::elm::spinner sp7(efl::eo::parent = win);
sp7.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
sp7.size_hint_align_set(EVAS_HINT_FILL, 0.5);
bx.pack_end(sp7);
sp7.visible_set(true);
sp7.editable_set(true);
auto changed = std::bind([&] () { std::cout << "Value changed to " << sp7.value_get() << std::endl; });
sp7.callback_changed_add( changed );
auto delay = std::bind([&] () {std::cout << "Value delay changed to " << sp7.value_get() << std::endl;});
sp7.callback_delay_changed_add( delay );
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,43 @@
#include <Elementary.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win win(elm_win_util_standard_add("table", "Table"));
win.autohide_set(true);
::elm::table table(efl::eo::parent = win);
win.resize_object_add(table);
table.visible_set(true);
table.padding_set(5, 5);
table.homogeneous_set(true);
::elm::label label(efl::eo::parent = win);
label.text_set(nullptr, "label 0");
label.visible_set(true);
table.pack(label, 0, 0, 1, 1);
::elm::label label1(efl::eo::parent = win);
label1.text_set(nullptr, "label 1");
label1.visible_set(true);
table.pack(label1, 1, 0, 1, 1);
::elm::label label2(efl::eo::parent = win);
label2.text_set(nullptr, "label 2");
label2.visible_set(true);
table.pack(label2, 0, 1, 1, 1);
::elm::label label3(efl::eo::parent = win);
label3.text_set(nullptr, "label 3");
label3.visible_set(true);
table.pack(label3, 1, 1, 1, 1);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,46 @@
#include <Elementary.hh>
#include <Evas.hh>
EAPI_MAIN int
elm_main (int argc, char *argv[])
{
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win win(elm_win_util_standard_add("table", "Table"));
win.autohide_set(true);
::elm::table table(efl::eo::parent = win);
win.resize_object_add(table);
table.visible_set(true);
table.homogeneous_set(false);
evas::rectangle rect(efl::eo::parent = win);
rect.color_set( 255, 0, 0, 255);
rect.size_hint_min_set( 100, 50);
rect.visible_set(true);
table.pack(rect, 0, 0, 2, 1);
evas::rectangle rect2(efl::eo::parent = win);
rect2.color_set( 0, 255, 0, 255);
rect2.size_hint_min_set(50, 100);
rect2.visible_set(true);
table.pack(rect2, 0, 1, 1, 2);
evas::rectangle rect3(efl::eo::parent = win);
rect3.color_set( 0, 0, 255, 255);
rect3.size_hint_min_set(50, 50);
rect3.visible_set(true);
table.pack(rect3, 1, 1, 1, 1);
evas::rectangle rect4(efl::eo::parent = win);
rect4.color_set( 255, 255, 0, 255);
rect4.size_hint_min_set(50, 50);
rect4.visible_set(true);
table.pack(rect4, 1, 2, 1, 1);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -0,0 +1,48 @@
#include <Elementary.hh>
#include <iostream>
#include <sstream>
EAPI_MAIN int
elm_main(int argc, char *argv[])
{
elm_need_ethumb();
elm_app_info_set(reinterpret_cast<void*>(elm_main), "elementary", "images/plant_01.jpg");
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN);
::elm::win_standard win;
win.title_set("Thumbnailer");
win.autohide_set(true);
::elm::thumb thumb(efl::eo::parent = win);
auto generation_started = std::bind([] { std::cout << "thumbnail generation started." << std::endl; });
auto generation_finished = std::bind([] { std::cout << "thumbnail generation finished." << std::endl; });
auto generation_error = std::bind([] { std::cout << "thumbnail generation error." << std::endl; });
thumb.callback_generate_start_add( generation_started );
thumb.callback_generate_stop_add( generation_finished );
thumb.callback_generate_error_add( generation_error );
thumb.size_set(160, 160);
thumb.editable_set(false);
std::stringstream ss;
ss << elm_app_data_dir_get() << "/images/plant_01.jpg";
thumb.file_set(ss.str(), "image");
thumb.reload();
thumb.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
win.resize_object_add(thumb);
thumb.visible_set(true);
win.size_set(320, 320);
win.visible_set(true);
elm_run();
return 0;
}
ELM_MAIN()

View File

@ -1,9 +1,11 @@
/Elementary.h
/Elementary.hh
/elm_intro.h
/*.eo.c
/*.eo.h
/*.eo.legacy.h
/*.eo.hh
/*.eo.impl.hh
/*.eot.h
/eldbus_elementary_colorclass.c
/eldbus_elementary_colorclass.h

View File

@ -0,0 +1,146 @@
/* This is the prmary Elementary header file that includes all other useful
* headers.
*
* Elementary is distributed under the LGPLv2 license. Please see the COPYING
* file that was distributed with this source.
*/
#ifndef ELEMENTARY_CXX_HH
#define ELEMENTARY_CXX_HH
#if defined(ELEMENTARY_H) || defined(ELM_WIDGET_H)
#error Do not include Elm C API headers before including Elementary.hh
#endif
#ifdef HAVE_CONFIG_H
extern "C" {
#include <elementary_config.h>
}
#endif
#define ELM_INTERNAL_API_ARGESFSDFEFC
#define ELM_WIDGET_ITEM_PROTECTED
extern "C" {
#include "Elementary.h"
#include "elm_widget.h"
}
#ifdef EFL_BETA_API_SUPPORT
@ELM_ELOCATION_DEF@ ELM_ELOCATION
#include <elm_widget_item.eo.hh>
#include <elm_access.eo.hh>
#include <elm_actionslider.eo.hh>
#include <elm_atspi_bridge.eo.hh>
#include <elm_app_client.eo.hh>
#include <elm_app_client_view.eo.hh>
#include <elm_app_server.eo.hh>
#include <elm_app_server_view.eo.hh>
#include <elm_atspi_app_object.eo.hh>
#include <elm_bg.eo.hh>
#include <elm_box.eo.hh>
#include <elm_bubble.eo.hh>
#include <elm_button.eo.hh>
#include <elm_calendar.eo.hh>
#include <elm_check.eo.hh>
#include <elm_clock.eo.hh>
#include <elm_colorselector.eo.hh>
#include <elm_conformant.eo.hh>
#include <elm_container.eo.hh>
#include <elm_ctxpopup.eo.hh>
#include <elm_datetime.eo.hh>
#include <elm_dayselector.eo.hh>
#include <elm_diskselector.eo.hh>
#include <elm_entry.eo.hh>
#include <elm_fileselector.eo.hh>
#include <elm_fileselector_button.eo.hh>
#include <elm_fileselector_entry.eo.hh>
#include <elm_flip.eo.hh>
#include <elm_flipselector.eo.hh>
#include <elm_frame.eo.hh>
#include <elm_gengrid.eo.hh>
#include <elm_gengrid_pan.eo.hh>
#include <elm_genlist.eo.hh>
#include <elm_genlist_pan.eo.hh>
#include <elm_gesture_layer.eo.hh>
#include <elm_glview.eo.hh>
#include <elm_grid.eo.hh>
#include <elm_hover.eo.hh>
#include <elm_hoversel.eo.hh>
#include <elm_icon.eo.hh>
#include <elm_image.eo.hh>
#include <elm_index.eo.hh>
#include <elm_interface_atspi_accessible.eo.hh>
#include <elm_interface_atspi_action.eo.hh>
#include <elm_interface_atspi_component.eo.hh>
#include <elm_interface_atspi_editable_text.eo.hh>
#include <elm_interface_atspi_image.eo.hh>
#include <elm_interface_atspi_selection.eo.hh>
#include <elm_interface_atspi_text.eo.hh>
#include <elm_interface_atspi_value.eo.hh>
#include <elm_interface_atspi_widget_action.eo.hh>
#include <elm_interface_atspi_window.eo.hh>
#include <elm_interface_fileselector.eo.hh>
#include <elm_interface_scrollable.eo.hh>
#include <elm_inwin.eo.hh>
#include <elm_label.eo.hh>
#include <elm_layout.eo.hh>
#include <elm_list.eo.hh>
#include <elm_map.eo.hh>
#include <elm_map_pan.eo.hh>
#include <elm_mapbuf.eo.hh>
#include <elm_menu.eo.hh>
#include <elm_multibuttonentry.eo.hh>
#include <elm_naviframe.eo.hh>
#include <elm_notify.eo.hh>
#include <elm_pan.eo.hh>
#include <elm_panel.eo.hh>
#include <elm_panes.eo.hh>
#include <elm_photo.eo.hh>
#include <elm_photocam.eo.hh>
#include <elm_photocam_pan.eo.hh>
#include <elm_player.eo.hh>
#include <elm_plug.eo.hh>
#include <elm_popup.eo.hh>
#include <elm_prefs.eo.hh>
#include <elm_progressbar.eo.hh>
#include <elm_radio.eo.hh>
#include <elm_route.eo.hh>
#include <elm_scroller.eo.hh>
#include <elm_segment_control.eo.hh>
#include <elm_separator.eo.hh>
#include <elm_slider.eo.hh>
#include <elm_slideshow.eo.hh>
#include <elm_spinner.eo.hh>
#include <elm_systray.eo.hh>
#include <elm_table.eo.hh>
#include <elm_thumb.eo.hh>
#include <elm_toolbar.eo.hh>
#include <elm_video.eo.hh>
#include <elm_view_list.eo.hh>
#include <elm_view_form.eo.hh>
#include <elm_web.eo.hh>
#include <elm_widget.eo.hh>
#include <elm_win.eo.hh>
#include <elm_win_standard.eo.hh>
#include <elm_color_item.eo.hh>
#include <elm_dayselector_item.eo.hh>
#include <elm_hoversel_item.eo.hh>
#include <elm_segment_control_item.eo.hh>
#include <elm_slideshow_item.eo.hh>
#include <elm_flipselector_item.eo.hh>
#include <elm_menu_item.eo.hh>
#include <elm_ctxpopup_item.eo.hh>
#include <elm_index_item.eo.hh>
#include <elm_multibuttonentry_item.eo.hh>
#include <elm_naviframe_item.eo.hh>
#include <elm_genlist_item.eo.hh>
#include <elm_gengrid_item.eo.hh>
#include <elm_list_item.eo.hh>
#include <elm_toolbar_item.eo.hh>
#include <elm_diskselector_item.eo.hh>
#include <elm_popup_item.eo.hh>
#endif
#endif

View File

@ -641,6 +641,7 @@ elm_eolian_c = $(elm_eolian_files:%.eo=%.eo.c)
elm_eolian_h = $(elm_eolian_files:%.eo=%.eo.h)
elm_eolian_legacy_h = $(elm_eolian_files:%.eo=%.eo.legacy.h)
elm_eolian_hh = $(elm_eolian_files:%.eo=%.eo.hh)
elm_eolian_impl_hh = $(elm_eolian_files:%.eo=%.eo.impl.hh)
elm_eolian_eot_h = $(elm_eolian_type_files:%.eot=%.eot.h)
@ -657,134 +658,14 @@ EXTRA_DIST += ${elementaryeolianfiles_DATA}
nodist_includesunstable_HEADERS = $(elm_eolian_h) $(elm_eolian_legacy_h) $(elm_eolian_eot_h)
CLEANFILES += $(nodist_includesunstable_HEADERS)
elementaryeolianfilesdir = $(datadir)/eolian/include/elementary-@VMAJ@
elementaryeolianfiles_DATA = \
elm_widget.eo \
elm_container.eo \
elm_layout.eo \
elm_interface_scrollable.eo \
elm_pan.eo \
elm_frame.eo \
elm_hover.eo \
elm_access.eo \
elm_actionslider.eo \
elm_app_client.eo \
elm_app_client_view.eo \
elm_app_server.eo \
elm_app_server_view.eo \
elm_atspi_app_object.eo \
elm_atspi_bridge.eo \
elm_interface_atspi_accessible.eo \
elm_interface_atspi_action.eo \
elm_interface_atspi_component.eo \
elm_interface_atspi_editable_text.eo \
elm_interface_atspi_image.eo \
elm_interface_atspi_selection.eo \
elm_interface_atspi_text.eo \
elm_interface_atspi_value.eo \
elm_interface_atspi_widget_action.eo \
elm_interface_atspi_window.eo \
elm_bg.eo \
elm_box.eo \
elm_bubble.eo \
elm_button.eo \
elm_calendar.eo \
elm_check.eo \
elm_clock.eo \
elm_colorselector.eo \
elm_conformant.eo \
elm_ctxpopup.eo \
elm_datetime.eo \
elm_dayselector.eo \
elm_diskselector.eo \
elm_entry.eo \
elm_fileselector.eo \
elm_fileselector_button.eo \
elm_fileselector_entry.eo \
elm_flipselector.eo \
elm_flip.eo \
elm_general.eot \
elm_gengrid.eo \
elm_gengrid_pan.eo \
elm_genlist.eo \
elm_genlist_pan.eo \
elm_gesture_layer.eo \
elm_glview.eo \
elm_grid.eo \
elm_hoversel.eo \
elm_image.eo \
elm_icon.eo \
elm_index.eo \
elm_interface_fileselector.eo \
elm_inwin.eo \
elm_label.eo \
elm_list.eo \
elm_map_pan.eo \
elm_map.eo \
elm_menu.eo \
elm_multibuttonentry.eo \
elm_naviframe.eo \
elm_panel.eo \
elm_mapbuf.eo \
elm_notify.eo \
elm_panes.eo \
elm_photocam.eo \
elm_photocam_pan.eo \
elm_photo.eo \
elm_player.eo \
elm_plug.eo \
elm_popup.eo \
elm_prefs.eo \
elm_progressbar.eo \
elm_radio.eo \
elm_route.eo \
elm_scroller.eo \
elm_segment_control.eo \
elm_separator.eo \
elm_slider.eo \
elm_slideshow.eo \
elm_spinner.eo \
elm_systray.eo \
elm_table.eo \
elm_thumb.eo \
elm_toolbar.eo \
elm_video.eo \
elm_view_list.eo \
elm_view_form.eo \
elm_web.eo \
elm_win.eo \
elm_win_standard.eo \
elm_widget_item.eo \
elm_color_item.eo \
elm_dayselector_item.eo \
elm_hoversel_item.eo \
elm_segment_control_item.eo \
elm_slideshow_item.eo \
elm_flipselector_item.eo \
elm_menu_item.eo \
elm_ctxpopup_item.eo \
elm_index_item.eo \
elm_multibuttonentry_item.eo \
elm_naviframe_item.eo \
elm_genlist_item.eo \
elm_gengrid_item.eo \
elm_list_item.eo \
elm_toolbar_item.eo \
elm_diskselector_item.eo \
elm_popup_item.eo
EXTRA_DIST += ${elementaryeolianfiles_DATA}
includecxxbindingsdir = $(includedir)/elementary-cxx-@VMAJ@
if HAVE_CXX11
nodist_includecxxbindings_HEADERS = Elementary.hh $(elm_eolian_hh)
CLEANFILES += Elementary.hh $(nodist_includecxxbindings_HEADERS)
Elementary.hh: $(elm_eolian_hh)
@echo @ECHO_E@ "#ifndef ELEMENTARY_CXX_HH\n#define ELEMENTARY_CXX_HH\n" > $(top_builddir)/src/lib/Elementary.hh
@echo @ECHO_E@ "#ifdef EFL_BETA_API_SUPPORT" >> $(top_builddir)/src/lib/Elementary.hh
@for i in $(elm_eolian_hh); do echo "#include <$$(basename $$i)>" >> $(top_builddir)/src/lib/Elementary.hh; done
@echo @ECHO_E@ "#endif\n\n#endif\n" >> $(top_builddir)/src/lib/Elementary.hh
nodist_includecxxbindings_HEADERS = Elementary.hh $(elm_eolian_hh) $(elm_eolian_impl_hh)
CLEANFILES += $(nodist_includecxxbindings_HEADERS)
EXTRA_DIST += Elementary.hh.in
endif

View File

@ -3,3 +3,6 @@
/elm_suite.log
/elm_suite.trs
/test-suite.log
/elm_cxx_suite
/elm_cxx_suite.log
/elm_cxx_suite.trs

View File

@ -1,124 +1,4 @@
extern "C"
{
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#define ELM_INTERNAL_API_ARGESFSDFEFC
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED
#define ELM_INTERFACE_ATSPI_ACTION_PROTECTED
#define ELM_INTERFACE_ATSPI_VALUE_PROTECTED
#define ELM_INTERFACE_ATSPI_EDITABLE_TEXT_PROTECTED
#define ELM_INTERFACE_ATSPI_TEXT_PROTECTED
#define ELM_INTERFACE_ATSPI_SELECTION_PROTECTED
#define ELM_INTERFACE_ATSPI_IMAGE_PROTECTED
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
#include <Eo.h>
#include <Evas.h>
#include <Elementary.h>
#include <elm_widget.h>
#include <elm_interface_scrollable.h>
#include <elm_interface_atspi_text.h>
#include <elm_interface_atspi_accessible.h>
#include <elm_interface_atspi_widget_action.h>
}
#include <elm_access.eo.hh>
#include <elm_actionslider.eo.hh>
#include <elm_app_client.eo.hh>
#include <elm_app_client_view.eo.hh>
#include <elm_app_server.eo.hh>
#include <elm_app_server_view.eo.hh>
#include <elm_atspi_app_object.eo.hh>
#include <elm_bg.eo.hh>
#include <elm_box.eo.hh>
#include <elm_bubble.eo.hh>
#include <elm_button.eo.hh>
#include <elm_calendar.eo.hh>
#include <elm_check.eo.hh>
#include <elm_clock.eo.hh>
#include <elm_colorselector.eo.hh>
#include <elm_conformant.eo.hh>
#include <elm_container.eo.hh>
#include <elm_ctxpopup.eo.hh>
#include <elm_datetime.eo.hh>
#include <elm_dayselector.eo.hh>
#include <elm_diskselector.eo.hh>
#include <elm_entry.eo.hh>
#include <elm_fileselector_button.eo.hh>
#include <elm_fileselector_entry.eo.hh>
#include <elm_fileselector.eo.hh>
#include <elm_flip.eo.hh>
#include <elm_flipselector.eo.hh>
#include <elm_frame.eo.hh>
#include <elm_gengrid.eo.hh>
#include <elm_gengrid_pan.eo.hh>
#include <elm_genlist.eo.hh>
#include <elm_genlist_pan.eo.hh>
#include <elm_gesture_layer.eo.hh>
#include <elm_glview.eo.hh>
#include <elm_grid.eo.hh>
#include <elm_hover.eo.hh>
#include <elm_hoversel.eo.hh>
#include <elm_icon.eo.hh>
#include <elm_image.eo.hh>
#include <elm_index.eo.hh>
#include <elm_interface_atspi_accessible.eo.hh>
#include <elm_interface_atspi_action.eo.hh>
#include <elm_interface_atspi_component.eo.hh>
#include <elm_interface_atspi_editable_text.eo.hh>
#include <elm_interface_atspi_image.eo.hh>
#include <elm_interface_atspi_selection.eo.hh>
#include <elm_interface_atspi_text.eo.hh>
#include <elm_interface_atspi_value.eo.hh>
#include <elm_interface_atspi_widget_action.eo.hh>
#include <elm_interface_atspi_widget.eo.hh>
#include <elm_interface_atspi_window.eo.hh>
#include <elm_interface_fileselector.eo.hh>
#include <elm_interface_scrollable.eo.hh>
#include <elm_inwin.eo.hh>
#include <elm_label.eo.hh>
#include <elm_layout.eo.hh>
#include <elm_list.eo.hh>
#include <elm_mapbuf.eo.hh>
#include <elm_map.eo.hh>
#include <elm_map_pan.eo.hh>
#include <elm_menu.eo.hh>
#include <elm_multibuttonentry.eo.hh>
#include <elm_naviframe.eo.hh>
#include <elm_notify.eo.hh>
#include <elm_panel.eo.hh>
#include <elm_pan.eo.hh>
#include <elm_panes.eo.hh>
#include <elm_photocam.eo.hh>
#include <elm_photocam_pan.eo.hh>
#include <elm_photo.eo.hh>
#include <elm_player.eo.hh>
#include <elm_plug.eo.hh>
#include <elm_popup.eo.hh>
#include <elm_prefs.eo.hh>
#include <elm_progressbar.eo.hh>
#include <elm_radio.eo.hh>
#include <elm_route.eo.hh>
#include <elm_scroller.eo.hh>
#include <elm_segment_control.eo.hh>
#include <elm_separator.eo.hh>
#include <elm_slider.eo.hh>
#include <elm_slideshow.eo.hh>
#include <elm_spinner.eo.hh>
#include <elm_systray.eo.hh>
#include <elm_table.eo.hh>
#include <elm_thumb.eo.hh>
#include <elm_toolbar.eo.hh>
#include <elm_video.eo.hh>
#include <elm_web.eo.hh>
#include <elm_widget.eo.hh>
#include <elm_win.eo.hh>
#include <Elementary.hh>
int main()
{