X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/324eeecb3cdc9522e136af6670443148772b412a..9b89f11ad8f5456b6823598f7f2c3c1070a6f10c:/src/palmos/control.cpp diff --git a/src/palmos/control.cpp b/src/palmos/control.cpp index 5f60d345ca..3b9b881995 100644 --- a/src/palmos/control.cpp +++ b/src/palmos/control.cpp @@ -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, @@ -299,18 +306,23 @@ void wxControl::DoSetBounds( RectangleType &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) @@ -332,7 +344,7 @@ void wxControl::DoMoveWindow(int x, int y, int width, int height) 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; @@ -343,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); }