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)
 
 ~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 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.
 

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 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.

Definition at line 39 of file field_warning_icon.h.

Constructor & Destructor Documentation

◆ FIELD_WARNING_ICON()

FIELD_WARNING_ICON::FIELD_WARNING_ICON ( wxWindow * aField)
explicit
Parameters
aFieldthe field to mark, which needs a parent window

Definition at line 35 of file field_warning_icon.cpp.

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

◆ ~FIELD_WARNING_ICON()

FIELD_WARNING_ICON::~FIELD_WARNING_ICON ( )
override

Definition at line 50 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 144 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 157 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 115 of file field_warning_icon.cpp.

References m_field.

Referenced by onFieldChanged(), and SetWarnings().

◆ 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 104 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 62 of file field_warning_icon.cpp.

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

Referenced by SetWarning().

Member Data Documentation

◆ m_field

wxWindow* FIELD_WARNING_ICON::m_field
private

Null once the field has been destroyed.

Definition at line 63 of file field_warning_icon.h.

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

◆ 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 43 of file field_warning_icon.h.

Referenced by SetWarnings().


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