Version: 3.3.0
wxInfoDC Class Reference

#include <wx/dc.h>

+ Inheritance diagram for wxInfoDC:

Detailed Description

Class used for querying the window device context.

This class can be used to retrieve information about the window device context, including its coordinate system and text extents.

Unlike wxPaintDC, objects of this class can be created at any time.

Public Member Functions

 wxInfoDC (wxWindow *win)
 Create the information device context associated with the given window. More...
 
- Public Member Functions inherited from wxReadOnlyDC
bool IsOk () const
 Returns true if the DC is ok to use. More...
 
double GetContentScaleFactor () const
 Returns the factor used for converting logical pixels to physical ones. More...
 
int GetDepth () const
 Returns the depth (number of bits/pixel) of this DC. More...
 
wxPoint GetDeviceOrigin () const
 Returns the current device origin. More...
 
wxMappingMode GetMapMode () const
 Gets the current mapping mode for the device context. More...
 
wxSize GetPPI () const
 Returns the resolution of the device in pixels per inch. More...
 
wxSize FromDIP (const wxSize &sz) const
 Convert DPI-independent pixel values to the value in pixels appropriate for the DC. More...
 
wxPoint FromDIP (const wxPoint &pt) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
int FromDIP (int d) const
 Convert DPI-independent value in pixels to the value in pixels appropriate for the DC. More...
 
wxSize ToDIP (const wxSize &sz) const
 Convert pixel values of the current DC to DPI-independent pixel values. More...
 
wxPoint ToDIP (const wxPoint &pt) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
int ToDIP (int d) const
 Convert pixel values of the current DC to DPI-independent pixel values. More...
 
void GetSize (wxCoord *width, wxCoord *height) const
 Gets the horizontal and vertical extent of this device context in device units. More...
 
wxSize GetSize () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void GetSizeMM (wxCoord *width, wxCoord *height) const
 Returns the horizontal and vertical resolution in millimetres. More...
 
wxSize GetSizeMM () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void GetUserScale (double *x, double *y) const
 Gets the current user scale factor. More...
 
const wxFontGetFont () const
 Gets the current font. More...
 
wxLayoutDirection GetLayoutDirection () const
 Gets the current layout direction of the device context. More...
 
void SetFont (const wxFont &font)
 Sets the current font for the DC. More...
 
void SetLayoutDirection (wxLayoutDirection dir)
 Sets the current layout direction for the device context. More...
 
bool CanDrawBitmap () const
 Does the DC support drawing bitmaps? More...
 
bool CanGetTextExtent () const
 Does the DC support calculating the size required to draw text? More...
 
wxCoord DeviceToLogicalX (wxCoord x) const
 Convert device X coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More...
 
wxCoord DeviceToLogicalXRel (wxCoord x) const
 Convert device X coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More...
 
wxCoord DeviceToLogicalY (wxCoord y) const
 Converts device Y coordinate to logical coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More...
 
wxCoord DeviceToLogicalYRel (wxCoord y) const
 Convert device Y coordinate to relative logical coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More...
 
wxCoord LogicalToDeviceX (wxCoord x) const
 Converts logical X coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More...
 
wxCoord LogicalToDeviceXRel (wxCoord x) const
 Converts logical X coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More...
 
wxCoord LogicalToDeviceY (wxCoord y) const
 Converts logical Y coordinate to device coordinate, using the current mapping mode, user scale factor, device origin and axis orientation. More...
 
wxCoord LogicalToDeviceYRel (wxCoord y) const
 Converts logical Y coordinate to relative device coordinate, using the current mapping mode and user scale factor but ignoring the axis orientation. More...
 
wxPoint DeviceToLogical (wxCoord x, wxCoord y) const
 Converts device (x, y) coordinates to logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation. More...
 
wxPoint DeviceToLogical (const wxPoint &pt) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
wxSize DeviceToLogicalRel (int x, int y) const
 Converts device x, y coordinates to relative logical coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. More...
 
wxSize DeviceToLogicalRel (const wxSize &dim) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
wxPoint LogicalToDevice (wxCoord x, wxCoord y) const
 Converts logical (x, y) coordinates to device coordinates taking into account all applied transformations like the current mapping mode, scale factors, device origin, axes orientation, affine transformation. More...
 
wxPoint LogicalToDevice (const wxPoint &pt) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
wxSize LogicalToDeviceRel (int x, int y) const
 Converts logical x, y coordinates to relative device coordinates taking into account all applied transformations like the current mapping mode, scale factors, affine transformation. More...
 
wxSize LogicalToDeviceRel (const wxSize &dim) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
void SetAxisOrientation (bool xLeftRight, bool yBottomUp)
 Sets the x and y axis orientation (i.e. the direction from lowest to highest values on the axis). More...
 
void SetDeviceOrigin (wxCoord x, wxCoord y)
 Sets the device origin (i.e. the origin in pixels after scaling has been applied). More...
 
void SetMapMode (wxMappingMode mode)
 The mapping mode of the device context defines the unit of measurement used to convert logical units to device units. More...
 
void SetUserScale (double xScale, double yScale)
 Sets the user scaling factor, useful for applications which require 'zooming'. More...
 
void SetLogicalScale (double x, double y)
 Set the scale to use for translating wxDC coordinates to the physical pixels. More...
 
void GetLogicalScale (double *x, double *y) const
 Return the scale set by the last call to SetLogicalScale(). More...
 
void SetLogicalOrigin (wxCoord x, wxCoord y)
 Change the offset used for translating wxDC coordinates. More...
 
void GetLogicalOrigin (wxCoord *x, wxCoord *y) const
 Return the coordinates of the logical point (0, 0). More...
 
wxPoint GetLogicalOrigin () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
bool CanUseTransformMatrix () const
 Check if the use of transformation matrix is supported by the current system. More...
 
bool SetTransformMatrix (const wxAffineMatrix2D &matrix)
 Set the transformation matrix. More...
 
wxAffineMatrix2D GetTransformMatrix () const
 Return the transformation matrix used by this device context. More...
 
void ResetTransformMatrix ()
 Revert the transformation matrix to identity matrix. More...
 
wxCoord GetCharHeight () const
 Gets the character height of the currently set font. More...
 
wxCoord GetCharWidth () const
 Gets the average character width of the currently set font. More...
 
wxFontMetrics GetFontMetrics () const
 Returns the various font characteristics. More...
 
void GetMultiLineTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *heightLine=nullptr, const wxFont *font=nullptr) const
 Gets the dimensions of the string using the currently selected font. More...
 
wxSize GetMultiLineTextExtent (const wxString &string) const
 Gets the dimensions of the string using the currently selected font. More...
 
bool GetPartialTextExtents (const wxString &text, wxArrayInt &widths) const
 Fills the widths array with the widths from the beginning of text to the corresponding character of text. More...
 
void GetTextExtent (const wxString &string, wxCoord *w, wxCoord *h, wxCoord *descent=nullptr, wxCoord *externalLeading=nullptr, const wxFont *font=nullptr) const
 Gets the dimensions of the string using the currently selected font. More...
 
wxSize GetTextExtent (const wxString &string) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to nullptr the internal reference data. More...
 
 wxObject (const wxObject &other)
 Copy ctor. More...
 
virtual ~wxObject ()
 Destructor. More...
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class. More...
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj. More...
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone. More...
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer. More...
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public. More...
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 
void * operator new (size_t size, const wxString &filename=nullptr, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier __WXDEBUG__ is defined. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object. More...
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Constructor & Destructor Documentation

◆ wxInfoDC()

wxInfoDC::wxInfoDC ( wxWindow win)
explicit

Create the information device context associated with the given window.

Parameters
winValid, i.e. non-nullptr, window pointer.