Implemented progressbar for web application
[platform/framework/web/crosswalk-tizen.git] / runtime / browser / native_window.cc
index 9350c66..40162be 100755 (executable)
@@ -75,6 +75,10 @@ NativeWindow::NativeWindow()
       currentViewModeFullScreen_(false),
       focus_(NULL),
       content_(NULL),
+#ifdef PROFILE_MOBILE
+      progressbar_(NULL),
+      top_layout_(NULL),
+#endif
       rotation_(0),
       handler_id_(0) {
 }
@@ -126,6 +130,9 @@ void NativeWindow::Initialize() {
   EVAS_SIZE_EXPAND_FILL(top_layout);
   elm_object_content_set(conformant, top_layout);
   evas_object_show(top_layout);
+#ifdef PROFILE_MOBILE
+  top_layout_ = top_layout;
+#endif
 
   // focus
   Evas_Object* focus = elm_bg_add(top_layout);
@@ -139,6 +146,17 @@ void NativeWindow::Initialize() {
   evas_object_show(focus);
   focus_ = focus;
 
+#ifdef PROFILE_MOBILE
+  // progressbar
+  Evas_Object *progressbar = elm_progressbar_add(top_layout);
+  EVAS_SIZE_EXPAND_FILL(progressbar);
+  elm_progressbar_unit_format_set(progressbar, "%1.1f%%");
+  elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
+  elm_object_part_content_set(top_layout, "elm.swallow.progress", progressbar);
+  evas_object_show(progressbar);
+  progressbar_ = progressbar;
+#endif
+
   // focus callback
   auto focus_callback = [](void* user_data,
                            Evas_Object*,
@@ -306,4 +324,15 @@ void NativeWindow::ManualRotationDone() {
 }
 #endif  // MANUAL_ROTATE_FEATURE_SUPPORT
 
+#ifdef PROFILE_MOBILE
+void NativeWindow::SignalEmit(const char* emission,
+    const char* source) {
+  elm_object_signal_emit(top_layout_, emission, source);
+}
+
+void NativeWindow::UpdateProgress(double value) {
+  elm_progressbar_value_set(progressbar_, ELM_SCALE_SIZE(value));
+}
+#endif
+
 }  // namespace runtime