20#ifndef DRC_RE_BITMAP_OVERLAY_PANEL_H
21#define DRC_RE_BITMAP_OVERLAY_PANEL_H
38class wxDPIChangedEvent;
39class wxSysColourChangedEvent;
107 template <
typename T>
121 template <
typename T>
155 void OnPaint( wxPaintEvent& aEvent );
179 std::vector<std::unique_ptr<DRC_RE_OVERLAY_FIELD>>
m_fields;
189 auto field = std::make_unique<DRC_RE_OVERLAY_FIELD>(
this, aId, aControl, aPosition );
196 int height = aControl->GetBestSize().GetHeight();
197 int width = aPosition.
xEnd - aPosition.
xStart;
198 wxPoint pos( aPosition.
xStart, aPosition.
yCenter - ( height + 1 ) / 2 );
199 wxSize size( width, height );
200 aControl->SetPosition( pos );
201 aControl->SetSize( size );
214 m_fields.push_back( std::move( field ) );
225 T* control =
new T(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, aStyle );
BITMAPS
A list of all bitmap identifiers.
DRC_RE_OVERLAY_FIELD * AddCheckbox(const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition)
Create and position a checkbox control on the bitmap overlay.
void LoadBitmap()
Load the appropriate bitmap variant for the current theme and DPI.
void OnThemeChange(wxSysColourChangedEvent &aEvent)
wxBitmap m_bitmap
Current background bitmap.
DRC_RE_OVERLAY_FIELD * AddControl(const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition, T *aControl)
Position a control on the bitmap overlay.
void OnDPIChanged(wxDPIChangedEvent &aEvent)
void PositionLabel(DRC_RE_OVERLAY_FIELD *aField)
Position a label relative to its field control based on the label position setting.
void ShowFieldError(const wxString &aFieldId)
Show an error indicator on the specified field.
DRC_RE_OVERLAY_FIELD * AddField(const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition, long aStyle=0)
Create and position a field control on the bitmap overlay.
void OnPaint(wxPaintEvent &aEvent)
void OnFieldBlur(wxFocusEvent &aEvent)
void SetupFieldStyling(wxControl *aControl)
Apply transparent styling to a field control.
virtual ~DRC_RE_BITMAP_OVERLAY_PANEL()
bool TransferDataToWindow() override
std::map< wxString, DRC_RE_OVERLAY_FIELD * > m_fieldIdMap
Field ID to field lookup.
void SetBackgroundBitmap(BITMAPS aBitmap)
Set the background bitmap for this panel.
wxSize m_logicalBitmapSize
Bitmap size in logical pixels.
bool TransferDataFromWindow() override
DRC_RE_BITMAP_OVERLAY_PANEL(wxWindow *aParent, wxWindowID aId=wxID_ANY)
void ClearFieldErrors()
Clear error indicators from all fields.
BITMAPS m_bitmapId
BITMAPS enum value.
void PositionFields()
Position all fields based on the current scale factor.
void OnFieldFocus(wxFocusEvent &aEvent)
DRC_RE_OVERLAY_FIELD * AddFieldWithUnits(const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition, UNIT_BINDER *aUnitBinder, long aStyle=0)
Create and position a field control with unit binding.
std::vector< std::unique_ptr< DRC_RE_OVERLAY_FIELD > > m_fields
All overlay fields.
void PositionPrefixLabel(DRC_RE_OVERLAY_FIELD *aField)
Position a prefix label to the left of its field control.
Wraps a wxControl positioned over a bitmap overlay panel.
void CreateLabels()
Create and associate labels with this field.
bool HasPrefixLabel() const
void SetUnitBinder(UNIT_BINDER *aBinder)
Associate a UNIT_BINDER for unit conversion.
DRC_RULE_EDITOR_CONTENT_PANEL_BASE()=default
Specifies the position and size of a field overlaid on a constraint bitmap.
int xEnd
Right edge X coordinate where the field ends.
int xStart
Left edge X coordinate where the field starts.
int yCenter
Vertical center Y coordinate of the field.