]> git.mxchange.org Git - simgear.git/blobdiff - simgear/canvas/layout/LayoutItem.cxx
canvas::Text: add heightForWidth method.
[simgear.git] / simgear / canvas / layout / LayoutItem.cxx
index 31be629ea309116211ffb5238d13215277094fad..1dfc07d935a9e872455101c57c98c9774172139c 100644 (file)
@@ -23,10 +23,15 @@ namespace simgear
 {
 namespace canvas
 {
+  const SGVec2i LayoutItem::MAX_SIZE( SGLimits<int>::max(),
+                                      SGLimits<int>::max() );
 
   //----------------------------------------------------------------------------
   LayoutItem::LayoutItem():
-    _flags(0)
+    _flags(0),
+    _size_hint(16, 16),
+    _min_size(0, 0),
+    _max_size(MAX_SIZE)
   {
     invalidate();
   }
@@ -73,6 +78,24 @@ namespace canvas
     return _max_size;
   }
 
+  //----------------------------------------------------------------------------
+  bool LayoutItem::hasHeightForWidth() const
+  {
+    return false;
+  }
+
+  //----------------------------------------------------------------------------
+  int LayoutItem::heightForWidth(int w) const
+  {
+    return -1;
+  }
+
+  //------------------------------------------------------------------------------
+  int LayoutItem::minimumHeightForWidth(int w) const
+  {
+    return heightForWidth(w);
+  }
+
   //----------------------------------------------------------------------------
   void LayoutItem::invalidate()
   {
@@ -132,19 +155,19 @@ namespace canvas
   //----------------------------------------------------------------------------
   SGVec2i LayoutItem::sizeHintImpl() const
   {
-    return SGVec2i(16, 16);
+    return _size_hint;
   }
 
   //----------------------------------------------------------------------------
   SGVec2i LayoutItem::minimumSizeImpl() const
   {
-    return SGVec2i(0, 0);
+    return _min_size;
   }
 
   //----------------------------------------------------------------------------
   SGVec2i LayoutItem::maximumSizeImpl() const
   {
-    return SGVec2i(SGLimits<int>::max(), SGLimits<int>::max());
+    return _max_size;
   }
 
 } // namespace canvas