]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/sizer.cpp
fix WXDLLIMPEXP_STC definition when building all wx libraries as DLLs (patch 1704527)
[wxWidgets.git] / src / common / sizer.cpp
index 06a9bf2e49e58fdaaf10948b8bff5cab7cd4853b..5f3c324720f396a19abe40cfdcb75d529eb3603f 100644 (file)
@@ -587,13 +587,9 @@ bool wxSizer::Remove( int index )
 
     wxCHECK_MSG( node, false, _T("Failed to find child node") );
 
 
     wxCHECK_MSG( node, false, _T("Failed to find child node") );
 
-    wxSizerItem *item = node->GetData();
-
-    if ( item->IsWindow() )
-        item->GetWindow()->SetContainingSizer( NULL );
-
-    delete item;
+    delete node->GetData();
     m_children.Erase( node );
     m_children.Erase( node );
+
     return true;
 }
 
     return true;
 }
 
@@ -630,7 +626,6 @@ bool wxSizer::Detach( wxWindow *window )
 
         if (item->GetWindow() == window)
         {
 
         if (item->GetWindow() == window)
         {
-            item->GetWindow()->SetContainingSizer( NULL );
             delete item;
             m_children.Erase( node );
             return true;
             delete item;
             m_children.Erase( node );
             return true;
@@ -655,8 +650,6 @@ bool wxSizer::Detach( int index )
 
     if ( item->IsSizer() )
         item->DetachSizer();
 
     if ( item->IsSizer() )
         item->DetachSizer();
-    else if ( item->IsWindow() )
-        item->GetWindow()->SetContainingSizer( NULL );
 
     delete item;
     m_children.Erase( node );
 
     delete item;
     m_children.Erase( node );
@@ -675,8 +668,7 @@ bool wxSizer::Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive )
 
         if (item->GetWindow() == oldwin)
         {
 
         if (item->GetWindow() == oldwin)
         {
-            item->GetWindow()->SetContainingSizer( NULL );
-            item->SetWindow(newwin);
+            item->AssignWindow(newwin);
             newwin->SetContainingSizer( this );
             return true;
         }
             newwin->SetContainingSizer( this );
             return true;
         }
@@ -704,9 +696,7 @@ bool wxSizer::Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive )
 
         if (item->GetSizer() == oldsz)
         {
 
         if (item->GetSizer() == oldsz)
         {
-            wxSizer *old = item->GetSizer();
-            item->SetSizer(newsz);
-            delete old;
+            item->AssignSizer(newsz);
             return true;
         }
         else if (recursive && item->IsSizer())
             return true;
         }
         else if (recursive && item->IsSizer())
@@ -1972,6 +1962,7 @@ void wxStdDialogButtonSizer::AddButton(wxButton *mybutton)
             m_buttonNegative = mybutton;
             break;
         case wxID_CANCEL:
             m_buttonNegative = mybutton;
             break;
         case wxID_CANCEL:
+        case wxID_CLOSE:
             m_buttonCancel = mybutton;
             break;
         case wxID_HELP:
             m_buttonCancel = mybutton;
             break;
         case wxID_HELP:
@@ -2050,15 +2041,17 @@ void wxStdDialogButtonSizer::Realize()
             Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
         }
 
             Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
         }
 
+        // according to HIG, in explicit apply windows the order is: 
+        // [ Help                     Apply   Cancel   OK ]
+        if (m_buttonApply)
+            Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
+
         if (m_buttonCancel){
             Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
             // Cancel or help should be default
             // m_buttonCancel->SetDefaultButton();
         }
 
         if (m_buttonCancel){
             Add((wxWindow*)m_buttonCancel, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
             // Cancel or help should be default
             // m_buttonCancel->SetDefaultButton();
         }
 
-        if (m_buttonApply)
-            Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
-
         if (m_buttonAffirmative)
             Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT, 6);
 #elif defined(__WXMSW__)
         if (m_buttonAffirmative)
             Add((wxWindow*)m_buttonAffirmative, 0, wxALIGN_CENTRE | wxLEFT, 6);
 #elif defined(__WXMSW__)