]> git.saurik.com Git - wxWidgets.git/blame - include/wx/bmpcbox.h
make wxSortedArrayString::Sort() and Insert() private in STL build (closes #10947)
[wxWidgets.git] / include / wx / bmpcbox.h
CommitLineData
95a46303
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/bmpcbox.h
3// Purpose: wxBitmapComboBox base header
4// Author: Jaakko Salli
5// Modified by:
6// Created: Aug-31-2006
7// Copyright: (c) Jaakko Salli
1c4e8f38 8// RCS-ID: $Id$
95a46303
RR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_BMPCBOX_H_BASE_
13#define _WX_BMPCBOX_H_BASE_
14
15
16#include "wx/defs.h"
17
18#if wxUSE_BITMAPCOMBOBOX
19
20#include "wx/bitmap.h"
3b8b8024 21#include "wx/window.h"
95a46303 22
c574bfa9
VZ
23class WXDLLIMPEXP_FWD_CORE wxItemContainer;
24
f696015c
VZ
25// Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which
26// wxBitmapComboBox implementation utilizes ownerdrawn combobox
27// (either native or generic).
4c7b2d36 28#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__)
f696015c
VZ
29 #define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
30#endif
95a46303 31
23318a53 32extern WXDLLIMPEXP_DATA_ADV(const char) wxBitmapComboBoxNameStr[];
95a46303
RR
33
34
35class WXDLLIMPEXP_ADV wxBitmapComboBoxBase
36{
37public:
95a46303 38 // ctors and such
f696015c 39 wxBitmapComboBoxBase() { Init(); }
95a46303
RR
40
41 virtual ~wxBitmapComboBoxBase() { }
42
95a46303
RR
43 // Sets the image for the given item.
44 virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
45
f696015c
VZ
46#if !defined(wxBITMAPCOMBOBOX_OWNERDRAWN_BASED)
47
48 // Returns the image of the item with the given index.
49 virtual wxBitmap GetItemBitmap(unsigned int n) const = 0;
50
95a46303
RR
51 // Returns size of the image used in list
52 virtual wxSize GetBitmapSize() const = 0;
f696015c
VZ
53
54private:
55 void Init() {}
56
57#else // wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
58
59 // Returns the image of the item with the given index.
60 virtual wxBitmap GetItemBitmap(unsigned int n) const;
61
62 // Returns size of the image used in list
63 virtual wxSize GetBitmapSize() const
64 {
65 return m_usedImgSize;
66 }
67
68protected:
69
70 // Returns pointer to the combobox item container
71 virtual wxItemContainer* GetItemContainer() = 0;
72
73 // Return pointer to the owner-drawn combobox control
74 virtual wxWindow* GetControl() = 0;
75
76 // wxItemContainer functions
77 void BCBDoClear();
78 void BCBDoDeleteOneItem(unsigned int n);
79
80 void DoSetItemBitmap(unsigned int n, const wxBitmap& bitmap);
81
82 void DrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const;
83 void DrawItem(wxDC& dc, const wxRect& rect, int item, const wxString& text,
84 int flags) const;
85 wxCoord MeasureItem(size_t item) const;
86
87 // Returns true if image size was affected
88 virtual bool OnAddBitmap(const wxBitmap& bitmap);
89
90 // Recalculates amount of empty space needed in front of text
91 // in control itself. Returns number that can be passed to
92 // wxOwnerDrawnComboBox::SetCustomPaintWidth() and similar
93 // functions.
94 virtual int DetermineIndent();
95
96 void UpdateInternals();
97
98 wxArrayPtrVoid m_bitmaps; // Images associated with items
99 wxSize m_usedImgSize; // Size of bitmaps
100
101 int m_imgAreaWidth; // Width and height of area next to text field
102 int m_fontHeight;
103 int m_indent;
104
105private:
106 void Init();
107#endif // !wxBITMAPCOMBOBOX_OWNERDRAWN_BASED/wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
95a46303
RR
108};
109
110
f696015c
VZ
111#if defined(__WXUNIVERSAL__)
112 #include "wx/generic/bmpcbox.h"
113#elif defined(__WXMSW__)
114 #include "wx/msw/bmpcbox.h"
faba238f 115#elif defined(__WXGTK20__)
e78c1d78 116 #include "wx/gtk/bmpcbox.h"
f696015c
VZ
117#else
118 #include "wx/generic/bmpcbox.h"
119#endif
95a46303
RR
120
121#endif // wxUSE_BITMAPCOMBOBOX
122
8d37334f 123#endif // _WX_BMPCBOX_H_BASE_