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