X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fe3d9123c6968b452a95133c635069d6f7ae8ea5..1e52188741389278cd99abf79218162c87024ba3:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index f8620938f2..3389cf3707 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "choice.h" #endif @@ -40,7 +40,29 @@ #include "wx/msw/private.h" +#if wxUSE_EXTENDED_RTTI +IMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl,"wx/checkbox.h") + +WX_BEGIN_PROPERTIES_TABLE(wxChoice) + // TODO DELEGATES + WX_PROPERTY( Font , wxFont , SetFont , GetFont , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + WX_PROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) + WX_PROPERTY( Selection ,int, SetSelection, GetSelection, , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) +WX_END_PROPERTIES_TABLE() + +WX_BEGIN_HANDLERS_TABLE(wxChoice) +WX_END_HANDLERS_TABLE() + +WX_CONSTRUCTOR_4( wxChoice , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size ) +#else IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) +#endif +/* + TODO PROPERTIES + selection (long) + content (list) + item +*/ // ============================================================================ // implementation @@ -115,6 +137,20 @@ int wxChoice::DoAppend(const wxString& item) return n; } +int wxChoice::DoInsert(const wxString& item, int pos) +{ + 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()); + if ( n == CB_ERR ) + { + wxLogLastError(wxT("SendMessage(CB_INSERTSTRING)")); + } + + return n; +} + void wxChoice::Delete(int n) { wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") ); @@ -237,8 +273,6 @@ wxString wxChoice::GetString(int n) const { wxLogLastError(wxT("SendMessage(CB_GETLBTEXT)")); } - - str.UngetWriteBuf(); } return str; @@ -399,11 +433,6 @@ WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED( ) { HDC hdc = (HDC)pDC; - if (GetParent()->GetTransparentBackground()) - SetBkMode(hdc, TRANSPARENT); - else - SetBkMode(hdc, OPAQUE); - wxColour colBack = GetBackgroundColour(); if (!IsEnabled())