Implement default messagebox for desktop. 44/156944/2
authorSanghyup Lee <sh53.lee@samsung.com>
Mon, 23 Oct 2017 01:26:33 +0000 (10:26 +0900)
committerSanghyup Lee <sh53.lee@samsung.com>
Mon, 23 Oct 2017 01:44:04 +0000 (10:44 +0900)
Change-Id: I72578839b9e839e3faaa8a0acb6f487df95e1792
Signed-off-by: Sanghyup Lee <sh53.lee@samsung.com>
atom/browser/native_window_efl.h
atom/browser/ui/message_box_efl.cc

index 5546bf6..773fd0b 100644 (file)
@@ -88,6 +88,8 @@ class NativeWindowEfl : public NativeWindow {
   void SetVisibleOnAllWorkspaces(bool visible) override;
   bool IsVisibleOnAllWorkspaces() override;
 
+  Evas_Object* evas_object() { return window_; }
+
  private:
   // Converts between content bounds and window bounds.
   virtual gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) override;
index 56b8443..b3125fc 100755 (executable)
@@ -4,10 +4,17 @@
 
 #include "atom/browser/ui/message_box.h"
 
+#include "atom/browser/native_window_efl.h"
 #include "base/logging.h"
 
+#include <Elementary.h>
+
 namespace atom {
 
+static void _response_cb(void* data, Evas_Object* obj, void* event_info) {
+  evas_object_del(static_cast<Evas_Object*>(data));
+}
+
 int ShowMessageBox(NativeWindow* parent_window,
                    MessageBoxType type,
                    const std::vector<std::string>& buttons,
@@ -18,7 +25,20 @@ int ShowMessageBox(NativeWindow* parent_window,
                    const std::string& message,
                    const std::string& detail,
                    const gfx::ImageSkia& icon) {
-  NOTIMPLEMENTED();
+  Evas_Object* win = static_cast<NativeWindowEfl*>(parent_window)->evas_object();
+  Evas_Object* popup = elm_popup_add(win);
+
+  elm_object_text_set(popup, message.c_str());
+  elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR);
+  elm_object_part_text_set(popup, "title,text", title.c_str());
+
+  Evas_Object* btn1 = elm_button_add(popup);
+  elm_object_text_set(btn1, "OK");
+  elm_object_part_content_set(popup, "button1", btn1);
+  evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
+
+  evas_object_show(popup);
+
   return 0;
 }
 
@@ -35,10 +55,12 @@ void ShowMessageBox(NativeWindow* parent_window,
                     bool checkbox_checked,
                     const gfx::ImageSkia& icon,
                     const MessageBoxCallback& callback) {
+  LOG(INFO) << "ShowMessageBox : " << title << ", " << message;
   NOTIMPLEMENTED();
 }
 
 void ShowErrorBox(const base::string16& title, const base::string16& content) {
+  LOG(INFO) << "ShowErrorBox : " << title << ", " << content;
   NOTIMPLEMENTED();
 }