KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DPI_SCALING Class Referenceabstract

Class to handle configuration and automatic determination of the DPI scale to use for canvases. More...

#include <dpi_scaling.h>

Inheritance diagram for DPI_SCALING:
DPI_SCALING_COMMON

Public Member Functions

 DPI_SCALING ()
 Construct a DPI scale provider.
 
virtual ~DPI_SCALING ()
 
virtual double GetScaleFactor () const =0
 Get the DPI scale from all known sources in order:
 
virtual double GetContentScaleFactor () const =0
 Get the content scale factor, which may be different from the scale factor on some platforms.
 
virtual bool GetCanvasIsAutoScaled () const =0
 Is the current value auto scaled, or is it user-set in the config.
 
virtual void SetDpiConfig (bool aAuto, double aValue)=0
 Set the common DPI config in a given config object.
 

Static Public Member Functions

static double GetMaxScaleFactor ()
 
static double GetMinScaleFactor ()
 
static double GetDefaultScaleFactor ()
 Get the "default" scaling factor to use if not other config is available.
 

Detailed Description

Class to handle configuration and automatic determination of the DPI scale to use for canvases.

This has several sources and the availability of some of them are platform dependent.

Definition at line 35 of file dpi_scaling.h.

Constructor & Destructor Documentation

◆ DPI_SCALING()

DPI_SCALING::DPI_SCALING ( )
inline

Construct a DPI scale provider.

Parameters
aConfigthe config store to check for a user value (can be nullptr, in which case on automatically determined values are considered)
aWindowa WX window to use for automatic DPI determination
Returns
the scaling factor (1.0 = no scaling)

Definition at line 46 of file dpi_scaling.h.

◆ ~DPI_SCALING()

virtual DPI_SCALING::~DPI_SCALING ( )
inlinevirtual

Definition at line 48 of file dpi_scaling.h.

Member Function Documentation

◆ GetCanvasIsAutoScaled()

virtual bool DPI_SCALING::GetCanvasIsAutoScaled ( ) const
pure virtual

Is the current value auto scaled, or is it user-set in the config.

Implemented in DPI_SCALING_COMMON.

◆ GetContentScaleFactor()

virtual double DPI_SCALING::GetContentScaleFactor ( ) const
pure virtual

Get the content scale factor, which may be different from the scale factor on some platforms.

This value should be used for scaling user interface elements (fonts, icons, etc) whereas the scale factor should be used for scaling canvases.

Implemented in DPI_SCALING_COMMON.

◆ GetDefaultScaleFactor()

double DPI_SCALING::GetDefaultScaleFactor ( )
static

Get the "default" scaling factor to use if not other config is available.

Definition at line 42 of file dpi_scaling.cpp.

Referenced by DPI_SCALING_COMMON::GetContentScaleFactor(), DPI_SCALING_COMMON::GetScaleFactor(), and PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().

◆ GetMaxScaleFactor()

double DPI_SCALING::GetMaxScaleFactor ( )
static

Definition at line 27 of file dpi_scaling.cpp.

Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().

◆ GetMinScaleFactor()

double DPI_SCALING::GetMinScaleFactor ( )
static

Definition at line 35 of file dpi_scaling.cpp.

Referenced by PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS().

◆ GetScaleFactor()

virtual double DPI_SCALING::GetScaleFactor ( ) const
pure virtual

Get the DPI scale from all known sources in order:

  • user config, if given
  • user's environment variables, if set and according to platform
  • WX's internal determination of the DPI scaling (WX > 3.1)

Implemented in DPI_SCALING_COMMON.

◆ SetDpiConfig()

virtual void DPI_SCALING::SetDpiConfig ( bool  aAuto,
double  aValue 
)
pure virtual

Set the common DPI config in a given config object.

The encoding of the automatic/manual nature of the config is handled internally.

Parameters
aAutostore a value meaning "no user-set scale"
aValuethe value to store (ignored if aAuto set)

Implemented in DPI_SCALING_COMMON.


The documentation for this class was generated from the following files: