]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/listbox.h
compilation fix for non-PCH
[wxWidgets.git] / include / wx / mac / listbox.h
CommitLineData
0dbd6262
SC
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
e7549107 12
0dbd6262
SC
13#ifndef _WX_LISTBOX_H_
14#define _WX_LISTBOX_H_
15
af49c4b8 16#if defined(__GNUG__) && !defined(__APPLE__)
e7549107 17 #pragma interface "listbox.h"
0dbd6262
SC
18#endif
19
e7549107
SC
20// ----------------------------------------------------------------------------
21// simple types
22// ----------------------------------------------------------------------------
0dbd6262 23
e7549107
SC
24#if wxUSE_OWNER_DRAWN
25 class WXDLLEXPORT wxOwnerDrawn;
0dbd6262 26
e7549107 27 // define the array of list box items
cba5db5f 28 #include "wx/dynarray.h"
0dbd6262 29
e7549107
SC
30 WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray);
31#endif // wxUSE_OWNER_DRAWN
32
33// forward decl for GetSelections()
34class wxArrayInt;
0dbd6262
SC
35
36// List box item
519cb848
SC
37
38WX_DEFINE_ARRAY( char * , wxListDataArray ) ;
39
e7549107
SC
40// ----------------------------------------------------------------------------
41// List box control
42// ----------------------------------------------------------------------------
43
44class WXDLLEXPORT wxListBox : public wxListBoxBase
0dbd6262 45{
e7549107
SC
46public:
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();
60149370
GD
69 virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL);
70
e7549107
SC
71 // implement base class pure virtuals
72 virtual void Clear();
73 virtual void Delete(int n);
74
75 virtual int GetCount() const;
76 virtual wxString GetString(int n) const;
77 virtual void SetString(int n, const wxString& s);
78 virtual int FindString(const wxString& s) const;
79
80 virtual bool IsSelected(int n) const;
81 virtual void SetSelection(int n, bool select = TRUE);
82 virtual int GetSelection() const;
83 virtual int GetSelections(wxArrayInt& aSelections) const;
84
85 virtual int DoAppend(const wxString& item);
86 virtual void DoInsertItems(const wxArrayString& items, int pos);
87 virtual void DoSetItems(const wxArrayString& items, void **clientData);
88
89 virtual void DoSetFirstItem(int n);
90
91 virtual void DoSetItemClientData(int n, void* clientData);
92 virtual void* DoGetItemClientData(int n) const;
93 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
94 virtual wxClientData* DoGetItemClientObject(int n) const;
d84afea9 95 virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
e7549107
SC
96
97 // wxCheckListBox support
98#if wxUSE_OWNER_DRAWN
99 // plug-in for derived classes
100 virtual wxOwnerDrawn *CreateItem(size_t n);
101
102 // allows to get the item and use SetXXX functions to set it's appearance
103 wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
104
105 // get the index of the given item
106 int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
107#endif // wxUSE_OWNER_DRAWN
108
e7549107
SC
109 // Windows callbacks
110
d84afea9
GD
111 virtual void SetupColours();
112 virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
5fcf715b
SC
113 virtual bool MacCanFocus() const { return true ; }
114 void OnChar(wxKeyEvent& event);
e7549107 115
d84afea9
GD
116 void* m_macList ;
117 wxArrayString m_stringArray ;
118 wxListDataArray m_dataArray ;
119 wxArrayInt m_selectionPreImage ;
120 void MacSetRedraw( bool doDraw ) ;
e7549107 121protected:
d84afea9
GD
122 void MacDestroy() ;
123 void MacDelete( int n ) ;
124 void MacInsert( int n , const char * text) ;
125 void MacAppend( const char * text) ;
126 void MacSet( int n , const char *text ) ;
127 void MacClear() ;
128 void MacSetSelection( int n , bool select ) ;
129 int MacGetSelection() const ;
130 int MacGetSelections(wxArrayInt& aSelections) const ;
131 bool MacIsSelected( int n ) const ;
132 void MacScrollTo( int n ) ;
133 void OnSize( const wxSizeEvent &size ) ;
134 void MacDoClick() ;
135 void MacDoDoubleClick() ;
519cb848 136
e7549107
SC
137 // do we have multiple selections?
138 bool HasMultipleSelection() const;
139
140 // free memory (common part of Clear() and dtor)
4b651a46
GD
141 // prevent collision with some BSD definitions of macro Free()
142 void FreeData();
e7549107
SC
143
144 int m_noItems;
145 int m_selected;
5fcf715b
SC
146 wxString m_typeIn ;
147 long m_lastTypeIn ;
e7549107 148
05adb9d2 149 virtual wxSize DoGetBestSize() const;
e7549107
SC
150
151#if wxUSE_OWNER_DRAWN
152 // control items
153 wxListBoxItemsArray m_aItems;
154#endif
155
156private:
157 DECLARE_DYNAMIC_CLASS(wxListBox)
d84afea9 158 DECLARE_EVENT_TABLE()
0dbd6262
SC
159};
160
161#endif
162 // _WX_LISTBOX_H_