]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/listbox.h
oops... fixed a typo
[wxWidgets.git] / include / wx / mac / listbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: listbox.h
3 // Purpose: wxListBox class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12
13 #ifndef _WX_LISTBOX_H_
14 #define _WX_LISTBOX_H_
15
16 #ifdef __GNUG__
17 #pragma interface "listbox.h"
18 #endif
19
20 // ----------------------------------------------------------------------------
21 // simple types
22 // ----------------------------------------------------------------------------
23
24 #if wxUSE_OWNER_DRAWN
25 class WXDLLEXPORT wxOwnerDrawn;
26
27 // define the array of list box items
28 #include <wx/dynarray.h>
29
30 WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray);
31 #endif // wxUSE_OWNER_DRAWN
32
33 // forward decl for GetSelections()
34 class wxArrayInt;
35
36 // List box item
37
38 WX_DEFINE_ARRAY( char * , wxListDataArray ) ;
39
40 // ----------------------------------------------------------------------------
41 // List box control
42 // ----------------------------------------------------------------------------
43
44 class WXDLLEXPORT wxListBox : public wxListBoxBase
45 {
46 public:
47 // ctors and such
48 wxListBox();
49 wxListBox(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 Create(parent, id, pos, size, n, choices, style, validator, name);
58 }
59
60 bool Create(wxWindow *parent, wxWindowID id,
61 const wxPoint& pos = wxDefaultPosition,
62 const wxSize& size = wxDefaultSize,
63 int n = 0, const wxString choices[] = NULL,
64 long style = 0,
65 const wxValidator& validator = wxDefaultValidator,
66 const wxString& name = wxListBoxNameStr);
67
68 virtual ~wxListBox();
69
70 // implement base class pure virtuals
71 virtual void Clear();
72 virtual void Delete(int n);
73
74 virtual int GetCount() const;
75 virtual wxString GetString(int n) const;
76 virtual void SetString(int n, const wxString& s);
77 virtual int FindString(const wxString& s) const;
78
79 virtual bool IsSelected(int n) const;
80 virtual void SetSelection(int n, bool select = TRUE);
81 virtual int GetSelection() const;
82 virtual int GetSelections(wxArrayInt& aSelections) const;
83
84 virtual int DoAppend(const wxString& item);
85 virtual void DoInsertItems(const wxArrayString& items, int pos);
86 virtual void DoSetItems(const wxArrayString& items, void **clientData);
87
88 virtual void DoSetFirstItem(int n);
89
90 virtual void DoSetItemClientData(int n, void* clientData);
91 virtual void* DoGetItemClientData(int n) const;
92 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
93 virtual wxClientData* DoGetItemClientObject(int n) const;
94
95 // wxCheckListBox support
96 #if wxUSE_OWNER_DRAWN
97 // plug-in for derived classes
98 virtual wxOwnerDrawn *CreateItem(size_t n);
99
100 // allows to get the item and use SetXXX functions to set it's appearance
101 wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
102
103 // get the index of the given item
104 int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
105 #endif // wxUSE_OWNER_DRAWN
106
107 // Windows callbacks
108
109 virtual void SetupColours();
110 virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
111
112 ListHandle m_macList ;
113 wxArrayString m_stringArray ;
114 wxListDataArray m_dataArray ;
115 void MacSetRedraw( bool doDraw ) ;
116 protected:
117 void MacDestroy() ;
118 void MacDelete( int n ) ;
119 void MacInsert( int n , const char * text) ;
120 void MacAppend( const char * text) ;
121 void MacSet( int n , const char *text ) ;
122 void MacClear() ;
123 void MacSetSelection( int n , bool select ) ;
124 int MacGetSelection() const ;
125 int MacGetSelections(wxArrayInt& aSelections) const ;
126 bool MacIsSelected( int n ) const ;
127 void MacScrollTo( int n ) ;
128 void OnSize( const wxSizeEvent &size ) ;
129 void MacDoClick() ;
130 void MacDoDoubleClick() ;
131
132 // do we have multiple selections?
133 bool HasMultipleSelection() const;
134
135 // free memory (common part of Clear() and dtor)
136 void Free();
137
138 int m_noItems;
139 int m_selected;
140
141 virtual wxSize DoGetBestSize() const;
142
143 #if wxUSE_OWNER_DRAWN
144 // control items
145 wxListBoxItemsArray m_aItems;
146 #endif
147
148 private:
149 DECLARE_DYNAMIC_CLASS(wxListBox)
150 DECLARE_EVENT_TABLE()
151 };
152
153 #endif
154 // _WX_LISTBOX_H_