]>
Commit | Line | Data |
---|---|---|
8cf73271 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/mac/carbon/listbox.h |
8cf73271 SC |
3 | // Purpose: wxListBox class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
8cf73271 SC |
12 | #ifndef _WX_LISTBOX_H_ |
13 | #define _WX_LISTBOX_H_ | |
14 | ||
8cf73271 SC |
15 | // ---------------------------------------------------------------------------- |
16 | // simple types | |
17 | // ---------------------------------------------------------------------------- | |
18 | #include "wx/dynarray.h" | |
19 | #include "wx/arrstr.h" | |
20 | ||
8cf73271 SC |
21 | // forward decl for GetSelections() |
22 | class wxArrayInt; | |
23 | ||
ba5b8a68 | 24 | // forward decl for GetPeer() |
12cb7591 | 25 | class wxMacListControl; |
ba5b8a68 | 26 | |
8cf73271 SC |
27 | // List box item |
28 | ||
12cb7591 | 29 | WX_DEFINE_ARRAY( char* , wxListDataArray ); |
8cf73271 SC |
30 | |
31 | // ---------------------------------------------------------------------------- | |
32 | // List box control | |
33 | // ---------------------------------------------------------------------------- | |
34 | ||
35 | class WXDLLEXPORT wxListBox : public wxListBoxBase | |
36 | { | |
37 | public: | |
38 | // ctors and such | |
39 | wxListBox(); | |
12cb7591 DS |
40 | |
41 | wxListBox( | |
42 | wxWindow *parent, | |
43 | wxWindowID id, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | int n = 0, const wxString choices[] = NULL, | |
47 | long style = 0, | |
48 | const wxValidator& validator = wxDefaultValidator, | |
49 | const wxString& name = wxListBoxNameStr) | |
8cf73271 SC |
50 | { |
51 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
52 | } | |
12cb7591 DS |
53 | |
54 | wxListBox( | |
55 | wxWindow *parent, | |
56 | wxWindowID id, | |
57 | const wxPoint& pos, | |
58 | const wxSize& size, | |
59 | const wxArrayString& choices, | |
60 | long style = 0, | |
61 | const wxValidator& validator = wxDefaultValidator, | |
62 | const wxString& name = wxListBoxNameStr) | |
8cf73271 SC |
63 | { |
64 | Create(parent, id, pos, size, choices, style, validator, name); | |
65 | } | |
66 | ||
12cb7591 DS |
67 | bool Create( |
68 | wxWindow *parent, | |
69 | wxWindowID id, | |
70 | const wxPoint& pos = wxDefaultPosition, | |
71 | const wxSize& size = wxDefaultSize, | |
72 | int n = 0, | |
73 | const wxString choices[] = NULL, | |
74 | long style = 0, | |
75 | const wxValidator& validator = wxDefaultValidator, | |
76 | const wxString& name = wxListBoxNameStr); | |
77 | ||
78 | bool Create( | |
79 | wxWindow *parent, | |
80 | wxWindowID id, | |
81 | const wxPoint& pos, | |
82 | const wxSize& size, | |
83 | const wxArrayString& choices, | |
84 | long style = 0, | |
85 | const wxValidator& validator = wxDefaultValidator, | |
86 | const wxString& name = wxListBoxNameStr); | |
8cf73271 SC |
87 | |
88 | virtual ~wxListBox(); | |
de1b0aeb | 89 | |
8cf73271 | 90 | // implement base class pure virtuals |
12cb7591 | 91 | virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); |
8cf73271 | 92 | virtual void Clear(); |
aa61d352 | 93 | virtual void Delete(unsigned int n); |
8cf73271 | 94 | |
aa61d352 VZ |
95 | virtual unsigned int GetCount() const; |
96 | virtual wxString GetString(unsigned int n) const; | |
97 | virtual void SetString(unsigned int n, const wxString& s); | |
853dcc57 | 98 | virtual int FindString(const wxString& s, bool bCase = false) const; |
8cf73271 SC |
99 | |
100 | virtual bool IsSelected(int n) const; | |
8cf73271 SC |
101 | virtual int GetSelection() const; |
102 | virtual int GetSelections(wxArrayInt& aSelections) const; | |
103 | ||
8cf73271 | 104 | // wxCheckListBox support |
b6a20a20 RD |
105 | static wxVisualAttributes |
106 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
de1b0aeb | 107 | |
12cb7591 | 108 | wxMacListControl * GetPeer() const { return (wxMacListControl*)m_peer; } |
de1b0aeb | 109 | |
12cb7591 DS |
110 | wxArrayString m_stringArray; |
111 | wxListDataArray m_dataArray; | |
112 | ||
8cf73271 | 113 | protected: |
12cb7591 DS |
114 | // common creation for all databrowser list implementations |
115 | wxMacListControl* CreateMacListControl(const wxPoint& pos, const wxSize& size, long style); | |
116 | ||
ba5b8a68 | 117 | // internal storage for line n has changed, issue a redraw |
12cb7591 | 118 | void MacUpdateLine(int n); |
ba5b8a68 | 119 | |
6f02a879 VZ |
120 | virtual void DoSetSelection(int n, bool select); |
121 | virtual int DoAppend(const wxString& item); | |
aa61d352 | 122 | virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); |
6f02a879 VZ |
123 | virtual void DoSetItems(const wxArrayString& items, void **clientData); |
124 | virtual void DoSetFirstItem(int n); | |
aa61d352 VZ |
125 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
126 | virtual void* DoGetItemClientData(unsigned int n) const; | |
127 | virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); | |
128 | virtual wxClientData* DoGetItemClientObject(unsigned int n) const; | |
6f02a879 | 129 | virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
c00fed0e | 130 | virtual int DoListHitTest(const wxPoint& point) const; |
12cb7591 | 131 | virtual wxSize DoGetBestSize() const; |
6f02a879 | 132 | |
8cf73271 | 133 | // free memory (common part of Clear() and dtor) |
de1b0aeb | 134 | // prevent collision with some BSD definitions of macro Free() |
8cf73271 SC |
135 | void FreeData(); |
136 | ||
aa61d352 | 137 | unsigned int m_noItems; |
8cf73271 | 138 | |
8cf73271 SC |
139 | private: |
140 | DECLARE_DYNAMIC_CLASS(wxListBox) | |
141 | DECLARE_EVENT_TABLE() | |
142 | }; | |
143 | ||
de1b0aeb | 144 | #endif // _WX_LISTBOX_H_ |