26#include <wx/settings.h>
28#include <wx/statbmp.h>
31 ICON_ID aInitialIcon,
int aID ):
32 wxPanel( aParent, aID ),
33 m_iconProvider( aIconProvider ),
34 m_currentId( aInitialIcon )
36 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
41 m_bitmap =
new wxStaticBitmap(
this, aID, icon, wxDefaultPosition, icon.GetSize() );
45 auto evtSkipper = [
this] ( wxEvent& aEvent )
47 wxPostEvent(
this, aEvent );
50 m_bitmap->Bind( wxEVT_LEFT_DOWN, evtSkipper );
75 wxImage
image( size, size );
78 for(
int y = 0; y < size; ++y )
79 for(
int x = 0; x < size; ++x )
80 image.SetAlpha( x, y, wxIMAGE_ALPHA_TRANSPARENT );
85 image.SetRGB( size / 2, size / 2, 128, 128, 128 );
86 image.SetAlpha( size / 2, size / 2, 10 );
95wxBitmap
createArrow(
int size,
int aDirection, wxColour aColour )
99 int startX = size / 2 - 1;
102 int startY = aDirection % 2;
104 for(
int y = startY; y < startY + ( size / 2 ); ++y )
106 for(
int x = startX; x < startX + len; ++x )
108 image.SetRGB( x, y, aColour.Red(), aColour.Green(), aColour.Blue() );
109 image.SetAlpha( x, y, wxIMAGE_ALPHA_OPAQUE );
117 for(
int i = 0; i < aDirection; ++i )
120 return wxBitmap(
image );
129 int startX = size / 2 - 1;
134 for(
int y = startY; y < size && len > 0; ++y )
136 for(
int x = startX; x < startX + len; ++x )
138 image.SetRGB( x, y, aColour.Red(), aColour.Green(), aColour.Blue() );
139 image.SetAlpha( x, y, wxIMAGE_ALPHA_OPAQUE );
143 if( y < ( size / 2) - 1 )
155 return wxBitmap(
image );
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 aSize)
wxBitmap m_downArrowBitmap
wxBitmap createDiamond(int size, wxColour aColour)
wxImage createBlankImage(int size)
wxBitmap createArrow(int size, int aDirection, wxColour aColour)