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