Custom validator that verifies that a string defines a valid LIB_ID.
More...
#include <validators.h>
Custom validator that verifies that a string defines a valid LIB_ID.
The default validation allows empty LIB_ID strings to allow the LIB_ID to be cleared. Use SetStyle( wxFILTER_EMPTY ) to force a valid LIB_ID string.
Definition at line 172 of file validators.h.
◆ LIB_ID_VALIDATOR()
LIB_ID_VALIDATOR::LIB_ID_VALIDATOR |
( |
wxString * |
aValue = nullptr | ) |
|
|
inline |
- Parameters
-
aLibIdType | is the type of LIB_ID object to validate. |
aValue | is a pointer to a wxString containing the value to validate. |
Definition at line 179 of file validators.h.
180 wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue )
182 SetCharExcludes( wxT(
"\r\n\t" ) );
Referenced by Clone().
◆ Clone()
virtual wxObject* LIB_ID_VALIDATOR::Clone |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ Validate()
bool LIB_ID_VALIDATOR::Validate |
( |
wxWindow * |
aParent | ) |
|
|
override |
Definition at line 271 of file validators.cpp.
276 if( !m_validatorWindow->IsEnabled() )
279 wxTextEntry*
const text = GetTextEntry();
285 wxString val(
text->GetValue() );
286 wxString tmp = val.Clone();
289 if( !(GetStyle() & wxFILTER_EMPTY) && val.IsEmpty() )
292 if( tmp.Trim() != val )
294 msg =
_(
"Entry contains trailing white space." );
296 else if( tmp.Trim(
false ) != val )
298 msg =
_(
"Entry contains leading white space." );
300 else if(
dummy.Parse( val ) != -1 || !
dummy.IsValid() )
302 msg.Printf(
_(
"'%s' is not a valid library identifier format." ), val );
307 m_validatorWindow->SetFocus();
309 wxMessageBox( msg,
_(
"Library Identifier Validation Error" ),
310 wxOK | wxICON_EXCLAMATION, aParent );
A logical library item identifier and consists of various portions much like a URI.
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
References _, dummy(), and text.
The documentation for this class was generated from the following files: