ctrlsub.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. // Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_MSW_CTRLSUB_H_
  10. #define _WX_MSW_CTRLSUB_H_
  11. // ----------------------------------------------------------------------------
  12. // wxControlWithItems
  13. // ----------------------------------------------------------------------------
  14. class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase
  15. {
  16. public:
  17. wxControlWithItems() { }
  18. protected:
  19. // preallocate memory for inserting the given new items into the control
  20. // using the wm message (normally either LB_INITSTORAGE or CB_INITSTORAGE)
  21. void MSWAllocStorage(const wxArrayStringsAdapter& items, unsigned wm);
  22. // insert or append a string to the controls using the given message
  23. // (one of {CB,LB}_{ADD,INSERT}STRING, pos must be 0 when appending)
  24. int MSWInsertOrAppendItem(unsigned pos, const wxString& item, unsigned wm);
  25. // normally the control containing the items is this window itself but if
  26. // the derived control is composed of several windows, this method can be
  27. // overridden to return the real list/combobox control
  28. virtual WXHWND MSWGetItemsHWND() const { return GetHWND(); }
  29. private:
  30. DECLARE_ABSTRACT_CLASS(wxControlWithItems)
  31. wxDECLARE_NO_COPY_CLASS(wxControlWithItems);
  32. };
  33. #endif // _WX_MSW_CTRLSUB_H_