QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskSkinStateChanger.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_SKIN_STATE_CHANGER_H
7#define QSK_SKIN_STATE_CHANGER_H
8
9#include "QskAspect.h"
10#include "QskSkinnable.h"
11
13{
14 public:
17
18 void setStates( QskAspect::States, int sampleIndex = -1 );
19 void resetStates();
20
21 private:
22 QskSkinnable* m_skinnable;
23 const QskAspect::States m_oldStates;
24};
25
26inline QskSkinStateChanger::QskSkinStateChanger( const QskSkinnable* skinnable )
27 : m_skinnable( const_cast< QskSkinnable* >( skinnable ) )
28 , m_oldStates( skinnable->skinStates() )
29{
30}
31
32inline QskSkinStateChanger::~QskSkinStateChanger()
33{
34 resetStates();
35}
36
37inline void QskSkinStateChanger::setStates(
38 QskAspect::States states, int sampleIndex )
39{
40 m_skinnable->replaceSkinStates( states, sampleIndex );
41}
42
43inline void QskSkinStateChanger::resetStates()
44{
45 m_skinnable->replaceSkinStates( m_oldStates, -1 );
46}
47
48#endif