Version: 3.2.2
wxDCBgModeChanger Class Reference

#include <wx/dc.h>

Public Member Functions

 wxDCBgModeChanger (wxDC &dc)
 Trivial constructor not changing anything. More...
 
 wxDCBgModeChanger (wxDC &dc, int mode)
 Sets mode on the given dc, storing the old one. More...
 
void Set (int mode)
 Set the text background mode to use. More...
 
 ~wxDCBgModeChanger ()
 Restores the text background mode originally selected in the DC passed to the ctor. More...
 

Constructor & Destructor Documentation

◆ wxDCBgModeChanger() [1/2]

wxDCBgModeChanger::wxDCBgModeChanger ( wxDC dc)

Trivial constructor not changing anything.

This constructor is useful if you don't know beforehand if the background mode needs to be changed or not. It simply creates the object which won't do anything in its destructor unless Set() is called – in which case it would reset the previous mode.

◆ wxDCBgModeChanger() [2/2]

wxDCBgModeChanger::wxDCBgModeChanger ( wxDC dc,
int  mode 
)

Sets mode on the given dc, storing the old one.

Parameters
dcThe DC where the mode must be temporary set.
modeThe background mode to set, one of wxBRUSHSTYLE_SOLID or wxBRUSHSTYLE_TRANSPARENT.

◆ ~wxDCBgModeChanger()

wxDCBgModeChanger::~wxDCBgModeChanger ( )

Restores the text background mode originally selected in the DC passed to the ctor.

Member Function Documentation

◆ Set()

void wxDCBgModeChanger::Set ( int  mode)

Set the text background mode to use.

This method is meant to be called once only and only on the objects created with the constructor overload not taking mode argument and has the same effect as the other constructor, i.e. sets the background mode to the given one, and ensures that the old value is restored when this object is destroyed.