]> git.saurik.com Git - wxWidgets.git/blob - include/wx/editlbox.h
Restore correct setting of the background colour.
[wxWidgets.git] / include / wx / editlbox.h
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
14 #include "wx/defs.h"
15
16 #if wxUSE_EDITABLELISTBOX
17
18 #include "wx/panel.h"
19
20 class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
21 class WXDLLIMPEXP_FWD_CORE wxListCtrl;
22 class WXDLLIMPEXP_FWD_CORE wxListEvent;
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
28 #define wxEL_DEFAULT_STYLE (wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE)
29
30 extern WXDLLIMPEXP_DATA_ADV(const char) wxEditableListBoxNameStr[];
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:
38 wxEditableListBox() { Init(); }
39
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)
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);
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
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
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()
92 };
93
94 #endif // wxUSE_EDITABLELISTBOX
95
96 #endif // __WX_EDITLBOX_H__