KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIUI Namespace Reference

Functions

void ValidatorTransferToWindowWithoutEvents (wxValidator &aValidator)
 Call a text validator's TransferDataToWindow method without firing a text change event.
 
void SetControlsTabOrder (const std::vector< wxWindow * > &aControlsInTabOrder)
 Set a list of controls to have a defined sequential tab order.
 
KICOMMON_API int GetStdMargin ()
 Get the standard margin around a widget in the KiCad UI.
 
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 currently set in that window.
 
KICOMMON_API wxFont GetMonospacedUIFont ()
 
KICOMMON_API wxFont GetControlFont (wxWindow *aWindow)
 
KICOMMON_API wxFont GetInfoFont (wxWindow *aWindow)
 
KICOMMON_API wxFont GetDockedPaneFont (wxWindow *aWindow)
 
KICOMMON_API wxFont GetStatusFont (wxWindow *aWindow)
 
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 it.
 
KICOMMON_API void SelectReferenceNumber (wxTextEntry *aTextEntry)
 Select the number (or "?") in a reference for ease of editing.
 
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 wxString EllipsizeMenuText (const wxString &aString)
 Ellipsize text (at the end) to be no more than 36 characters.
 
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 bool IsModalDialogFocused ()
 
KICOMMON_API void Disable (wxWindow *aWindow)
 Makes a window read-only.
 
KICOMMON_API void AddBitmapToMenuItem (wxMenuItem *aMenu, const wxBitmap &aImage)
 Add a bitmap to a menuitem.
 
KICOMMON_API wxMenuItem * AddMenuItem (wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
 Create and insert a menu item with an icon into aMenu.
 
KICOMMON_API wxMenuItem * AddMenuItem (wxMenu *aMenu, int aId, const wxString &aText, const wxString &aHelpText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
 Create and insert a menu item with an icon and a help message string into aMenu.
 
KICOMMON_API wxMenuItem * AddMenuItem (wxMenu *aMenu, wxMenu *aSubMenu, int aId, const wxString &aText, const wxBitmap &aImage)
 Create and insert a menu item with an icon into aSubMenu in aMenu.
 
KICOMMON_API wxMenuItem * AddMenuItem (wxMenu *aMenu, wxMenu *aSubMenu, int aId, const wxString &aText, const wxString &aHelpText, const wxBitmap &aImage)
 Create and insert a menu item with an icon and a help message string into aSubMenu in aMenu.
 

Variables

KICOMMON_API const wxString s_FocusStealableInputName = wxS( "KI_NOFOCUS")
 

Function Documentation

◆ AddBitmapToMenuItem()

void KIUI::AddBitmapToMenuItem ( wxMenuItem *  aMenu,
const wxBitmap &  aImage 
)

Add a bitmap to a menuitem.

It is added only if use images in menus config option allows it. For wxITEM_CHECK or wxITEM_RADIO menuitems, the bitmap is added only on Windows, other platforms do not support it

Parameters
aMenuis the menuitem.
aImageis the icon to add to aMenu.

Definition at line 358 of file ui_common.cpp.

References PGM_BASE::GetCommonSettings(), COMMON_SETTINGS::m_Appearance, Pgm(), and COMMON_SETTINGS::APPEARANCE::use_icons_in_menus.

Referenced by ACTION_MENU::Add(), CONDITIONAL_MENU::AddCheckItem(), CONDITIONAL_MENU::AddItem(), AddMenuItem(), ACTION_MENU::appendCopy(), ACTION_MENU::DisplayTitle(), and CONDITIONAL_MENU::Evaluate().

◆ AddMenuItem() [1/4]

wxMenuItem * KIUI::AddMenuItem ( wxMenu *  aMenu,
int  aId,
const wxString &  aText,
const wxBitmap &  aImage,
wxItemKind  aType = wxITEM_NORMAL 
)

Create and insert a menu item with an icon into aMenu.

Parameters
aMenuis the menu to add the new item.
aIdis the command ID for the new menu item.
aTextis the string for the new menu item.
aImageis the icon to add to the new menu item.
aTypeis the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
Returns
a pointer to the new created wxMenuItem.

Definition at line 372 of file ui_common.cpp.

References AddBitmapToMenuItem().

Referenced by GERBER_LAYER_WIDGET::AddRightClickMenuItems(), PCB_EDIT_FRAME::buildActionPluginMenus(), PROJECT_TREE_PANE::onRight(), LAYER_WIDGET::OnRightDownLayer(), LAYER_WIDGET::OnRightDownRender(), APPEARANCE_CONTROLS::rebuildLayerContextMenu(), and PANEL_COLOR_SETTINGS::ShowColorContextMenu().

◆ AddMenuItem() [2/4]

wxMenuItem * KIUI::AddMenuItem ( wxMenu *  aMenu,
int  aId,
const wxString &  aText,
const wxString &  aHelpText,
const wxBitmap &  aImage,
wxItemKind  aType = wxITEM_NORMAL 
)

Create and insert a menu item with an icon and a help message string into aMenu.

Parameters
aMenuis the menu to add the new item.
aIdis the command ID for the new menu item.
aTextis the string for the new menu item.
aHelpTextis the help message string for the new menu item.
aImageis the icon to add to the new menu item.
aTypeis the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
Returns
a pointer to the new created wxMenuItem.

Definition at line 384 of file ui_common.cpp.

References AddBitmapToMenuItem().

◆ AddMenuItem() [3/4]

wxMenuItem * KIUI::AddMenuItem ( wxMenu *  aMenu,
wxMenu *  aSubMenu,
int  aId,
const wxString &  aText,
const wxBitmap &  aImage 
)

Create and insert a menu item with an icon into aSubMenu in aMenu.

Parameters
aMenuis the menu to add the new submenu item.
aSubMenuis the submenu to add the new menu.
aIdis the command ID for the new menu item.
aTextis the string for the new menu item.
aImageis the icon to add to the new menu item.
Returns
a pointer to the new created wxMenuItem,

Definition at line 396 of file ui_common.cpp.

References AddBitmapToMenuItem().

◆ AddMenuItem() [4/4]

wxMenuItem * KIUI::AddMenuItem ( wxMenu *  aMenu,
wxMenu *  aSubMenu,
int  aId,
const wxString &  aText,
const wxString &  aHelpText,
const wxBitmap &  aImage 
)

Create and insert a menu item with an icon and a help message string into aSubMenu in aMenu.

Parameters
aMenuis the menu to add the new submenu item.
aSubMenuis the submenu to add the new menu.
aIdis the command ID for the new menu item.
aTextis the string for the new menu item.
aHelpTextis the help message string for the new menu item.
aImageis the icon to add to the new menu item.
Returns
a pointer to the new created wxMenuItem.

Definition at line 409 of file ui_common.cpp.

References AddBitmapToMenuItem().

◆ Disable()

void KIUI::Disable ( wxWindow *  aWindow)

Makes a window read-only.

Does some extra work over wxWindow::Disable() to make sure you can still scroll around in sub-windows.

Definition at line 323 of file ui_common.cpp.

References Disable(), and grid.

Referenced by Disable(), DIALOG_SCHEMATIC_SETUP::onPageChanged(), and DIALOG_BOARD_SETUP::onPageChanged().

◆ EllipsizeMenuText()

◆ EllipsizeStatusText()

wxString KIUI::EllipsizeStatusText ( wxWindow *  aWindow,
const wxString &  aString 
)

◆ EnsureTextCtrlWidth()

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.

The current font within the text control is considered. The text can come either from the control or be given as an argument. If the text control is larger than needed, then nothing is done.

Parameters
aCtrlthe text control to potentially make wider.
aStringthe text that is used in sizing the control's pixel width. If NULL, then the text already within the control is used.
Returns
true if the aCtrl had its size changed, else false.

Definition at line 166 of file ui_common.cpp.

References GetTextSize().

Referenced by GERBVIEW_FRAME::UpdateTitleAndInfo().

◆ GetControlFont()

◆ GetDockedPaneFont()

wxFont KIUI::GetDockedPaneFont ( wxWindow *  aWindow)

◆ GetInfoFont()

wxFont KIUI::GetInfoFont ( wxWindow *  aWindow)

Definition at line 154 of file ui_common.cpp.

References getGUIFont().

Referenced by APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D(), APPEARANCE_CONTROLS::createControls(), DIALOG_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS(), DIALOG_CLEANUP_GRAPHICS::DIALOG_CLEANUP_GRAPHICS(), DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_GET_FOOTPRINT_BY_NAME::DIALOG_GET_FOOTPRINT_BY_NAME(), DIALOG_GLOBAL_EDIT_TEARDROPS::DIALOG_GLOBAL_EDIT_TEARDROPS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW(), DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), DIALOG_SIM_MODEL< T >::DIALOG_SIM_MODEL(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES(), PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS(), PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS(), PANEL_GERBVIEW_EXCELLON_SETTINGS::PANEL_GERBVIEW_EXCELLON_SETTINGS(), PANEL_PLUGIN_SETTINGS::PANEL_PLUGIN_SETTINGS(), PANEL_RF_ATTENUATORS::PANEL_RF_ATTENUATORS(), PANEL_SCH_SELECTION_FILTER::PANEL_SCH_SELECTION_FILTER(), PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER(), PANEL_SETUP_BUSES::PANEL_SETUP_BUSES(), PANEL_SETUP_CONSTRAINTS::PANEL_SETUP_CONSTRAINTS(), PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING(), PANEL_SETUP_MASK_AND_PASTE::PANEL_SETUP_MASK_AND_PASTE(), PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES(), PANEL_SETUP_TEARDROPS::PANEL_SETUP_TEARDROPS(), PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS(), PROPERTIES_FRAME::PROPERTIES_FRAME(), TEMPLATE_WIDGET::SetTemplate(), PANEL_RF_ATTENUATORS::ThemeChanged(), and WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL().

◆ GetMonospacedUIFont()

wxFont KIUI::GetMonospacedUIFont ( )

◆ GetStatusFont()

◆ GetStdMargin()

int KIUI::GetStdMargin ( )

Get the standard margin around a widget in the KiCad UI.

Returns
margin in pixels

Definition at line 48 of file ui_common.cpp.

Referenced by BUTTON_ROW_PANEL::addButtons(), BUTTON_ROW_PANEL::BUTTON_ROW_PANEL(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), and PANEL_HOTKEYS_EDITOR::installButtons().

◆ GetTextSize()

◆ IsInputControlEditable()

bool KIUI::IsInputControlEditable ( wxWindow *  aControl)

Check if a input control has focus.

Parameters
aFocusControl that test if editable
Returns
True if control is input and editable OR control is not a input. False if control is input and not editable.

Definition at line 300 of file ui_common.cpp.

Referenced by TOOL_DISPATCHER::DispatchWxEvent().

◆ IsInputControlFocused()

bool KIUI::IsInputControlFocused ( wxWindow *  aFocus = nullptr)

Check if a input control has focus.

Parameters
aFocusControl that has focus, if null, wxWidgets will be queried

Definition at line 263 of file ui_common.cpp.

References s_FocusStealableInputName.

Referenced by TOOL_DISPATCHER::DispatchWxEvent(), EDA_DRAW_PANEL_GAL::onEnter(), KIGFX::WX_VIEW_CONTROLS::onEnter(), and EDA_DRAW_PANEL_GAL::OnEvent().

◆ IsModalDialogFocused()

bool KIUI::IsModalDialogFocused ( )

Definition at line 317 of file ui_common.cpp.

References PGM_BASE::m_ModalDialogs, and Pgm().

Referenced by EDA_DRAW_PANEL_GAL::onEnter(), and EDA_DRAW_PANEL_GAL::OnEvent().

◆ SelectReferenceNumber()

void KIUI::SelectReferenceNumber ( wxTextEntry *  aTextEntry)

◆ SetControlsTabOrder()

void KIUI::SetControlsTabOrder ( const std::vector< wxWindow * > &  aControlsInTabOrder)

Set a list of controls to have a defined sequential tab order.

Each control in the list will come after the previous one. The first control will keep its current position. The end result will be that the given control will be sequential when tabbed though.

This can be slightly clearer than manually calling MoveAfterInTabOrder on each control in turn.

Parameters
aControlsInTabOrderlist of controls (wxWindows) in desired tab order

◆ ValidatorTransferToWindowWithoutEvents()

void KIUI::ValidatorTransferToWindowWithoutEvents ( wxValidator &  aValidator)

Call a text validator's TransferDataToWindow method without firing a text change event.

This is useful when you want to keep a validator in sync with other data, but the act of changing it should not trigger other updates. It is the validator equivalent of ChangeValue() compared to SetValue().

This function blocks all events, but the same technique can be used to selectively block events.

Parameters
aValidatorthe validator to update the control of

Definition at line 301 of file validators.cpp.

Variable Documentation

◆ s_FocusStealableInputName

const wxString KIUI::s_FocusStealableInputName = wxS( "KI_NOFOCUS")
extern

Definition at line 45 of file ui_common.cpp.

Referenced by HOTKEY_CYCLE_POPUP::HOTKEY_CYCLE_POPUP(), and IsInputControlFocused().