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