]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/listbox.h
Made some treectrl sample icons transparent; added toolbar.h to wx.h
[wxWidgets.git] / include / wx / os2 / listbox.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: listbox.h
3// Purpose: wxListBox class
fb9010ed 4// Author: David Webster
0e320a79 5// Modified by:
fb9010ed 6// Created: 10/09/99
0e320a79 7// RCS-ID: $Id$
fb9010ed
DW
8// Copyright: (c) David Webster
9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_LISTBOX_H_
13#define _WX_LISTBOX_H_
14
dcd307ee
DW
15// ----------------------------------------------------------------------------
16// simple types
17// ----------------------------------------------------------------------------
0e320a79 18
fb9010ed
DW
19#if wxUSE_OWNER_DRAWN
20 class WXDLLEXPORT wxOwnerDrawn;
21
22 // define the array of list box items
23 #include <wx/dynarray.h>
24
dcd307ee
DW
25 WX_DEFINE_EXPORTED_ARRAY(wxOwnerDrawn *, wxListBoxItemsArray);
26#endif // wxUSE_OWNER_DRAWN
fb9010ed 27
0e320a79 28// forward decl for GetSelections()
dcd307ee 29class wxArrayInt;
0e320a79 30
dcd307ee
DW
31// ----------------------------------------------------------------------------
32// List box control
33// ----------------------------------------------------------------------------
0e320a79 34
dcd307ee 35class WXDLLEXPORT wxListBox : public wxListBoxBase
0e320a79 36{
dcd307ee
DW
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,
57c4d796
DW
45#if wxUSE_VALIDATORS
46# if defined(__VISAGECPP__)
47 const wxValidator* validator = wxDefaultValidator,
48# else
dcd307ee 49 const wxValidator& validator = wxDefaultValidator,
57c4d796
DW
50# endif
51#endif
dcd307ee
DW
52 const wxString& name = wxListBoxNameStr)
53 {
54 Create(parent, id, pos, size, n, choices, style, validator, name);
55 }
56
57 bool Create(wxWindow *parent, wxWindowID id,
58 const wxPoint& pos = wxDefaultPosition,
59 const wxSize& size = wxDefaultSize,
60 int n = 0, const wxString choices[] = NULL,
61 long style = 0,
57c4d796
DW
62#if wxUSE_VALIDATORS
63# if defined(__VISAGECPP__)
64 const wxValidator* validator = wxDefaultValidator,
65# else
dcd307ee 66 const wxValidator& validator = wxDefaultValidator,
57c4d796
DW
67# endif
68#endif
dcd307ee
DW
69 const wxString& name = wxListBoxNameStr);
70
71 virtual ~wxListBox();
72
73 // implement base class pure virtuals
74 virtual void Clear();
75 virtual void Delete(int n);
76
77 virtual int GetCount() const;
78 virtual wxString GetString(int n) const;
79 virtual void SetString(int n, const wxString& s);
80 virtual int FindString(const wxString& s) const;
81
82 virtual bool IsSelected(int n) const;
83 virtual void SetSelection(int n, bool select = TRUE);
84 virtual int GetSelection() const;
85 virtual int GetSelections(wxArrayInt& aSelections) const;
86
87 virtual int DoAppend(const wxString& item);
88 virtual void DoInsertItems(const wxArrayString& items, int pos);
89 virtual void DoSetItems(const wxArrayString& items, void **clientData);
90
91 virtual void DoSetFirstItem(int n);
92
93 virtual void DoSetItemClientData(int n, void* clientData);
94 virtual void* DoGetItemClientData(int n) const;
95 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
96 virtual wxClientData* DoGetItemClientObject(int n) const;
97
98 // wxCheckListBox support
fb9010ed
DW
99#if wxUSE_OWNER_DRAWN
100 bool OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
101 bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
102
103 // plug-in for derived classes
104 virtual wxOwnerDrawn *CreateItem(size_t n);
105
106 // allows to get the item and use SetXXX functions to set it's appearance
107 wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
108
109 // get the index of the given item
110 int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
111#endif // wxUSE_OWNER_DRAWN
112
dcd307ee
DW
113 // Windows-specific code to set the horizontal extent of the listbox, if
114 // necessary. If s is non-NULL, it's used to calculate the horizontal
115 // extent. Otherwise, all strings are used.
fb9010ed
DW
116 virtual void SetHorizontalExtent(const wxString& s = wxEmptyString);
117
dcd307ee 118 // Windows callbacks
fb9010ed 119 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
dcd307ee
DW
120 WXUINT message,
121 WXWPARAM wParam, WXLPARAM lParam);
122
123 bool OS2Command(WXUINT param, WXWORD id);
fb9010ed 124
fb9010ed
DW
125 virtual void SetupColours();
126
127protected:
dcd307ee
DW
128 // do we have multiple selections?
129 bool HasMultipleSelection() const;
130
131 int m_noItems;
132 int m_selected;
fb9010ed 133
dcd307ee 134 virtual wxSize DoGetBestSize();
fb9010ed
DW
135
136#if wxUSE_OWNER_DRAWN
137 // control items
138 wxListBoxItemsArray m_aItems;
139#endif
dcd307ee 140
fb9010ed 141private:
dcd307ee
DW
142#if wxUSE_WX_RESOURCES
143# if wxUSE_OWNER_DRAWN
144 virtual wxControl *CreateItem(const wxItemResource* childResource,
145 const wxItemResource* parentResource,
146 const wxResourceTable *table = (const wxResourceTable *) NULL)
147 { return(wxWindowBase::CreateItem(childResource, parentResource, table)); }
148# endif
149#endif
150 DECLARE_DYNAMIC_CLASS(wxListBox)
0e320a79
DW
151};
152
153#endif
154 // _WX_LISTBOX_H_