KiCad PCB EDA Suite
ui_common.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
26 #ifndef UI_COMMON_H
27 #define UI_COMMON_H
28 
29 #include "report_severity.h" // enum SEVERITY
30 #include <wx/string.h>
31 #include <wx/font.h>
32 
33 class wxSize;
34 class wxTextCtrl;
35 class wxTextEntry;
36 class wxWindow;
37 
38 namespace KIUI
39 {
40 
45 int GetStdMargin();
46 
51 wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow );
52 
53 wxFont GetMonospacedUIFont();
54 
55 wxFont GetControlFont( wxWindow* aWindow );
56 wxFont GetInfoFont( wxWindow* aWindow );
57 wxFont GetStatusFont( wxWindow* aWindow );
58 
73 bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = nullptr );
74 
78 void SelectReferenceNumber( wxTextEntry* aTextEntry );
79 
85 bool IsInputControlFocused( wxWindow* aFocus = nullptr );
86 
94 bool IsInputControlEditable( wxWindow* aControl );
95 
97 
98 }
99 
100 SEVERITY SeverityFromString( const wxString& aSeverity );
101 
102 wxString SeverityToString( const SEVERITY& aSeverity );
103 
104 #endif // UI_COMMON_H
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:182
bool IsModalDialogFocused()
Definition: ui_common.cpp:267
bool IsInputControlEditable(wxWindow *aControl)
Check if a input control has focus.
Definition: ui_common.cpp:250
wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:82
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:141
int GetStdMargin()
Get the standard margin around a widget in the KiCad UI.
Definition: ui_common.cpp:38
wxFont GetControlFont(wxWindow *aWindow)
Definition: ui_common.cpp:147
SEVERITY SeverityFromString(const wxString &aSeverity)
Definition: ui_common.cpp:45
bool EnsureTextCtrlWidth(wxTextCtrl *aCtrl, const wxString *aString=nullptr)
Set the minimum pixel width on a text control in order to make a text string be fully visible within ...
Definition: ui_common.cpp:153
bool IsInputControlFocused(wxWindow *aFocus=nullptr)
Check if a input control has focus.
Definition: ui_common.cpp:217
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...
Definition: ui_common.cpp:67
SEVERITY
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:129
wxString SeverityToString(const SEVERITY &aSeverity)
Definition: ui_common.cpp:56