]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/listbox.h
added DoCreate/Load/SaveDocument() (patches 983570 and 983571)
[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(NO_GCC_PRAGMA)
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 wxListBox(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos,
45 const wxSize& size,
46 const wxArrayString& choices,
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxListBoxNameStr)
50 {
51 Create(parent, id, pos, size, choices, style, validator, name);
52 }
53
54 bool Create(wxWindow *parent, wxWindowID id,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 int n = 0, const wxString choices[] = NULL,
58 long style = 0,
59 const wxValidator& validator = wxDefaultValidator,
60 const wxString& name = wxListBoxNameStr);
61
62 bool Create(wxWindow *parent, wxWindowID id,
63 const wxPoint& pos,
64 const wxSize& size,
65 const wxArrayString& choices,
66 long style = 0,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString& name = wxListBoxNameStr);
69
70 ~wxListBox();
71
72 // implementation of wxControlWithItems
73 virtual int GetCount() const;
74 virtual int DoAppend(const wxString& item);
75 virtual void DoSetItemClientData(int n, void* clientData);
76 virtual void* DoGetItemClientData(int n) const;
77 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
78 virtual wxClientData* DoGetItemClientObject(int n) const;
79 virtual int GetSelection() const;
80 virtual void Delete(int n);
81 virtual int FindString(const wxString& s) const;
82 virtual void Clear();
83 virtual void SetString(int n, const wxString& s);
84 virtual wxString GetString(int n) const;
85
86 // implementation of wxListBoxbase
87 virtual void SetSelection(int n, bool select = TRUE);
88 virtual void DoInsertItems(const wxArrayString& items, int pos);
89 virtual void DoSetItems(const wxArrayString& items, void **clientData);
90 virtual void DoSetFirstItem(int n);
91 virtual int GetSelections(wxArrayInt& aSelections) const;
92 virtual bool IsSelected(int n) const;
93
94 // For single or multiple choice list item
95 void Command(wxCommandEvent& event);
96
97 // Implementation
98 virtual void ChangeBackgroundColour();
99 virtual void ChangeForegroundColour();
100 WXWidget GetTopWidget() const;
101
102 #if wxUSE_CHECKLISTBOX
103 virtual void DoToggleItem(int item, int x) {};
104 #endif
105 protected:
106 virtual wxSize DoGetBestSize() const;
107
108 int m_noItems;
109
110 // List mapping positions->client data
111 wxClientDataDictionary m_clientDataDict;
112 private:
113 void SetSelectionPolicy();
114 };
115
116 #endif
117 // _WX_LISTBOX_H_