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 The 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
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
25
26#ifndef UI_COMMON_H
27#define UI_COMMON_H
28
29#include <kicommon.h>
30#include "report_severity.h" // enum SEVERITY
31#include <wx/string.h>
32#include <wx/font.h>
33
34class wxBitmapBundle;
35class wxSize;
36class wxTextCtrl;
37class wxTextEntry;
38class wxWindow;
39class wxMenuItem;
40class wxMenu;
41class wxNotebook;
42
47#define INDETERMINATE_STATE _( "-- mixed values --" )
48#define INDETERMINATE_ACTION _( "-- leave unchanged --" )
49
50namespace KIUI
51{
52
53const int c_IndicatorSizeDIP = 10;
54
55
61
66KICOMMON_API wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow );
67
68KICOMMON_API wxFont GetMonospacedUIFont( int aRelativeSize = 0 );
69
70KICOMMON_API wxFont GetControlFont( wxWindow* aWindow );
71KICOMMON_API wxFont GetInfoFont( wxWindow* aWindow );
72KICOMMON_API wxFont GetSmallInfoFont( wxWindow* aWindow );
73KICOMMON_API wxFont GetDockedPaneFont( wxWindow* aWindow );
74KICOMMON_API wxFont GetStatusFont( wxWindow* aWindow );
75
90KICOMMON_API bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = nullptr );
91
95KICOMMON_API void SelectReferenceNumber( wxTextEntry* aTextEntry );
96
102KICOMMON_API wxString EllipsizeStatusText( wxWindow* aWindow, const wxString& aString );
103
109KICOMMON_API wxString EllipsizeMenuText( const wxString& aString );
110
118KICOMMON_API wxString WrapText( wxWindow* aWindow, const wxString& aText, int aWidth );
119
125KICOMMON_API bool IsInputControlFocused( wxWindow* aFocus = nullptr );
126
134KICOMMON_API bool IsInputControlEditable( wxWindow* aControl );
135
137
142KICOMMON_API void Disable( wxWindow* aWindow );
143
144KICOMMON_API extern const wxString s_FocusStealableInputName;
145
146
157KICOMMON_API void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmapBundle& aImage );
158
159
170KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
171 const wxBitmapBundle& aImage,
172 wxItemKind aType = wxITEM_NORMAL );
173
174
186KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
187 const wxString& aHelpText, const wxBitmapBundle& aImage,
188 wxItemKind aType = wxITEM_NORMAL );
189
190
201KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
202 const wxString& aText, const wxBitmapBundle& aImage );
203
204
217KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
218 const wxString& aText, const wxString& aHelpText,
219 const wxBitmapBundle& aImage );
220}
221
222KICOMMON_API SEVERITY SeverityFromString( const wxString& aSeverity );
223
224KICOMMON_API wxString SeverityToString( const SEVERITY& aSeverity );
225
226KICOMMON_API int FindNotebookPage( wxNotebook* aNotebook, wxWindow* aChildWindow );
227
228#endif // UI_COMMON_H
#define KICOMMON_API
Definition kicommon.h:27
KICOMMON_API int GetStdMargin()
Get the standard margin around a widget in the KiCad UI.
Definition ui_common.cpp:51
KICOMMON_API wxFont GetDockedPaneFont(wxWindow *aWindow)
KICOMMON_API wxFont GetStatusFont(wxWindow *aWindow)
KICOMMON_API bool IsInputControlFocused(wxWindow *aFocus=nullptr)
Check if a input control has focus.
KICOMMON_API bool IsInputControlEditable(wxWindow *aControl)
Check if a input control has focus.
KICOMMON_API wxString EllipsizeMenuText(const wxString &aString)
Ellipsize text (at the end) to be no more than 36 characters.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
KICOMMON_API wxString WrapText(wxWindow *aWindow, const wxString &aText, int aWidth)
Break text into lines no wider than aWidth pixels in aWindow's font.
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
KICOMMON_API bool IsModalDialogFocused()
KICOMMON_API wxFont GetControlFont(wxWindow *aWindow)
KICOMMON_API wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmapBundle &aImage, wxItemKind aType=wxITEM_NORMAL)
Create and insert a menu item with an icon into aMenu.
KICOMMON_API wxString EllipsizeStatusText(wxWindow *aWindow, const wxString &aString)
Ellipsize text (at the end) to be no more than 1/3 of the window width.
KICOMMON_API const wxString s_FocusStealableInputName
Definition ui_common.cpp:48
KICOMMON_API void SelectReferenceNumber(wxTextEntry *aTextEntry)
Select the number (or "?") in a reference for ease of editing.
KICOMMON_API 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:80
KICOMMON_API void AddBitmapToMenuItem(wxMenuItem *aMenu, const wxBitmapBundle &aImage)
Add a bitmap to a menuitem.
KICOMMON_API wxFont GetMonospacedUIFont(int aRelativeSize=0)
Definition ui_common.cpp:95
KICOMMON_API 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 ...
KICOMMON_API void Disable(wxWindow *aWindow)
Makes a window read-only.
const int c_IndicatorSizeDIP
Definition ui_common.h:53
SEVERITY
KICOMMON_API SEVERITY SeverityFromString(const wxString &aSeverity)
Definition ui_common.cpp:58
KICOMMON_API int FindNotebookPage(wxNotebook *aNotebook, wxWindow *aChildWindow)
KICOMMON_API wxString SeverityToString(const SEVERITY &aSeverity)
Definition ui_common.cpp:69