27#include <wx/settings.h>
29#include <wx/statbmp.h>
32 ICON_ID aInitialIcon,
int aID ):
33 wxPanel( aParent, aID ),
34 m_iconProvider( aIconProvider ),
35 m_currentId( aInitialIcon )
37 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
42 m_bitmap =
new wxStaticBitmap(
this, aID, icon, wxDefaultPosition, icon.GetLogicalSize() );
46 auto evtSkipper = [
this] ( wxEvent& aEvent )
48 wxPostEvent(
this, aEvent );
51 m_bitmap->Bind( wxEVT_LEFT_DOWN, evtSkipper );
64 m_bitmap->SetSize( icon.GetLogicalSize() );
76 wxImage
image( size, size );
80 for(
int y = 0; y < size; ++y )
82 for(
int x = 0; x < size; ++x )
83 image.SetAlpha( x, y, wxIMAGE_ALPHA_TRANSPARENT );
89 image.SetRGB( size / 2, size / 2, 128, 128, 128 );
90 image.SetAlpha( size / 2, size / 2, 10 );
99wxBitmap
createArrow(
int size,
double aScaleFactor,
int aDirection, wxColour aColour )
103 int startX = size / 2 - 1;
106 int startY = aDirection % 2;
108 for(
int y = startY; y < startY + ( size / 2 ); ++y )
110 for(
int x = startX; x < startX + len; ++x )
112 image.SetRGB( x, y, aColour.Red(), aColour.Green(), aColour.Blue() );
113 image.SetAlpha( x, y, wxIMAGE_ALPHA_OPAQUE );
121 for(
int i = 0; i < aDirection; ++i )
124 wxBitmap bmp(
image );
125 bmp.SetScaleFactor( aScaleFactor );
135 int startX = size / 2 - 1;
140 for(
int y = startY; y < size && len > 0; ++y )
142 for(
int x = startX; x < startX + len; ++x )
144 image.SetRGB( x, y, aColour.Red(), aColour.Green(), aColour.Blue() );
145 image.SetAlpha( x, y, wxIMAGE_ALPHA_OPAQUE );
149 if( y < ( size / 2) - 1 )
161 wxBitmap bmp(
image );
162 bmp.SetScaleFactor( aScaleFactor );
172 return aWindow->ToPhys( aWindow->FromDIP( dip ) );
175 double scale = aWindow->GetDPIScaleFactor();
176 wxColour shadowColor = wxSystemSettings().GetColour( wxSYS_COLOUR_3DDKSHADOW );
A simple object that can provide fixed bitmaps for use as row indicators.
virtual const wxBitmap & GetIndicatorIcon(ICON_ID aIconId) const =0
Get a reference to the row icon in the given mode.
ICON_PROVIDER & m_iconProvider
< An class that delivers icons for the indicator (currently just uses a default implementation).
int ICON_ID
An id that refers to a certain icon state.
INDICATOR_ICON(wxWindow *aParent, ICON_PROVIDER &aIconProvider, ICON_ID aInitialIcon, int aID)
void SetIndicatorState(ICON_ID aIconId)
Set the row indicator to the given state.
wxStaticBitmap * m_bitmap
Is the icon currently "on".
ICON_ID GetIndicatorState() const
const wxBitmap & GetIndicatorIcon(INDICATOR_ICON::ICON_ID aIconId) const override
Get a reference to the row icon in the given mode.
wxBitmap m_rightArrowBitmap
@ UP
Row above design alpha.
@ DOWN
Row below design alpha.
@ OFF
Row "off" or "deselected".
@ ON
Row "on" or "selected".
ROW_ICON_PROVIDER(int aSizeDIP, wxWindow *aWindow)
wxBitmap m_downArrowBitmap
wxBitmap createArrow(int size, double aScaleFactor, int aDirection, wxColour aColour)
wxBitmap createDiamond(int size, double aScaleFactor, wxColour aColour)
wxImage createBlankImage(int size)