X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c085e333984dc079a001cd3f581aeb1f51a1f227..89077ebcc8990c84d94a601b221210d3ff7a8ec7:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 956e0e418c..26b67c9d36 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -22,6 +22,7 @@ #ifndef WX_PRECOMP #include "wx/choice.h" +#include "wx/utils.h" #endif #include "wx/msw/private.h" @@ -105,7 +106,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, // Subclass again for purposes of dialog editing mode SubclassWin(m_hWnd); - SetFont(* parent->GetFont()); + SetFont(parent->GetFont()); int i; for (i = 0; i < n; i++) @@ -204,7 +205,7 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) int cx; // button font dimensions int cy; - wxGetCharSize(GetHWND(), &cx, &cy, GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont()); int control_width, control_height; @@ -232,7 +233,7 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) for (i = 0; i < m_noStrings; i++) { wxString str(GetString(i)); - GetTextExtent(str, &len, &ht, NULL, NULL,GetFont()); + GetTextExtent(str, &len, &ht, NULL, NULL, & this->GetFont()); if ( len > longest) longest = len; } @@ -240,6 +241,12 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) control_width = longest + cx*5; } } + else + { + // If non-default width... + control_width = w1; + } + // Choice drop-down list depends on number of items (limited to 10) if (h1 <= 0) @@ -250,10 +257,6 @@ void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags) h1 = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)*(wxMin(10, m_noStrings) + 1); } - // If non-default width... - if (w1 >= 0) - control_width = w1; - control_height = h1; // Calculations may have made text size too small