#ifndef WX_PRECOMP
#include "wx/choice.h"
+#include "wx/utils.h"
#endif
#include "wx/msw/private.h"
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId);
event.SetInt(GetSelection());
event.SetEventObject(this);
- event.SetString(copystring(GetStringSelection()));
+ event.SetString(GetStringSelection());
ProcessCommand(event);
- delete[] event.GetString();
+
return TRUE;
}
- else return FALSE;
+ else
+ return FALSE;
}
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
if (parent) parent->AddChild(this);
SetBackgroundColour(parent->GetBackgroundColour()) ;
SetForegroundColour(parent->GetForegroundColour()) ;
- m_noStrings = n;
+ m_noStrings = 0;
m_windowStyle = style;
wxCHECK_MSG( m_hWnd, FALSE, "Failed to create combobox" );
/*
-#if CTL3D
+#if wxUSE_CTL3D
if (want3D)
{
m_useCtl3D = TRUE;
// 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++)
return wxString(wxBuffer);
}
-void wxChoice::SetSize(int x, int y, int width, int height, int sizeFlags)
+void wxChoice::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
int currentX, currentY;
GetPosition(¤tX, ¤tY);
int cx; // button font dimensions
int cy;
- wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
+ wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont());
int control_width, control_height;
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;
}
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)
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