1
/////////////////////////////////////////////////////////////////////////////
3
// Purpose: wxBitmapComboBox base header
4
// Author: Jaakko Salli
6
// Created: Aug-31-2006
7
// Copyright: (c) Jaakko Salli
8
// Licence: wxWindows licence
9
/////////////////////////////////////////////////////////////////////////////
11
#ifndef _WX_BMPCBOX_H_BASE_
12
#define _WX_BMPCBOX_H_BASE_
17
#if wxUSE_BITMAPCOMBOBOX
19
#include "wx/bitmap.h"
21
class WXDLLIMPEXP_FWD_CORE wxWindow;
22
class WXDLLIMPEXP_FWD_CORE wxItemContainer;
24
// Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which
25
// wxBitmapComboBox implementation utilizes ownerdrawn combobox
26
// (either native or generic).
27
#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__)
28
#define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
30
class WXDLLIMPEXP_FWD_CORE wxDC;
33
extern WXDLLIMPEXP_DATA_ADV(const char) wxBitmapComboBoxNameStr[];
36
class WXDLLIMPEXP_ADV wxBitmapComboBoxBase
40
wxBitmapComboBoxBase() { Init(); }
42
virtual ~wxBitmapComboBoxBase() { }
44
// Sets the image for the given item.
45
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
47
#if !defined(wxBITMAPCOMBOBOX_OWNERDRAWN_BASED)
49
// Returns the image of the item with the given index.
50
virtual wxBitmap GetItemBitmap(unsigned int n) const = 0;
52
// Returns size of the image used in list
53
virtual wxSize GetBitmapSize() const = 0;
58
#else // wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
60
// Returns the image of the item with the given index.
61
virtual wxBitmap GetItemBitmap(unsigned int n) const;
63
// Returns size of the image used in list
64
virtual wxSize GetBitmapSize() const
71
// Returns pointer to the combobox item container
72
virtual wxItemContainer* GetItemContainer() = 0;
74
// Return pointer to the owner-drawn combobox control
75
virtual wxWindow* GetControl() = 0;
77
// wxItemContainer functions
79
void BCBDoDeleteOneItem(unsigned int n);
81
void DoSetItemBitmap(unsigned int n, const wxBitmap& bitmap);
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,
86
wxCoord MeasureItem(size_t item) const;
88
// Returns true if image size was affected
89
virtual bool OnAddBitmap(const wxBitmap& bitmap);
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
95
virtual int DetermineIndent();
97
void UpdateInternals();
99
wxArrayPtrVoid m_bitmaps; // Images associated with items
100
wxSize m_usedImgSize; // Size of bitmaps
102
int m_imgAreaWidth; // Width and height of area next to text field
108
#endif // !wxBITMAPCOMBOBOX_OWNERDRAWN_BASED/wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
112
#if defined(__WXUNIVERSAL__)
113
#include "wx/generic/bmpcbox.h"
114
#elif defined(__WXMSW__)
115
#include "wx/msw/bmpcbox.h"
116
#elif defined(__WXGTK20__)
117
#include "wx/gtk/bmpcbox.h"
119
#include "wx/generic/bmpcbox.h"
122
#endif // wxUSE_BITMAPCOMBOBOX
124
#endif // _WX_BMPCBOX_H_BASE_