]>
Commit | Line | Data |
---|---|---|
9b6dbb09 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/motif/combobox.h |
9b6dbb09 JS |
3 | // Purpose: wxComboBox class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
7d8268a1 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_COMBOBOX_H_ | |
13 | #define _WX_COMBOBOX_H_ | |
14 | ||
9b6dbb09 | 15 | #include "wx/choice.h" |
978c6e41 | 16 | #include "wx/textentry.h" |
9b6dbb09 | 17 | |
9b6dbb09 | 18 | // Combobox item |
978c6e41 VZ |
19 | class WXDLLEXPORT wxComboBox : public wxChoice, |
20 | public wxTextEntry | |
9b6dbb09 | 21 | { |
bfc6fde4 | 22 | public: |
d8d18184 | 23 | wxComboBox() { m_inSetSelection = false; } |
d3c7fc99 | 24 | virtual ~wxComboBox(); |
7d8268a1 | 25 | |
bfc6fde4 | 26 | inline wxComboBox(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
27 | const wxString& value = wxEmptyString, |
28 | const wxPoint& pos = wxDefaultPosition, | |
29 | const wxSize& size = wxDefaultSize, | |
30 | int n = 0, const wxString choices[] = NULL, | |
31 | long style = 0, | |
32 | const wxValidator& validator = wxDefaultValidator, | |
33 | const wxString& name = wxComboBoxNameStr) | |
bfc6fde4 | 34 | { |
d8d18184 | 35 | m_inSetSelection = false; |
ec75d791 MB |
36 | Create(parent, id, value, pos, size, n, choices, |
37 | style, validator, name); | |
bfc6fde4 | 38 | } |
7d8268a1 | 39 | |
584ad2a3 MB |
40 | inline wxComboBox(wxWindow *parent, wxWindowID id, |
41 | const wxString& value, | |
42 | const wxPoint& pos, | |
43 | const wxSize& size, | |
44 | const wxArrayString& choices, | |
45 | long style = 0, | |
46 | const wxValidator& validator = wxDefaultValidator, | |
47 | const wxString& name = wxComboBoxNameStr) | |
48 | { | |
49 | m_inSetSelection = false; | |
50 | Create(parent, id, value, pos, size, choices, | |
51 | style, validator, name); | |
52 | } | |
7d8268a1 | 53 | |
bfc6fde4 | 54 | bool Create(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
55 | const wxString& value = wxEmptyString, |
56 | const wxPoint& pos = wxDefaultPosition, | |
57 | const wxSize& size = wxDefaultSize, | |
58 | int n = 0, const wxString choices[] = NULL, | |
59 | long style = 0, | |
60 | const wxValidator& validator = wxDefaultValidator, | |
61 | const wxString& name = wxComboBoxNameStr); | |
7d8268a1 | 62 | |
584ad2a3 MB |
63 | bool Create(wxWindow *parent, wxWindowID id, |
64 | const wxString& value, | |
65 | const wxPoint& pos, | |
66 | const wxSize& size, | |
67 | const wxArrayString& choices, | |
68 | long style = 0, | |
69 | const wxValidator& validator = wxDefaultValidator, | |
70 | const wxString& name = wxComboBoxNameStr); | |
7d8268a1 | 71 | |
978c6e41 VZ |
72 | // resolve ambiguities among virtual functions inherited from both base |
73 | // classes | |
74 | virtual void Clear(); | |
75 | virtual wxString GetValue() const { return wxTextEntry::GetValue(); } | |
76 | virtual void SetValue(const wxString& value); | |
77 | virtual wxString GetStringSelection() const | |
78 | { return wxChoice::GetStringSelection(); } | |
79 | ||
80 | virtual void SetSelection(long from, long to) | |
81 | { wxTextEntry::SetSelection(from, to); } | |
82 | virtual void GetSelection(long *from, long *to) const | |
83 | { wxTextEntry::GetSelection(from, to); } | |
84 | ||
85 | ||
ec75d791 | 86 | // implementation of wxControlWithItems |
a236aa20 VZ |
87 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
88 | unsigned int pos, | |
89 | void **clientData, wxClientDataType type); | |
90 | virtual void DoDeleteOneItem(unsigned int n); | |
bfc6fde4 VZ |
91 | virtual int GetSelection() const ; |
92 | virtual void SetSelection(int n); | |
853dcc57 | 93 | virtual int FindString(const wxString& s, bool bCase = false) const; |
aa61d352 VZ |
94 | virtual wxString GetString(unsigned int n) const ; |
95 | virtual void SetString(unsigned int n, const wxString& s); | |
9b1bd0c6 | 96 | |
bfc6fde4 | 97 | // Implementation |
7d8268a1 | 98 | virtual void ChangeFont(bool keepOriginalSize = true); |
bfc6fde4 VZ |
99 | virtual void ChangeBackgroundColour(); |
100 | virtual void ChangeForegroundColour(); | |
101 | WXWidget GetTopWidget() const { return m_mainWidget; } | |
102 | WXWidget GetMainWidget() const { return m_mainWidget; } | |
ec75d791 | 103 | |
bfc6fde4 | 104 | protected: |
978c6e41 | 105 | virtual wxSize DoGetBestSize() const; |
bfc6fde4 | 106 | virtual void DoSetSize(int x, int y, |
978c6e41 VZ |
107 | int width, int height, |
108 | int sizeFlags = wxSIZE_AUTO); | |
109 | ||
110 | virtual WXWidget GetTextWidget() const; | |
111 | ||
e1aae528 MB |
112 | private: |
113 | // only implemented for native combo box | |
114 | void AdjustDropDownListSize(); | |
d8d18184 MB |
115 | |
116 | // implementation detail, should really be private | |
117 | public: | |
118 | bool m_inSetSelection; | |
978c6e41 VZ |
119 | |
120 | DECLARE_DYNAMIC_CLASS(wxComboBox) | |
9b6dbb09 JS |
121 | }; |
122 | ||
978c6e41 | 123 | #endif // _WX_COMBOBOX_H_ |