]> git.saurik.com Git - wxWidgets.git/commitdiff
[ 1493802 ] Allow multiple wxComboCtrl::SetPopupControl calls.
authorWłodzimierz Skiba <abx@abx.art.pl>
Wed, 24 May 2006 09:29:06 +0000 (09:29 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Wed, 24 May 2006 09:29:06 +0000 (09:29 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/combo.h
include/wx/odcombo.h
src/common/combocmn.cpp

index 213409a74b321ac3624857daadeabea2fd2ab2e1..c821f1e328a4bf28239fbe9884d03e985c0f51ce 100644 (file)
@@ -375,6 +375,9 @@ protected:
     // Creates popup window, calls interface->Create(), etc
     void CreatePopup();
 
+    // Destroy popup window and all related constructs
+    void DestroyPopup();
+
     // override the base class virtuals involved in geometry calculations
     virtual void DoMoveWindow(int x, int y, int width, int height);
     virtual wxSize DoGetBestSize() const;
index 832778c23789606bf62daf91d3c72807bdd1ea48..3c960cb4ee2dcd04da8590d6ec665c68831a3a43 100644 (file)
@@ -125,7 +125,7 @@ protected:
 
     // sends combobox select event from the parent combo control
     void SendComboBoxEvent( int selection );
-    
+
     // gets value, sends event and dismisses
     void DismissWithEvent();
 
@@ -221,7 +221,7 @@ public:
                          const wxPoint& pos,
                          const wxSize& size,
                          const wxArrayString& choices,
-                         long style = 0,
+                         long style,
                          const wxValidator& validator = wxDefaultValidator,
                          const wxString& name = wxComboBoxNameStr);
 
@@ -262,6 +262,13 @@ public:
     virtual int GetSelection() const;
     virtual void SetSelection(int n) { Select(n); }
 
+
+    // Prevent a method from being hidden
+    virtual void SetSelection(long from, long to)
+    {
+        wxComboCtrl::SetSelection(from,to);
+    }
+
     wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
 
 protected:
@@ -294,5 +301,6 @@ private:
 
 
 #endif // wxUSE_ODCOMBOBOX
+
 #endif
     // _WX_ODCOMBO_H_
index e78ccaaa1ac4d2755bfbce26ab37ec74ba176eb1..356689bf702ef0120c66fdbfca0fa301aaf746bc 100644 (file)
@@ -774,15 +774,7 @@ wxComboCtrlBase::~wxComboCtrlBase()
     m_toplevEvtHandler = (wxEvtHandler*) NULL;
 #endif
 
-    if ( m_popup )
-        m_popup->RemoveEventHandler(m_popupExtraHandler);
-
-    delete m_popupExtraHandler;
-
-    HidePopup();
-
-    delete m_popupInterface;
-    delete m_winPopup;
+    DestroyPopup();
 
     RemoveEventHandler(m_extraEvtHandler);
 
@@ -1531,19 +1523,38 @@ void wxComboCtrlBase::CreatePopup()
     popupInterface->m_iFlags |= wxCP_IFLAG_CREATED;
 }
 
+// Destroy popup window and the child control
+void wxComboCtrlBase::DestroyPopup()
+{
+    if ( m_popup )
+        m_popup->RemoveEventHandler(m_popupExtraHandler);
+
+    delete m_popupExtraHandler;
+
+    HidePopup();
+
+    delete m_popupInterface;
+
+    if ( m_winPopup )
+        m_winPopup->Destroy();
+
+    m_popupInterface = (wxComboPopup*) NULL;
+    m_winPopup = (wxWindow*) NULL;
+    m_popup = (wxWindow*) NULL;
+}
+
 void wxComboCtrlBase::SetPopupControl( wxComboPopup* iface )
 {
     wxCHECK_RET( iface, wxT("no popup interface set for wxComboCtrl") );
 
-    delete m_popupInterface;
-    delete m_winPopup;
+    DestroyPopup();
 
     iface->InitBase(this);
     iface->Init();
 
     m_popupInterface = iface;
 
-    if ( !iface->LazyCreate() || m_winPopup )
+    if ( !iface->LazyCreate() )
     {
         CreatePopup();
     }