wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
IMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl,"wx/choice.h")
wxBEGIN_PROPERTIES_TABLE(wxChoice)
- wxEVENT_PROPERTY( Select , wxEVT_COMMAND_CHOICE_SELECTED , wxCommandEvent )
+ wxEVENT_PROPERTY( Select , wxEVT_COMMAND_CHOICE_SELECTED , wxCommandEvent )
- wxPROPERTY( Font , wxFont , SetFont , GetFont , , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxPROPERTY( Selection ,int, SetSelection, GetSelection, , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
- wxPROPERTY_FLAGS( WindowStyle , wxChoiceStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
+ wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+ wxPROPERTY_FLAGS( WindowStyle , wxChoiceStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
wxEND_PROPERTIES_TABLE()
wxBEGIN_HANDLERS_TABLE(wxChoice)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_4( wxChoice , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
+wxCONSTRUCTOR_4( wxChoice , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
#else
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
#endif
/*
- TODO PROPERTIES
- selection (long)
- content (list)
- item
+ TODO PROPERTIES
+ selection (long)
+ content (list)
+ item
*/
// ============================================================================
bool wxChoice::CreateAndInit(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
- const wxSize& sizeOrig,
+ const wxSize& size,
int n, const wxString choices[],
long style,
const wxValidator& validator,
const wxString& name)
{
- // this is a bit hackish but we want to prevent MSWCreateControl() from
- // calling SetBestSize() (which it would do if any of the size components
- // is not given) because it wouldn't calculate it correctly if we have any
- // strings as they're not yet added to the control when it is called
- //
- // so: if we have any strings, we fudge the size parameter so that
- // SetBestSize() is not called by MSWCreateControl() but then we do call it
- // manually below
- bool autoSize = false;
- wxSize size = sizeOrig;
- if ( n )
- {
- if ( size.x < 0 )
- {
- size.x = 1;
- autoSize = true;
- }
- if ( size.y < 0 )
- {
- size.y = 1;
- autoSize = true;
- }
- }
-
// initialize wxControl
if ( !CreateControl(parent, id, pos, size, style, validator, name) )
return FALSE;
}
// and now we may finally size the control properly (if needed)
- if ( autoSize )
- {
- SetBestSize(sizeOrig);
- }
+ SetBestSize(size);
return TRUE;
}
int wxChoice::DoAppend(const wxString& item)
{
- int n = (int)SendMessage(GetHwnd(), CB_ADDSTRING, 0, (LONG)item.c_str());
+ int n = (int)SendMessage(GetHwnd(), CB_ADDSTRING, 0, (LPARAM)item.c_str());
if ( n == CB_ERR )
{
wxLogLastError(wxT("SendMessage(CB_ADDSTRING)"));
wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index"));
- int n = (int)SendMessage(GetHwnd(), CB_INSERTSTRING, pos, (LONG)item.c_str());
+ int n = (int)SendMessage(GetHwnd(), CB_INSERTSTRING, pos, (LPARAM)item.c_str());
if ( n == CB_ERR )
{
wxLogLastError(wxT("SendMessage(CB_INSERTSTRING)"));
// the combobox should be slightly larger than the widest string
wChoice += 5*GetCharWidth();
- // +5 is magic but seems to work well
- return wxSize(wChoice, GetCharHeight() + 5);
+ return wxSize(wChoice, EDIT_HEIGHT_FROM_CHAR_HEIGHT(GetCharHeight()));
}
-long wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+WXLRESULT wxChoice::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
if ( nMsg == WM_LBUTTONUP )
{