X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/71e57cd6506760f7ca0e3195a5ecf99d78a77be9..1d421f0c396c4b29cc2e7a867845284a4108d3c0:/include/wx/msw/choice.h diff --git a/include/wx/msw/choice.h b/include/wx/msw/choice.h index 2ee9390c57..4661025fe9 100644 --- a/include/wx/msw/choice.h +++ b/include/wx/msw/choice.h @@ -24,7 +24,7 @@ class WXDLLEXPORT wxChoice : public wxChoiceBase { public: // ctors - wxChoice() { } + wxChoice() { Init(); } virtual ~wxChoice(); wxChoice(wxWindow *parent, @@ -36,8 +36,10 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr) { + Init(); Create(parent, id, pos, size, n, choices, style, validator, name); } + wxChoice(wxWindow *parent, wxWindowID id, const wxPoint& pos, @@ -47,6 +49,7 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr) { + Init(); Create(parent, id, pos, size, choices, style, validator, name); } @@ -75,6 +78,9 @@ public: virtual int GetCount() const; virtual int GetSelection() const; +#if wxABI_VERSION >= 20602 + virtual int GetCurrentSelection() const; +#endif virtual void SetSelection(int n); virtual int FindString(const wxString& s) const; @@ -83,11 +89,13 @@ public: // MSW only virtual bool MSWCommand(WXUINT param, WXWORD id); - long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXHBRUSH MSWControlColor(WXHDC hDC, WXHWND hWnd); protected: + // common part of all ctors + void Init() { m_lastAcceptedSelection = wxID_NONE; } + virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoSetItemClientData( int n, void* clientData ); virtual void* DoGetItemClientData( int n ) const; @@ -101,10 +109,9 @@ protected: int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; + virtual bool MSWShouldPreProcessMessage(WXMSG *pMsg); - // get the real height of the control - int GetVisibleHeight() const; + virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; // update the height of the drop down list to fit the number of items we // have (without changing the visible height) @@ -122,6 +129,13 @@ protected: // free all memory we have (used by Clear() and dtor) void Free(); + + // last "completed" selection, i.e. not the transient one while the user is + // browsing the popup list: this is only used when != wxID_NONE which is + // the case while the drop down is opened + int m_lastAcceptedSelection; + + DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) };