]> git.saurik.com Git - wxWidgets.git/blobdiff - src/palmos/control.cpp
Use empty check consistent with other parts.
[wxWidgets.git] / src / palmos / control.cpp
index 5dd719b4c3666e67afc93993f611c1973f69cc60..3b9b881995a1914e6f47fb3811597882f4537597 100644 (file)
@@ -123,7 +123,14 @@ bool wxControl::PalmCreateControl(ControlStyleType style,
             w = size.x == wxDefaultCoord ? 1 : size.x,
             h = size.y == wxDefaultCoord ? 1 : size.y;
 
-    AdjustForParentClientOrigin(x, y);
+    wxWindow *win = this;
+    while(win->GetParent())
+    {
+        win = win->GetParent();
+        wxPoint pt(win->GetClientAreaOrigin());
+        x += pt.x;
+        y += pt.y;
+    }
 
     ControlType *control = CtlNewControl(
                                (void **)&form,
@@ -286,30 +293,58 @@ void wxControl::DoGetBounds( RectangleType &rect ) const
     FrmGetObjectBounds(form,index,&rect);
 }
 
+void wxControl::DoSetBounds( RectangleType &rect )
+{
+    FormType* form = GetParentForm();
+    if(form==NULL)
+        return;
+    uint16_t index = FrmGetObjectIndex(form,GetId());
+    if(index==frmInvalidObjectId)
+        return;
+    FrmSetObjectBounds(form,index,&rect);
+}
+
 void wxControl::DoGetPosition( int *x, int *y ) const
 {
+    int ox = 0, oy = 0;
+    AdjustForParentClientOrigin(ox, oy);
+
     RectangleType rect;
     DoGetBounds(rect);
+
     if(x)
-        *x = rect.topLeft.x;
+        *x = rect.topLeft.x - ox;
     if(y)
-        *y = rect.topLeft.y;
+        *y = rect.topLeft.y - oy;
 }
 
 void wxControl::DoGetSize( int *width, int *height ) const
 {
     RectangleType rect;
     DoGetBounds(rect);
+
     if(width)
         *width = rect.extent.x;
     if(height)
         *height = rect.extent.y;
 }
 
+void wxControl::DoMoveWindow(int x, int y, int width, int height)
+{
+    wxRect area = GetRect();
+    RectangleType rect;
+    rect.topLeft.x = x;
+    rect.topLeft.y = y;
+    rect.extent.x = width;
+    rect.extent.y = height;
+    DoSetBounds(rect);
+    GetParent()->Refresh(true, &area);
+}
+
 bool wxControl::Enable(bool enable)
 {
     ControlType *control = (ControlType *)GetObjectPtr();
-    if( (IsPalmControl()) || (control == NULL))
+    if( !IsPalmControl() || (control == NULL))
         return false;
     if( CtlEnabled(control) == enable)
         return false;
@@ -320,7 +355,7 @@ bool wxControl::Enable(bool enable)
 bool wxControl::IsEnabled() const
 {
     ControlType *control = (ControlType *)GetObjectPtr();
-    if( (IsPalmControl()) || (control == NULL))
+    if( !IsPalmControl() || (control == NULL))
         return false;
     return CtlEnabled(control);
 }
@@ -468,17 +503,4 @@ void wxControl::OnEraseBackground(wxEraseEvent& event)
 {
 }
 
-WXHBRUSH wxControl::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(nCtlColor),
-                               WXUINT WXUNUSED(message),
-                               WXWPARAM WXUNUSED(wParam),
-                               WXLPARAM WXUNUSED(lParam)
-    )
-{
-    return (WXHBRUSH)0;
-}
-
-// ---------------------------------------------------------------------------
-// global functions
-// ---------------------------------------------------------------------------
-
 #endif // wxUSE_CONTROLS