KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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
33class wxSize;
34class wxTextCtrl;
35class wxTextEntry;
36class wxWindow;
37
42#define INDETERMINATE_STATE _( "-- mixed values --" )
43#define INDETERMINATE_ACTION _( "-- leave unchanged --" )
44
45namespace KIUI
46{
47
52int GetStdMargin();
53
58wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow );
59
60wxFont GetMonospacedUIFont();
61
62wxFont GetControlFont( wxWindow* aWindow );
63wxFont GetInfoFont( wxWindow* aWindow );
64wxFont GetDockedPaneFont( wxWindow* aWindow );
65wxFont GetStatusFont( wxWindow* aWindow );
66
81bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = nullptr );
82
86void SelectReferenceNumber( wxTextEntry* aTextEntry );
87
93wxString EllipsizeStatusText( wxWindow* aWindow, const wxString& aString );
94
100wxString EllipsizeMenuText( const wxString& aString );
101
107bool IsInputControlFocused( wxWindow* aFocus = nullptr );
108
116bool IsInputControlEditable( wxWindow* aControl );
117
119
124void Disable( wxWindow* aWindow );
125
126}
127
128SEVERITY SeverityFromString( const wxString& aSeverity );
129
130wxString SeverityToString( const SEVERITY& aSeverity );
131
132#endif // UI_COMMON_H
wxFont GetMonospacedUIFont()
Definition: ui_common.cpp:85
int GetStdMargin()
Get the standard margin around a widget in the KiCad UI.
Definition: ui_common.cpp:41
wxFont GetDockedPaneFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
wxFont GetStatusFont(wxWindow *aWindow)
Definition: ui_common.cpp:132
bool IsInputControlFocused(wxWindow *aFocus=nullptr)
Check if a input control has focus.
Definition: ui_common.cpp:265
bool IsInputControlEditable(wxWindow *aControl)
Check if a input control has focus.
Definition: ui_common.cpp:298
wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
Definition: ui_common.cpp:215
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:156
bool IsModalDialogFocused()
Definition: ui_common.cpp:315
wxFont GetControlFont(wxWindow *aWindow)
Definition: ui_common.cpp:162
wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
Definition: ui_common.cpp:197
void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
Definition: ui_common.cpp:230
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
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:168
void Disable(wxWindow *aWindow)
Makes a window read-only.
Definition: ui_common.cpp:321
SEVERITY
SEVERITY SeverityFromString(const wxString &aSeverity)
Definition: ui_common.cpp:48
wxString SeverityToString(const SEVERITY &aSeverity)
Definition: ui_common.cpp:59