21 #include <wx/dataview.h> 22 #include <wx/stc/stc.h> 38 if( aSeverity == wxT(
"warning" ) )
40 else if( aSeverity == wxT(
"ignore" ) )
50 return wxT(
"ignore" );
52 return wxT(
"warning" );
54 return wxT(
"error" );
64 wxClientDC dc( aWindow );
65 dc.SetFont( aWindow->GetFont() );
66 dc.GetTextExtent( aSingleLine, &width, &height );
69 return wxSize( width, height );
75 wxWindow* window = aCtrl->GetParent();
84 ctrlText = aCtrl->GetValue();
89 wxSize ctrlz = aCtrl->GetSize();
91 if( ctrlz.GetWidth() < textz.GetWidth() + 10 )
93 ctrlz.SetWidth( textz.GetWidth() + 10 );
94 aCtrl->SetSizeHints( ctrlz );
104 wxString ref = aTextEntry->GetValue();
106 if( ref.find_first_of(
'?' ) != ref.npos )
108 aTextEntry->SetSelection( ref.find_first_of(
'?' ), ref.find_last_of(
'?' ) + 1 );
110 else if( ref.find_first_of(
'*' ) != ref.npos )
112 aTextEntry->SetSelection( ref.find_first_of(
'*' ), ref.find_last_of(
'*' ) + 1 );
118 while( !num.IsEmpty() && ( !isdigit( num.Last() ) || !isdigit( num.GetChar( 0 ) ) ) )
121 if( !isdigit( num.Last() ) )
125 if( !num.IsEmpty() && !isdigit( num.GetChar( 0 ) ) )
126 num = num.Right( num.Length() - 1 );
129 aTextEntry->SetSelection( ref.Find( num ), ref.Find( num ) + num.Length() );
132 aTextEntry->SetSelection( -1, -1 );
139 wxWindow* focus = wxWindow::FindFocus();
140 wxTextEntry* textEntry = dynamic_cast<wxTextEntry*>( focus );
141 wxStyledTextCtrl* styledText = dynamic_cast<wxStyledTextCtrl*>( focus );
142 wxListBox* listBox = dynamic_cast<wxListBox*>( focus );
143 wxDataViewCtrl* dataViewCtrl = dynamic_cast<wxDataViewCtrl*>( focus );
145 return ( textEntry || styledText || listBox || dataViewCtrl );
151 return Pgm().m_ModalDialogCount > 0;
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
bool IsModalDialogFocused()
int GetStdMargin()
Get the standard margin around a widget in the KiCad UI.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
bool IsInputControlFocused()
Checks if a input control has focus.
wxSize GetTextSize(const wxString &aSingleLine, wxWindow *aWindow)
Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currentl...
Functions to provide common constants and other functions to assist in making a consistent UI.
bool EnsureTextCtrlWidth(wxTextCtrl *aCtrl, const wxString *aString=NULL)
Set the minimum pixel width on a text control in order to make a text string be fully visible within ...
wxString SeverityToString(const SEVERITY &aSeverity)
SEVERITY SeverityFromString(const wxString &aSeverity)