KiCad PCB EDA Suite
Loading...
Searching...
No Matches
FIELD_WARNING_ICON Class Reference

A warning icon drawn inside the right edge of a field, left of its dropdown button when it has one, with the warnings as its tooltip. More...

#include <field_warning_icon.h>

Inheritance diagram for FIELD_WARNING_ICON:

Public Member Functions

 FIELD_WARNING_ICON (wxWindow *aField, BITMAPS aIcon=BITMAPS::small_warning, int aSlot=0)
 
 ~FIELD_WARNING_ICON () override
 
void SetWarnings (const wxArrayString &aMessages)
 Lists aMessages in the tooltip, once each with a count when repeated, and shows the icon, or hides it when there are none.
 
void SetWarning (const wxString &aMessage)
 Shows aMessage as the tooltip, or hides the icon when it is empty.
 
void ShowAsBadge ()
 Shows the icon with no tooltip of its own, for one that opens something on click or hover.
 
void Reposition ()
 Moves the icon back over the field after the field has moved or changed size.
 

Static Public Attributes

static constexpr size_t MAX_LINES = 10
 The most warnings listed in the tooltip, with a count of the rest.
 

Private Member Functions

void onFieldChanged (wxEvent &aEvent)
 
void onFieldDestroyed (wxWindowDestroyEvent &aEvent)
 

Private Attributes

wxWindow * m_field
 Null once the field has been destroyed.
 
int m_slot
 

Detailed Description

A warning icon drawn inside the right edge of a field, left of its dropdown button when it has one, with the warnings as its tooltip.

The icon is shown only while there is something to warn about. It marks a combo box, a choice, a spin control or a text control.

The icon is a sibling of the field, since native combo boxes cannot host child windows on every port, and follows the field when it moves or changes size. Like any child window it belongs to the field's parent, which destroys it.

A field that carries a button of its own at that edge, a combo box or a spin control, is given room for it.

Definition at line 43 of file field_warning_icon.h.

Constructor & Destructor Documentation

◆ FIELD_WARNING_ICON()

FIELD_WARNING_ICON::FIELD_WARNING_ICON ( wxWindow * aField,
BITMAPS aIcon = BITMAPS::small_warning,
int aSlot = 0 )
explicit
Parameters
aFieldthe field to mark, which needs a parent window
aIconthe glyph to draw
aSlotplace at the right edge, counting inwards from zero

Definition at line 36 of file field_warning_icon.cpp.

References KiBitmapBundle(), m_field, m_slot, onFieldChanged(), and onFieldDestroyed().

◆ ~FIELD_WARNING_ICON()

FIELD_WARNING_ICON::~FIELD_WARNING_ICON ( )
override

Definition at line 52 of file field_warning_icon.cpp.

References m_field, onFieldChanged(), and onFieldDestroyed().

Member Function Documentation

◆ onFieldChanged()

void FIELD_WARNING_ICON::onFieldChanged ( wxEvent & aEvent)
private

Definition at line 158 of file field_warning_icon.cpp.

References Reposition().

Referenced by FIELD_WARNING_ICON(), and ~FIELD_WARNING_ICON().

◆ onFieldDestroyed()

void FIELD_WARNING_ICON::onFieldDestroyed ( wxWindowDestroyEvent & aEvent)
private

Definition at line 171 of file field_warning_icon.cpp.

References m_field.

Referenced by FIELD_WARNING_ICON(), and ~FIELD_WARNING_ICON().

◆ Reposition()

void FIELD_WARNING_ICON::Reposition ( )

Moves the icon back over the field after the field has moved or changed size.

Definition at line 126 of file field_warning_icon.cpp.

References m_field, and m_slot.

Referenced by onFieldChanged(), SetWarnings(), and ShowAsBadge().

◆ SetWarning()

void FIELD_WARNING_ICON::SetWarning ( const wxString & aMessage)

Shows aMessage as the tooltip, or hides the icon when it is empty.

Definition at line 106 of file field_warning_icon.cpp.

References SetWarnings().

◆ SetWarnings()

void FIELD_WARNING_ICON::SetWarnings ( const wxArrayString & aMessages)

Lists aMessages in the tooltip, once each with a count when repeated, and shows the icon, or hides it when there are none.

Definition at line 64 of file field_warning_icon.cpp.

References _, MAX_LINES, message, Reposition(), and text.

Referenced by SetWarning().

◆ ShowAsBadge()

void FIELD_WARNING_ICON::ShowAsBadge ( )

Shows the icon with no tooltip of its own, for one that opens something on click or hover.

Definition at line 117 of file field_warning_icon.cpp.

References Reposition().

Member Data Documentation

◆ m_field

wxWindow* FIELD_WARNING_ICON::m_field
private

Null once the field has been destroyed.

Definition at line 72 of file field_warning_icon.h.

Referenced by FIELD_WARNING_ICON(), onFieldDestroyed(), Reposition(), and ~FIELD_WARNING_ICON().

◆ m_slot

int FIELD_WARNING_ICON::m_slot
private

Definition at line 73 of file field_warning_icon.h.

Referenced by FIELD_WARNING_ICON(), and Reposition().

◆ MAX_LINES

size_t FIELD_WARNING_ICON::MAX_LINES = 10
staticconstexpr

The most warnings listed in the tooltip, with a count of the rest.

Definition at line 47 of file field_warning_icon.h.

Referenced by SetWarnings().


The documentation for this class was generated from the following files: