QskSkinStateChanger introduced
This commit is contained in:
parent
47f7737985
commit
6fd771d741
38
src/controls/QskSkinStateChanger.h
Normal file
38
src/controls/QskSkinStateChanger.h
Normal file
@ -0,0 +1,38 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_SKIN_STATE_CHANGER_H
|
||||
#define QSK_SKIN_STATE_CHANGER_H
|
||||
|
||||
#include "QskAspect.h"
|
||||
#include "QskSkinnable.h"
|
||||
|
||||
class QskSkinStateChanger
|
||||
{
|
||||
public:
|
||||
QskSkinStateChanger( const QskSkinnable*, QskAspect::States );
|
||||
~QskSkinStateChanger();
|
||||
|
||||
private:
|
||||
QskSkinnable* m_skinnable;
|
||||
QskAspect::States m_oldStates;
|
||||
};
|
||||
|
||||
inline QskSkinStateChanger::QskSkinStateChanger(
|
||||
const QskSkinnable* skinnable, QskAspect::States states )
|
||||
: m_skinnable( const_cast< QskSkinnable* >( skinnable ) )
|
||||
, m_oldStates( skinnable->skinStates() )
|
||||
{
|
||||
if ( states )
|
||||
m_skinnable->replaceSkinStates( m_oldStates | states );
|
||||
}
|
||||
|
||||
inline QskSkinStateChanger::~QskSkinStateChanger()
|
||||
{
|
||||
if ( m_oldStates != m_skinnable->skinStates() )
|
||||
m_skinnable->replaceSkinStates( m_oldStates );
|
||||
}
|
||||
|
||||
#endif
|
@ -179,6 +179,7 @@ HEADERS += \
|
||||
controls/QskSkinHintTable.h \
|
||||
controls/QskSkinHintTableEditor.h \
|
||||
controls/QskSkinManager.h \
|
||||
controls/QskSkinStateChanger.h \
|
||||
controls/QskSkinTransition.h \
|
||||
controls/QskSkinlet.h \
|
||||
controls/QskSkinnable.h \
|
||||
|
Loading…
x
Reference in New Issue
Block a user