From 9cc37dc4cf4a1f695880560664e7cab6ce386d1a Mon Sep 17 00:00:00 2001
From: Lendemor <thomas.brandeho@gmail.com>
Date: Thu, 23 Feb 2017 19:02:38 +0100
Subject: [PATCH] add scrollable content

---
 doc/sceneClasses.graphml                | 90 +++++++++++++++++--------
 src/scene/gui/callback.h                |  1 -
 src/scene/gui/scrollablecontentnode.cpp |  6 ++
 src/scene/gui/scrollablecontentnode.h   | 12 ++++
 src/scene/gui/scrollbarnode.cpp         |  3 +
 5 files changed, 83 insertions(+), 29 deletions(-)
 create mode 100644 src/scene/gui/scrollablecontentnode.cpp
 create mode 100644 src/scene/gui/scrollablecontentnode.h

diff --git a/doc/sceneClasses.graphml b/doc/sceneClasses.graphml
index a199776..27c7361 100644
--- a/doc/sceneClasses.graphml
+++ b/doc/sceneClasses.graphml
@@ -253,13 +253,12 @@
       </data>
     </node>
     <node id="n14">
-      <data key="d5"/>
       <data key="d6">
         <y:ShapeNode>
-          <y:Geometry height="45.282162162162194" width="126.60681114551085" x="1.6585581600736532E-4" y="296.2821621621622"/>
+          <y:Geometry height="45.282162162162194" width="150.0" x="-23.393022998673132" y="296.2821621621622"/>
           <y:Fill color="#FFCC00" transparent="false"/>
           <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
-          <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.701171875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="98.72265625" x="13.942077447755423" y="13.290495143581097">ScrollableContent<y:LabelModel>
+          <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.701171875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="127.41015625" x="11.294921875" y="13.290495143581097">ScrollableContentNode<y:LabelModel>
               <y:SmartNodeLabelModel distance="4.0"/>
             </y:LabelModel>
             <y:ModelParameter>
@@ -454,6 +453,23 @@
         </node>
       </graph>
     </node>
+    <node id="n16">
+      <data key="d6">
+        <y:ShapeNode>
+          <y:Geometry height="45.282162162162194" width="123.71280388978928" x="-144.11107955264788" y="376.878825178501"/>
+          <y:Fill color="#FFCC00" transparent="false"/>
+          <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
+          <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.701171875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="108.056640625" x="7.828081632394657" y="13.290495143581097">TextContainerNode<y:LabelModel>
+              <y:SmartNodeLabelModel distance="4.0"/>
+            </y:LabelModel>
+            <y:ModelParameter>
+              <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
+            </y:ModelParameter>
+          </y:NodeLabel>
+          <y:Shape type="rectangle"/>
+        </y:ShapeNode>
+      </data>
+    </node>
     <edge id="e0" source="n1" target="n2">
       <data key="d10">
         <y:PolyLineEdge>
@@ -713,31 +729,6 @@
         </y:PolyLineEdge>
       </data>
     </edge>
-    <edge id="e21" source="n14" target="n12">
-      <data key="d10">
-        <y:PolyLineEdge>
-          <y:Path sx="31.65170278637771" sy="22.641081081081097" tx="-24.576162162162035" ty="-18.5">
-            <y:Point x="94.95527421494914" y="351.5643243243244"/>
-            <y:Point x="71.22820291720305" y="351.5643243243244"/>
-          </y:Path>
-          <y:LineStyle color="#FF6600" type="line" width="1.0"/>
-          <y:Arrows source="none" target="standard"/>
-          <y:BendStyle smoothed="false"/>
-        </y:PolyLineEdge>
-      </data>
-    </edge>
-    <edge id="e22" source="n14" target="n7">
-      <data key="d10">
-        <y:GenericEdge configuration="com.yworks.edge.framed">
-          <y:Path sx="-31.65170278637771" sy="22.641081081081097" tx="-27.0" ty="-18.5">
-            <y:Point x="31.651984126984125" y="538.8464864864866"/>
-            <y:Point x="195.87698412698413" y="538.8464864864866"/>
-          </y:Path>
-          <y:LineStyle color="#000000" type="line" width="3.0"/>
-          <y:Arrows source="none" target="standard"/>
-        </y:GenericEdge>
-      </data>
-    </edge>
     <edge id="n15::e0" source="n15::n0" target="n15::n1">
       <data key="d10">
         <y:PolyLineEdge>
@@ -767,6 +758,49 @@
         </y:PolyLineEdge>
       </data>
     </edge>
+    <edge id="e21" source="n14" target="n11">
+      <data key="d10">
+        <y:PolyLineEdge>
+          <y:Path sx="-28.646076590341956" sy="22.16275012816004" tx="0.0" ty="0.0">
+            <y:Point x="22.960900410984912" y="457.7054054054055"/>
+          </y:Path>
+          <y:LineStyle color="#FF6600" type="line" width="1.0"/>
+          <y:Arrows source="none" target="standard"/>
+          <y:BendStyle smoothed="false"/>
+        </y:PolyLineEdge>
+      </data>
+    </edge>
+    <edge id="e22" source="n14" target="n12">
+      <data key="d10">
+        <y:PolyLineEdge>
+          <y:Path sx="11.696594427244563" sy="-4.964640471515793" tx="-32.50079365079365" ty="0.0"/>
+          <y:LineStyle color="#FF6600" type="line" width="1.0"/>
+          <y:Arrows source="none" target="standard"/>
+          <y:BendStyle smoothed="false"/>
+        </y:PolyLineEdge>
+      </data>
+    </edge>
+    <edge id="e23" source="n14" target="n16">
+      <data key="d10">
+        <y:PolyLineEdge>
+          <y:Path sx="-47.54722997374785" sy="-2.2673147016616326" tx="0.0" ty="0.0"/>
+          <y:LineStyle color="#FF6600" type="line" width="1.0"/>
+          <y:Arrows source="none" target="standard"/>
+          <y:BendStyle smoothed="false"/>
+        </y:PolyLineEdge>
+      </data>
+    </edge>
+    <edge id="e24" source="n16" target="n7">
+      <data key="d10">
+        <y:GenericEdge configuration="com.yworks.edge.framed">
+          <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
+            <y:Point x="-82.25467760775325" y="595.8464864864866"/>
+          </y:Path>
+          <y:LineStyle color="#000000" type="line" width="3.0"/>
+          <y:Arrows source="none" target="standard"/>
+        </y:GenericEdge>
+      </data>
+    </edge>
   </graph>
   <data key="d7">
     <y:Resources/>
diff --git a/src/scene/gui/callback.h b/src/scene/gui/callback.h
index c02636f..e272bd6 100644
--- a/src/scene/gui/callback.h
+++ b/src/scene/gui/callback.h
@@ -4,7 +4,6 @@
 class CallBack
 {
 public:
-    CallBack(){}
     virtual void exec()=0;
 };
 
diff --git a/src/scene/gui/scrollablecontentnode.cpp b/src/scene/gui/scrollablecontentnode.cpp
new file mode 100644
index 0000000..100d935
--- /dev/null
+++ b/src/scene/gui/scrollablecontentnode.cpp
@@ -0,0 +1,6 @@
+#include "scrollablecontentnode.h"
+
+ScrollableContentNode::ScrollableContentNode()
+{
+
+}
diff --git a/src/scene/gui/scrollablecontentnode.h b/src/scene/gui/scrollablecontentnode.h
new file mode 100644
index 0000000..0735351
--- /dev/null
+++ b/src/scene/gui/scrollablecontentnode.h
@@ -0,0 +1,12 @@
+#ifndef SCROLLABLECONTENTNODE_H
+#define SCROLLABLECONTENTNODE_H
+
+#include "guinode.h"
+
+class ScrollableContentNode : public GUINode
+{
+public:
+    ScrollableContentNode();
+};
+
+#endif // SCROLLABLECONTENTNODE_H
diff --git a/src/scene/gui/scrollbarnode.cpp b/src/scene/gui/scrollbarnode.cpp
index d4d91df..2abd15e 100644
--- a/src/scene/gui/scrollbarnode.cpp
+++ b/src/scene/gui/scrollbarnode.cpp
@@ -14,6 +14,9 @@ ScrollBarNode::ScrollBarNode(glm::vec2 dimension, glm::vec3 bar_color):
     m_bar_dimension(dimension),
     m_bar_color(bar_color),
     m_bar_color_updated(false),
+    m_index_position(0),
+    m_bar_size(0),
+    m_total_size(0),
     m_bar_resized(false),
     m_bar_moved(false)
 {