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 wxHyperlinkCtrl;
36class wxSize;
37class wxTextCtrl;
38class wxTextEntry;
39class wxWindow;
40class wxMenuItem;
41class wxMenu;
42class wxNotebook;
43
48#define INDETERMINATE_STATE _( "-- mixed values --" )
49#define INDETERMINATE_ACTION _( "-- leave unchanged --" )
50
51namespace KIUI
52{
53
54const int c_IndicatorSizeDIP = 10;
55
56
62
67KICOMMON_API wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow );
68
69KICOMMON_API wxFont GetMonospacedUIFont( int aRelativeSize = 0 );
70
71KICOMMON_API wxFont GetControlFont( wxWindow* aWindow );
72KICOMMON_API wxFont GetInfoFont( wxWindow* aWindow );
73KICOMMON_API wxFont GetSmallInfoFont( wxWindow* aWindow );
74KICOMMON_API wxFont GetDockedPaneFont( wxWindow* aWindow );
75KICOMMON_API wxFont GetStatusFont( wxWindow* aWindow );
76
91KICOMMON_API bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = nullptr );
92
96KICOMMON_API void SelectReferenceNumber( wxTextEntry* aTextEntry );
97
103KICOMMON_API wxString EllipsizeStatusText( wxWindow* aWindow, const wxString& aString );
104
110KICOMMON_API wxString EllipsizeMenuText( const wxString& aString );
111
119KICOMMON_API wxString WrapText( wxWindow* aWindow, const wxString& aText, int aWidth );
120
126KICOMMON_API bool IsInputControlFocused( wxWindow* aFocus = nullptr );
127
135KICOMMON_API bool IsInputControlEditable( wxWindow* aControl );
136
138
143KICOMMON_API void Disable( wxWindow* aWindow );
144
151KICOMMON_API void FollowSystemLinkColour( wxHyperlinkCtrl* aLink );
152
153KICOMMON_API extern const wxString s_FocusStealableInputName;
154
155
166KICOMMON_API void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmapBundle& aImage );
167
168
179KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
180 const wxBitmapBundle& aImage,
181 wxItemKind aType = wxITEM_NORMAL );
182
183
195KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
196 const wxString& aHelpText, const wxBitmapBundle& aImage,
197 wxItemKind aType = wxITEM_NORMAL );
198
199
210KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
211 const wxString& aText, const wxBitmapBundle& aImage );
212
213
226KICOMMON_API wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
227 const wxString& aText, const wxString& aHelpText,
228 const wxBitmapBundle& aImage );
229}
230
231KICOMMON_API SEVERITY SeverityFromString( const wxString& aSeverity );
232
233KICOMMON_API wxString SeverityToString( const SEVERITY& aSeverity );
234
235KICOMMON_API int FindNotebookPage( wxNotebook* aNotebook, wxWindow* aChildWindow );
236
237#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 void FollowSystemLinkColour(wxHyperlinkCtrl *aLink)
Keep a hyperlink in the system link colour across a light or dark switch.
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:54
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