]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/layout.cpp
Prepare wxToolBarSimple for event type change.
[wxWidgets.git] / src / common / layout.cpp
index 188d4c6d8f5076d1f783809490aacd815a17d310..8dbb8ea8dc5e93601ff196e31f90c85df0b784d5 100644 (file)
 
 #include "wx/layout.h"
 
 
 #include "wx/layout.h"
 
-#if !USE_SHARED_LIBRARY
     IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject)
     IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
     IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject)
     IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
-#endif
 
 
 wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
 
 
 wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
@@ -68,11 +66,20 @@ wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint()
 
 void wxIndividualLayoutConstraint::Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val, int marg)
 {
 
 void wxIndividualLayoutConstraint::Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val, int marg)
 {
-  relationship = rel;
-  otherWin = otherW;
-  otherEdge = otherE;
-  value = val;
-  margin = marg;
+    relationship = rel;
+    otherWin = otherW;
+    otherEdge = otherE;
+
+    if ( rel == wxPercentOf )
+    {
+        percent = val;
+    }
+    else
+    {
+        value = val;
+    }
+
+    margin = marg;
 }
 
 void wxIndividualLayoutConstraint::LeftOf(wxWindowBase *sibling, int marg)
 }
 
 void wxIndividualLayoutConstraint::LeftOf(wxWindowBase *sibling, int marg)
@@ -100,18 +107,13 @@ void wxIndividualLayoutConstraint::Below(wxWindowBase *sibling, int marg)
 //
 void wxIndividualLayoutConstraint::SameAs(wxWindowBase *otherW, wxEdge edge, int marg)
 { 
 //
 void wxIndividualLayoutConstraint::SameAs(wxWindowBase *otherW, wxEdge edge, int marg)
 { 
-    Set(wxPercentOf, otherW, edge, 0, marg);
-    percent = 100;
+    Set(wxPercentOf, otherW, edge, 100, marg);
 }
 
 // The edge is a percentage of the other window's edge
 void wxIndividualLayoutConstraint::PercentOf(wxWindowBase *otherW, wxEdge wh, int per)
 { 
 }
 
 // The edge is a percentage of the other window's edge
 void wxIndividualLayoutConstraint::PercentOf(wxWindowBase *otherW, wxEdge wh, int per)
 { 
-    otherWin = otherW;
-    relationship = wxPercentOf;
-    percent = per;
-
-    otherEdge = wh;
+    Set(wxPercentOf, otherW, wh, per);
 }
 
 //
 }
 
 //
@@ -119,7 +121,8 @@ void wxIndividualLayoutConstraint::PercentOf(wxWindowBase *otherW, wxEdge wh, in
 //
 void wxIndividualLayoutConstraint::Absolute(int val)
 {
 //
 void wxIndividualLayoutConstraint::Absolute(int val)
 {
-    value = val; relationship = wxAbsolute;
+    value = val;
+    relationship = wxAbsolute;
 }
 
 // Reset constraint if it mentions otherWin
 }
 
 // Reset constraint if it mentions otherWin
@@ -136,8 +139,8 @@ bool wxIndividualLayoutConstraint::ResetIfWin(wxWindowBase *otherW)
         otherWin = (wxWindowBase *) NULL;
         return TRUE;
     }
         otherWin = (wxWindowBase *) NULL;
         return TRUE;
     }
-    else
-        return FALSE;
+
+    return FALSE;
 }
 
 // Try to satisfy constraint
 }
 
 // Try to satisfy constraint