From f272e00aec57df4eccae18414190b990b73564b5 Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Mon, 25 Jun 2012 12:04:27 +0200
Subject: [PATCH] ENH: add methods to modify the resizable status of the widget
 & to get the shown status

---
 Code/Visualization/otbPackedWidgetManager.cxx | 15 +++++++++
 Code/Visualization/otbPackedWidgetManager.h   |  3 +-
 .../otbSplittedWidgetManager.cxx              | 31 +++++++++++++++++++
 Code/Visualization/otbSplittedWidgetManager.h |  4 ++-
 Code/Visualization/otbWidgetManager.h         |  1 +
 5 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/Code/Visualization/otbPackedWidgetManager.cxx b/Code/Visualization/otbPackedWidgetManager.cxx
index 2aac71d95e..c62c3e5db3 100644
--- a/Code/Visualization/otbPackedWidgetManager.cxx
+++ b/Code/Visualization/otbPackedWidgetManager.cxx
@@ -164,4 +164,19 @@ PackedWidgetManager
   return m_PackedWidget->m_Window->shown();
 }
 
+void
+PackedWidgetManager
+::SetResizable(bool resize)
+{
+  if (resize)
+    {
+    m_PackedWidget->m_Window->resizable(m_PackedWidget->m_Window);
+    }
+  else
+    {
+    // If the resizable is NULL then all widgets remain a fixed size
+    m_PackedWidget->m_Window->resizable(NULL);
+    }
+}
+
 }
diff --git a/Code/Visualization/otbPackedWidgetManager.h b/Code/Visualization/otbPackedWidgetManager.h
index 4900fa9779..b0c7fbca2c 100644
--- a/Code/Visualization/otbPackedWidgetManager.h
+++ b/Code/Visualization/otbPackedWidgetManager.h
@@ -63,7 +63,8 @@ public:
   virtual void SetLabelScrollWidget(const char * label);
   virtual void SetLabelFullWidget(const char * label);
   virtual void SetLabelZoomWidget(const char * label);
-  virtual int Shown();
+  virtual int  Shown();
+  virtual void SetResizable(bool resize);
 
 protected:
   /** Constructor */
diff --git a/Code/Visualization/otbSplittedWidgetManager.cxx b/Code/Visualization/otbSplittedWidgetManager.cxx
index c3191cd503..5203b843d6 100644
--- a/Code/Visualization/otbSplittedWidgetManager.cxx
+++ b/Code/Visualization/otbSplittedWidgetManager.cxx
@@ -185,4 +185,35 @@ SplittedWidgetManager
   m_SplittedWidget->m_ZoomGroup->label(label);
 }
 
+int
+SplittedWidgetManager
+::ZoomWidgetShown()
+{
+  return m_SplittedWidget->m_ZoomGroup->shown();
+}
+
+int
+SplittedWidgetManager
+::FullWidgetShown()
+{
+  return m_SplittedWidget->m_FullGroup->shown();
+}
+
+void
+SplittedWidgetManager
+::SetResizable(bool resize)
+{
+  if (resize)
+    {
+    m_SplittedWidget->m_FullGroup->resizable(m_SplittedWidget->m_FullGroup);
+    m_SplittedWidget->m_ZoomGroup->resizable(m_SplittedWidget->m_ZoomGroup);
+    }
+  else
+    {
+    // If the resizable is NULL then all widgets remain a fixed size
+    m_SplittedWidget->m_FullGroup->resizable(NULL);
+    m_SplittedWidget->m_ZoomGroup->resizable(NULL);
+    }
+}
+
 }
diff --git a/Code/Visualization/otbSplittedWidgetManager.h b/Code/Visualization/otbSplittedWidgetManager.h
index a3caf532e4..589bc9c122 100644
--- a/Code/Visualization/otbSplittedWidgetManager.h
+++ b/Code/Visualization/otbSplittedWidgetManager.h
@@ -61,6 +61,9 @@ public:
   virtual void SetLabelScrollWidget(const char * label);
   virtual void SetLabelFullWidget(const char * label);
   virtual void SetLabelZoomWidget(const char * label);
+  virtual int  ZoomWidgetShown();
+  virtual int  FullWidgetShown();
+  virtual void SetResizable(bool resize);
 
 protected:
   /** Constructor */
@@ -79,7 +82,6 @@ private:
   void operator =(const Self&); // purposely not implemented
 
   ImageWidgetSplittedManagerType* m_SplittedWidget;
-
 };
 }
 #endif
diff --git a/Code/Visualization/otbWidgetManager.h b/Code/Visualization/otbWidgetManager.h
index dcd42f1c06..2c4a99bd5d 100644
--- a/Code/Visualization/otbWidgetManager.h
+++ b/Code/Visualization/otbWidgetManager.h
@@ -62,6 +62,7 @@ public:
   virtual void SetLabelScrollWidget(const char * label) = 0;
   virtual void SetLabelFullWidget(const char * label) = 0;
   virtual void SetLabelZoomWidget(const char * label) = 0;
+  virtual void SetResizable(bool resize) = 0;
 
 protected:
   /** Constructor */
-- 
GitLab