diff Framework/Widgets/WidgetBase.h @ 61:ca644004d2ee wasm

MAJOR - removal of Start/Stop and observers in IWidget
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 May 2017 17:55:13 +0200
parents f0f354a97581
children 298f375dcb68
line wrap: on
line diff
--- a/Framework/Widgets/WidgetBase.h	Wed May 10 16:10:47 2017 +0200
+++ b/Framework/Widgets/WidgetBase.h	Wed May 10 17:55:13 2017 +0200
@@ -24,18 +24,17 @@
 #include "IWidget.h"
 
 #include "../Viewport/CairoContext.h"
-#include "../Toolbox/ObserversRegistry.h"
 
 namespace OrthancStone
 {
   class WidgetBase : public IWidget
   {
   private:
-    IStatusBar*                  statusBar_;
-    ObserversRegistry<IWidget>   observers_;
-    bool                         started_;
-    bool                         backgroundCleared_;
-    uint8_t                      backgroundColor_[3];
+    IWidget*     parent_;
+    IViewport*   viewport_;
+    IStatusBar*  statusBar_;
+    bool         backgroundCleared_;
+    uint8_t      backgroundColor_[3];
 
   protected:
     void ClearBackgroundOrthanc(Orthanc::ImageAccessor& target) const;
@@ -44,8 +43,6 @@
 
     void ClearBackgroundCairo(Orthanc::ImageAccessor& target) const;
 
-    void NotifyChange();
-
     void UpdateStatusBar(const std::string& message);
 
     IStatusBar* GetStatusBar() const
@@ -53,14 +50,17 @@
       return statusBar_;
     }
 
-    bool IsStarted() const
-    {
-      return started_;
-    }
-
   public:
     WidgetBase();
 
+    virtual void SetDefaultView()
+    {
+    }
+  
+    virtual void SetParent(IWidget& parent);
+    
+    virtual void SetViewport(IViewport& viewport);
+
     void SetBackgroundCleared(bool clear)
     {
       backgroundCleared_ = clear;
@@ -79,24 +79,11 @@
                             uint8_t& green,
                             uint8_t& blue) const;
 
-    virtual void Register(IChangeObserver& observer);
-
-    virtual void Unregister(IChangeObserver& observer);
-    
     virtual void SetStatusBar(IStatusBar& statusBar)
     {
       statusBar_ = &statusBar;
     }
 
-    virtual void ResetStatusBar()
-    {
-      statusBar_ = NULL;
-    }    
-
-    virtual void Start();
-
-    virtual void Stop();
-
     virtual bool Render(Orthanc::ImageAccessor& surface);
 
     virtual bool HasUpdateContent() const
@@ -110,5 +97,7 @@
     {
       return false;
     }
+
+    virtual void NotifyChange();
   };
 }