]> git.saurik.com Git - wxWidgets.git/blob - include/wx/editlbox.h
wxRTC: fixed guidelines overwriting adjacent cell borders; corrected capitalisation...
[wxWidgets.git] / include / wx / editlbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/editlbox.h
3 // Purpose: ListBox with editable items
4 // Author: Vaclav Slavik
5 // Copyright: (c) Vaclav Slavik
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 #ifndef __WX_EDITLBOX_H__
11 #define __WX_EDITLBOX_H__
12
13 #include "wx/defs.h"
14
15 #if wxUSE_EDITABLELISTBOX
16
17 #include "wx/panel.h"
18
19 class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
20 class WXDLLIMPEXP_FWD_CORE wxListCtrl;
21 class WXDLLIMPEXP_FWD_CORE wxListEvent;
22
23 #define wxEL_ALLOW_NEW 0x0100
24 #define wxEL_ALLOW_EDIT 0x0200
25 #define wxEL_ALLOW_DELETE 0x0400
26 #define wxEL_NO_REORDER 0x0800
27 #define wxEL_DEFAULT_STYLE (wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE)
28
29 extern WXDLLIMPEXP_DATA_ADV(const char) wxEditableListBoxNameStr[];
30
31 // This class provides a composite control that lets the
32 // user easily enter list of strings
33
34 class WXDLLIMPEXP_ADV wxEditableListBox : public wxPanel
35 {
36 public:
37 wxEditableListBox() { Init(); }
38
39 wxEditableListBox(wxWindow *parent, wxWindowID id,
40 const wxString& label,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
43 long style = wxEL_DEFAULT_STYLE,
44 const wxString& name = wxEditableListBoxNameStr)
45 {
46 Init();
47 Create(parent, id, label, pos, size, style, name);
48 }
49
50 bool Create(wxWindow *parent, wxWindowID id,
51 const wxString& label,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 long style = wxEL_DEFAULT_STYLE,
55 const wxString& name = wxEditableListBoxNameStr);
56
57 void SetStrings(const wxArrayString& strings);
58 void GetStrings(wxArrayString& strings) const;
59
60 wxListCtrl* GetListCtrl() { return m_listCtrl; }
61 wxBitmapButton* GetDelButton() { return m_bDel; }
62 wxBitmapButton* GetNewButton() { return m_bNew; }
63 wxBitmapButton* GetUpButton() { return m_bUp; }
64 wxBitmapButton* GetDownButton() { return m_bDown; }
65 wxBitmapButton* GetEditButton() { return m_bEdit; }
66
67 protected:
68 wxBitmapButton *m_bDel, *m_bNew, *m_bUp, *m_bDown, *m_bEdit;
69 wxListCtrl *m_listCtrl;
70 int m_selection;
71 long m_style;
72
73 void Init()
74 {
75 m_style = 0;
76 m_selection = 0;
77 m_bEdit = m_bNew = m_bDel = m_bUp = m_bDown = NULL;
78 m_listCtrl = NULL;
79 }
80
81 void OnItemSelected(wxListEvent& event);
82 void OnEndLabelEdit(wxListEvent& event);
83 void OnNewItem(wxCommandEvent& event);
84 void OnDelItem(wxCommandEvent& event);
85 void OnEditItem(wxCommandEvent& event);
86 void OnUpItem(wxCommandEvent& event);
87 void OnDownItem(wxCommandEvent& event);
88
89 DECLARE_CLASS(wxEditableListBox)
90 DECLARE_EVENT_TABLE()
91
92 private:
93 void SwapItems(long i1, long i2);
94
95 };
96
97 #endif // wxUSE_EDITABLELISTBOX
98
99 #endif // __WX_EDITLBOX_H__