]> git.saurik.com Git - wxWidgets.git/blobdiff - src/palmos/control.cpp
Lock whole screen when popup is open under GTK+.
[wxWidgets.git] / src / palmos / control.cpp
index 54b61fd862cb6731dddd247758ebbd44488384b3..b9bb06863ef0a285d20efdf46b205731a3dbc4b7 100644 (file)
@@ -72,7 +72,17 @@ void wxControl::Init()
 
 wxControl::~wxControl()
 {
+    SetLabel(wxEmptyString);
     m_isBeingDeleted = true;
+
+    DestroyChildren();
+
+    uint16_t index;
+    FormType* form = GetObjectFormIndex(index);
+    if(form!=NULL && index!=frmInvalidObjectId)
+    {
+        FrmRemoveObject((FormType **)&form,index);
+    }
 }
 
 // ----------------------------------------------------------------------------
@@ -107,20 +117,18 @@ bool wxControl::PalmCreateControl(ControlStyleType style,
     if(form==NULL)
         return false;
 
-    m_label = label;
-
     ControlType *control = CtlNewControl(
                                (void **)&form,
                                GetId(),
                                style,
-                               m_label.c_str(),
+                               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,
                                stdFont,
                                groupID,
-                               false
+                               true
                            );
 
     if(control==NULL)
@@ -128,6 +136,7 @@ bool wxControl::PalmCreateControl(ControlStyleType style,
 
     m_palmControl = true;
 
+    SetLabel(label);
     Show();
     return true;
 }
@@ -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);
 }
 
@@ -350,6 +361,13 @@ void wxControl::SetFieldLabel(const wxString& label)
 
 void wxControl::SetControlLabel(const wxString& label)
 {
+    ControlType* control = (ControlType*)GetObjectPtr();
+    if(control==NULL)
+        return;
+    CtlSetLabel(control,wxEmptyString);
+    m_label = label;
+    if(!m_label.empty())
+        CtlSetLabel(control,m_label.c_str());
 }
 
 void wxControl::SetLabel(const wxString& label)