2006-09-23 05:14:49 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/bmpcbox.h
|
|
|
|
// Purpose: wxBitmapComboBox base header
|
|
|
|
// Author: Jaakko Salli
|
|
|
|
// Modified by:
|
|
|
|
// Created: Aug-31-2006
|
|
|
|
// Copyright: (c) Jaakko Salli
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_BMPCBOX_H_BASE_
|
|
|
|
#define _WX_BMPCBOX_H_BASE_
|
|
|
|
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_BITMAPCOMBOBOX
|
|
|
|
|
2022-01-19 02:44:02 -05:00
|
|
|
#include "wx/bmpbndl.h"
|
2014-07-12 04:31:22 -04:00
|
|
|
#include "wx/dynarray.h"
|
2006-09-23 05:14:49 -04:00
|
|
|
|
2009-12-05 14:57:58 -05:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
2008-05-17 19:42:37 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxItemContainer;
|
|
|
|
|
2008-05-17 18:43:00 -04:00
|
|
|
// Define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED for platforms which
|
|
|
|
// wxBitmapComboBox implementation utilizes ownerdrawn combobox
|
|
|
|
// (either native or generic).
|
2008-08-01 09:53:05 -04:00
|
|
|
#if !defined(__WXGTK20__) || defined(__WXUNIVERSAL__)
|
2008-05-17 18:43:00 -04:00
|
|
|
#define wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
|
2010-01-22 10:52:20 -05:00
|
|
|
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxDC;
|
2008-05-17 18:43:00 -04:00
|
|
|
#endif
|
2006-09-23 05:14:49 -04:00
|
|
|
|
2018-08-27 10:34:34 -04:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const char) wxBitmapComboBoxNameStr[];
|
2006-09-23 05:14:49 -04:00
|
|
|
|
|
|
|
|
2018-08-27 10:34:34 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxBitmapComboBoxBase
|
2006-09-23 05:14:49 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctors and such
|
2008-05-17 18:43:00 -04:00
|
|
|
wxBitmapComboBoxBase() { Init(); }
|
2006-09-23 05:14:49 -04:00
|
|
|
|
|
|
|
virtual ~wxBitmapComboBoxBase() { }
|
|
|
|
|
|
|
|
// Sets the image for the given item.
|
2022-01-19 02:44:02 -05:00
|
|
|
virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) = 0;
|
2006-09-23 05:14:49 -04:00
|
|
|
|
2008-05-17 18:43:00 -04:00
|
|
|
#if !defined(wxBITMAPCOMBOBOX_OWNERDRAWN_BASED)
|
|
|
|
|
|
|
|
// Returns the image of the item with the given index.
|
|
|
|
virtual wxBitmap GetItemBitmap(unsigned int n) const = 0;
|
|
|
|
|
2006-09-23 05:14:49 -04:00
|
|
|
// Returns size of the image used in list
|
|
|
|
virtual wxSize GetBitmapSize() const = 0;
|
2008-05-17 18:43:00 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void Init() {}
|
|
|
|
|
|
|
|
#else // wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
|
|
|
|
|
|
|
|
// Returns the image of the item with the given index.
|
|
|
|
virtual wxBitmap GetItemBitmap(unsigned int n) const;
|
|
|
|
|
|
|
|
// Returns size of the image used in list
|
|
|
|
virtual wxSize GetBitmapSize() const
|
|
|
|
{
|
|
|
|
return m_usedImgSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// Returns pointer to the combobox item container
|
|
|
|
virtual wxItemContainer* GetItemContainer() = 0;
|
|
|
|
|
|
|
|
// Return pointer to the owner-drawn combobox control
|
|
|
|
virtual wxWindow* GetControl() = 0;
|
|
|
|
|
|
|
|
// wxItemContainer functions
|
|
|
|
void BCBDoClear();
|
|
|
|
void BCBDoDeleteOneItem(unsigned int n);
|
|
|
|
|
2022-01-19 02:44:02 -05:00
|
|
|
void DoSetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap);
|
2008-05-17 18:43:00 -04:00
|
|
|
|
|
|
|
void DrawBackground(wxDC& dc, const wxRect& rect, int item, int flags) const;
|
|
|
|
void DrawItem(wxDC& dc, const wxRect& rect, int item, const wxString& text,
|
|
|
|
int flags) const;
|
|
|
|
wxCoord MeasureItem(size_t item) const;
|
|
|
|
|
|
|
|
// Returns true if image size was affected
|
2022-01-19 02:44:02 -05:00
|
|
|
virtual bool OnAddBitmap(const wxBitmapBundle& bitmap);
|
2008-05-17 18:43:00 -04:00
|
|
|
|
|
|
|
// Recalculates amount of empty space needed in front of text
|
|
|
|
// in control itself. Returns number that can be passed to
|
|
|
|
// wxOwnerDrawnComboBox::SetCustomPaintWidth() and similar
|
|
|
|
// functions.
|
|
|
|
virtual int DetermineIndent();
|
|
|
|
|
|
|
|
void UpdateInternals();
|
|
|
|
|
2022-02-07 07:44:00 -05:00
|
|
|
wxVector<wxBitmapBundle> m_bitmapbundles;// Images associated with items
|
|
|
|
wxSize m_usedImgSize; // Size of bitmaps
|
2008-05-17 18:43:00 -04:00
|
|
|
|
|
|
|
int m_imgAreaWidth; // Width and height of area next to text field
|
|
|
|
int m_fontHeight;
|
|
|
|
int m_indent;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Init();
|
|
|
|
#endif // !wxBITMAPCOMBOBOX_OWNERDRAWN_BASED/wxBITMAPCOMBOBOX_OWNERDRAWN_BASED
|
2006-09-23 05:14:49 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-05-17 18:43:00 -04:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#include "wx/generic/bmpcbox.h"
|
|
|
|
#elif defined(__WXMSW__)
|
|
|
|
#include "wx/msw/bmpcbox.h"
|
2008-06-07 10:26:49 -04:00
|
|
|
#elif defined(__WXGTK20__)
|
2008-05-27 06:17:56 -04:00
|
|
|
#include "wx/gtk/bmpcbox.h"
|
2008-05-17 18:43:00 -04:00
|
|
|
#else
|
|
|
|
#include "wx/generic/bmpcbox.h"
|
|
|
|
#endif
|
2006-09-23 05:14:49 -04:00
|
|
|
|
|
|
|
#endif // wxUSE_BITMAPCOMBOBOX
|
|
|
|
|
2006-09-24 09:18:23 -04:00
|
|
|
#endif // _WX_BMPCBOX_H_BASE_
|