| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/msw/ctrlsub.h |
| 3 | // Purpose: common functionality of wxItemContainer-derived controls |
| 4 | // Author: Vadim Zeitlin |
| 5 | // Created: 2007-07-25 |
| 6 | // RCS-ID: $Id$ |
| 7 | // Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org> |
| 8 | // Licence: wxWindows licence |
| 9 | /////////////////////////////////////////////////////////////////////////////// |
| 10 | |
| 11 | #ifndef _WX_MSW_CTRLSUB_H_ |
| 12 | #define _WX_MSW_CTRLSUB_H_ |
| 13 | |
| 14 | // ---------------------------------------------------------------------------- |
| 15 | // wxControlWithItems |
| 16 | // ---------------------------------------------------------------------------- |
| 17 | |
| 18 | class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase |
| 19 | { |
| 20 | public: |
| 21 | wxControlWithItems() { } |
| 22 | |
| 23 | protected: |
| 24 | // preallocate memory for inserting the given new items into the control |
| 25 | // using the wm message (normally either LB_INITSTORAGE or CB_INITSTORAGE) |
| 26 | void MSWAllocStorage(const wxArrayStringsAdapter& items, unsigned wm); |
| 27 | |
| 28 | // insert or append a string to the controls using the given message |
| 29 | // (one of {CB,LB}_{ADD,INSERT}STRING, pos must be 0 when appending) |
| 30 | int MSWInsertOrAppendItem(unsigned pos, const wxString& item, unsigned wm); |
| 31 | |
| 32 | // normally the control containing the items is this window itself but if |
| 33 | // the derived control is composed of several windows, this method can be |
| 34 | // overridden to return the real list/combobox control |
| 35 | virtual WXHWND MSWGetItemsHWND() const { return GetHWND(); } |
| 36 | |
| 37 | private: |
| 38 | DECLARE_ABSTRACT_CLASS(wxControlWithItems) |
| 39 | wxDECLARE_NO_COPY_CLASS(wxControlWithItems); |
| 40 | }; |
| 41 | |
| 42 | #endif // _WX_MSW_CTRLSUB_H_ |
| 43 | |