23#include <wx/settings.h>
25#include <wx/statbmp.h>
28 ICON_ID aInitialIcon,
int aID ):
29 wxPanel( aParent, aID ),
33 wxBoxSizer* sizer =
new wxBoxSizer( wxHORIZONTAL );
38 m_bitmap =
new wxStaticBitmap(
this, aID, icon, wxDefaultPosition, icon.GetLogicalSize() );
42 auto evtSkipper = [
this] ( wxEvent& aEvent )
44 wxPostEvent(
this, aEvent );
47 m_bitmap->Bind( wxEVT_LEFT_DOWN, evtSkipper );
60 m_bitmap->SetSize( icon.GetLogicalSize() );
66 wxImage
image( size, size );
70 for(
int y = 0; y < size; ++y )
72 for(
int x = 0; x < size; ++x )
73 image.SetAlpha( x, y, wxIMAGE_ALPHA_TRANSPARENT );
79 image.SetRGB( size / 2, size / 2, 128, 128, 128 );
80 image.SetAlpha( size / 2, size / 2, 10 );
89wxBitmap
createArrow(
int size,
double aScaleFactor,
int aDirection,
const wxColour& aColour )
93 int startX = ( size - 1 ) / 2;
96 int startY = aDirection % 2;
98 for(
int y = startY; y < startY + ( size / 2 ); ++y )
100 for(
int x = startX; x < startX + len; ++x )
102 image.SetRGB( x, y, aColour.Red(), aColour.Green(), aColour.Blue() );
103 image.SetAlpha( x, y, wxIMAGE_ALPHA_OPAQUE );
111 for(
int i = 0; i < aDirection; ++i )
114 wxBitmap bmp(
image );
115 bmp.SetScaleFactor( aScaleFactor );
122wxBitmap
createTurndown(
int size,
double aScaleFactor,
int aDirection,
const wxColour& aColour )
126 const unsigned char opacity = 0.70 * wxIMAGE_ALPHA_OPAQUE;
127 const int padding_start = 0 * aScaleFactor + 0.5;
128 const int padding_end = 2 * aScaleFactor + 0.5;
130 int startX = ( size - 1 ) / 2;
133 int startY = padding_start;
135 for(
int y = 0; y < size - padding_end; ++y )
137 for(
int x = 0; x < len; ++x )
139 image.SetRGB( x + startX, y + startY, aColour.Red(), aColour.Green(), aColour.Blue() );
140 image.SetAlpha( x + startX, y + startY, ( y % 2 ) || ( ( x > 0 ) && ( x < len - 1 ) ) ? opacity : opacity / 2);
151 for(
int i = 0; i < aDirection; ++i )
154 wxBitmap bmp(
image );
155 bmp.SetScaleFactor( aScaleFactor );
165 int startX = size / 2 - 1;
170 for(
int y = startY; y < size && len > 0; ++y )
172 for(
int x = startX; x < startX + len; ++x )
174 image.SetRGB( x, y, aColour.Red(), aColour.Green(), aColour.Blue() );
175 image.SetAlpha( x, y, wxIMAGE_ALPHA_OPAQUE );
179 if( y < ( size / 2) - 1 )
191 wxBitmap bmp(
image );
192 bmp.SetScaleFactor( aScaleFactor );
202 return aWindow->ToPhys( aWindow->FromDIP( dip ) );
205 double scale = aWindow->GetDPIScaleFactor();
206 wxColour shadowColor = wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW );
207 wxColour textColor = wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXTEXT );
A simple object that can provide fixed bitmaps for use as row indicators.
ICON_PROVIDER & m_iconProvider
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.
ICON_ID m_currentId
Handle on the bitmap widget.
wxStaticBitmap * m_bitmap
Object that delivers icons for the indicator.
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.
@ CLOSED
Tree control closed.
@ 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 createTurndown(int size, double aScaleFactor, int aDirection, const wxColour &aColour)
wxBitmap createArrow(int size, double aScaleFactor, int aDirection, const wxColour &aColour)
wxBitmap createDiamond(int size, double aScaleFactor, wxColour aColour)
wxImage createBlankImage(int size)