]> git.saurik.com Git - wxWidgets.git/blame - include/wx/palmos/listbox.h
fix from Francesco for the latest version of wxPresets
[wxWidgets.git] / include / wx / palmos / listbox.h
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/palmos/listbox.h
3// Purpose: wxListBox class
e1d63b79 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
e1d63b79 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_LISTBOX_H_
13#define _WX_LISTBOX_H_
14
ffecfa5a
JS
15#if wxUSE_LISTBOX
16
17// ----------------------------------------------------------------------------
18// simple types
19// ----------------------------------------------------------------------------
20
21#if wxUSE_OWNER_DRAWN
22 class WXDLLEXPORT wxOwnerDrawn;
23
24 // define the array of list box items
25 #include "wx/dynarray.h"
26
27 WX_DEFINE_EXPORTED_ARRAY_PTR(wxOwnerDrawn *, wxListBoxItemsArray);
28#endif // wxUSE_OWNER_DRAWN
29
30// forward decl for GetSelections()
31class wxArrayInt;
32
33// ----------------------------------------------------------------------------
34// List box control
35// ----------------------------------------------------------------------------
36
37class WXDLLEXPORT wxListBox : public wxListBoxBase
38{
39public:
40 // ctors and such
41 wxListBox();
42 wxListBox(wxWindow *parent, wxWindowID id,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 int n = 0, const wxString choices[] = NULL,
46 long style = 0,
47 const wxValidator& validator = wxDefaultValidator,
48 const wxString& name = wxListBoxNameStr)
49 {
50 Create(parent, id, pos, size, n, choices, style, validator, name);
51 }
52 wxListBox(wxWindow *parent, wxWindowID id,
53 const wxPoint& pos,
54 const wxSize& size,
55 const wxArrayString& choices,
56 long style = 0,
57 const wxValidator& validator = wxDefaultValidator,
58 const wxString& name = wxListBoxNameStr)
59 {
60 Create(parent, id, pos, size, choices, style, validator, name);
61 }
62
63 bool Create(wxWindow *parent, wxWindowID id,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 int n = 0, const wxString choices[] = NULL,
67 long style = 0,
68 const wxValidator& validator = wxDefaultValidator,
69 const wxString& name = wxListBoxNameStr);
70 bool Create(wxWindow *parent, wxWindowID id,
71 const wxPoint& pos,
72 const wxSize& size,
73 const wxArrayString& choices,
74 long style = 0,
75 const wxValidator& validator = wxDefaultValidator,
76 const wxString& name = wxListBoxNameStr);
77
78 virtual ~wxListBox();
79
80 // implement base class pure virtuals
81 virtual void Clear();
aa61d352 82 virtual void Delete(unsigned int n);
ffecfa5a 83
aa61d352
VZ
84 virtual unsigned int GetCount() const;
85 virtual wxString GetString(unsigned int n) const;
86 virtual void SetString(unsigned int n, const wxString& s);
ffecfa5a
JS
87
88 virtual bool IsSelected(int n) const;
c6179a84 89 virtual void DoSetSelection(int n, bool select);
ffecfa5a
JS
90 virtual int GetSelection() const;
91 virtual int GetSelections(wxArrayInt& aSelections) const;
92
93 virtual int DoAppend(const wxString& item);
aa61d352 94 virtual void DoInsertItems(const wxArrayString& items, unsigned int pos);
ffecfa5a
JS
95 virtual void DoSetItems(const wxArrayString& items, void **clientData);
96
97 virtual void DoSetFirstItem(int n);
98
aa61d352
VZ
99 virtual void DoSetItemClientData(unsigned int n, void* clientData);
100 virtual void* DoGetItemClientData(unsigned int n) const;
101 virtual void DoSetItemClientObject(unsigned int n, wxClientData* clientData);
102 virtual wxClientData* DoGetItemClientObject(unsigned int n) const;
ffecfa5a
JS
103
104 // wxCheckListBox support
105#if wxUSE_OWNER_DRAWN
106 bool MSWOnMeasure(WXMEASUREITEMSTRUCT *item);
107 bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
108
109 // plug-in for derived classes
110 virtual wxOwnerDrawn *CreateLboxItem(size_t n);
111
112 // allows to get the item and use SetXXX functions to set it's appearance
113 wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
114
115 // get the index of the given item
116 int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
117#endif // wxUSE_OWNER_DRAWN
118
119 // Windows-specific code to set the horizontal extent of the listbox, if
120 // necessary. If s is non-NULL, it's used to calculate the horizontal
121 // extent. Otherwise, all strings are used.
122 virtual void SetHorizontalExtent(const wxString& s = wxEmptyString);
123
124 // Windows callbacks
125 bool MSWCommand(WXUINT param, WXWORD id);
126
127 virtual wxVisualAttributes GetDefaultAttributes() const
128 {
129 return GetClassDefaultAttributes(GetWindowVariant());
130 }
131
132 static wxVisualAttributes
133 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL)
134 {
135 return GetCompositeControlsDefaultAttributes(variant);
136 }
137
138protected:
139 WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
140
141 // free memory (common part of Clear() and dtor)
142 void Free();
143
ffecfa5a
JS
144 int m_selected;
145
146 virtual wxSize DoGetBestSize() const;
147
148#if wxUSE_OWNER_DRAWN
149 // control items
150 wxListBoxItemsArray m_aItems;
151#endif
152
153private:
154 DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox)
155};
156
157#endif // wxUSE_LISTBOX
158
159#endif
160 // _WX_LISTBOX_H_