]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/listbox.h
Can now skip default manifest inclusion by defining wxUSE_NO_MANIFEST
[wxWidgets.git] / include / wx / motif / listbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: listbox.h
3 // Purpose: wxListBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_LISTBOX_H_
13 #define _WX_LISTBOX_H_
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "listbox.h"
17 #endif
18
19 #include "wx/ctrlsub.h"
20 #include "wx/clntdata.h"
21
22 // forward decl for GetSelections()
23 class WXDLLEXPORT wxArrayInt;
24
25 // List box item
26 class WXDLLEXPORT wxListBox: public wxListBoxBase
27 {
28 DECLARE_DYNAMIC_CLASS(wxListBox)
29
30 public:
31 wxListBox();
32 wxListBox(wxWindow *parent, wxWindowID id,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 int n = 0, const wxString choices[] = NULL,
36 long style = 0,
37 const wxValidator& validator = wxDefaultValidator,
38 const wxString& name = wxListBoxNameStr)
39 {
40 Create(parent, id, pos, size, n, choices, style, validator, name);
41 }
42
43 bool Create(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize,
46 int n = 0, const wxString choices[] = NULL,
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxListBoxNameStr);
50
51 ~wxListBox();
52
53 // implementation of wxControlWithItems
54 virtual int GetCount() const;
55 virtual int DoAppend(const wxString& item);
56 virtual void DoSetItemClientData(int n, void* clientData);
57 virtual void* DoGetItemClientData(int n) const;
58 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
59 virtual wxClientData* DoGetItemClientObject(int n) const;
60 virtual int GetSelection() const;
61 virtual void Delete(int n);
62 virtual int FindString(const wxString& s) const;
63 virtual void Clear();
64 virtual void SetString(int n, const wxString& s);
65 virtual wxString GetString(int n) const;
66
67 // implementation of wxListBoxbase
68 virtual void SetSelection(int n, bool select = TRUE);
69 virtual void DoInsertItems(const wxArrayString& items, int pos);
70 virtual void DoSetItems(const wxArrayString& items, void **clientData);
71 virtual void DoSetFirstItem(int n);
72 virtual int GetSelections(wxArrayInt& aSelections) const;
73 virtual bool IsSelected(int n) const;
74
75 // For single or multiple choice list item
76 void Command(wxCommandEvent& event);
77
78 // Implementation
79 virtual void ChangeBackgroundColour();
80 virtual void ChangeForegroundColour();
81 WXWidget GetTopWidget() const;
82
83 #if wxUSE_CHECKLISTBOX
84 virtual void DoToggleItem(int item, int x) {};
85 #endif
86 protected:
87 virtual wxSize DoGetBestSize() const;
88
89 int m_noItems;
90
91 // List mapping positions->client data
92 wxClientDataDictionary m_clientDataDict;
93 private:
94 void SetSelectionPolicy();
95 };
96
97 #endif
98 // _WX_LISTBOX_H_