]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/msw/combobox.h | |
3 | // Purpose: wxComboBox class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
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 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "combobox.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/choice.h" | |
20 | ||
21 | #if wxUSE_COMBOBOX | |
22 | ||
23 | // ---------------------------------------------------------------------------- | |
24 | // Combobox control | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
27 | class WXDLLEXPORT wxComboBox: public wxChoice | |
28 | { | |
29 | public: | |
30 | wxComboBox() { Init(); } | |
31 | ||
32 | wxComboBox(wxWindow *parent, wxWindowID id, | |
33 | const wxString& value = wxEmptyString, | |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | const wxSize& size = wxDefaultSize, | |
36 | int n = 0, const wxString choices[] = NULL, | |
37 | long style = 0, | |
38 | const wxValidator& validator = wxDefaultValidator, | |
39 | const wxString& name = wxComboBoxNameStr) | |
40 | { | |
41 | Init(); | |
42 | ||
43 | Create(parent, id, value, pos, size, n, choices, style, validator, name); | |
44 | } | |
45 | wxComboBox(wxWindow *parent, wxWindowID id, | |
46 | const wxString& value, | |
47 | const wxPoint& pos, | |
48 | const wxSize& size, | |
49 | const wxArrayString& choices, | |
50 | long style = 0, | |
51 | const wxValidator& validator = wxDefaultValidator, | |
52 | const wxString& name = wxComboBoxNameStr) | |
53 | { | |
54 | Init(); | |
55 | ||
56 | Create(parent, id, value, pos, size, choices, style, validator, name); | |
57 | } | |
58 | ||
59 | bool Create(wxWindow *parent, | |
60 | wxWindowID id, | |
61 | const wxString& value = wxEmptyString, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | int n = 0, | |
65 | const wxString choices[] = NULL, | |
66 | long style = 0, | |
67 | const wxValidator& validator = wxDefaultValidator, | |
68 | const wxString& name = wxComboBoxNameStr); | |
69 | bool Create(wxWindow *parent, | |
70 | wxWindowID id, | |
71 | const wxString& value, | |
72 | const wxPoint& pos, | |
73 | const wxSize& size, | |
74 | const wxArrayString& choices, | |
75 | long style = 0, | |
76 | const wxValidator& validator = wxDefaultValidator, | |
77 | const wxString& name = wxComboBoxNameStr); | |
78 | ||
79 | // List functions: see wxChoice | |
80 | ||
81 | // Text field functions | |
82 | wxString GetValue() const { return m_value; } | |
83 | virtual void SetValue(const wxString& value); | |
84 | ||
85 | // Clipboard operations | |
86 | virtual void Copy(); | |
87 | virtual void Cut(); | |
88 | virtual void Paste(); | |
89 | virtual void SetInsertionPoint(long pos); | |
90 | virtual void SetInsertionPointEnd(); | |
91 | virtual long GetInsertionPoint() const; | |
92 | virtual long GetLastPosition() const; | |
93 | virtual void Replace(long from, long to, const wxString& value); | |
94 | virtual void Remove(long from, long to); | |
95 | virtual void SetSelection(int n) { wxChoice::SetSelection(n); } | |
96 | virtual void SetSelection(long from, long to); | |
97 | virtual int GetSelection() const; | |
98 | virtual void GetSelection(long* from, long* to) const; | |
99 | virtual void SetEditable(bool editable); | |
100 | virtual void Clear() { wxChoice::Clear(); m_selectionOld = -1; } | |
101 | ||
102 | // implementation only from now on | |
103 | virtual bool MSWCommand(WXUINT param, WXWORD id); | |
104 | bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam); | |
105 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); | |
106 | ||
107 | WXHWND GetEditHWND() const; | |
108 | ||
109 | protected: | |
110 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
111 | ||
112 | // common part of all ctors | |
113 | void Init() { m_selectionOld = -1; } | |
114 | ||
115 | ||
116 | // the previous selection (see MSWCommand() to see why it is needed) | |
117 | int m_selectionOld; | |
118 | ||
119 | // the current selection (also see MSWCommand()) | |
120 | wxString m_value; | |
121 | ||
122 | private: | |
123 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) | |
124 | }; | |
125 | ||
126 | #endif // wxUSE_COMBOBOX | |
127 | #endif | |
128 | // _WX_COMBOBOX_H_ |