]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mac/carbon/listbox.h
Blind check for compatibility flags.
[wxWidgets.git] / include / wx / mac / carbon / listbox.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/mac/carbon/listbox.h
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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_LISTBOX_H_
13#define _WX_LISTBOX_H_
14
15// ----------------------------------------------------------------------------
16// simple types
17// ----------------------------------------------------------------------------
18#include "wx/dynarray.h"
19#include "wx/arrstr.h"
20
21// forward decl for GetSelections()
22class wxArrayInt;
23
24// forward decl for GetPeer()
25class wxMacListControl ;
26
27// List box item
28
29WX_DEFINE_ARRAY( char * , wxListDataArray ) ;
30
31// ----------------------------------------------------------------------------
32// List box control
33// ----------------------------------------------------------------------------
34
35class WXDLLEXPORT wxListBox : public wxListBoxBase
36{
37public:
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();
77 virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL);
78
79 // implement base class pure virtuals
80 virtual void Clear();
81 virtual void Delete(unsigned int n);
82
83 virtual unsigned int GetCount() const;
84 virtual wxString GetString(unsigned int n) const;
85 virtual void SetString(unsigned int n, const wxString& s);
86 virtual int FindString(const wxString& s, bool bCase = false) const;
87
88 virtual bool IsSelected(int n) const;
89 virtual int GetSelection() const;
90 virtual int GetSelections(wxArrayInt& aSelections) const;
91
92 // wxCheckListBox support
93 static wxVisualAttributes
94 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
95
96 wxArrayString m_stringArray ;
97 wxListDataArray m_dataArray ;
98
99 wxMacListControl* GetPeer() const { return (wxMacListControl*) m_peer ; }
100
101protected:
102 // internal storage for line n has changed, issue a redraw
103 void MacUpdateLine( int n ) ;
104
105 virtual void DoSetSelection(int n, bool select);
106 virtual int DoAppend(const wxString& item);
107 virtual void DoInsertItems(const wxArrayString& items, unsigned int pos);
108 virtual void DoSetItems(const wxArrayString& items, void **clientData);
109 virtual void DoSetFirstItem(int n);
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;
114 virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
115 virtual int DoListHitTest(const wxPoint& point) const;
116
117 // free memory (common part of Clear() and dtor)
118 // prevent collision with some BSD definitions of macro Free()
119 void FreeData();
120
121 unsigned int m_noItems;
122
123 virtual wxSize DoGetBestSize() const;
124
125 // common creation for all databrowser list implementations
126 wxMacListControl* CreateMacListControl(const wxPoint& pos, const wxSize& size, long style) ;
127
128private:
129 DECLARE_DYNAMIC_CLASS(wxListBox)
130 DECLARE_EVENT_TABLE()
131};
132
133#endif // _WX_LISTBOX_H_