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
This commit is contained in:
Włodzimierz Skiba
2005-02-02 07:02:50 +00:00
parent 1d41ed0a1c
commit 5b72333dfe
3 changed files with 31 additions and 10 deletions

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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