KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIPLATFORM::UI Namespace Reference

Functions

bool IsDarkTheme ()
 Determine if the desktop interface is currently using a dark theme or a light theme.
 
wxColour GetDialogBGColour ()
 
void ForceFocus (wxWindow *aWindow)
 Pass the current focus to the window.
 
bool IsWindowActive (wxWindow *aWindow)
 Check to see if the given window is the currently active window (e.g.
 
void ReparentQuasiModal (wxNonOwnedWindow *aWindow)
 Move a window's parent to be the top-level window and force the window to be on top.
 
void FixupCancelButtonCmdKeyCollision (wxWindow *aWindow)
 
bool IsStockCursorOk (wxStockCursor aCursor)
 Checks if we designated a stock cursor for this OS as "OK" or else we may need to load a custom one.
 
void LargeChoiceBoxHack (wxChoice *aChoice)
 Configure a wxChoice control to support a lot of entries by disabling functionality that makes adding new items become very expensive.
 
void EllipsizeChoiceBox (wxChoice *aChoice)
 Configure a wxChoice control to ellipsize the shown text in the button with the ellipses placed at the end of the string.
 
double GetPixelScaleFactor (const wxWindow *aWindow)
 Tries to determine the pixel scaling factor currently in use for the window.
 
double GetContentScaleFactor (const wxWindow *aWindow)
 Tries to determine the content scaling factor currently in use for the window.
 
wxSize GetUnobscuredSize (const wxWindow *aWindow)
 Tries to determine the size of the viewport of a scrollable widget (wxDataViewCtrl, wxGrid) that won't be obscured by scrollbars.
 
void SetOverlayScrolling (const wxWindow *aWindow, bool overlay)
 Used to set overlay/non-overlay scrolling mode in a window.
 
bool AllowIconsInMenus ()
 If the user has disabled icons system-wide, we check that here.
 
wxPoint GetMousePosition ()
 Returns the mouse position in screen coordinates.
 
bool WarpPointer (wxWindow *aWindow, int aX, int aY)
 Move the mouse cursor to a specific position relative to the window.
 
void ImmControl (wxWindow *aWindow, bool aEnable)
 Configures the IME mode of a given control handle.
 
bool InfiniteDragPrepareWindow (wxWindow *aWindow)
 On Wayland, restricts the pointer movement to a rectangle slightly bigger than the given wxWindow.
 
void InfiniteDragReleaseWindow ()
 On Wayland, allows the cursor to freely move again after a drag (see InfiniteDragPrepareWindow).
 

Function Documentation

◆ AllowIconsInMenus()

bool KIPLATFORM::UI::AllowIconsInMenus ( )

If the user has disabled icons system-wide, we check that here.

Definition at line 209 of file gtk/ui.cpp.

Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().

◆ EllipsizeChoiceBox()

void KIPLATFORM::UI::EllipsizeChoiceBox ( wxChoice *  aChoice)

Configure a wxChoice control to ellipsize the shown text in the button with the ellipses placed at the end of the string.

Parameters
aChoiceis the choice box to ellipsize

Definition at line 154 of file gtk/ui.cpp.

Referenced by DIALOG_SELECT_3DMODEL::DIALOG_SELECT_3DMODEL().

◆ FixupCancelButtonCmdKeyCollision()

void KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision ( wxWindow *  aWindow)

◆ ForceFocus()

void KIPLATFORM::UI::ForceFocus ( wxWindow *  aWindow)

Pass the current focus to the window.

On OSX this will forcefully give the focus to the desired window, while on MSW and GTK it will simply call the wxWidgets SetFocus() function.

Parameters
aWindowis the window to pass focus to

Definition at line 67 of file gtk/ui.cpp.

Referenced by NET_SELECTOR_COMBOPOPUP::doSetFocus(), SYMBOL_CHOOSER_FRAME::OnPaint(), FOOTPRINT_CHOOSER_FRAME::OnPaint(), DIALOG_SHIM::OnPaint(), DIALOG_DRC::OnRunDRCClick(), DIALOG_ERC::OnRunERCClick(), and EE_INSPECTION_TOOL::ShowERCDialog().

◆ GetContentScaleFactor()

double KIPLATFORM::UI::GetContentScaleFactor ( const wxWindow *  aWindow)

Tries to determine the content scaling factor currently in use for the window.

The content scaling factor is typically settable by the user and may differ from the pixel scaling factor.

Definition at line 188 of file gtk/ui.cpp.

References GetPixelScaleFactor().

Referenced by DPI_SCALING_COMMON::GetContentScaleFactor(), and WX_AUI_TOOLBAR_ART::GetToolSize().

◆ GetDialogBGColour()

◆ GetMousePosition()

◆ GetPixelScaleFactor()

double KIPLATFORM::UI::GetPixelScaleFactor ( const wxWindow *  aWindow)

Tries to determine the pixel scaling factor currently in use for the window.

Under wx3.0, GTK fails to properly detect the scale factor.

Parameters
aWindowpointer to the window to check
Returns
Pixel scale factor in use, defaulting to the wxWidgets method

Definition at line 175 of file gtk/ui.cpp.

Referenced by ACTION_TOOLBAR_PALETTE::AddAction(), WX_AUI_TOOLBAR_ART::DrawButton(), GetContentScaleFactor(), DPI_SCALING_COMMON::GetScaleFactor(), and BITMAP_BUTTON::OnPaint().

◆ GetUnobscuredSize()

◆ ImmControl()

void KIPLATFORM::UI::ImmControl ( wxWindow *  aWindow,
bool  aEnable 
)

Configures the IME mode of a given control handle.

Definition at line 319 of file gtk/ui.cpp.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ InfiniteDragPrepareWindow()

bool KIPLATFORM::UI::InfiniteDragPrepareWindow ( wxWindow *  aWindow)

On Wayland, restricts the pointer movement to a rectangle slightly bigger than the given wxWindow.

This way, the cursor doesn't exit the (bigger) application window and we retain control on it. Required to make the infinite mouse-drag work with fast movement. See https://gitlab.com/kicad/code/kicad/-/issues/7207#note_1562089503

Parameters
aWindowWindow in which to position to mouse cursor
Returns
true if infinite panning is supported

Definition at line 588 of file gtk/ui.cpp.

Referenced by KIGFX::WX_VIEW_CONTROLS::onButton().

◆ InfiniteDragReleaseWindow()

void KIPLATFORM::UI::InfiniteDragReleaseWindow ( )

On Wayland, allows the cursor to freely move again after a drag (see InfiniteDragPrepareWindow).

Definition at line 595 of file gtk/ui.cpp.

Referenced by KIGFX::WX_VIEW_CONTROLS::onButton().

◆ IsDarkTheme()

◆ IsStockCursorOk()

bool KIPLATFORM::UI::IsStockCursorOk ( wxStockCursor  aCursor)

Checks if we designated a stock cursor for this OS as "OK" or else we may need to load a custom one.

Parameters
aCursoris wxStockCursor we want to see if its acceptable

Definition at line 100 of file gtk/ui.cpp.

Referenced by CURSOR_STORE::GetStockCursor().

◆ IsWindowActive()

bool KIPLATFORM::UI::IsWindowActive ( wxWindow *  aWindow)

Check to see if the given window is the currently active window (e.g.

the window in the foreground the user is interacting with).

Parameters
aWindowis the window to check

Definition at line 73 of file gtk/ui.cpp.

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

◆ LargeChoiceBoxHack()

void KIPLATFORM::UI::LargeChoiceBoxHack ( wxChoice *  aChoice)

Configure a wxChoice control to support a lot of entries by disabling functionality that makes adding new items become very expensive.

Parameters
aChoiceis the choice box to modify

Definition at line 136 of file gtk/ui.cpp.

References disable_area_apply_attributes_cb().

Referenced by FONT_CHOICE::FONT_CHOICE().

◆ ReparentQuasiModal()

void KIPLATFORM::UI::ReparentQuasiModal ( wxNonOwnedWindow *  aWindow)

Move a window's parent to be the top-level window and force the window to be on top.

This only has an affect for OSX, it is a NOP for GTK and MSW.

Apple in its infinite wisdom will raise a disabled window before even passing us the event, so we have no way to stop it. Instead, we must set an order on the windows so that the quasi-modal will be pushed in front of the disabled window when it is raised.

Parameters
aWindowis the window to reparent

Definition at line 88 of file gtk/ui.cpp.

Referenced by PCB_VIEWER_TOOLS::Show3DViewer(), FOOTPRINT_CHOOSER_FRAME::Show3DViewerFrame(), and DIALOG_SHIM::ShowQuasiModal().

◆ SetOverlayScrolling()

void KIPLATFORM::UI::SetOverlayScrolling ( const wxWindow *  aWindow,
bool  overlay 
)

Used to set overlay/non-overlay scrolling mode in a window.

Implemented only on GTK.

Definition at line 202 of file gtk/ui.cpp.

References overlay.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ WarpPointer()

bool KIPLATFORM::UI::WarpPointer ( wxWindow *  aWindow,
int  aX,
int  aY 
)

Move the mouse cursor to a specific position relative to the window.

Parameters
aWindowWindow in which to position to mouse cursor
aXdestination x position
aYdestination y position
Returns
true if the warp was successful

Definition at line 253 of file gtk/ui.cpp.

References traceWayland.

Referenced by KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), KIGFX::WX_VIEW_CONTROLS::handleCursorCapture(), KIGFX::WX_VIEW_CONTROLS::onMotion(), and KIGFX::WX_VIEW_CONTROLS::WarpMouseCursor().