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 
102 void Disable( wxWindow* aWindow );
103 
104 }
105 
106 SEVERITY SeverityFromString( const wxString& aSeverity );
107 
108 wxString SeverityToString( const SEVERITY& aSeverity );
109 
110 #endif // UI_COMMON_H
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:185
bool IsModalDialogFocused()
Definition: ui_common.cpp:270
bool IsInputControlEditable(wxWindow *aControl)
Check if a input control has focus.
Definition: ui_common.cpp:253
void Disable(wxWindow *aWindow)
Makes a window read-only.
Definition: ui_common.cpp:276
wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:85
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
int GetStdMargin()
Get the standard margin around a widget in the KiCad UI.
Definition: ui_common.cpp:41
wxFont GetControlFont(wxWindow *aWindow)
Definition: ui_common.cpp:150
SEVERITY SeverityFromString(const wxString &aSeverity)
Definition: ui_common.cpp:48
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:156
bool IsInputControlFocused(wxWindow *aFocus=nullptr)
Check if a input control has focus.
Definition: ui_common.cpp:220
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:70
SEVERITY
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:132
wxString SeverityToString(const SEVERITY &aSeverity)
Definition: ui_common.cpp:59