combobox.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/combobox.h
  3. // Purpose: wxComboBox declaration
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 24.12.00
  7. // Copyright: (c) 1996-2000 wxWidgets team
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_COMBOBOX_H_BASE_
  11. #define _WX_COMBOBOX_H_BASE_
  12. #include "wx/defs.h"
  13. #if wxUSE_COMBOBOX
  14. // For compatibility with 2.8 include this header to allow using wxTE_XXX
  15. // styles with wxComboBox without explicitly including it in the user code.
  16. #include "wx/textctrl.h"
  17. extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
  18. // ----------------------------------------------------------------------------
  19. // wxComboBoxBase: this interface defines the methods wxComboBox must implement
  20. // ----------------------------------------------------------------------------
  21. #include "wx/ctrlsub.h"
  22. #include "wx/textentry.h"
  23. class WXDLLIMPEXP_CORE wxComboBoxBase : public wxItemContainer,
  24. public wxTextEntry
  25. {
  26. public:
  27. // override these methods to disambiguate between two base classes versions
  28. virtual void Clear()
  29. {
  30. wxTextEntry::Clear();
  31. wxItemContainer::Clear();
  32. }
  33. // IsEmpty() is ambiguous because we inherit it from both wxItemContainer
  34. // and wxTextEntry, and even if defined it here to help the compiler with
  35. // choosing one of them, it would still be confusing for the human users of
  36. // this class. So instead define the clearly named methods below and leave
  37. // IsEmpty() ambiguous to trigger a compilation error if it's used.
  38. bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
  39. bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
  40. // also bring in GetSelection() versions of both base classes in scope
  41. //
  42. // NB: GetSelection(from, to) could be already implemented in wxTextEntry
  43. // but still make it pure virtual because for some platforms it's not
  44. // implemented there and also because the derived class has to override
  45. // it anyhow to avoid ambiguity with the other GetSelection()
  46. virtual int GetSelection() const = 0;
  47. virtual void GetSelection(long *from, long *to) const = 0;
  48. virtual void Popup() { wxFAIL_MSG( wxT("Not implemented") ); }
  49. virtual void Dismiss() { wxFAIL_MSG( wxT("Not implemented") ); }
  50. // may return value different from GetSelection() when the combobox
  51. // dropdown is shown and the user selected, but not yet accepted, a value
  52. // different from the old one in it
  53. virtual int GetCurrentSelection() const { return GetSelection(); }
  54. };
  55. // ----------------------------------------------------------------------------
  56. // include the platform-dependent header defining the real class
  57. // ----------------------------------------------------------------------------
  58. #if defined(__WXUNIVERSAL__)
  59. #include "wx/univ/combobox.h"
  60. #elif defined(__WXMSW__)
  61. #include "wx/msw/combobox.h"
  62. #elif defined(__WXMOTIF__)
  63. #include "wx/motif/combobox.h"
  64. #elif defined(__WXGTK20__)
  65. #include "wx/gtk/combobox.h"
  66. #elif defined(__WXGTK__)
  67. #include "wx/gtk1/combobox.h"
  68. #elif defined(__WXMAC__)
  69. #include "wx/osx/combobox.h"
  70. #elif defined(__WXCOCOA__)
  71. #include "wx/cocoa/combobox.h"
  72. #elif defined(__WXPM__)
  73. #include "wx/os2/combobox.h"
  74. #endif
  75. #endif // wxUSE_COMBOBOX
  76. #endif // _WX_COMBOBOX_H_BASE_