]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: 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 | ||
14 | #include "wx/panel.h" | |
15 | #include "wx/gizmos/gizmos.h" | |
16 | ||
17 | class WXDLLEXPORT wxBitmapButton; | |
18 | class WXDLLEXPORT wxListCtrl; | |
19 | class WXDLLEXPORT wxListEvent; | |
20 | ||
21 | #define wxEL_ALLOW_NEW 0x0100 | |
22 | #define wxEL_ALLOW_EDIT 0x0200 | |
23 | #define wxEL_ALLOW_DELETE 0x0400 | |
24 | ||
25 | // This class provides a composite control that lets the | |
26 | // user easily enter list of strings | |
27 | ||
28 | class WXDLLIMPEXP_GIZMOS wxEditableListBox : public wxPanel | |
29 | { | |
30 | DECLARE_CLASS(wxEditableListBox) | |
31 | ||
32 | public: | |
33 | wxEditableListBox(wxWindow *parent, wxWindowID id, | |
34 | const wxString& label, | |
35 | const wxPoint& pos = wxDefaultPosition, | |
36 | const wxSize& size = wxDefaultSize, | |
37 | long style = wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE, | |
38 | const wxString& name = wxT("editableListBox")); | |
39 | ||
40 | void SetStrings(const wxArrayString& strings); | |
41 | void GetStrings(wxArrayString& strings); | |
42 | ||
43 | wxListCtrl* GetListCtrl() { return m_listCtrl; } | |
44 | wxBitmapButton* GetDelButton() { return m_bDel; } | |
45 | wxBitmapButton* GetNewButton() { return m_bNew; } | |
46 | wxBitmapButton* GetUpButton() { return m_bUp; } | |
47 | wxBitmapButton* GetDownButton() { return m_bDown; } | |
48 | wxBitmapButton* GetEditButton() { return m_bEdit; } | |
49 | ||
50 | protected: | |
51 | wxBitmapButton *m_bDel, *m_bNew, *m_bUp, *m_bDown, *m_bEdit; | |
52 | wxListCtrl *m_listCtrl; | |
53 | int m_selection; | |
54 | long m_style; | |
55 | ||
56 | void OnItemSelected(wxListEvent& event); | |
57 | void OnEndLabelEdit(wxListEvent& event); | |
58 | void OnNewItem(wxCommandEvent& event); | |
59 | void OnDelItem(wxCommandEvent& event); | |
60 | void OnEditItem(wxCommandEvent& event); | |
61 | void OnUpItem(wxCommandEvent& event); | |
62 | void OnDownItem(wxCommandEvent& event); | |
63 | ||
64 | DECLARE_EVENT_TABLE() | |
65 | }; | |
66 | ||
67 | #endif |