24#ifndef DRC_RE_BITMAP_OVERLAY_PANEL_H
25#define DRC_RE_BITMAP_OVERLAY_PANEL_H
42class wxDPIChangedEvent;
43class wxSysColourChangedEvent;
100 template <
typename T>
114 template <
typename T>
147 void OnPaint( wxPaintEvent& aEvent );
163 std::vector<std::unique_ptr<DRC_RE_OVERLAY_FIELD>>
m_fields;
174 T* control =
new T(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, aStyle );
177 auto field = std::make_unique<DRC_RE_OVERLAY_FIELD>(
this, aId, control, aPosition );
184 wxPoint pos( aPosition.
xStart, aPosition.
yTop );
185 int width = aPosition.
xEnd - aPosition.
xStart;
186 wxSize size( width, control->GetBestSize().GetHeight() );
187 control->SetPosition( pos );
188 control->SetSize( size );
198 m_fields.push_back( std::move( field ) );
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.
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_baseBitmapSize
Bitmap size at 1x scale.
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.
Wraps a wxControl positioned over a bitmap overlay panel.
void CreateLabel()
Create and associate a label with this field.
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 yTop
Top edge Y coordinate of the field.