KiCad PCB EDA Suite
ui_common.h File Reference

Functions to provide common constants and other functions to assist in making a consistent UI. More...

#include "report_severity.h"
#include <wx/string.h>
#include <wx/font.h>

Go to the source code of this file.

Namespaces

namespace  KIUI
 

Macros

#define INDETERMINATE_STATE   _( "-- mixed values --" )
 Used for holding indeterminate values, such as with multiple selections holding different values or controls which do not wish to set a value. More...
 
#define INDETERMINATE_ACTION   _( "-- leave unchanged --" )
 

Functions

int KIUI::GetStdMargin ()
 Get the standard margin around a widget in the KiCad UI. More...
 
wxSize KIUI::GetTextSize (const wxString &aSingleLine, wxWindow *aWindow)
 Return the size of aSingleLine of text when it is rendered in aWindow using whatever font is currently set in that window. More...
 
wxFont KIUI::GetMonospacedUIFont ()
 
wxFont KIUI::GetControlFont (wxWindow *aWindow)
 
wxFont KIUI::GetInfoFont (wxWindow *aWindow)
 
wxFont KIUI::GetStatusFont (wxWindow *aWindow)
 
bool KIUI::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 it. More...
 
void KIUI::SelectReferenceNumber (wxTextEntry *aTextEntry)
 Select the number (or "?") in a reference for ease of editing. More...
 
wxString KIUI::EllipsizeStatusText (wxWindow *aWindow, const wxString &aString)
 Ellipsize text (at the end) to be no more than 1/3 of the window width. More...
 
wxString KIUI::EllipsizeMenuText (const wxString &aString)
 Ellipsize text (at the end) to be no more than 36 characters. More...
 
bool KIUI::IsInputControlFocused (wxWindow *aFocus=nullptr)
 Check if a input control has focus. More...
 
bool KIUI::IsInputControlEditable (wxWindow *aControl)
 Check if a input control has focus. More...
 
bool KIUI::IsModalDialogFocused ()
 
void KIUI::Disable (wxWindow *aWindow)
 Makes a window read-only. More...
 
SEVERITY SeverityFromString (const wxString &aSeverity)
 
wxString SeverityToString (const SEVERITY &aSeverity)
 

Detailed Description

Functions to provide common constants and other functions to assist in making a consistent UI.

Definition in file ui_common.h.

Macro Definition Documentation

◆ INDETERMINATE_ACTION

#define INDETERMINATE_ACTION   _( "-- leave unchanged --" )

Definition at line 43 of file ui_common.h.

◆ INDETERMINATE_STATE

#define INDETERMINATE_STATE   _( "-- mixed values --" )

Used for holding indeterminate values, such as with multiple selections holding different values or controls which do not wish to set a value.

Definition at line 42 of file ui_common.h.

Function Documentation

◆ SeverityFromString()

SEVERITY SeverityFromString ( const wxString &  aSeverity)

Definition at line 48 of file ui_common.cpp.

49{
50 if( aSeverity == wxT( "warning" ) )
52 else if( aSeverity == wxT( "ignore" ) )
54 else
55 return RPT_SEVERITY_ERROR;
56}
@ RPT_SEVERITY_WARNING
@ RPT_SEVERITY_ERROR
@ RPT_SEVERITY_IGNORE

References RPT_SEVERITY_ERROR, RPT_SEVERITY_IGNORE, and RPT_SEVERITY_WARNING.

◆ SeverityToString()

wxString SeverityToString ( const SEVERITY aSeverity)

Definition at line 59 of file ui_common.cpp.

60{
61 if( aSeverity == RPT_SEVERITY_IGNORE )
62 return wxT( "ignore" );
63 else if( aSeverity == RPT_SEVERITY_WARNING )
64 return wxT( "warning" );
65 else
66 return wxT( "error" );
67}

References RPT_SEVERITY_IGNORE, and RPT_SEVERITY_WARNING.

Referenced by BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), and ERC_SETTINGS::ERC_SETTINGS().