]> git.saurik.com Git - wxWidgets.git/commitdiff
Use parents client size and origin in placement of controls.
authorWłodzimierz Skiba <abx@abx.art.pl>
Fri, 11 Feb 2005 06:56:47 +0000 (06:56 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Fri, 11 Feb 2005 06:56:47 +0000 (06:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/palmos/button.cpp
src/palmos/control.cpp
src/palmos/frame.cpp
src/palmos/slider.cpp

index f8ec74481c13eba54fddd0d3eb7104f65fc6574f..262972367ce46117ddac17d9207f67ab3486562d 100644 (file)
@@ -138,7 +138,7 @@ bool wxButton::Create(wxWindow *parent,
     wxPoint palmPos(pos);
     if((palmPos.x==wxDefaultCoord)||(palmPos.y==wxDefaultCoord))
     {
-        wxSize parentSize(parent->GetSize());
+        wxSize parentSize(parent->GetClientSize());
         wxWindow* parentTLW = parent;
         while ( parentTLW && !parentTLW->IsTopLevel() )
         {
@@ -148,14 +148,14 @@ bool wxButton::Create(wxWindow *parent,
         if(wxDynamicCast(parentTLW, wxFrame)!=NULL)
         {
             if(palmPos.x==wxDefaultCoord)
-                palmPos.x = 1;
+                palmPos.x = 0;
             if(palmPos.y==wxDefaultCoord)
                 palmPos.y = parentSize.y-palmSize.y;
         }
         else if(wxDynamicCast(parentTLW, wxDialog)!=NULL)
         {
             if(palmPos.x==wxDefaultCoord)
-                palmPos.x = 5;
+                palmPos.x = 4;
             if(palmPos.y==wxDefaultCoord)
                 palmPos.y = parentSize.y-palmSize.y-5;
         }
index 0d68b270555a3a6bb20718bc9c0b236b00d00597..5dd719b4c3666e67afc93993f611c1973f69cc60 100644 (file)
@@ -117,15 +117,23 @@ bool wxControl::PalmCreateControl(ControlStyleType style,
     if(form==NULL)
         return false;
 
+
+    wxCoord x = pos.x == wxDefaultCoord ? 0 : pos.x,
+            y = pos.y == wxDefaultCoord ? 0 : pos.y,
+            w = size.x == wxDefaultCoord ? 1 : size.x,
+            h = size.y == wxDefaultCoord ? 1 : size.y;
+
+    AdjustForParentClientOrigin(x, y);
+
     ControlType *control = CtlNewControl(
                                (void **)&form,
                                GetId(),
                                style,
                                wxEmptyString,
-                               ( pos.x == wxDefaultCoord ) ? winUndefConstraint : pos.x,
-                               ( pos.y == wxDefaultCoord ) ? winUndefConstraint : pos.y,
-                               ( size.x == wxDefaultCoord ) ? winUndefConstraint : size.x,
-                               ( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y,
+                               x,
+                               y,
+                               w,
+                               h,
                                stdFont,
                                groupID,
                                true
@@ -136,6 +144,7 @@ bool wxControl::PalmCreateControl(ControlStyleType style,
 
     m_palmControl = true;
 
+    SetInitialBestSize(size);
     SetLabel(label);
     Show();
     return true;
@@ -154,13 +163,20 @@ bool wxControl::PalmCreateField(const wxString& label,
 
     m_label = label;
 
+    wxCoord x = pos.x == wxDefaultCoord ? 0 : pos.x,
+            y = pos.y == wxDefaultCoord ? 0 : pos.y,
+            w = size.x == wxDefaultCoord ? 1 : size.x,
+            h = size.y == wxDefaultCoord ? 1 : size.y;
+
+    AdjustForParentClientOrigin(x, y);
+
     FieldType *field = FldNewField(
                            (void **)&form,
                            GetId(),
-                           ( pos.x == wxDefaultCoord ) ? winUndefConstraint : pos.x,
-                           ( pos.y == wxDefaultCoord ) ? winUndefConstraint : pos.y,
-                           ( size.x == wxDefaultCoord ) ? winUndefConstraint : size.x,
-                           ( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y,
+                           x,
+                           y,
+                           w,
+                           h,
                            stdFont,
                            10,
                            editable,
@@ -178,8 +194,9 @@ bool wxControl::PalmCreateField(const wxString& label,
 
     m_palmField = true;
 
-    Show();
+    SetInitialBestSize(size);
     SetLabel(label);
+    Show();
     return true;
 }
 
index c81817af9299809c46f35c59c77839eb2eeef0b3..6015a059d34d8bd08ef16875c7139588f243fcb8 100644 (file)
@@ -183,6 +183,10 @@ void wxFrame::DoSetClientSize(int width, int height)
 // Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
 void wxFrame::DoGetClientSize(int *x, int *y) const
 {
+    wxSize size = GetSize();
+    wxPoint pos = GetClientAreaOrigin();
+    *x = size.x - pos.x - 1;
+    *y = size.y - pos.y - 1;
 }
 
 // ----------------------------------------------------------------------------
index 8c9b711b7cf430a4009d16716835bb13d4096d7c..40c62201836ac12c041d19335c695f35518fd75f 100644 (file)
@@ -130,6 +130,13 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
 
     m_oldValue = m_oldPos = value;
 
+    wxCoord x = pos.x == wxDefaultCoord ? 0 : pos.x,
+            y = pos.y == wxDefaultCoord ? 0 : pos.y,
+            w = size.x == wxDefaultCoord ? 1 : size.x,
+            h = size.y == wxDefaultCoord ? 1 : size.y;
+
+    AdjustForParentClientOrigin(x, y);
+
     SliderControlType *slider = CtlNewSliderControl (
                                    (void **)&form,
                                    GetId(),
@@ -137,10 +144,10 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
                                    NULL,
                                    0,
                                    0,
-                                   pos.x,
-                                   pos.y,
-                                   size.x,
-                                   size.y,
+                                   x,
+                                   y,
+                                   w,
+                                   h,
                                    minValue,
                                    maxValue,
                                    1,
@@ -150,6 +157,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
     if(slider==NULL)
         return false;
 
+    SetInitialBestSize(size);
     Show();
     return true;
 }