}
// Evas_Smart_Class callback interface:
-void handleEvasObjectAdd(Evas_Object* evas_object)
-{
- const Evas_Smart* smart = evas_object_smart_smart_get(evas_object);
+void handleEwkViewAdd(Evas_Object* ewk_view) {
+ const Evas_Smart* smart = evas_object_smart_smart_get(ewk_view);
const Evas_Smart_Class* smart_class = evas_smart_class_get(smart);
const Ewk_View_Smart_Class* api = reinterpret_cast<const Ewk_View_Smart_Class*>(smart_class);
assert(api);
- Ewk_View_Smart_Data* smart_data =
- GetEwkViewSmartDataFromEvasObject(evas_object);
+ Ewk_View_Smart_Data* smart_data = GetSmartDataFromEwkView(ewk_view);
if (!smart_data) {
// Allocating with 'calloc' as the API contract is that it should be deleted with 'free()'.
EINA_LOG_ERR("Failed to allocate Smart View Data");
return;
}
- evas_object_smart_data_set(evas_object, smart_data);
+ evas_object_smart_data_set(ewk_view, smart_data);
}
- smart_data->self = evas_object;
+ smart_data->self = ewk_view;
smart_data->api = api;
- parent_smart_class_.add(evas_object);
+ parent_smart_class_.add(ewk_view);
smart_data->priv = 0; // Will be initialized later.
}
// Ewk_View_Smart_Class callback interface:
-void handleEvasObjectDelete(Evas_Object* evas_object)
-{
- Ewk_View_Smart_Data* smart_data = GetEwkViewSmartDataFromEvasObject(evas_object);
+void handleEwkViewDelete(Evas_Object* ewk_view) {
+ Ewk_View_Smart_Data* smart_data = GetSmartDataFromEwkView(ewk_view);
if (smart_data) {
delete smart_data->priv;
smart_data->priv = NULL;
}
- parent_smart_class_.del(evas_object);
+ parent_smart_class_.del(ewk_view);
}
-void handleEvasObjectShow(Evas_Object* o)
-{
- Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o);
- EWebView* wv = GetWebViewFromSmartData(d);
+void handleEwkViewShow(Evas_Object* ewk_view) {
+ Ewk_View_Smart_Data* d = GetSmartDataFromEwkView(ewk_view);
+ EWebView* wv = GetEWebViewFromSmartData(d);
if (!wv) {
return;
}
wv->HandleShow();
}
-void handleEvasObjectHide(Evas_Object* o)
-{
- Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o);
- EWebView* wv = GetWebViewFromSmartData(d);
+void handleEwkViewHide(Evas_Object* ewk_view) {
+ Ewk_View_Smart_Data* d = GetSmartDataFromEwkView(ewk_view);
+ EWebView* wv = GetEWebViewFromSmartData(d);
if (!wv) {
return;
}
wv->HandleHide();
}
-void handleEvasObjectMove(Evas_Object* o, Evas_Coord x, Evas_Coord y)
-{
- Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o);
- EWebView* wv = GetWebViewFromSmartData(d);
+void handleEwkViewMove(Evas_Object* ewk_view, Evas_Coord x, Evas_Coord y) {
+ Ewk_View_Smart_Data* d = GetSmartDataFromEwkView(ewk_view);
+ EWebView* wv = GetEWebViewFromSmartData(d);
if (!wv) {
return;
}
SmartDataChanged(d);
}
-void handleEvasObjectResize(Evas_Object* o, Evas_Coord width, Evas_Coord height)
-{
- Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o);
- EWebView* wv = GetWebViewFromSmartData(d);
+void handleEwkViewResize(Evas_Object* ewk_view,
+ Evas_Coord width,
+ Evas_Coord height) {
+ Ewk_View_Smart_Data* d = GetSmartDataFromEwkView(ewk_view);
+ EWebView* wv = GetEWebViewFromSmartData(d);
if (!wv) {
return;
}
LOG(ERROR) << "hardcode size as 1920 * 1080 for invalid size";
width = 1920;
height = 1080;
- evas_object_geometry_set(o, 0, 0, width, height);
+ evas_object_geometry_set(ewk_view, 0, 0, width, height);
}
#endif
d->view.w = width;
SmartDataChanged(d);
}
-void handleEvasObjectCalculate(Evas_Object* o)
-{
- Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o);
- EWebView* wv = GetWebViewFromSmartData(d);
+void handleEwkViewCalculate(Evas_Object* ewk_view) {
+ Ewk_View_Smart_Data* d = GetSmartDataFromEwkView(ewk_view);
+ EWebView* wv = GetEWebViewFromSmartData(d);
if (!wv) {
return;
}
Evas_Coord x, y, width, height;
- evas_object_geometry_get(o, &x, &y, &width, &height);
+ evas_object_geometry_get(ewk_view, &x, &y, &width, &height);
d->view.x = x;
d->view.y = y;
d->view.w = width;
d->view.h = height;
}
-void handleEvasObjectColorSet(Evas_Object*, int red, int green, int blue, int alpha)
-{
+void handleEwkViewColorSet(Evas_Object*,
+ int red,
+ int green,
+ int blue,
+ int alpha) {
// FIXME: implement.
}
Eina_Bool handleTextSelectionDown(Ewk_View_Smart_Data* d, int x, int y)
{
- EWebView* wv = GetWebViewFromSmartData(d);
+ EWebView* wv = GetEWebViewFromSmartData(d);
if (!wv)
return false;
return wv->HandleTextSelectionDown(x, y);
Eina_Bool handleTextSelectionUp(Ewk_View_Smart_Data* d, int x, int y)
{
- EWebView* wv = GetWebViewFromSmartData(d);
+ EWebView* wv = GetEWebViewFromSmartData(d);
if (!wv)
return false;
return wv->HandleTextSelectionUp(x, y);
// --------- public API --------------
-bool IsWebViewObject(const Evas_Object* evas_object)
-{
- if (!evas_object) {
+bool IsSmartWebViewObject(const Evas_Object* ewk_view) {
+ if (!ewk_view) {
return false;
}
- const char* object_type = evas_object_type_get(evas_object);
- const Evas_Smart* evas_smart = evas_object_smart_smart_get(evas_object);
+ const char* object_type = evas_object_type_get(ewk_view);
+ const Evas_Smart* evas_smart = evas_object_smart_smart_get(ewk_view);
if (!evas_smart) {
- EINA_LOG_ERR("%p (%s) is not a smart object!", evas_object,
+ EINA_LOG_ERR("%p (%s) is not a smart object!", ewk_view,
object_type ? object_type : "(null)");
return false;
}
const Evas_Smart_Class* smart_class = evas_smart_class_get(evas_smart);
if (!smart_class) {
- EINA_LOG_ERR("%p (%s) is not a smart class object!", evas_object,
+ EINA_LOG_ERR("%p (%s) is not a smart class object!", ewk_view,
object_type ? object_type : "(null)");
return false;
}
if (smart_class->data != EwkViewSmartClassName) {
- EINA_LOG_ERR("%p (%s) is not of an ewk_view (need %p, got %p)!",
- evas_object, object_type ? object_type : "(null)",
- EwkViewSmartClassName, smart_class->data);
+ EINA_LOG_ERR("%p (%s) is not of an ewk_view (need %p, got %p)!", ewk_view,
+ object_type ? object_type : "(null)", EwkViewSmartClassName,
+ smart_class->data);
return false;
}
return true;
}
-Ewk_View_Smart_Data* GetEwkViewSmartDataFromEvasObject(const Evas_Object* evas_object)
-{
- assert(evas_object);
- assert(IsWebViewObject(evas_object));
- return static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(evas_object));
+Ewk_View_Smart_Data* GetSmartDataFromEwkView(const Evas_Object* ewk_view) {
+ assert(ewk_view);
+ assert(IsSmartWebViewObject(ewk_view));
+ return static_cast<Ewk_View_Smart_Data*>(
+ evas_object_smart_data_get(ewk_view));
}
-EWebView* GetWebViewFromSmartData(const Ewk_View_Smart_Data* smartData)
-{
- if (smartData && smartData->priv) {
- return smartData->priv->GetTizenWebView();
+EWebView* GetEWebViewFromSmartData(const Ewk_View_Smart_Data* smart_data) {
+ if (smart_data && smart_data->priv) {
+ return smart_data->priv->GetTizenWebView();
}
return NULL;
}
-EWebView* GetWebViewFromEvasObject(const Evas_Object* eo) {
- if (!IsWebViewObject(eo)) {
+EWebView* GetEWebViewFromEwkView(const Evas_Object* ewk_view) {
+ if (!IsSmartWebViewObject(ewk_view)) {
return NULL;
}
- Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromEvasObject(eo);
- return GetWebViewFromSmartData(sd);
+ Ewk_View_Smart_Data* sd = GetSmartDataFromEwkView(ewk_view);
+ return GetEWebViewFromSmartData(sd);
}
Evas_Object* CreateWebViewAsEvasObject(Ewk_Context* context,
Evas* canvas,
Evas_Smart* smart /*= 0*/) {
smart = smart ? smart : DefaultSmartClassInstance();
- Evas_Object* wv_evas_object = evas_object_smart_add(canvas, smart);
- EWebView* view = new EWebView(context, wv_evas_object);
+ Evas_Object* ewk_view = evas_object_smart_add(canvas, smart);
+ EWebView* view = new EWebView(context, ewk_view);
if (!view) {
return NULL;
}
- LOG(INFO) << "EWebView: " << view << ", ewk_view:" << wv_evas_object;
- Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromEvasObject(wv_evas_object);
+ LOG(INFO) << "EWebView: " << view << ", ewk_view: " << ewk_view;
+ Ewk_View_Smart_Data* sd = GetSmartDataFromEwkView(ewk_view);
if (!sd) {
delete view;
return NULL;
// attach webview as a member of smart data
sd->priv = new EwkViewImpl(view);
view->Initialize();
- return wv_evas_object;
+ return ewk_view;
}
evas_object_smart_clipped_smart_set(&api.sc);
// Set Evas_Smart_Class callbacks.
- api.sc.add = &handleEvasObjectAdd;
- api.sc.del = &handleEvasObjectDelete;
- api.sc.move = &handleEvasObjectMove;
- api.sc.resize = &handleEvasObjectResize;
- api.sc.show = &handleEvasObjectShow;
- api.sc.hide = &handleEvasObjectHide;
- api.sc.calculate = &handleEvasObjectCalculate;
- api.sc.color_set = &handleEvasObjectColorSet;
+ api.sc.add = &handleEwkViewAdd;
+ api.sc.del = &handleEwkViewDelete;
+ api.sc.move = &handleEwkViewMove;
+ api.sc.resize = &handleEwkViewResize;
+ api.sc.show = &handleEwkViewShow;
+ api.sc.hide = &handleEwkViewHide;
+ api.sc.calculate = &handleEwkViewCalculate;
+ api.sc.color_set = &handleEwkViewColorSet;
// Set Ewk_View_Smart_Class callbacks.
api.text_selection_down = &handleTextSelectionDown;