]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/listbox.h
0ab770ac57165df0865e548b05a0e5cf600716a9
[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 #ifndef _WX_LISTBOX_H_
13 #define _WX_LISTBOX_H_
14
15 #ifdef __GNUG__
16 #pragma interface "listbox.h"
17 #endif
18
19 #include "wx/control.h"
20 #include "wx/dynarray.h"
21
22 WXDLLEXPORT_DATA(extern const char*) wxListBoxNameStr;
23
24 // forward decl for GetSelections()
25 class WXDLLEXPORT wxArrayInt;
26
27 WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
28
29 // List box item
30
31 WX_DEFINE_ARRAY( char * , wxListDataArray ) ;
32
33 class WXDLLEXPORT wxListBox: public wxControl
34 {
35 DECLARE_DYNAMIC_CLASS(wxListBox)
36 public:
37
38 wxListBox();
39 inline wxListBox(wxWindow *parent, wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 int n = 0, const wxString choices[] = NULL,
43 long style = 0,
44 const wxValidator& validator = wxDefaultValidator,
45 const wxString& name = wxListBoxNameStr)
46 {
47 Create(parent, id, pos, size, n, choices, style, validator, name);
48 }
49
50 bool Create(wxWindow *parent, wxWindowID id,
51 const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize,
53 int n = 0, const wxString choices[] = NULL,
54 long style = 0,
55 const wxValidator& validator = wxDefaultValidator,
56 const wxString& name = wxListBoxNameStr);
57
58 ~wxListBox();
59
60 virtual void Append(const wxString& item);
61 virtual void Append(const wxString& item, char *clientData);
62 virtual void Set(int n, const wxString* choices, char **clientData = NULL);
63 virtual int FindString(const wxString& s) const ;
64 virtual void Clear();
65 virtual void SetSelection(int n, bool select = TRUE);
66
67 virtual void Deselect(int n);
68
69 // For single choice list item only
70 virtual int GetSelection() const ;
71 virtual void Delete(int n);
72 virtual char *GetClientData(int n) const ;
73 virtual void SetClientData(int n, char *clientData);
74 virtual void SetString(int n, const wxString& s);
75
76 // For single or multiple choice list item
77 virtual int GetSelections(wxArrayInt& aSelections) const;
78 virtual bool Selected(int n) const ;
79 virtual wxString GetString(int n) const ;
80
81 // Set the specified item at the first visible item
82 // or scroll to max range.
83 virtual void SetFirstItem(int n) ;
84 virtual void SetFirstItem(const wxString& s) ;
85
86 virtual void InsertItems(int nItems, const wxString items[], int pos);
87
88 virtual wxString GetStringSelection() const ;
89 virtual bool SetStringSelection(const wxString& s, bool flag = TRUE);
90 virtual int Number() const ;
91
92 void Command(wxCommandEvent& event);
93
94 void MacSetRedraw( bool doDraw ) ;
95 protected:
96 int m_noItems;
97 int m_selected;
98
99 void MacDestroy() ;
100 void MacDelete( int n ) ;
101 void MacInsert( int n , const char * text) ;
102 void MacAppend( const char * text) ;
103 void MacSet( int n , const char *text ) ;
104 void MacClear() ;
105 void MacSetSelection( int n , bool select ) ;
106 int MacGetSelection() const ;
107 int MacGetSelections(wxArrayInt& aSelections) const ;
108 bool MacIsSelected( int n ) const ;
109 void MacScrollTo( int n ) ;
110 void OnSize( const wxSizeEvent &size ) ;
111 void MacDoClick() ;
112 void MacDoDoubleClick() ;
113
114 public :
115 ListHandle m_macList ;
116 wxArrayString m_stringArray ;
117 wxListDataArray m_dataArray ;
118
119 virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
120 DECLARE_EVENT_TABLE()
121 };
122
123 #endif
124 // _WX_LISTBOX_H_