]> git.saurik.com Git - wxWidgets.git/blame - include/wx/editlbox.h
using Run of base class
[wxWidgets.git] / include / wx / editlbox.h
CommitLineData
806ad819
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/editlbox.h
3// Purpose: ListBox with editable items
4// Author: Vaclav Slavik
806ad819
VZ
5// Copyright: (c) Vaclav Slavik
6// Licence: wxWindows licence
7/////////////////////////////////////////////////////////////////////////////
8
9
10#ifndef __WX_EDITLBOX_H__
11#define __WX_EDITLBOX_H__
12
23575150
RR
13#include "wx/defs.h"
14
15#if wxUSE_EDITABLELISTBOX
16
806ad819
VZ
17#include "wx/panel.h"
18
b5dbe15d
VS
19class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
20class WXDLLIMPEXP_FWD_CORE wxListCtrl;
21class WXDLLIMPEXP_FWD_CORE wxListEvent;
806ad819
VZ
22
23#define wxEL_ALLOW_NEW 0x0100
24#define wxEL_ALLOW_EDIT 0x0200
25#define wxEL_ALLOW_DELETE 0x0400
26#define wxEL_NO_REORDER 0x0800
395367bc
RR
27#define wxEL_DEFAULT_STYLE (wxEL_ALLOW_NEW | wxEL_ALLOW_EDIT | wxEL_ALLOW_DELETE)
28
23318a53 29extern WXDLLIMPEXP_DATA_ADV(const char) wxEditableListBoxNameStr[];
806ad819
VZ
30
31// This class provides a composite control that lets the
32// user easily enter list of strings
33
34class WXDLLIMPEXP_ADV wxEditableListBox : public wxPanel
35{
36public:
395367bc
RR
37 wxEditableListBox() { Init(); }
38
806ad819
VZ
39 wxEditableListBox(wxWindow *parent, wxWindowID id,
40 const wxString& label,
41 const wxPoint& pos = wxDefaultPosition,
42 const wxSize& size = wxDefaultSize,
395367bc
RR
43 long style = wxEL_DEFAULT_STYLE,
44 const wxString& name = wxEditableListBoxNameStr)
45 {
46 Init();
47 Create(parent, id, label, pos, size, style, name);
48 }
49
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);
806ad819
VZ
56
57 void SetStrings(const wxArrayString& strings);
58 void GetStrings(wxArrayString& strings) const;
59
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; }
66
67protected:
68 wxBitmapButton *m_bDel, *m_bNew, *m_bUp, *m_bDown, *m_bEdit;
69 wxListCtrl *m_listCtrl;
70 int m_selection;
71 long m_style;
72
395367bc
RR
73 void Init()
74 {
75 m_style = 0;
76 m_selection = 0;
77 m_bEdit = m_bNew = m_bDel = m_bUp = m_bDown = NULL;
78 m_listCtrl = NULL;
79 }
80
806ad819
VZ
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);
88
89 DECLARE_CLASS(wxEditableListBox)
90 DECLARE_EVENT_TABLE()
6b0dfbca
VZ
91
92private:
93 void SwapItems(long i1, long i2);
94
806ad819
VZ
95};
96
23575150
RR
97#endif // wxUSE_EDITABLELISTBOX
98
806ad819 99#endif // __WX_EDITLBOX_H__