From: Włodzimierz Skiba Date: Wed, 2 Feb 2005 07:02:50 +0000 (+0000) Subject: Flags for wxStaticText alignment. Destroying of the control. Internal minor reorganiz... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5b72333dfeb4eca184507c1c2d3a890c997a433f Flags for wxStaticText alignment. Destroying of the control. Internal minor reorganization. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/palmos/control.h b/include/wx/palmos/control.h index fb8b83cb57..08a1918e0e 100644 --- a/include/wx/palmos/control.h +++ b/include/wx/palmos/control.h @@ -78,7 +78,7 @@ public: protected: // regardless how deeply we are in wxWidgets hierarchy always get correct form FormType* GetParentForm() const; - uint16_t GetObjectIndex() const; + FormType* GetObjectFormIndex(uint16_t& index) const; void* GetObjectPtr() const; // choose the default border for this window diff --git a/src/palmos/control.cpp b/src/palmos/control.cpp index 88fd6fac82..b9bb06863e 100644 --- a/src/palmos/control.cpp +++ b/src/palmos/control.cpp @@ -74,6 +74,15 @@ wxControl::~wxControl() { SetLabel(wxEmptyString); m_isBeingDeleted = true; + + DestroyChildren(); + + uint16_t index; + FormType* form = GetObjectFormIndex(index); + if(form!=NULL && index!=frmInvalidObjectId) + { + FrmRemoveObject((FormType **)&form,index); + } } // ---------------------------------------------------------------------------- @@ -119,7 +128,7 @@ bool wxControl::PalmCreateControl(ControlStyleType style, ( size.y == wxDefaultCoord ) ? winUndefConstraint : size.y, stdFont, groupID, - false + true ); if(control==NULL) @@ -191,19 +200,21 @@ FormType* wxControl::GetParentForm() const return tlw->GetForm(); } -uint16_t wxControl::GetObjectIndex() const +FormType* wxControl::GetObjectFormIndex(uint16_t& index) const { FormType* form = GetParentForm(); - if(form==NULL)return frmInvalidObjectId; - return FrmGetObjectIndex(form, GetId()); + if(form!=NULL) + index = FrmGetObjectIndex(form, GetId()); + else + index = frmInvalidObjectId; + return form; } void* wxControl::GetObjectPtr() const { - FormType* form = GetParentForm(); - if(form==NULL)return NULL; - uint16_t index = FrmGetObjectIndex(form, GetId()); - if(index==frmInvalidObjectId)return NULL; + uint16_t index; + FormType* form = GetObjectFormIndex(index); + if(form==NULL || index==frmInvalidObjectId)return NULL; return FrmGetObjectPtr(form,index); } diff --git a/src/palmos/stattext.cpp b/src/palmos/stattext.cpp index 789e227e3f..61ec4eb58c 100644 --- a/src/palmos/stattext.cpp +++ b/src/palmos/stattext.cpp @@ -94,7 +94,17 @@ bool wxStaticText::Create(wxWindow *parent, if(!wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name)) return false; - return wxControl::PalmCreateField(label, pos, size, false, false, leftAlign); + // note that wxALIGN_LEFT is equal to 0 so we shouldn't + // test for it using & operator + + JustificationType align = leftAlign; + + if ( style & wxALIGN_CENTRE ) + align = centerAlign ; + else if ( style & wxALIGN_RIGHT ) + align = rightAlign; + + return wxControl::PalmCreateField(label, pos, size, false, false, align); } wxBorder wxStaticText::GetDefaultBorder() const