]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/listbox.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / motif / listbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/listbox.h
3 // Purpose: wxListBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_LISTBOX_H_
12 #define _WX_LISTBOX_H_
13
14 #include "wx/ctrlsub.h"
15 #include "wx/clntdata.h"
16
17 // forward decl for GetSelections()
18 class WXDLLIMPEXP_FWD_BASE wxArrayInt;
19
20 // List box item
21 class WXDLLIMPEXP_CORE wxListBox: public wxListBoxBase
22 {
23 DECLARE_DYNAMIC_CLASS(wxListBox)
24
25 public:
26 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,
31 long style = 0,
32 const wxValidator& validator = wxDefaultValidator,
33 const wxString& name = wxListBoxNameStr)
34 {
35 Create(parent, id, pos, size, n, choices, style, validator, name);
36 }
37
38 wxListBox(wxWindow *parent, wxWindowID id,
39 const wxPoint& pos,
40 const wxSize& size,
41 const wxArrayString& choices,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxListBoxNameStr)
45 {
46 Create(parent, id, pos, size, choices, style, validator, name);
47 }
48
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,
53 long style = 0,
54 const wxValidator& validator = wxDefaultValidator,
55 const wxString& name = wxListBoxNameStr);
56
57 bool Create(wxWindow *parent, wxWindowID id,
58 const wxPoint& pos,
59 const wxSize& size,
60 const wxArrayString& choices,
61 long style = 0,
62 const wxValidator& validator = wxDefaultValidator,
63 const wxString& name = wxListBoxNameStr);
64
65 // implementation of wxControlWithItems
66 virtual unsigned int GetCount() const;
67 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
68 unsigned int pos,
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;
76
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;
82
83 // For single or multiple choice list item
84 void Command(wxCommandEvent& event);
85
86 // Implementation
87 virtual void ChangeBackgroundColour();
88 virtual void ChangeForegroundColour();
89 WXWidget GetTopWidget() const;
90
91 #if wxUSE_CHECKLISTBOX
92 virtual void DoToggleItem(int WXUNUSED(item), int WXUNUSED(x)) {}
93 #endif
94 protected:
95 virtual wxSize DoGetBestSize() const;
96
97 unsigned int m_noItems;
98
99 private:
100 void SetSelectionPolicy();
101 };
102
103 #endif
104 // _WX_LISTBOX_H_