- wrap elmxx type access functions

- change example to demonstrate type save and type unsave External access
(now commited from my second system...)


SVN revision: 55761
master
Andreas Volz 12 years ago
parent 9a1b0dcd7f
commit 1182a56653
  1. 2
      compile.sh
  2. 23
      eflxx_examples/src/elementaryxx/external/main.cpp
  3. 20
      elementaryxx/include/elementaryxx/Object.h
  4. 28
      elementaryxx/src/Object.cpp

@ -1,5 +1,5 @@
#!/bin/bash
#test
PKG="eflxx
einaxx
evasxx

@ -47,10 +47,12 @@ int main (int argc, char **argv)
edje->setLayer (0);
edje->show ();
// This access is type unsafe as a cast is done without checking prior the type!
Eflxx::CountedPtr <Evasxx::Object> ext_eo (edje->getPart ("Button01")->getExternalObject ());
Elmxx::Button *button = static_cast <Elmxx::Button*> (&(*ext_eo));
button->setLabel ("This is a changed button");
// This access is type unsafe as a cast is done without checking prior the type!
Eflxx::CountedPtr <Evasxx::Object> ext_eo2 (edje->getPart ("List01")->getExternalObject ());
Elmxx::List *list = static_cast <Elmxx::List*> (&(*ext_eo2));
assert (list->append ("1. Line", NULL, NULL));
@ -59,11 +61,24 @@ int main (int argc, char **argv)
assert (list->append ("4. Line", NULL, NULL));
list->go ();
// The code below accesses a Edje External widget (here: Elementary Progressbar) in a type save way
Eflxx::CountedPtr <Evasxx::Object> ext_eo3 (edje->getPart ("Progressbar01")->getExternalObject ());
Elmxx::Progressbar *progressbar = static_cast <Elmxx::Progressbar*> (&(*ext_eo3));
progressbar->setLabel ("This is the status");
progressbar->setValue (0.5);
cout << "Edje Widget type: " << ext_eo3->getType () << endl;
if (ext_eo3->getType () == "elm_widget")
{
Elmxx::Object *elm_object = static_cast <Elmxx::Object*> (&(*ext_eo3));
cout << "Elm Widget type: " << elm_object->getWidgetType () << endl;
if (elm_object->getWidgetType () == "progressbar")
{
Elmxx::Progressbar *progressbar = static_cast <Elmxx::Progressbar*> (elm_object);
progressbar->setLabel ("This is the status");
progressbar->setValue (0.5);
progressbar->obj();
}
}
// This External access is save as it only calls the ExternalParam interface
Eflxx::CountedPtr <Edjexx::Part> part (edje->getPart ("Slider01"));
Edjexx::ExternalParam param ("value", 5.0f);

@ -24,6 +24,26 @@ public:
virtual void focus ();
/*!
* Check if the given Evas Object is an Elementary widget.
*/
bool checkWidget ();
/*!
* Get the first parent of the given object that is an Elementary widget.
*/
Eflxx::CountedPtr <Evasxx::Object> getParentWidget ();
/*!
* Get the top level parent of an Elementary widget.
*/
Eflxx::CountedPtr <Evasxx::Object> getTopWidget ();
/*!
* Get the string that represents this Elementary widget.
*/
const std::string getWidgetType ();
/*void elm_object_scroll_hold_push(Evas_Object *obj);
void elm_object_scroll_hold_pop(Evas_Object *obj);
void elm_object_scroll_freeze_push(Evas_Object *obj);

@ -79,4 +79,32 @@ void Object::focus ()
elm_object_focus (o);
}
bool Object::checkWidget ()
{
return elm_object_widget_check (o);
}
Eflxx::CountedPtr <Evasxx::Object> Object::getParentWidget ()
{
Evas_Object *eo = elm_object_parent_widget_get (o);
Evasxx::Object *ret_o = Evasxx::Object::wrap (eo);
return Eflxx::CountedPtr <Evasxx::Object> (ret_o);
}
Eflxx::CountedPtr <Evasxx::Object> Object::getTopWidget ()
{
Evas_Object *eo = elm_object_top_widget_get (o);
Evasxx::Object *ret_o = Evasxx::Object::wrap (eo);
return Eflxx::CountedPtr <Evasxx::Object> (ret_o);
}
const std::string Object::getWidgetType ()
{
return elm_object_widget_type_get (o);
}
} // end namespace Elmxx

Loading…
Cancel
Save