#include "ewk_view.h"
#include <Elementary.h>
-#include <efl_assist.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
ewk_view_javascript_alert_reply(popup->ewkView());
}
-static void alertHwBackKeyCallback(void* data, Evas_Object* obj, void* eventInfo)
-{
- JavaScriptPopup* popup = static_cast<JavaScriptPopup*>(data);
- if (!popup)
- return;
- popup->close();
- ewk_view_javascript_alert_reply(popup->ewkView());
-}
-
bool JavaScriptPopup::setLabelText(const char* message)
{
if (!message)
// Get layout width to set a dynamic label wrap width
int layoutWidth;
- evas_object_geometry_get(layout, 0, 0, &layoutWidth, 0);
+ evas_object_geometry_get(layout, NULL, NULL, &layoutWidth, NULL);
Evas_Object* label = elm_label_add(layout);
elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
// Get label height for check the length of the character
int labelHeight;
- evas_object_geometry_get(label, 0, 0, 0, &labelHeight);
+ evas_object_geometry_get(label, NULL, NULL, NULL, &labelHeight);
// Use the general popup instead of scroll layout when message is a short sentences
if (labelHeight < 400) {
evas_object_del(m_popup);
- Evas_Object* parent = getParentWindow();
+ Evas_Object *parent = getParentWindow();
m_popup = elm_popup_add(parent);
if (!m_popup)
bool JavaScriptPopup::alert(const char* message)
{
- Evas_Object* parent = getParentWindow();
+ Evas_Object *parent = getParentWindow();
if (m_popup)
return false;
if (!setLabelText(message))
return false;
- ea_object_event_callback_add(m_popup, EA_CALLBACK_BACK, alertHwBackKeyCallback, this);
-
Evas_Object* okButton = elm_button_add(m_popup);
- // FIXME: Need to apply i18n for the button label
+ //FIXME: Need to apply i18n for the button label
elm_object_text_set(okButton, "OK");
elm_object_part_content_set(m_popup, "button1", okButton);
evas_object_smart_callback_add(okButton, "clicked", alertResponseCallback, this);
ewk_view_javascript_confirm_reply(popup->ewkView(), false);
}
-static void confirmHwBackKeyCallback(void* data, Evas_Object* obj, void* eventInfo)
-{
- JavaScriptPopup* popup = static_cast<JavaScriptPopup*>(data);
- if (!popup)
- return;
- popup->close();
- ewk_view_javascript_confirm_reply(popup->ewkView(), false);
-}
-
bool JavaScriptPopup::confirm(const char* message)
{
- Evas_Object* parent = getParentWindow();
+ Evas_Object *parent = getParentWindow();
if (m_popup)
return false;
if (!setLabelText(message))
return false;
- ea_object_event_callback_add(m_popup, EA_CALLBACK_BACK, confirmHwBackKeyCallback, this);
-
Evas_Object* okButton = elm_button_add(m_popup);
- // FIXME: Need to apply i18n for the button label
+ //FIXME: Need to apply i18n for the button label
elm_object_text_set(okButton, "OK");
elm_object_part_content_set(m_popup, "button1", okButton);
evas_object_smart_callback_add(okButton, "clicked", confirmOkCallback, this);
Evas_Object* cancelButton = elm_button_add(m_popup);
- // FIXME: Need to apply i18n for the button label
+ //FIXME: Need to apply i18n for the button label
elm_object_text_set(cancelButton, "Cancel");
elm_object_part_content_set(m_popup, "button2", cancelButton);
evas_object_smart_callback_add(cancelButton, "clicked", confirmCancelCallback, this);
free(result);
}
-static void promptHwBackKeyCallback(void* data, Evas_Object* obj, void* eventInfo)
-{
- JavaScriptPopup* popup = static_cast<JavaScriptPopup*>(data);
- if (!popup)
- return;
- popup->close();
- ewk_view_javascript_prompt_reply(popup->ewkView(), 0);
-}
-
bool JavaScriptPopup::prompt(const char* message, const char* defaultValue)
{
- Evas_Object* parent = getParentWindow();
+ Evas_Object *parent = getParentWindow();
if (m_popup)
return false;
m_entry = elm_entry_add(m_popup);
Ecore_IMF_Context* imfContext = static_cast<Ecore_IMF_Context*>(elm_entry_imf_context_get(m_entry));
- ecore_imf_context_input_panel_event_callback_add(imfContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, promptEntryChanged, 0);
+ ecore_imf_context_input_panel_event_callback_add(imfContext, ECORE_IMF_INPUT_PANEL_STATE_EVENT, promptEntryChanged, NULL);
elm_entry_scrollable_set(m_entry, EINA_TRUE);
elm_object_text_set(m_entry, defaultValue);
elm_entry_cursor_end_set(m_entry);
elm_object_part_content_set(layout, "prompt_container", m_entry);
elm_object_content_set(m_popup, layout);
- ea_object_event_callback_add(m_popup, EA_CALLBACK_BACK, promptHwBackKeyCallback, this);
-
Evas_Object* okButton = elm_button_add(m_popup);
- // FIXME: Need to apply i18n for the button label
+ //FIXME: Need to apply i18n for the button label
elm_object_text_set(okButton, "OK");
elm_object_part_content_set(m_popup, "button1", okButton);
evas_object_smart_callback_add(okButton, "clicked", promptOkCallback, this);
Evas_Object* cancelButton = elm_button_add(m_popup);
- // FIXME: Need to apply i18n for the button label
+ //FIXME: Need to apply i18n for the button label
elm_object_text_set(cancelButton, "Cancel");
elm_object_part_content_set(m_popup, "button2", cancelButton);
evas_object_smart_callback_add(cancelButton, "clicked", promptCancelCallback, this);
return false;
Evas_Object* leaveButton = elm_button_add(m_popup);
- // FIXME: Need to apply i18n for the button label
+ //FIXME: Need to apply i18n for the button label
elm_object_text_set(leaveButton, "Leave");
elm_object_part_content_set(m_popup, "button1", leaveButton);
evas_object_smart_callback_add(leaveButton, "clicked", beforeUnloadConfirmPanelLeaveCallback, this);
Evas_Object* stayButton = elm_button_add(m_popup);
- // FIXME: Need to apply i18n for the button label
+ //FIXME: Need to apply i18n for the button label
elm_object_text_set(stayButton, "Stay");
elm_object_part_content_set(m_popup, "button2", stayButton);
evas_object_smart_callback_add(stayButton, "clicked", beforeUnloadConfirmPanelStayCallback, this);