]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: combobox.h | |
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 | |
65571936 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_COMBOBOX_H_ | |
13 | #define _WX_COMBOBOX_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
9b6dbb09 JS |
16 | #pragma interface "combobox.h" |
17 | #endif | |
18 | ||
19 | #include "wx/choice.h" | |
20 | ||
9b6dbb09 JS |
21 | // Combobox item |
22 | class WXDLLEXPORT wxComboBox: public wxChoice | |
23 | { | |
bfc6fde4 | 24 | DECLARE_DYNAMIC_CLASS(wxComboBox) |
83df96d6 | 25 | |
bfc6fde4 | 26 | public: |
d8d18184 | 27 | wxComboBox() { m_inSetSelection = false; } |
bfc6fde4 | 28 | ~wxComboBox(); |
83df96d6 | 29 | |
bfc6fde4 | 30 | inline wxComboBox(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
31 | const wxString& value = wxEmptyString, |
32 | const wxPoint& pos = wxDefaultPosition, | |
33 | const wxSize& size = wxDefaultSize, | |
34 | int n = 0, const wxString choices[] = NULL, | |
35 | long style = 0, | |
36 | const wxValidator& validator = wxDefaultValidator, | |
37 | const wxString& name = wxComboBoxNameStr) | |
bfc6fde4 | 38 | { |
d8d18184 | 39 | m_inSetSelection = false; |
ec75d791 MB |
40 | Create(parent, id, value, pos, size, n, choices, |
41 | style, validator, name); | |
bfc6fde4 | 42 | } |
83df96d6 | 43 | |
584ad2a3 MB |
44 | inline wxComboBox(wxWindow *parent, wxWindowID id, |
45 | const wxString& value, | |
46 | const wxPoint& pos, | |
47 | const wxSize& size, | |
48 | const wxArrayString& choices, | |
49 | long style = 0, | |
50 | const wxValidator& validator = wxDefaultValidator, | |
51 | const wxString& name = wxComboBoxNameStr) | |
52 | { | |
53 | m_inSetSelection = false; | |
54 | Create(parent, id, value, pos, size, choices, | |
55 | style, validator, name); | |
56 | } | |
57 | ||
bfc6fde4 | 58 | bool Create(wxWindow *parent, wxWindowID id, |
83df96d6 JS |
59 | const wxString& value = wxEmptyString, |
60 | const wxPoint& pos = wxDefaultPosition, | |
61 | const wxSize& size = wxDefaultSize, | |
62 | int n = 0, const wxString choices[] = NULL, | |
63 | long style = 0, | |
64 | const wxValidator& validator = wxDefaultValidator, | |
65 | const wxString& name = wxComboBoxNameStr); | |
66 | ||
584ad2a3 MB |
67 | bool Create(wxWindow *parent, wxWindowID id, |
68 | const wxString& value, | |
69 | const wxPoint& pos, | |
70 | const wxSize& size, | |
71 | const wxArrayString& choices, | |
72 | long style = 0, | |
73 | const wxValidator& validator = wxDefaultValidator, | |
74 | const wxString& name = wxComboBoxNameStr); | |
75 | ||
ec75d791 MB |
76 | // implementation of wxControlWithItems |
77 | virtual int DoAppend(const wxString& item); | |
243dbf1a | 78 | virtual int DoInsert(const wxString& item, int pos); |
bfc6fde4 VZ |
79 | virtual void Delete(int n); |
80 | virtual void Clear(); | |
81 | virtual int GetSelection() const ; | |
82 | virtual void SetSelection(int n); | |
83 | virtual int FindString(const wxString& s) const; | |
84 | virtual wxString GetString(int n) const ; | |
9b1bd0c6 MB |
85 | virtual void SetString(int n, const wxString& s); |
86 | ||
bfc6fde4 VZ |
87 | // Text field functions |
88 | virtual wxString GetValue() const ; | |
89 | virtual void SetValue(const wxString& value); | |
83df96d6 | 90 | |
bfc6fde4 VZ |
91 | // Clipboard operations |
92 | virtual void Copy(); | |
93 | virtual void Cut(); | |
94 | virtual void Paste(); | |
95 | virtual void SetInsertionPoint(long pos); | |
96 | virtual void SetInsertionPointEnd(); | |
97 | virtual long GetInsertionPoint() const ; | |
98 | virtual long GetLastPosition() const ; | |
99 | virtual void Replace(long from, long to, const wxString& value); | |
100 | virtual void Remove(long from, long to); | |
101 | virtual void SetSelection(long from, long to); | |
102 | virtual void SetEditable(bool editable); | |
83df96d6 | 103 | |
bfc6fde4 VZ |
104 | // Implementation |
105 | virtual void ChangeFont(bool keepOriginalSize = TRUE); | |
106 | virtual void ChangeBackgroundColour(); | |
107 | virtual void ChangeForegroundColour(); | |
108 | WXWidget GetTopWidget() const { return m_mainWidget; } | |
109 | WXWidget GetMainWidget() const { return m_mainWidget; } | |
ec75d791 MB |
110 | |
111 | virtual wxSize DoGetBestSize() const; | |
bfc6fde4 VZ |
112 | protected: |
113 | virtual void DoSetSize(int x, int y, | |
83df96d6 JS |
114 | int width, int height, |
115 | int sizeFlags = wxSIZE_AUTO); | |
e1aae528 MB |
116 | private: |
117 | // only implemented for native combo box | |
118 | void AdjustDropDownListSize(); | |
d8d18184 MB |
119 | |
120 | // implementation detail, should really be private | |
121 | public: | |
122 | bool m_inSetSelection; | |
9b6dbb09 JS |
123 | }; |
124 | ||
125 | #endif | |
83df96d6 | 126 | // _WX_COMBOBOX_H_ |