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