1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: ListBox with editable items
4 // Author: Vaclav Slavik
5 // Copyright: (c) Vaclav Slavik
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __WX_EDITLBOX_H__
11 #define __WX_EDITLBOX_H__
15 #if wxUSE_EDITABLELISTBOX
19 class WXDLLIMPEXP_FWD_CORE wxBitmapButton
;
20 class WXDLLIMPEXP_FWD_CORE wxListCtrl
;
21 class WXDLLIMPEXP_FWD_CORE wxListEvent
;
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)
29 extern WXDLLIMPEXP_DATA_ADV(const char) wxEditableListBoxNameStr
[];
31 // This class provides a composite control that lets the
32 // user easily enter list of strings
34 class WXDLLIMPEXP_ADV wxEditableListBox
: public wxPanel
37 wxEditableListBox() { Init(); }
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
)
47 Create(parent
, id
, label
, pos
, size
, style
, name
);
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
);
57 void SetStrings(const wxArrayString
& strings
);
58 void GetStrings(wxArrayString
& strings
) const;
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
; }
68 wxBitmapButton
*m_bDel
, *m_bNew
, *m_bUp
, *m_bDown
, *m_bEdit
;
69 wxListCtrl
*m_listCtrl
;
77 m_bEdit
= m_bNew
= m_bDel
= m_bUp
= m_bDown
= NULL
;
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
);
89 DECLARE_CLASS(wxEditableListBox
)
93 void SwapItems(long i1
, long i2
);
97 #endif // wxUSE_EDITABLELISTBOX
99 #endif // __WX_EDITLBOX_H__