]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 670782 ] Combobox uses popup window width
authorJulian Smart <julian@anthemion.co.uk>
Sun, 2 Feb 2003 14:47:04 +0000 (14:47 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 2 Feb 2003 14:47:04 +0000 (14:47 +0000)
(wxUniv)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/univ/combobox.h
src/univ/combobox.cpp

index 532073b4601eb32851f64e2672e648f2c09d6bfb..2bb7faccb63963b77e70adee1f7b46493f0c9135 100644 (file)
@@ -83,6 +83,8 @@ public:
     // called immediately after the control is shown
     virtual void OnShow() = 0;
 
     // called immediately after the control is shown
     virtual void OnShow() = 0;
 
+    virtual wxCoord GetBestWidth() const {return 0; }
+
 protected:
     wxComboControl *m_combo;
 };
 protected:
     wxComboControl *m_combo;
 };
index 74b01d41744853c650f1f3d4d02c479c7179f396..4f7263b30c95898eb3028d91d06af674ffc7ab89 100644 (file)
@@ -125,6 +125,7 @@ public:
     virtual bool SetSelection(const wxString& value);
     virtual wxControl *GetControl() { return this; }
     virtual void OnShow();
     virtual bool SetSelection(const wxString& value);
     virtual wxControl *GetControl() { return this; }
     virtual void OnShow();
+    virtual wxCoord wxComboListBox::GetBestWidth() const;
 
 protected:
     // we shouldn't return height too big from here
 
 protected:
     // we shouldn't return height too big from here
@@ -300,8 +301,15 @@ wxSize wxComboControl::DoGetBestClientSize() const
 {
     wxSize sizeBtn = m_btn->GetBestSize(),
            sizeText = m_text->GetBestSize();
 {
     wxSize sizeBtn = m_btn->GetBestSize(),
            sizeText = m_text->GetBestSize();
+    wxCoord widthPopup = 0;
 
 
-    return wxSize(sizeText.x + g_comboMargin + sizeBtn.x, wxMax(sizeBtn.y, sizeText.y));
+    if (m_popup)
+    {
+        widthPopup = m_popup->GetBestWidth();
+    }
+
+    return wxSize(wxMax(sizeText.x + g_comboMargin + sizeBtn.x, widthPopup), 
+                  wxMax(sizeBtn.y, sizeText.y));
 }
 
 void wxComboControl::DoMoveWindow(int x, int y, int width, int height)
 }
 
 void wxComboControl::DoMoveWindow(int x, int y, int width, int height)
@@ -615,6 +623,12 @@ void wxComboListBox::OnMouseMove(wxMouseEvent& event)
     }
 }
 
     }
 }
 
+wxCoord wxComboListBox::GetBestWidth() const
+{
+    wxSize size = wxListBox::GetBestSize();
+    return size.x;
+}
+
 wxSize wxComboListBox::DoGetBestClientSize() const
 {
     // don't return size too big or we risk to not fit on the screen
 wxSize wxComboListBox::DoGetBestClientSize() const
 {
     // don't return size too big or we risk to not fit on the screen