27#include <wx/settings.h>
29#include <wx/statbmp.h>
32 ICON_ID aInitialIcon,
int aID ):
33 wxPanel( aParent, aID ),
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() );
70 wxImage
image( size, size );
74 for(
int y = 0; y < size; ++y )
76 for(
int x = 0; x < size; ++x )
77 image.SetAlpha( x, y, wxIMAGE_ALPHA_TRANSPARENT );
83 image.SetRGB( size / 2, size / 2, 128, 128, 128 );
84 image.SetAlpha( size / 2, size / 2, 10 );
93wxBitmap
createArrow(
int size,
double aScaleFactor,
int aDirection,
const wxColour& aColour )
97 int startX = ( size - 1 ) / 2;
100 int startY = aDirection % 2;
102 for(
int y = startY; y < startY + ( size / 2 ); ++y )
104 for(
int x = startX; x < startX + len; ++x )
106 image.SetRGB( x, y, aColour.Red(), aColour.Green(), aColour.Blue() );
107 image.SetAlpha( x, y, wxIMAGE_ALPHA_OPAQUE );
115 for(
int i = 0; i < aDirection; ++i )
118 wxBitmap bmp(
image );
119 bmp.SetScaleFactor( aScaleFactor );
126wxBitmap
createTurndown(
int size,
double aScaleFactor,
int aDirection,
const wxColour& aColour )
130 const unsigned char opacity = 0.70 * wxIMAGE_ALPHA_OPAQUE;
131 const int padding_start = 0 * aScaleFactor + 0.5;
132 const int padding_end = 2 * aScaleFactor + 0.5;
134 int startX = ( size - 1 ) / 2;
137 int startY = padding_start;
139 for(
int y = 0; y < size - padding_end; ++y )
141 for(
int x = 0; x < len; ++x )
143 image.SetRGB( x + startX, y + startY, aColour.Red(), aColour.Green(), aColour.Blue() );
144 image.SetAlpha( x + startX, y + startY, ( y % 2 ) || ( ( x > 0 ) && ( x < len - 1 ) ) ? opacity : opacity / 2);
155 for(
int i = 0; i < aDirection; ++i )
158 wxBitmap bmp(
image );
159 bmp.SetScaleFactor( aScaleFactor );
169 int startX = size / 2 - 1;
174 for(
int y = startY; y < size && len > 0; ++y )
176 for(
int x = startX; x < startX + len; ++x )
178 image.SetRGB( x, y, aColour.Red(), aColour.Green(), aColour.Blue() );
179 image.SetAlpha( x, y, wxIMAGE_ALPHA_OPAQUE );
183 if( y < ( size / 2) - 1 )
195 wxBitmap bmp(
image );
196 bmp.SetScaleFactor( aScaleFactor );
206 return aWindow->ToPhys( aWindow->FromDIP( dip ) );
209 double scale = aWindow->GetDPIScaleFactor();
210 wxColour shadowColor = wxSystemSettings::GetColour( wxSYS_COLOUR_3DDKSHADOW );
211 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)