1
#ifndef oxygenshadowdemowidget_h
2
#define oxygenshadowdemowidget_h
4
//////////////////////////////////////////////////////////////////////////////
5
// oxygenshadowdemowidget.h
9
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
11
// Permission is hereby granted, free of charge, to any person obtaining a copy
12
// of this software and associated documentation files (the "Software"), to
13
// deal in the Software without restriction, including without limitation the
14
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15
// sell copies of the Software, and to permit persons to whom the Software is
16
// furnished to do so, subject to the following conditions:
18
// The above copyright notice and this permission notice shall be included in
19
// all copies or substantial portions of the Software.
21
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28
//////////////////////////////////////////////////////////////////////////////
30
#include "oxygentileset.h"
31
#include "oxygenhelper.h"
33
#include <QtGui/QWidget>
34
#include <QtGui/QPaintEvent>
35
#include <QtGui/QPixmap>
41
//! shadow demo widget
42
class ShadowDemoWidget: public QWidget
50
explicit ShadowDemoWidget( QWidget* parent = 0 ):
52
_drawBackground( true ),
58
virtual ~ShadowDemoWidget( void )
62
void setHelper( Helper& helper )
63
{ _helper = &helper; }
66
void setTileSet( const TileSet& tileSet )
69
if( isVisible() ) update();
73
const TileSet& tileSet( void ) const
77
void setShadowSize( int size )
80
setMinimumSize( _shadowSize*2 + 100, _shadowSize*2 + 60 );
84
void setSquare( bool value )
87
if( isVisible() ) update();
92
//! toggle background drawing
93
void toggleBackground( bool value )
95
if( value == _drawBackground ) return;
96
_drawBackground = value;
103
virtual void paintEvent( QPaintEvent* );
105
//! render window to pixmap
106
void updateBackgroundPixmap( void );
108
Helper& helper( void ) const
119
//! draw window background
120
bool _drawBackground;
122
//! true if (bottom) corners are square
132
QPixmap _backgroundPixmap;