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