Implements WatchBase
[platform/core/appfw/widget-viewer.git] / watch-holder / src / watch_mirror.hh
index 67872f1..24e15fa 100644 (file)
 #include <list>
 #include <memory>
 
-#include <Evas.h>
 #include <bundle.h>
 #include <app_control.h>
 #include <aul_app_com.h>
 #include <vconf.h>
 
-#include "common.hh"
+#include "watch_mirror_base.hh"
 #include "watch.hh"
-#include "ambient_listener.hh"
 
 namespace watch_holder {
 
-class EXPORT_API WatchMirror : public Watch::IEvent, public AmbientListener {
+class EXPORT_API WatchMirror : public WatchMirrorBase {
  public:
   WatchMirror(Evas_Object* win);
   virtual ~WatchMirror();
-  int Listen();
-  std::shared_ptr<ISharableWatch> GetCurrent() const;
-  virtual void OnChanged(const ISharableWatch& watch);
-  virtual void OnAdded(const ISharableWatch& watch);
-  virtual void OnUpdated(const ISharableWatch& watch);
-  virtual void OnRemoved(const ISharableWatch& watch);
-  virtual void OnAmbientChanged(bool enter, tizen_base::Bundle& extra) override;
-  virtual void OnAmbientEvent(EventType ev, std::string sender,
-      tizen_base::Bundle extra) override;
+  void OnChanged(const ISharableWatchBase& watch) override;
+  std::shared_ptr<ISharableWatch> Cast(std::shared_ptr<ISharableWatchBase> watch);
+  const ISharableWatch& Cast(const ISharableWatchBase& watch);
+
+ protected:
+  std::shared_ptr<WatchBase> CreateWatch(int rid, std::string id,
+    std::string appid, bool mock = false) override;
+  std::shared_ptr<WatchBase> CreateWatch(int rid, std::string id,
+    std::string appid, tizen_base::Bundle extra, bool mock = false) override;
 
  private:
-  std::string GetUUID(std::string rid) const;
-  void OnAdded(const Watch& watch) override final;
-  void OnUpdated(const Watch& watch) override final;
-  void OnRemoved(const Watch& watch) override final;
-  void OnBound(const Watch& watch) override final;
-  static void OnChangedSignal(keynode_t *node, void *user_data);
+  void OnChanged(int, std::string inst_id, std::string appid) override;
 
  private:
-  std::string appid_;
-  Evas_Object* win_;
-  aul_app_com_connection_h watch_changed_conn_ = nullptr;
-  std::list<std::shared_ptr<Watch>> stack_;
+  Evas_Object* viewer_win_;
 };
 
 }  // namespace watch_holder