combobox.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/combobox.h
  3. // Purpose: wxComboBox class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/13/99
  7. // Copyright: (c) David Webster
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_COMBOBOX_H_
  11. #define _WX_COMBOBOX_H_
  12. #include "wx/choice.h"
  13. #include "wx/textentry.h"
  14. #if wxUSE_COMBOBOX
  15. // Combobox item
  16. class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
  17. public wxTextEntry
  18. {
  19. public:
  20. inline wxComboBox() {}
  21. inline wxComboBox( wxWindow* pParent
  22. ,wxWindowID vId
  23. ,const wxString& rsValue = wxEmptyString
  24. ,const wxPoint& rPos = wxDefaultPosition
  25. ,const wxSize& rSize = wxDefaultSize
  26. ,int n = 0
  27. ,const wxString asChoices[] = NULL
  28. ,long lStyle = 0
  29. ,const wxValidator& rValidator = wxDefaultValidator
  30. ,const wxString& rsName = wxComboBoxNameStr
  31. )
  32. {
  33. Create( pParent
  34. ,vId
  35. ,rsValue
  36. ,rPos
  37. ,rSize
  38. ,n
  39. ,asChoices
  40. ,lStyle
  41. ,rValidator
  42. ,rsName
  43. );
  44. }
  45. inline wxComboBox( wxWindow* pParent
  46. ,wxWindowID vId
  47. ,const wxString& rsValue
  48. ,const wxPoint& rPos
  49. ,const wxSize& rSize
  50. ,const wxArrayString& asChoices
  51. ,long lStyle = 0
  52. ,const wxValidator& rValidator = wxDefaultValidator
  53. ,const wxString& rsName = wxComboBoxNameStr
  54. )
  55. {
  56. Create( pParent
  57. ,vId
  58. ,rsValue
  59. ,rPos
  60. ,rSize
  61. ,asChoices
  62. ,lStyle
  63. ,rValidator
  64. ,rsName
  65. );
  66. }
  67. bool Create( wxWindow* pParent
  68. ,wxWindowID vId
  69. ,const wxString& rsValue = wxEmptyString
  70. ,const wxPoint& rPos = wxDefaultPosition
  71. ,const wxSize& rSize = wxDefaultSize
  72. ,int n = 0
  73. ,const wxString asChoices[] = NULL
  74. ,long lStyle = 0
  75. ,const wxValidator& rValidator = wxDefaultValidator
  76. ,const wxString& rsName = wxComboBoxNameStr
  77. );
  78. bool Create( wxWindow* pParent
  79. ,wxWindowID vId
  80. ,const wxString& rsValue
  81. ,const wxPoint& rPos
  82. ,const wxSize& rSize
  83. ,const wxArrayString& asChoices
  84. ,long lStyle = 0
  85. ,const wxValidator& rValidator = wxDefaultValidator
  86. ,const wxString& rsName = wxComboBoxNameStr
  87. );
  88. // See wxComboBoxBase discussion of IsEmpty().
  89. bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
  90. bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
  91. // resolve ambiguities among virtual functions inherited from both base
  92. // classes
  93. virtual void Clear();
  94. virtual wxString GetValue() const;
  95. virtual void SetValue(const wxString& value);
  96. virtual wxString GetStringSelection() const
  97. { return wxChoice::GetStringSelection(); }
  98. inline virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
  99. virtual void SetSelection(long from, long to)
  100. { wxTextEntry::SetSelection(from, to); }
  101. virtual int GetSelection() const { return wxChoice::GetSelection(); }
  102. virtual void GetSelection(long *from, long *to) const
  103. { wxTextEntry::GetSelection(from, to); }
  104. virtual bool IsEditable() const;
  105. virtual bool OS2Command( WXUINT uParam
  106. ,WXWORD wId
  107. );
  108. bool ProcessEditMsg( WXUINT uMsg
  109. ,WXWPARAM wParam
  110. ,WXLPARAM lParam
  111. );
  112. private:
  113. // implement wxTextEntry pure virtual methods
  114. virtual wxWindow *GetEditableWindow() { return this; }
  115. virtual WXHWND GetEditHWND() const { return m_hWnd; }
  116. DECLARE_DYNAMIC_CLASS(wxComboBox)
  117. }; // end of CLASS wxComboBox
  118. #endif // wxUSE_COMBOBOX
  119. #endif
  120. // _WX_COMBOBOX_H_