]>
git.saurik.com Git - wxWidgets.git/blob - interface/odcombo.h
5ee81f1683531445e488bcf8cb7ecb3554dd9a10
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxOwnerDrawnComboBox class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxOwnerDrawnComboBox
13 wxOwnerDrawnComboBox is a combobox with owner-drawn list items.
14 In essence, it is a wxComboCtrl with
15 wxVListBox popup and wxControlWithItems
18 Implementing item drawing and measuring is similar to wxVListBox.
19 Application needs to subclass wxOwnerDrawnComboBox and implement
20 wxOwnerDrawnComboBox::OnDrawItem, wxOwnerDrawnComboBox::OnMeasureItem
21 and wxOwnerDrawnComboBox::OnMeasureItemWidth.
24 @style{wxODCB_DCLICK_CYCLES}:
25 Double-clicking cycles item if wxCB_READONLY is also used.
26 Synonymous with wxCC_SPECIAL_DCLICK.
27 @style{wxODCB_STD_CONTROL_PAINT}:
28 Control itself is not custom painted using OnDrawItem. Even if this
29 style is not used, writable wxOwnerDrawnComboBox is never custom
30 painted unless SetCustomPaintWidth is called.
34 @event{EVT_COMBOBOX(id\, func)}:
35 Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on
36 the list is selected. Note that calling GetValue returns the new
42 @appearance{ownerdrawncombobox.png}
45 wxComboCtrl, wxComboBox, wxVListBox, wxCommandEvent
47 class wxOwnerDrawnComboBox
: public wxComboCtrl
52 Constructor, creating and showing a owner-drawn combobox.
55 Parent window. Must not be @NULL.
58 Window identifier. The value wxID_ANY indicates a default value.
61 Initial selection string. An empty string indicates no selection.
67 Window size. If wxDefaultSize is specified then the window is sized
71 Number of strings with which to initialise the control.
74 An array of strings with which to initialise the control.
77 Window style. See wxOwnerDrawnComboBox.
85 @sa Create(), wxValidator
87 wxOwnerDrawnComboBox();
88 wxOwnerDrawnComboBox(wxWindow
* parent
, wxWindowID id
,
89 const wxString
& value
= "",
90 const wxPoint
& pos
= wxDefaultPosition
,
91 const wxSize
& size
= wxDefaultSize
,
93 const wxString choices
[] = @NULL
,
95 const wxValidator
& validator
= wxDefaultValidator
,
96 const wxString
& name
= "comboBox");
97 wxOwnerDrawnComboBox(wxWindow
* parent
, wxWindowID id
,
98 const wxString
& value
,
101 const wxArrayString
& choices
,
103 const wxValidator
& validator
= wxDefaultValidator
,
104 const wxString
& name
= "comboBox");
108 Destructor, destroying the owner-drawn combobox.
110 ~wxOwnerDrawnComboBox();
114 Creates the combobox for two-step construction. Derived classes
115 should call or replace this function. See
116 wxOwnerDrawnComboBox()
119 bool Create(wxWindow
* parent
, wxWindowID id
,
120 const wxString
& value
= "",
121 const wxPoint
& pos
= wxDefaultPosition
,
122 const wxSize
& size
= wxDefaultSize
,
123 int n
, const wxString choices
[],
125 const wxValidator
& validator
= wxDefaultValidator
,
126 const wxString
& name
= "comboBox");
127 bool Create(wxWindow
* parent
, wxWindowID id
,
128 const wxString
& value
,
131 const wxArrayString
& choices
,
133 const wxValidator
& validator
= wxDefaultValidator
,
134 const wxString
& name
= "comboBox");
138 Returns index to the widest item in the list.
143 Returns width of the widest item in the list.
145 int GetWidestItemWidth();
148 This method is used to draw the items background and, maybe, a border around it.
150 The base class version implements a reasonable default behaviour which consists
151 in drawing the selected item with the standard background colour and drawing a
152 border around the item if it is either selected or current.
154 @remarks flags has the same meaning as with OnDrawItem.
156 void OnDrawBackground(wxDC
& dc
, const wxRect
& rect
, int item
,
160 The derived class may implement this function to actually draw the item
161 with the given index on the provided DC. If function is not implemented,
162 the item text is simply drawn, as if the control was a normal combobox.
165 The device context to use for drawing
168 The bounding rectangle for the item being drawn (DC clipping
169 region is set to this rectangle before calling this function)
172 The index of the item to be drawn
175 Combines any of the following flag values:
177 void OnDrawItem(wxDC
& dc
, const wxRect
& rect
, int item
,
181 The derived class may implement this method to return the height of the
182 specified item (in pixels).
184 The default implementation returns text height, as if this control was
187 wxCoord
OnMeasureItem(size_t item
);
190 The derived class may implement this method to return the width of the
191 specified item (in pixels). If -1 is returned, then the item text width
194 The default implementation returns -1.
196 wxCoord
OnMeasureItemWidth(size_t item
);