1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/listbox.h
3 // Purpose: wxListBox class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_LISTBOX_H_
12 #define _WX_LISTBOX_H_
14 #include "wx/ctrlsub.h"
15 #include "wx/clntdata.h"
17 // forward decl for GetSelections()
18 class WXDLLIMPEXP_FWD_BASE wxArrayInt
;
21 class WXDLLIMPEXP_CORE wxListBox
: public wxListBoxBase
23 DECLARE_DYNAMIC_CLASS(wxListBox
)
27 wxListBox(wxWindow
*parent
, wxWindowID id
,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
,
30 int n
= 0, const wxString choices
[] = NULL
,
32 const wxValidator
& validator
= wxDefaultValidator
,
33 const wxString
& name
= wxListBoxNameStr
)
35 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
38 wxListBox(wxWindow
*parent
, wxWindowID id
,
41 const wxArrayString
& choices
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxListBoxNameStr
)
46 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
49 bool Create(wxWindow
*parent
, wxWindowID id
,
50 const wxPoint
& pos
= wxDefaultPosition
,
51 const wxSize
& size
= wxDefaultSize
,
52 int n
= 0, const wxString choices
[] = NULL
,
54 const wxValidator
& validator
= wxDefaultValidator
,
55 const wxString
& name
= wxListBoxNameStr
);
57 bool Create(wxWindow
*parent
, wxWindowID id
,
60 const wxArrayString
& choices
,
62 const wxValidator
& validator
= wxDefaultValidator
,
63 const wxString
& name
= wxListBoxNameStr
);
65 // implementation of wxControlWithItems
66 virtual unsigned int GetCount() const;
67 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
69 void **clientData
, wxClientDataType type
);
70 virtual int GetSelection() const;
71 virtual void DoDeleteOneItem(unsigned int n
);
72 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
73 virtual void DoClear();
74 virtual void SetString(unsigned int n
, const wxString
& s
);
75 virtual wxString
GetString(unsigned int n
) const;
77 // implementation of wxListBoxbase
78 virtual void DoSetSelection(int n
, bool select
);
79 virtual void DoSetFirstItem(int n
);
80 virtual int GetSelections(wxArrayInt
& aSelections
) const;
81 virtual bool IsSelected(int n
) const;
83 // For single or multiple choice list item
84 void Command(wxCommandEvent
& event
);
87 virtual void ChangeBackgroundColour();
88 virtual void ChangeForegroundColour();
89 WXWidget
GetTopWidget() const;
91 #if wxUSE_CHECKLISTBOX
92 virtual void DoToggleItem(int WXUNUSED(item
), int WXUNUSED(x
)) {}
95 virtual wxSize
DoGetBestSize() const;
97 unsigned int m_noItems
;
100 void SetSelectionPolicy();