|
KiCad PCB EDA Suite
|
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>
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 |
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.
|
explicit |
| aField | the field to mark, which needs a parent window |
| aIcon | the glyph to draw |
| aSlot | place 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().
|
override |
Definition at line 52 of file field_warning_icon.cpp.
References m_field, onFieldChanged(), and onFieldDestroyed().
|
private |
Definition at line 158 of file field_warning_icon.cpp.
References Reposition().
Referenced by FIELD_WARNING_ICON(), and ~FIELD_WARNING_ICON().
|
private |
Definition at line 171 of file field_warning_icon.cpp.
References m_field.
Referenced by FIELD_WARNING_ICON(), and ~FIELD_WARNING_ICON().
| 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().
| 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().
| 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().
| 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().
|
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().
|
private |
Definition at line 73 of file field_warning_icon.h.
Referenced by FIELD_WARNING_ICON(), and Reposition().
|
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().