mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
kstyles: preperations for Katie changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
2cc0c53c82
commit
e484245630
12 changed files with 0 additions and 832 deletions
|
@ -15,7 +15,6 @@ add_subdirectory( demo )
|
|||
set(oxygen_PART_SRCS
|
||||
debug/oxygenwidgetexplorer.cpp
|
||||
oxygenframeshadow.cpp
|
||||
oxygenmdiwindowshadow.cpp
|
||||
oxygenmnemonics.cpp
|
||||
oxygenpropertynames.cpp
|
||||
oxygenshadowhelper.cpp
|
||||
|
|
|
@ -7,7 +7,6 @@ set(oxygen_demo_SOURCES
|
|||
oxygenframedemowidget.cpp
|
||||
oxygeninputdemowidget.cpp
|
||||
oxygenlistdemowidget.cpp
|
||||
oxygenmdidemowidget.cpp
|
||||
oxygensimulator.cpp
|
||||
oxygensliderdemowidget.cpp
|
||||
oxygentabdemowidget.cpp
|
||||
|
@ -17,7 +16,6 @@ set(oxygen_demo_SOURCES
|
|||
oxygenframedemowidget.ui
|
||||
oxygeninputdemowidget.ui
|
||||
oxygenlistdemowidget.ui
|
||||
oxygenmdidemowidget.ui
|
||||
oxygensliderdemowidget.ui
|
||||
oxygentabdemowidget.ui
|
||||
)
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "oxygeninputdemowidget.h"
|
||||
#include "oxygenframedemowidget.h"
|
||||
#include "oxygenlistdemowidget.h"
|
||||
#include "oxygenmdidemowidget.h"
|
||||
#include "oxygensliderdemowidget.h"
|
||||
#include "oxygentabdemowidget.h"
|
||||
|
||||
|
@ -137,16 +136,6 @@ namespace Oxygen
|
|||
_widgets.append( widget );
|
||||
}
|
||||
|
||||
// mdi
|
||||
{
|
||||
page = new KPageWidgetItem( widget = new MdiDemoWidget() );
|
||||
page->setName( "MDI Windows" );
|
||||
page->setIcon( KIcon( "preferences-system-windows" ) );
|
||||
page->setHeader( "Shows the appearance of MDI windows" );
|
||||
_pageWidget->addPage( page );
|
||||
_widgets.append( widget );
|
||||
}
|
||||
|
||||
// sliders
|
||||
{
|
||||
page = new KPageWidgetItem( widget = new SliderDemoWidget() );
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// oxygenmdidemowidget.cpp
|
||||
// oxygen mdi windows demo widget
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2010 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 "oxygenmdidemowidget.h"
|
||||
#include "moc_oxygenmdidemowidget.cpp"
|
||||
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QMenuBar>
|
||||
#include <QtGui/QMenu>
|
||||
#include <KIcon>
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
|
||||
//______________________________________________________________
|
||||
MdiDemoWidget::MdiDemoWidget( QWidget* parent ):
|
||||
DemoWidget( parent )
|
||||
{
|
||||
setLayout( new QVBoxLayout() );
|
||||
QMenuBar* menuBar = new QMenuBar( this );
|
||||
layout()->addWidget( menuBar );
|
||||
|
||||
QWidget* widget = new QWidget( this );
|
||||
layout()->addWidget( widget );
|
||||
ui.setupUi( widget );
|
||||
|
||||
QMenu* menu = menuBar->addMenu( "&Layout" );
|
||||
connect( menu->addAction( i18n( "Tile" ) ), SIGNAL(triggered()), ui.mdiArea, SLOT(tileSubWindows()) );
|
||||
//action->trigger();
|
||||
|
||||
connect( menu->addAction( i18n( "Cascade" ) ), SIGNAL(triggered()), ui.mdiArea, SLOT(cascadeSubWindows()) );
|
||||
|
||||
menu = menuBar->addMenu( "&Tools" );
|
||||
QAction* action;
|
||||
connect( action = menu->addAction( KIcon( "arrow-right" ), i18n( "Select Next Window" ) ), SIGNAL(triggered()), ui.mdiArea, SLOT(activateNextSubWindow()) );
|
||||
action->setShortcut( Qt::CTRL + Qt::Key_Tab );
|
||||
addAction( action );
|
||||
|
||||
connect( action = menu->addAction( KIcon( "arrow-left" ), i18n( "Select Previous Window" ) ), SIGNAL(triggered()), ui.mdiArea, SLOT(activatePreviousSubWindow()) );
|
||||
action->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_Tab );
|
||||
addAction( action );
|
||||
|
||||
}
|
||||
|
||||
//______________________________________________________________
|
||||
void MdiDemoWidget::benchmark( void )
|
||||
{
|
||||
if( !isVisible() ) return;
|
||||
|
||||
if( true )
|
||||
{
|
||||
// slide windows
|
||||
foreach( QMdiSubWindow* window, ui.mdiArea->findChildren<QMdiSubWindow*>() )
|
||||
{
|
||||
simulator().click( window );
|
||||
simulator().slide( window, QPoint( 20, 20 ) );
|
||||
simulator().slide( window, QPoint( -20, -20 ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( true )
|
||||
{
|
||||
foreach( QAbstractButton* button, ui.toolBox->findChildren<QAbstractButton*>() )
|
||||
{ simulator().click( button ); }
|
||||
|
||||
foreach( QAbstractButton* button, ui.toolBox->findChildren<QAbstractButton*>() )
|
||||
{ simulator().click( button ); }
|
||||
}
|
||||
|
||||
simulator().run();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
#ifndef OXYGENMDIDEMOWIDGET_H
|
||||
#define OXYGENMDIDEMOWIDGET_H
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// oxygenmdidemowidget.h
|
||||
// oxygen mdi windows demo widget
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2010 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 <QtGui/QWidget>
|
||||
#include <QtGui/QToolButton>
|
||||
|
||||
#include "oxygendemowidget.h"
|
||||
#include "ui_oxygenmdidemowidget.h"
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
class MdiDemoWidget: public DemoWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
explicit MdiDemoWidget( QWidget* = 0 );
|
||||
|
||||
//! destructor
|
||||
virtual ~MdiDemoWidget( void )
|
||||
{}
|
||||
|
||||
public slots:
|
||||
|
||||
void benchmark( void );
|
||||
|
||||
private:
|
||||
|
||||
Ui_MdiDemoWidget ui;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,164 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MdiDemoWidget</class>
|
||||
<widget class="QWidget" name="MdiDemoWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>620</width>
|
||||
<height>420</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QMdiArea" name="mdiArea">
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="Editors">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Editors</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Title:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="KLineEdit" name="lineEdit">
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="KTextEdit" name="textEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Toolbox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Toolbox</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>282</width>
|
||||
<height>72</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>First Page</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>83</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Second Page</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>First Label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Second Label</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Third Page</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>klineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>KTextEdit</class>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>ktextedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -36,8 +36,6 @@
|
|||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/QPushButton>
|
||||
|
@ -46,7 +44,6 @@
|
|||
#include <QtGui/QSlider>
|
||||
#include <QtGui/QStyle>
|
||||
#include <QtGui/qstyleoption.h>
|
||||
#include <QtGui/qstyleoption.h>
|
||||
#include <QtGui/QToolButton>
|
||||
|
||||
|
||||
|
@ -93,15 +90,6 @@ namespace Oxygen
|
|||
&option,
|
||||
radiobutton).center();
|
||||
|
||||
} else if( const QMdiSubWindow* window = qobject_cast<QMdiSubWindow*>( receiver ) ) {
|
||||
|
||||
QStyleOptionTitleBar option;
|
||||
option.initFrom( window );
|
||||
int titleBarHeight( window->style()->pixelMetric( QStyle::PM_TitleBarHeight, &option, window ) );
|
||||
QRect titleBarRect( QPoint(0,0), QSize( window->width(), titleBarHeight ) );
|
||||
if( !titleBarRect.isValid() ) return;
|
||||
position = titleBarRect.center();
|
||||
|
||||
} else {
|
||||
|
||||
position = receiver->rect().center();
|
||||
|
@ -365,15 +353,6 @@ namespace Oxygen
|
|||
if( !handleRect.isValid() ) break;
|
||||
begin = handleRect.center();
|
||||
|
||||
} else if( const QMdiSubWindow* window = qobject_cast<QMdiSubWindow*>( receiver ) ) {
|
||||
|
||||
QStyleOptionTitleBar option;
|
||||
option.initFrom( window );
|
||||
int titleBarHeight( window->style()->pixelMetric( QStyle::PM_TitleBarHeight, &option, window ) );
|
||||
QRect titleBarRect( QPoint(0,0), QSize( window->width(), titleBarHeight ) );
|
||||
if( !titleBarRect.isValid() ) break;
|
||||
begin = titleBarRect.center();
|
||||
|
||||
} else {
|
||||
|
||||
begin = receiver->rect().center();
|
||||
|
|
|
@ -1,224 +0,0 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// oxygenmdiwindowshadow.cpp
|
||||
// handle MDI windows' shadows
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
||||
//
|
||||
// Largely inspired from skulpture widget style
|
||||
// Copyright (c) 2007-2009 Christoph Feck <christoph@maxiom.de>
|
||||
//
|
||||
// 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 "oxygenmdiwindowshadow.h"
|
||||
#include "moc_oxygenmdiwindowshadow.cpp"
|
||||
#include "oxygenshadowcache.h"
|
||||
|
||||
#include <QtGui/QMdiArea>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
|
||||
//____________________________________________________________________
|
||||
void MdiWindowShadow::updateGeometry( void )
|
||||
{
|
||||
if( !_widget ) return;
|
||||
|
||||
// get tileSet rect
|
||||
_tileSetRect = _widget->frameGeometry().adjusted( -ShadowSize, -ShadowSize, ShadowSize, ShadowSize );
|
||||
|
||||
// get parent MDI area's viewport
|
||||
QWidget *parent( parentWidget() );
|
||||
if (parent && !qobject_cast<QMdiArea *>(parent) && qobject_cast<QMdiArea*>(parent->parentWidget()))
|
||||
{ parent = parent->parentWidget(); }
|
||||
if( qobject_cast<QAbstractScrollArea *>( parent ) )
|
||||
{ parent = qobject_cast<QAbstractScrollArea *>( parent )->viewport(); }
|
||||
|
||||
// set geometry
|
||||
QRect geometry( _tileSetRect );
|
||||
if( parent ) geometry &= parent->rect();
|
||||
setGeometry( geometry );
|
||||
|
||||
// translate rendering rect
|
||||
_tileSetRect.translate( -geometry.topLeft() );
|
||||
|
||||
}
|
||||
|
||||
//____________________________________________________________________
|
||||
void MdiWindowShadow::updateZOrder( void )
|
||||
{ stackUnder( _widget ); }
|
||||
|
||||
//____________________________________________________________________
|
||||
void MdiWindowShadow::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
|
||||
if( !_tileSet.isValid() ) return;
|
||||
|
||||
QPainter p( this );
|
||||
p.setRenderHints( QPainter::Antialiasing );
|
||||
p.setClipRegion( event->region() );
|
||||
_tileSet.render( _tileSetRect, &p );
|
||||
|
||||
}
|
||||
|
||||
//____________________________________________________________________
|
||||
MdiWindowShadowFactory::MdiWindowShadowFactory( QObject* parent, StyleHelper& helper ):
|
||||
QObject( parent )
|
||||
{
|
||||
|
||||
// create shadow cache
|
||||
ShadowCache cache( helper );
|
||||
cache.setShadowSize( QPalette::Inactive, MdiWindowShadow::ShadowSize );
|
||||
cache.setShadowSize( QPalette::Active, MdiWindowShadow::ShadowSize );
|
||||
|
||||
// get tileset
|
||||
_tileSet = *cache.tileSet( ShadowCache::Key() );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________________
|
||||
bool MdiWindowShadowFactory::registerWidget( QWidget* widget )
|
||||
{
|
||||
|
||||
// check widget type
|
||||
if( !( widget && qobject_cast<QMdiSubWindow*>( widget ) ) ) return false;
|
||||
|
||||
// make sure widget is not already registered
|
||||
if( isRegistered( widget ) ) return false;
|
||||
|
||||
// store in set
|
||||
_registeredWidgets.insert( widget );
|
||||
|
||||
widget->installEventFilter( this );
|
||||
|
||||
// catch object destruction
|
||||
connect( widget, SIGNAL(destroyed(QObject*)), SLOT(widgetDestroyed(QObject*)) );
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//____________________________________________________________________________________
|
||||
void MdiWindowShadowFactory::unregisterWidget( QWidget* widget )
|
||||
{
|
||||
if( !isRegistered( widget ) ) return;
|
||||
widget->removeEventFilter( this );
|
||||
_registeredWidgets.remove( widget );
|
||||
removeShadow( widget );
|
||||
}
|
||||
|
||||
//____________________________________________________________________________________
|
||||
bool MdiWindowShadowFactory::eventFilter( QObject* object, QEvent* event )
|
||||
{
|
||||
|
||||
switch( event->type() )
|
||||
{
|
||||
// TODO: possibly implement ZOrderChange event, to make sure that
|
||||
// the shadow is always painted on top
|
||||
case QEvent::ZOrderChange:
|
||||
updateShadowZOrder( object );
|
||||
break;
|
||||
|
||||
case QEvent::Destroy:
|
||||
if( isRegistered( object ) )
|
||||
{
|
||||
_registeredWidgets.remove( object );
|
||||
removeShadow( object );
|
||||
}
|
||||
break;
|
||||
|
||||
case QEvent::Hide:
|
||||
hideShadows( object );
|
||||
break;
|
||||
|
||||
case QEvent::Show:
|
||||
installShadow( object );
|
||||
updateShadowGeometry( object );
|
||||
updateShadowZOrder( object );
|
||||
break;
|
||||
|
||||
case QEvent::Move:
|
||||
case QEvent::Resize:
|
||||
updateShadowGeometry( object );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return QObject::eventFilter( object, event );
|
||||
|
||||
}
|
||||
|
||||
//____________________________________________________________________________________
|
||||
MdiWindowShadow* MdiWindowShadowFactory::findShadow( QObject* object ) const
|
||||
{
|
||||
|
||||
// check object,
|
||||
if( !object->parent() ) return 0L;
|
||||
|
||||
// find existing window shadows
|
||||
const QList<QObject* > children = object->parent()->children();
|
||||
foreach( QObject *child, children )
|
||||
{
|
||||
if( MdiWindowShadow* shadow = qobject_cast<MdiWindowShadow*>(child) )
|
||||
{ if( shadow->widget() == object ) return shadow; }
|
||||
}
|
||||
|
||||
return 0L;
|
||||
|
||||
}
|
||||
|
||||
//____________________________________________________________________________________
|
||||
void MdiWindowShadowFactory::installShadow( QObject* object )
|
||||
{
|
||||
|
||||
// cast
|
||||
QWidget* widget( static_cast<QWidget*>( object ) );
|
||||
if( !widget->parentWidget() ) return;
|
||||
|
||||
// make sure shadow is not already installed
|
||||
if( findShadow( object ) ) return;
|
||||
|
||||
// create new shadow
|
||||
MdiWindowShadow* windowShadow( new MdiWindowShadow( widget->parentWidget(), _tileSet ) );
|
||||
windowShadow->setWidget( widget );
|
||||
windowShadow->show();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//____________________________________________________________________________________
|
||||
void MdiWindowShadowFactory::removeShadow( QObject* object )
|
||||
{
|
||||
if( MdiWindowShadow* windowShadow = findShadow( object ) )
|
||||
{
|
||||
windowShadow->hide();
|
||||
windowShadow->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
//____________________________________________________________________________________
|
||||
void MdiWindowShadowFactory::widgetDestroyed( QObject* object )
|
||||
{ _registeredWidgets.remove( object ); }
|
||||
|
||||
}
|
|
@ -1,193 +0,0 @@
|
|||
#ifndef OXYGENMDIWINDOWSHADOW_H
|
||||
#define OXYGENMDIWINDOWSHADOW_H
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// oxygenmdiwindowshadow.h
|
||||
// handle MDI windows' shadows
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
||||
//
|
||||
// Largely inspired from skulpture widget style
|
||||
// Copyright (c) 2007-2009 Christoph Feck <christoph@maxiom.de>
|
||||
//
|
||||
// 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 <QtCore/QEvent>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QSet>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <KColorScheme>
|
||||
|
||||
#include "oxygenstylehelper.h"
|
||||
#include "oxygentileset.h"
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
|
||||
//! frame shadow
|
||||
/*! this allows the shadow to be painted over the widgets viewport */
|
||||
class MdiWindowShadow: public QWidget
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! shadow size (hard coded)
|
||||
enum { ShadowSize = 10 };
|
||||
|
||||
//! constructor
|
||||
explicit MdiWindowShadow( QWidget* parent, TileSet tileSet ):
|
||||
QWidget( parent ),
|
||||
_widget( 0L ),
|
||||
_tileSet( tileSet )
|
||||
{
|
||||
setAttribute( Qt::WA_OpaquePaintEvent, false );
|
||||
setAttribute( Qt::WA_TransparentForMouseEvents, true );
|
||||
setFocusPolicy( Qt::NoFocus );
|
||||
}
|
||||
|
||||
//! destructor
|
||||
virtual ~MdiWindowShadow( void )
|
||||
{}
|
||||
|
||||
//! update geometry
|
||||
void updateGeometry( void );
|
||||
|
||||
//! update ZOrder
|
||||
void updateZOrder( void );
|
||||
|
||||
//! set associated window
|
||||
void setWidget( QWidget* value )
|
||||
{ _widget = value; }
|
||||
|
||||
//! associated window
|
||||
QWidget* widget( void ) const
|
||||
{ return _widget; }
|
||||
|
||||
protected:
|
||||
|
||||
//! painting
|
||||
virtual void paintEvent(QPaintEvent *);
|
||||
|
||||
private:
|
||||
|
||||
//! associated widget
|
||||
QWidget* _widget;
|
||||
|
||||
//! tileset rect, used for painting
|
||||
QRect _tileSetRect;
|
||||
|
||||
//! tileset used to draw shadow
|
||||
TileSet _tileSet;
|
||||
|
||||
};
|
||||
|
||||
//! shadow manager
|
||||
class MdiWindowShadowFactory: public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
MdiWindowShadowFactory( QObject*, StyleHelper& );
|
||||
|
||||
//! destructor
|
||||
virtual ~MdiWindowShadowFactory( void )
|
||||
{}
|
||||
|
||||
//! register widget
|
||||
bool registerWidget( QWidget* );
|
||||
|
||||
//! unregister
|
||||
void unregisterWidget( QWidget* );
|
||||
|
||||
//! true if widget is registered
|
||||
bool isRegistered( const QObject* widget ) const
|
||||
{ return _registeredWidgets.contains( widget ); }
|
||||
|
||||
//! event filter
|
||||
virtual bool eventFilter( QObject*, QEvent*);
|
||||
|
||||
protected:
|
||||
|
||||
//! find shadow matching a given object
|
||||
MdiWindowShadow* findShadow( QObject* ) const;
|
||||
|
||||
//! install shadows on given widget
|
||||
void installShadow( QObject* );
|
||||
|
||||
//! remove shadows from widget
|
||||
void removeShadow( QObject* );
|
||||
|
||||
//! hide shadows
|
||||
void hideShadows( QObject* object ) const
|
||||
{
|
||||
if( MdiWindowShadow* windowShadow = findShadow( object ) )
|
||||
{ windowShadow->hide(); }
|
||||
}
|
||||
|
||||
//! update ZOrder
|
||||
void updateShadowZOrder( QObject* object ) const
|
||||
{
|
||||
if( MdiWindowShadow* windowShadow = findShadow( object ) )
|
||||
{
|
||||
if( !windowShadow->isVisible() ) windowShadow->show();
|
||||
windowShadow->updateZOrder();
|
||||
}
|
||||
}
|
||||
|
||||
//! update shadows geometry
|
||||
void updateShadowGeometry( QObject* object ) const
|
||||
{
|
||||
if( MdiWindowShadow* windowShadow = findShadow( object ) )
|
||||
{ windowShadow->updateGeometry(); }
|
||||
}
|
||||
|
||||
//! update shadows
|
||||
void update( QObject* object ) const
|
||||
{
|
||||
if( MdiWindowShadow* windowShadow = findShadow( object ) )
|
||||
{ windowShadow->update(); }
|
||||
}
|
||||
|
||||
protected slots:
|
||||
|
||||
//! triggered by object destruction
|
||||
void widgetDestroyed( QObject* );
|
||||
|
||||
private:
|
||||
|
||||
//! set of registered widgets
|
||||
QSet<const QObject*> _registeredWidgets;
|
||||
|
||||
//! tileset used to draw shadow
|
||||
TileSet _tileSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -50,7 +50,6 @@
|
|||
#include "moc_oxygenstyle.cpp"
|
||||
|
||||
#include "oxygenframeshadow.h"
|
||||
#include "oxygenmdiwindowshadow.h"
|
||||
#include "oxygenmnemonics.h"
|
||||
#include "oxygenshadowhelper.h"
|
||||
#include "oxygenstyleconfigdata.h"
|
||||
|
@ -75,7 +74,6 @@
|
|||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QRadioButton>
|
||||
#include <QtGui/QScrollBar>
|
||||
|
@ -159,7 +157,6 @@ namespace Oxygen
|
|||
_windowManager( new WindowManager( this ) ),
|
||||
_topLevelManager( new TopLevelManager( this, *_helper ) ),
|
||||
_frameShadowFactory( new FrameShadowFactory( this ) ),
|
||||
_mdiWindowShadowFactory( new MdiWindowShadowFactory( this, *_helper ) ),
|
||||
_mnemonics( new Mnemonics( this ) ),
|
||||
_widgetExplorer( new WidgetExplorer( this ) ),
|
||||
_tabBarData( new TabBarData( this ) ),
|
||||
|
@ -195,7 +192,6 @@ namespace Oxygen
|
|||
// register widget to animations
|
||||
windowManager().registerWidget( widget );
|
||||
frameShadowFactory().registerWidget( widget, helper() );
|
||||
mdiWindowShadowFactory().registerWidget( widget );
|
||||
shadowHelper().registerWidget( widget );
|
||||
|
||||
// scroll areas
|
||||
|
@ -368,11 +364,6 @@ namespace Oxygen
|
|||
widget->setContentsMargins( 3,3,3,3 );
|
||||
addEventFilter( widget );
|
||||
|
||||
} else if( qobject_cast<QMdiSubWindow*>( widget ) ) {
|
||||
|
||||
widget->setAutoFillBackground( false );
|
||||
addEventFilter( widget );
|
||||
|
||||
} else if( qobject_cast<QToolBox*>( widget ) ) {
|
||||
|
||||
widget->setBackgroundRole( QPalette::NoRole );
|
||||
|
@ -418,7 +409,6 @@ namespace Oxygen
|
|||
// register widget to animations
|
||||
windowManager().unregisterWidget( widget );
|
||||
frameShadowFactory().unregisterWidget( widget );
|
||||
mdiWindowShadowFactory().unregisterWidget( widget );
|
||||
shadowHelper().unregisterWidget( widget );
|
||||
|
||||
if( isKTextEditFrame( widget ) )
|
||||
|
@ -1146,7 +1136,6 @@ namespace Oxygen
|
|||
if( QToolBar* toolBar = qobject_cast<QToolBar*>( object ) ) { return eventFilterToolBar( toolBar, event ); }
|
||||
if( QDockWidget* dockWidget = qobject_cast<QDockWidget*>( object ) ) { return eventFilterDockWidget( dockWidget, event ); }
|
||||
if( QToolBox* toolBox = qobject_cast<QToolBox*>( object ) ) { return eventFilterToolBox( toolBox, event ); }
|
||||
if( QMdiSubWindow* subWindow = qobject_cast<QMdiSubWindow*>( object ) ) { return eventFilterMdiSubWindow( subWindow, event ); }
|
||||
if( QScrollBar* scrollBar = qobject_cast<QScrollBar*>( object ) ) { return eventFilterScrollBar( scrollBar, event ); }
|
||||
if( QProgressBar* progressBar = qobject_cast<QProgressBar*>( object ) ) { return eventFilterProgressBar( progressBar, event ); }
|
||||
|
||||
|
@ -1263,36 +1252,6 @@ namespace Oxygen
|
|||
|
||||
}
|
||||
|
||||
//____________________________________________________________________________
|
||||
bool Style::eventFilterMdiSubWindow( QMdiSubWindow* subWindow, QEvent* event )
|
||||
{
|
||||
|
||||
if( event->type() == QEvent::Paint )
|
||||
{
|
||||
|
||||
QPainter painter( subWindow );
|
||||
QRect clip( static_cast<QPaintEvent*>( event )->rect() );
|
||||
if( subWindow->isMaximized() ) helper().renderWindowBackground( &painter, clip, subWindow, subWindow->palette() );
|
||||
else {
|
||||
|
||||
painter.setClipRect( clip );
|
||||
|
||||
const QRect r( subWindow->rect() );
|
||||
TileSet *tileSet( helper().roundCorner( subWindow->palette().color( subWindow->backgroundRole() ) ) );
|
||||
tileSet->render( r, &painter );
|
||||
|
||||
painter.setClipRegion( helper().roundedMask( r.adjusted( 1, 1, -1, -1 ) ), Qt::IntersectClip );
|
||||
helper().renderWindowBackground( &painter, clip, subWindow, subWindow, subWindow->palette(), 0, 58 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// continue with normal painting
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
bool Style::eventFilterScrollBar( QWidget* widget, QEvent* event )
|
||||
{
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include <QtGui/QAbstractScrollArea>
|
||||
#include <QtGui/QCommonStyle>
|
||||
#include <QtGui/QDockWidget>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QStyleOption>
|
||||
#include <QtGui/qstyleoption.h>
|
||||
#include <QtGui/QToolBar>
|
||||
|
@ -69,7 +68,6 @@ namespace Oxygen
|
|||
|
||||
class Animations;
|
||||
class FrameShadowFactory;
|
||||
class MdiWindowShadowFactory;
|
||||
class Mnemonics;
|
||||
class ShadowHelper;
|
||||
class StyleHelper;
|
||||
|
@ -171,7 +169,6 @@ namespace Oxygen
|
|||
//@{
|
||||
bool eventFilterComboBoxContainer( QWidget*, QEvent* );
|
||||
bool eventFilterDockWidget( QDockWidget*, QEvent* );
|
||||
bool eventFilterMdiSubWindow( QMdiSubWindow*, QEvent* );
|
||||
bool eventFilterScrollBar( QWidget*, QEvent* );
|
||||
bool eventFilterTabBar( QWidget*, QEvent* );
|
||||
bool eventFilterToolBar( QToolBar*, QEvent* );
|
||||
|
@ -342,10 +339,6 @@ namespace Oxygen
|
|||
FrameShadowFactory& frameShadowFactory( void ) const
|
||||
{ return *_frameShadowFactory; }
|
||||
|
||||
//! mdi window shadows
|
||||
MdiWindowShadowFactory& mdiWindowShadowFactory( void ) const
|
||||
{ return *_mdiWindowShadowFactory; }
|
||||
|
||||
//! mdi window shadows
|
||||
Mnemonics& mnemonics( void ) const
|
||||
{ return *_mnemonics; }
|
||||
|
@ -820,9 +813,6 @@ namespace Oxygen
|
|||
//! frame shadows
|
||||
FrameShadowFactory* _frameShadowFactory;
|
||||
|
||||
//! mdi window shadows
|
||||
MdiWindowShadowFactory* _mdiWindowShadowFactory;
|
||||
|
||||
//! keyboard accelerators
|
||||
Mnemonics* _mnemonics;
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QListView>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMdiSubWindow>
|
||||
#include <QtGui/QMenuBar>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QtGui/QProgressBar>
|
||||
|
@ -466,9 +465,6 @@ namespace Oxygen
|
|||
if( QMenuBar* menuBar = qobject_cast<QMenuBar*>( widget ) )
|
||||
{
|
||||
|
||||
// do not drag from menubars embedded in Mdi windows
|
||||
if( findParent<QMdiSubWindow*>( widget ) ) return false;
|
||||
|
||||
// check if there is an active action
|
||||
if( menuBar->activeAction() && menuBar->activeAction()->isEnabled() ) return false;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue