1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: ListBox with editable items
4 // Author: Vaclav Slavik
6 // Copyright: (c) Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __WX_EDITLBOX_H__
12 #define __WX_EDITLBOX_H__
16 #if wxUSE_EDITABLELISTBOX
20 class WXDLLIMPEXP_FWD_CORE wxBitmapButton
;
21 class WXDLLIMPEXP_FWD_CORE wxListCtrl
;
22 class WXDLLIMPEXP_FWD_CORE wxListEvent
;
24 #define wxEL_ALLOW_NEW 0x0100
25 #define wxEL_ALLOW_EDIT 0x0200
26 #define wxEL_ALLOW_DELETE 0x0400
27 #define wxEL_NO_REORDER 0x0800
28 #define wxEL_DEFAULT_STYLE (wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE)
30 extern WXDLLIMPEXP_DATA_ADV(const char) wxEditableListBoxNameStr
[];
32 // This class provides a composite control that lets the
33 // user easily enter list of strings
35 class WXDLLIMPEXP_ADV wxEditableListBox
: public wxPanel
38 wxEditableListBox() { Init(); }
40 wxEditableListBox(wxWindow
*parent
, wxWindowID id
,
41 const wxString
& label
,
42 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxSize
& size
= wxDefaultSize
,
44 long style
= wxEL_DEFAULT_STYLE
,
45 const wxString
& name
= wxEditableListBoxNameStr
)
48 Create(parent
, id
, label
, pos
, size
, style
, name
);
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
);
58 void SetStrings(const wxArrayString
& strings
);
59 void GetStrings(wxArrayString
& strings
) const;
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
; }
69 wxBitmapButton
*m_bDel
, *m_bNew
, *m_bUp
, *m_bDown
, *m_bEdit
;
70 wxListCtrl
*m_listCtrl
;
78 m_bEdit
= m_bNew
= m_bDel
= m_bUp
= m_bDown
= NULL
;
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
);
90 DECLARE_CLASS(wxEditableListBox
)
94 void SwapItems(long i1
, long i2
);
98 #endif // wxUSE_EDITABLELISTBOX
100 #endif // __WX_EDITLBOX_H__