KiCad PCB EDA Suite
KIUI Namespace Reference

Functions

void ValidatorTransferToWindowWithoutEvents (wxValidator &aValidator)
 Call a text validator's TransferDataToWindow method without firing a text change event. More...
 
void SetControlsTabOrder (const std::vector< wxWindow * > &aControlsInTabOrder)
 Set a list of controls to have a defined sequential tab order. More...
 
int GetStdMargin ()
 Get the standard margin around a widget in the KiCad UI. More...
 

Function Documentation

◆ GetStdMargin()

int KIUI::GetStdMargin ( )

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

Returns
margin in pixels

Definition at line 23 of file ui_common.cpp.

24 {
25  // This is the value used in (most) wxFB dialogs
26  return 5;
27 }

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

◆ 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

Definition at line 27 of file tab_traversal.cpp.

28 {
29  for( unsigned i = 1; i < aControlsInTabOrder.size(); ++i )
30  {
31  aControlsInTabOrder[i]->MoveAfterInTabOrder( aControlsInTabOrder[i - 1] );
32  }
33 }
size_t i
Definition: json11.cpp:597

References i.

Referenced by DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), and DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES().

◆ 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 321 of file validators.cpp.

322 {
323  wxWindow* ctrl = aValidator.GetWindow();
324 
325  wxCHECK_RET( ctrl != nullptr, "Transferring validator data without a control" );
326 
327  wxEventBlocker orient_update_blocker( ctrl, wxEVT_ANY );
328  aValidator.TransferToWindow();
329 }

Referenced by DIALOG_FOOTPRINT_BOARD_EDITOR::updateOrientationControl().