]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/combobox.h
don't test for __WIN95__ which doesn't exist any more; don't do compiler checks here...
[wxWidgets.git] / include / wx / msw / combobox.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
f6bcfd97 2// Name: wx/msw/combobox.h
2bda0e17
KB
3// Purpose: wxComboBox class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
bbcdf8bc 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_COMBOBOX_H_
13#define _WX_COMBOBOX_H_
2bda0e17 14
2bda0e17
KB
15#include "wx/choice.h"
16
47d67540 17#if wxUSE_COMBOBOX
2bda0e17 18
4438caf4
VZ
19// ----------------------------------------------------------------------------
20// Combobox control
21// ----------------------------------------------------------------------------
22
2bda0e17
KB
23class WXDLLEXPORT wxComboBox: public wxChoice
24{
4438caf4 25public:
13bcc348 26 wxComboBox() { Init(); }
4438caf4
VZ
27
28 wxComboBox(wxWindow *parent, wxWindowID id,
29 const wxString& value = wxEmptyString,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 int n = 0, const wxString choices[] = NULL,
33 long style = 0,
34 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
35 const wxString& name = wxComboBoxNameStr)
36 {
13bcc348
VZ
37 Init();
38
6463b9f5
JS
39 Create(parent, id, value, pos, size, n, choices, style, validator, name);
40 }
584ad2a3
MB
41 wxComboBox(wxWindow *parent, wxWindowID id,
42 const wxString& value,
43 const wxPoint& pos,
44 const wxSize& size,
45 const wxArrayString& choices,
46 long style = 0,
47 const wxValidator& validator = wxDefaultValidator,
48 const wxString& name = wxComboBoxNameStr)
49 {
13bcc348
VZ
50 Init();
51
584ad2a3
MB
52 Create(parent, id, value, pos, size, choices, style, validator, name);
53 }
4438caf4 54
f6bcfd97
BP
55 bool Create(wxWindow *parent,
56 wxWindowID id,
57 const wxString& value = wxEmptyString,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 int n = 0,
61 const wxString choices[] = NULL,
62 long style = 0,
63 const wxValidator& validator = wxDefaultValidator,
64 const wxString& name = wxComboBoxNameStr);
584ad2a3
MB
65 bool Create(wxWindow *parent,
66 wxWindowID id,
67 const wxString& value,
68 const wxPoint& pos,
69 const wxSize& size,
70 const wxArrayString& choices,
71 long style = 0,
72 const wxValidator& validator = wxDefaultValidator,
73 const wxString& name = wxComboBoxNameStr);
4438caf4
VZ
74
75 // List functions: see wxChoice
76
77 // Text field functions
13bcc348 78 wxString GetValue() const { return m_value; }
4438caf4
VZ
79 virtual void SetValue(const wxString& value);
80
81 // Clipboard operations
82 virtual void Copy();
83 virtual void Cut();
84 virtual void Paste();
150e31d2
JS
85 virtual bool CanCopy() const;
86 virtual bool CanCut() const;
87 virtual bool CanPaste() const;
4438caf4
VZ
88 virtual void SetInsertionPoint(long pos);
89 virtual void SetInsertionPointEnd();
90 virtual long GetInsertionPoint() const;
7d8268a1 91 virtual wxTextPos GetLastPosition() const;
4438caf4
VZ
92 virtual void Replace(long from, long to, const wxString& value);
93 virtual void Remove(long from, long to);
94 virtual void SetSelection(int n) { wxChoice::SetSelection(n); }
95 virtual void SetSelection(long from, long to);
3f5ca6b1
RN
96 virtual int GetSelection() const;
97 virtual void GetSelection(long* from, long* to) const;
4438caf4 98 virtual void SetEditable(bool editable);
5996fb42 99 virtual void Clear();
4438caf4 100
150e31d2
JS
101 virtual void Undo() ;
102 virtual void Redo() ;
103 virtual bool CanUndo() const;
104 virtual bool CanRedo() const;
105 virtual void SelectAll();
106 virtual bool IsEditable() const ;
107 virtual bool HasSelection() const;
108
f6bcfd97 109 // implementation only from now on
4438caf4 110 virtual bool MSWCommand(WXUINT param, WXWORD id);
f6bcfd97 111 bool MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam);
c140b7e7 112 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
3a7d5f7c 113
f6bcfd97 114 WXHWND GetEditHWND() const;
fc7a2a60 115
150e31d2
JS
116 // Standard event handling
117 void OnCut(wxCommandEvent& event);
118 void OnCopy(wxCommandEvent& event);
119 void OnPaste(wxCommandEvent& event);
120 void OnUndo(wxCommandEvent& event);
121 void OnRedo(wxCommandEvent& event);
122 void OnDelete(wxCommandEvent& event);
123 void OnSelectAll(wxCommandEvent& event);
124
125 void OnUpdateCut(wxUpdateUIEvent& event);
126 void OnUpdateCopy(wxUpdateUIEvent& event);
127 void OnUpdatePaste(wxUpdateUIEvent& event);
128 void OnUpdateUndo(wxUpdateUIEvent& event);
129 void OnUpdateRedo(wxUpdateUIEvent& event);
130 void OnUpdateDelete(wxUpdateUIEvent& event);
131 void OnUpdateSelectAll(wxUpdateUIEvent& event);
132
71e57cd6
VZ
133protected:
134 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
135
13bcc348
VZ
136 // common part of all ctors
137 void Init() { m_selectionOld = -1; }
138
139
140 // the previous selection (see MSWCommand() to see why it is needed)
141 int m_selectionOld;
142
143 // the current selection (also see MSWCommand())
144 wxString m_value;
145
fc7a2a60
VZ
146private:
147 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
150e31d2 148 DECLARE_EVENT_TABLE()
2bda0e17
KB
149};
150
47d67540 151#endif // wxUSE_COMBOBOX
2bda0e17 152#endif
bbcdf8bc 153 // _WX_COMBOBOX_H_