2009-09-15 07:12:54 +00:00
|
|
|
#ifndef oxygenshadowconfiguration_h
|
|
|
|
#define oxygenshadowconfiguration_h
|
2009-09-14 19:21:39 +00:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-09-15 07:12:54 +00:00
|
|
|
// oxygenshadowconfiguration.h
|
2009-09-14 19:21:39 +00:00
|
|
|
// -------------------
|
|
|
|
//
|
|
|
|
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to
|
|
|
|
// deal in the Software without restriction, including without limitation the
|
|
|
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
// sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
// IN THE SOFTWARE.
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <KConfigGroup>
|
2009-09-20 07:42:03 +00:00
|
|
|
#include <QtGui/QPalette>
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
namespace OxygenConfig
|
2009-09-14 19:21:39 +00:00
|
|
|
{
|
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
static const QString SHADOW_SIZE = "Size";
|
|
|
|
static const QString SHADOW_HOFFSET= "HorizontalOffset";
|
|
|
|
static const QString SHADOW_VOFFSET= "VerticalOffset";
|
|
|
|
static const QString SHADOW_INNER_COLOR = "InnerColor";
|
|
|
|
static const QString SHADOW_OUTER_COLOR = "OuterColor";
|
|
|
|
static const QString SHADOW_USE_OUTER_COLOR = "UseOuterColor";
|
2009-09-14 19:21:39 +00:00
|
|
|
}
|
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
namespace Oxygen
|
2009-09-14 19:21:39 +00:00
|
|
|
{
|
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
class ShadowConfiguration
|
|
|
|
{
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
public:
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! button size enumeration
|
|
|
|
//! default constructor
|
|
|
|
ShadowConfiguration( QPalette::ColorGroup );
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! constructor from KConfig
|
|
|
|
ShadowConfiguration( QPalette::ColorGroup, KConfigGroup );
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! destructor
|
|
|
|
virtual ~ShadowConfiguration( void )
|
|
|
|
{}
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! write to kconfig group
|
|
|
|
virtual void write( KConfigGroup& ) const;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! color group
|
|
|
|
QPalette::ColorGroup colorGroup( void ) const
|
|
|
|
{ return colorGroup_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! enability
|
|
|
|
void setEnabled( bool value )
|
|
|
|
{ enabled_ = value; }
|
2010-03-25 00:51:27 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! enability
|
|
|
|
bool isEnabled( void ) const
|
|
|
|
{ return enabled_; }
|
2010-03-25 00:51:27 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! shadow size
|
|
|
|
qreal shadowSize( void ) const
|
|
|
|
{ return shadowSize_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! shadow size
|
|
|
|
void setShadowSize( qreal value )
|
|
|
|
{ shadowSize_ = value; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! horizontal offset
|
|
|
|
qreal horizontalOffset( void ) const
|
|
|
|
{ return horizontalOffset_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! horizontal offset
|
|
|
|
void setHorizontalOffset( qreal value )
|
|
|
|
{ horizontalOffset_ = value; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! vertical offset
|
|
|
|
qreal verticalOffset( void ) const
|
|
|
|
{ return verticalOffset_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! vertical offset
|
|
|
|
void setVerticalOffset( qreal value )
|
|
|
|
{ verticalOffset_ = value; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! inner color
|
|
|
|
QColor innerColor( void ) const
|
|
|
|
{ return innerColor_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! inner color
|
|
|
|
void setInnerColor( QColor );
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! mid color
|
|
|
|
QColor midColor( void ) const
|
|
|
|
{ return midColor_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! outer color
|
|
|
|
QColor outerColor( void ) const
|
|
|
|
{ return useOuterColor() ? outerColor_ : outerColor2_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! outer color
|
|
|
|
void setOuterColor( QColor );
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! use outer color
|
|
|
|
bool useOuterColor( void ) const
|
|
|
|
{ return useOuterColor_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! use outer color
|
|
|
|
void setUseOuterColor( bool value )
|
|
|
|
{ useOuterColor_ = value; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! equal to operator
|
|
|
|
bool operator == (const ShadowConfiguration& other ) const
|
|
|
|
{
|
|
|
|
return
|
|
|
|
colorGroup_ == other.colorGroup_ &&
|
|
|
|
enabled_ == other.enabled_ &&
|
|
|
|
shadowSize_ == other.shadowSize_ &&
|
|
|
|
horizontalOffset_ == other.horizontalOffset_ &&
|
|
|
|
verticalOffset_ == other.verticalOffset_ &&
|
|
|
|
innerColor_ == other.innerColor_ &&
|
|
|
|
( useOuterColor_ == false || outerColor_ == other.outerColor_ ) &&
|
|
|
|
useOuterColor_ == other.useOuterColor_;
|
|
|
|
}
|
2009-09-17 05:05:45 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
protected:
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! mid color
|
|
|
|
void setMidColor( QColor );
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! calculated outer color
|
|
|
|
QColor outerColor2( void ) const
|
|
|
|
{ return outerColor2_; }
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! calculated outer color
|
|
|
|
void setOuterColor2( QColor );
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! calculate mid color
|
|
|
|
QColor calcMidColor( void ) const;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! calculate outer color
|
|
|
|
QColor calcOuterColor( void ) const;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
private:
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! color group
|
|
|
|
QPalette::ColorGroup colorGroup_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! enability
|
|
|
|
bool enabled_;
|
2010-03-25 00:51:27 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! shadow size
|
|
|
|
qreal shadowSize_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! horizontal offset
|
|
|
|
qreal horizontalOffset_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! vertical offset
|
|
|
|
qreal verticalOffset_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! inner color
|
|
|
|
QColor innerColor_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! mid color
|
|
|
|
QColor midColor_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! outer color
|
|
|
|
QColor outerColor_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! calculated outer color
|
|
|
|
QColor outerColor2_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
//! use outer color
|
|
|
|
bool useOuterColor_;
|
2009-09-14 19:21:39 +00:00
|
|
|
|
2010-05-02 18:34:08 +00:00
|
|
|
};
|
2009-09-14 19:21:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|