]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/listbox.h
1. added encoding param to wxFontEncoding::EnumFamilies() which allows to get
[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,
45 const wxValidator& validator = wxDefaultValidator,
46 const wxString& name = wxListBoxNameStr)
47 {
48 Create(parent, id, pos, size, n, choices, style, validator, name);
49 }
50
51 bool Create(wxWindow *parent, wxWindowID id,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 int n = 0, const wxString choices[] = NULL,
55 long style = 0,
56 const wxValidator& validator = wxDefaultValidator,
57 const wxString& name = wxListBoxNameStr);
58
59 virtual ~wxListBox();
60
61 // implement base class pure virtuals
62 virtual void Clear();
63 virtual void Delete(int n);
64
65 virtual int GetCount() const;
66 virtual wxString GetString(int n) const;
67 virtual void SetString(int n, const wxString& s);
68 virtual int FindString(const wxString& s) const;
69
70 virtual bool IsSelected(int n) const;
71 virtual void SetSelection(int n, bool select = TRUE);
72 virtual int GetSelection() const;
73 virtual int GetSelections(wxArrayInt& aSelections) const;
74
75 virtual int DoAppend(const wxString& item);
76 virtual void DoInsertItems(const wxArrayString& items, int pos);
77 virtual void DoSetItems(const wxArrayString& items, void **clientData);
78
79 virtual void DoSetFirstItem(int n);
80
81 virtual void DoSetItemClientData(int n, void* clientData);
82 virtual void* DoGetItemClientData(int n) const;
83 virtual void DoSetItemClientObject(int n, wxClientData* clientData);
84 virtual wxClientData* DoGetItemClientObject(int n) const;
85
86 // wxCheckListBox support
fb9010ed
DW
87#if wxUSE_OWNER_DRAWN
88 bool OS2OnMeasure(WXMEASUREITEMSTRUCT *item);
89 bool OS2OnDraw(WXDRAWITEMSTRUCT *item);
90
91 // plug-in for derived classes
92 virtual wxOwnerDrawn *CreateItem(size_t n);
93
94 // allows to get the item and use SetXXX functions to set it's appearance
95 wxOwnerDrawn *GetItem(size_t n) const { return m_aItems[n]; }
96
97 // get the index of the given item
98 int GetItemIndex(wxOwnerDrawn *item) const { return m_aItems.Index(item); }
99#endif // wxUSE_OWNER_DRAWN
100
dcd307ee
DW
101 // Windows-specific code to set the horizontal extent of the listbox, if
102 // necessary. If s is non-NULL, it's used to calculate the horizontal
103 // extent. Otherwise, all strings are used.
fb9010ed
DW
104 virtual void SetHorizontalExtent(const wxString& s = wxEmptyString);
105
dcd307ee 106 // Windows callbacks
fb9010ed 107 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
dcd307ee
DW
108 WXUINT message,
109 WXWPARAM wParam, WXLPARAM lParam);
110
111 bool OS2Command(WXUINT param, WXWORD id);
fb9010ed 112
fb9010ed
DW
113 virtual void SetupColours();
114
115protected:
dcd307ee
DW
116 // do we have multiple selections?
117 bool HasMultipleSelection() const;
118
119 int m_noItems;
120 int m_selected;
fb9010ed 121
dcd307ee 122 virtual wxSize DoGetBestSize();
fb9010ed
DW
123
124#if wxUSE_OWNER_DRAWN
125 // control items
126 wxListBoxItemsArray m_aItems;
127#endif
dcd307ee 128
fb9010ed 129private:
dcd307ee
DW
130#if wxUSE_WX_RESOURCES
131# if wxUSE_OWNER_DRAWN
132 virtual wxControl *CreateItem(const wxItemResource* childResource,
133 const wxItemResource* parentResource,
134 const wxResourceTable *table = (const wxResourceTable *) NULL)
135 { return(wxWindowBase::CreateItem(childResource, parentResource, table)); }
136# endif
137#endif
138 DECLARE_DYNAMIC_CLASS(wxListBox)
0e320a79
DW
139};
140
141#endif
142 // _WX_LISTBOX_H_