]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/combobox.h
3 // Purpose: wxComboBox class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COMBOBOX_H_
13 #define _WX_COMBOBOX_H_
15 #include "wx/choice.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 class WXDLLEXPORT wxComboBox
: public wxChoice
26 wxComboBox() { Init(); }
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
,
34 const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
& name
= wxComboBoxNameStr
)
39 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
41 wxComboBox(wxWindow
*parent
, wxWindowID id
,
42 const wxString
& value
,
45 const wxArrayString
& choices
,
47 const wxValidator
& validator
= wxDefaultValidator
,
48 const wxString
& name
= wxComboBoxNameStr
)
52 Create(parent
, id
, value
, pos
, size
, choices
, style
, validator
, name
);
55 bool Create(wxWindow
*parent
,
57 const wxString
& value
= wxEmptyString
,
58 const wxPoint
& pos
= wxDefaultPosition
,
59 const wxSize
& size
= wxDefaultSize
,
61 const wxString choices
[] = NULL
,
63 const wxValidator
& validator
= wxDefaultValidator
,
64 const wxString
& name
= wxComboBoxNameStr
);
65 bool Create(wxWindow
*parent
,
67 const wxString
& value
,
70 const wxArrayString
& choices
,
72 const wxValidator
& validator
= wxDefaultValidator
,
73 const wxString
& name
= wxComboBoxNameStr
);
75 // List functions: see wxChoice
77 // Text field functions
78 wxString
GetValue() const { return m_value
; }
79 virtual void SetValue(const wxString
& value
);
81 // Clipboard operations
85 virtual bool CanCopy() const;
86 virtual bool CanCut() const;
87 virtual bool CanPaste() const;
88 virtual void SetInsertionPoint(long pos
);
89 virtual void SetInsertionPointEnd();
90 virtual long GetInsertionPoint() const;
91 virtual wxTextPos
GetLastPosition() const;
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
);
96 virtual int GetSelection() const;
97 virtual void GetSelection(long* from
, long* to
) const;
98 virtual void SetEditable(bool editable
);
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;
109 // implementation only from now on
110 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
111 bool MSWProcessEditMsg(WXUINT msg
, WXWPARAM wParam
, WXLPARAM lParam
);
112 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
114 WXHWND
GetEditHWND() const;
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
);
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
);
134 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
136 // common part of all ctors
137 void Init() { m_selectionOld
= -1; }
140 // the previous selection (see MSWCommand() to see why it is needed)
143 // the current selection (also see MSWCommand())
147 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox
)
148 DECLARE_EVENT_TABLE()
151 #endif // wxUSE_COMBOBOX