]>
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 SC |
24 | // forward decl for GetPeer() |
25 | class wxMacListControl ; | |
26 | ||
8cf73271 SC |
27 | // List box item |
28 | ||
29 | WX_DEFINE_ARRAY( char * , wxListDataArray ) ; | |
30 | ||
31 | // ---------------------------------------------------------------------------- | |
32 | // List box control | |
33 | // ---------------------------------------------------------------------------- | |
34 | ||
35 | class WXDLLEXPORT wxListBox : public wxListBoxBase | |
36 | { | |
37 | public: | |
38 | // ctors and such | |
39 | wxListBox(); | |
40 | wxListBox(wxWindow *parent, wxWindowID id, | |
41 | const wxPoint& pos = wxDefaultPosition, | |
42 | const wxSize& size = wxDefaultSize, | |
43 | int n = 0, const wxString choices[] = NULL, | |
44 | long style = 0, | |
45 | const wxValidator& validator = wxDefaultValidator, | |
46 | const wxString& name = wxListBoxNameStr) | |
47 | { | |
48 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
49 | } | |
50 | wxListBox(wxWindow *parent, wxWindowID id, | |
51 | const wxPoint& pos, | |
52 | const wxSize& size, | |
53 | const wxArrayString& choices, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxListBoxNameStr) | |
57 | { | |
58 | Create(parent, id, pos, size, choices, style, validator, name); | |
59 | } | |
60 | ||
61 | bool Create(wxWindow *parent, wxWindowID id, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | int n = 0, const wxString choices[] = NULL, | |
65 | long style = 0, | |
66 | const wxValidator& validator = wxDefaultValidator, | |
67 | const wxString& name = wxListBoxNameStr); | |
68 | bool Create(wxWindow *parent, wxWindowID id, | |
69 | const wxPoint& pos, | |
70 | const wxSize& size, | |
71 | const wxArrayString& choices, | |
72 | long style = 0, | |
73 | const wxValidator& validator = wxDefaultValidator, | |
74 | const wxString& name = wxListBoxNameStr); | |
75 | ||
76 | virtual ~wxListBox(); | |
8228b893 | 77 | virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); |
de1b0aeb | 78 | |
8cf73271 SC |
79 | // implement base class pure virtuals |
80 | virtual void Clear(); | |
aa61d352 | 81 | virtual void Delete(unsigned int n); |
8cf73271 | 82 | |
aa61d352 VZ |
83 | virtual unsigned int GetCount() const; |
84 | virtual wxString GetString(unsigned int n) const; | |
85 | virtual void SetString(unsigned int n, const wxString& s); | |
853dcc57 | 86 | virtual int FindString(const wxString& s, bool bCase = false) const; |
8cf73271 SC |
87 | |
88 | virtual bool IsSelected(int n) const; | |
8cf73271 SC |
89 | virtual int GetSelection() const; |
90 | virtual int GetSelections(wxArrayInt& aSelections) const; | |
91 | ||
8cf73271 | 92 | // wxCheckListBox support |
b6a20a20 RD |
93 | static wxVisualAttributes |
94 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
de1b0aeb | 95 | |
8cf73271 SC |
96 | wxArrayString m_stringArray ; |
97 | wxListDataArray m_dataArray ; | |
ba5b8a68 SC |
98 | |
99 | wxMacListControl* GetPeer() const { return (wxMacListControl*) m_peer ; } | |
de1b0aeb | 100 | |
8cf73271 | 101 | protected: |
ba5b8a68 SC |
102 | // internal storage for line n has changed, issue a redraw |
103 | void MacUpdateLine( int n ) ; | |
104 | ||
6f02a879 VZ |
105 | virtual void DoSetSelection(int n, bool select); |
106 | virtual int DoAppend(const wxString& item); | |
aa61d352 | 107 | virtual void DoInsertItems(const wxArrayString& items, unsigned int pos); |
6f02a879 VZ |
108 | virtual void DoSetItems(const wxArrayString& items, void **clientData); |
109 | virtual void DoSetFirstItem(int n); | |
aa61d352 VZ |
110 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
111 | virtual void* DoGetItemClientData(unsigned int n) const; | |
112 | virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData); | |
113 | virtual wxClientData* DoGetItemClientObject(unsigned int n) const; | |
6f02a879 | 114 | virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); |
c00fed0e | 115 | virtual int DoListHitTest(const wxPoint& point) const; |
6f02a879 | 116 | |
8cf73271 | 117 | // free memory (common part of Clear() and dtor) |
de1b0aeb | 118 | // prevent collision with some BSD definitions of macro Free() |
8cf73271 SC |
119 | void FreeData(); |
120 | ||
aa61d352 | 121 | unsigned int m_noItems; |
37c287c4 | 122 | |
8cf73271 SC |
123 | virtual wxSize DoGetBestSize() const; |
124 | ||
ba5b8a68 SC |
125 | // common creation for all databrowser list implementations |
126 | wxMacListControl* CreateMacListControl(const wxPoint& pos, const wxSize& size, long style) ; | |
127 | ||
8cf73271 SC |
128 | private: |
129 | DECLARE_DYNAMIC_CLASS(wxListBox) | |
130 | DECLARE_EVENT_TABLE() | |
131 | }; | |
132 | ||
de1b0aeb | 133 | #endif // _WX_LISTBOX_H_ |