mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kstyles: drop Oxygen extended resize feature
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
01dd6d631d
commit
101f6d1f02
8 changed files with 0 additions and 531 deletions
|
@ -20,7 +20,6 @@ set(oxygen_PART_SRCS
|
||||||
oxygenmnemonics.cpp
|
oxygenmnemonics.cpp
|
||||||
oxygenpropertynames.cpp
|
oxygenpropertynames.cpp
|
||||||
oxygenshadowhelper.cpp
|
oxygenshadowhelper.cpp
|
||||||
oxygensplitterproxy.cpp
|
|
||||||
oxygenstyle.cpp
|
oxygenstyle.cpp
|
||||||
oxygenstylehelper.cpp
|
oxygenstylehelper.cpp
|
||||||
oxygenwindowmanager.cpp
|
oxygenwindowmanager.cpp
|
||||||
|
|
|
@ -75,7 +75,6 @@ namespace Oxygen
|
||||||
|
|
||||||
connect( _toolBarDrawItemSeparator, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
connect( _toolBarDrawItemSeparator, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
||||||
connect( _checkDrawX, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
connect( _checkDrawX, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
||||||
connect( _splitterProxyEnabled, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
|
||||||
connect( _mnemonicsMode, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
|
connect( _mnemonicsMode, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
|
||||||
connect( _cacheEnabled, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
connect( _cacheEnabled, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
||||||
connect( _viewDrawTriangularExpander, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
connect( _viewDrawTriangularExpander, SIGNAL(toggled(bool)), SLOT(updateChanged()) );
|
||||||
|
@ -100,7 +99,6 @@ namespace Oxygen
|
||||||
{
|
{
|
||||||
StyleConfigData::setToolBarDrawItemSeparator( _toolBarDrawItemSeparator->isChecked() );
|
StyleConfigData::setToolBarDrawItemSeparator( _toolBarDrawItemSeparator->isChecked() );
|
||||||
StyleConfigData::setCheckBoxStyle( ( _checkDrawX->isChecked() ? StyleConfigData::CS_X : StyleConfigData::CS_CHECK ) );
|
StyleConfigData::setCheckBoxStyle( ( _checkDrawX->isChecked() ? StyleConfigData::CS_X : StyleConfigData::CS_CHECK ) );
|
||||||
StyleConfigData::setSplitterProxyEnabled( _splitterProxyEnabled->isChecked() );
|
|
||||||
StyleConfigData::setMnemonicsMode( _mnemonicsMode->currentIndex() );
|
StyleConfigData::setMnemonicsMode( _mnemonicsMode->currentIndex() );
|
||||||
StyleConfigData::setCacheEnabled( _cacheEnabled->isChecked() );
|
StyleConfigData::setCacheEnabled( _cacheEnabled->isChecked() );
|
||||||
StyleConfigData::setViewDrawTriangularExpander( _viewDrawTriangularExpander->isChecked() );
|
StyleConfigData::setViewDrawTriangularExpander( _viewDrawTriangularExpander->isChecked() );
|
||||||
|
@ -208,7 +206,6 @@ namespace Oxygen
|
||||||
else if( _scrollBarWidth->value() != StyleConfigData::scrollBarWidth() ) modified = true;
|
else if( _scrollBarWidth->value() != StyleConfigData::scrollBarWidth() ) modified = true;
|
||||||
else if( _scrollBarAddLineButtons->currentIndex() != StyleConfigData::scrollBarAddLineButtons() ) modified = true;
|
else if( _scrollBarAddLineButtons->currentIndex() != StyleConfigData::scrollBarAddLineButtons() ) modified = true;
|
||||||
else if( _scrollBarSubLineButtons->currentIndex() != StyleConfigData::scrollBarSubLineButtons() ) modified = true;
|
else if( _scrollBarSubLineButtons->currentIndex() != StyleConfigData::scrollBarSubLineButtons() ) modified = true;
|
||||||
else if( _splitterProxyEnabled->isChecked() != StyleConfigData::splitterProxyEnabled() ) modified = true;
|
|
||||||
else if( (_checkDrawX->isChecked() ? StyleConfigData::CS_X : StyleConfigData::CS_CHECK) != StyleConfigData::checkBoxStyle() ) modified = true;
|
else if( (_checkDrawX->isChecked() ? StyleConfigData::CS_X : StyleConfigData::CS_CHECK) != StyleConfigData::checkBoxStyle() ) modified = true;
|
||||||
else if( menuMode() != StyleConfigData::menuHighlightMode() ) modified = true;
|
else if( menuMode() != StyleConfigData::menuHighlightMode() ) modified = true;
|
||||||
else if( tabStyle() != StyleConfigData::tabStyle() ) modified = true;
|
else if( tabStyle() != StyleConfigData::tabStyle() ) modified = true;
|
||||||
|
@ -248,7 +245,6 @@ namespace Oxygen
|
||||||
|
|
||||||
_toolBarDrawItemSeparator->setChecked( StyleConfigData::toolBarDrawItemSeparator() );
|
_toolBarDrawItemSeparator->setChecked( StyleConfigData::toolBarDrawItemSeparator() );
|
||||||
_mnemonicsMode->setCurrentIndex( StyleConfigData::mnemonicsMode() );
|
_mnemonicsMode->setCurrentIndex( StyleConfigData::mnemonicsMode() );
|
||||||
_splitterProxyEnabled->setChecked( StyleConfigData::splitterProxyEnabled() );
|
|
||||||
_checkDrawX->setChecked( StyleConfigData::checkBoxStyle() == StyleConfigData::CS_X );
|
_checkDrawX->setChecked( StyleConfigData::checkBoxStyle() == StyleConfigData::CS_X );
|
||||||
_viewDrawTriangularExpander->setChecked( StyleConfigData::viewDrawTriangularExpander() );
|
_viewDrawTriangularExpander->setChecked( StyleConfigData::viewDrawTriangularExpander() );
|
||||||
_viewDrawFocusIndicator->setChecked( StyleConfigData::viewDrawFocusIndicator() );
|
_viewDrawFocusIndicator->setChecked( StyleConfigData::viewDrawFocusIndicator() );
|
||||||
|
|
|
@ -59,13 +59,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="_splitterProxyEnabled">
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable extended resize handles</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="_cacheEnabled">
|
<widget class="QCheckBox" name="_cacheEnabled">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -132,15 +132,6 @@
|
||||||
<default>WD_FULL</default>
|
<default>WD_FULL</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
<!-- splitter proxy -->
|
|
||||||
<entry name="SplitterProxyEnabled" type="Bool">
|
|
||||||
<default>true</default>
|
|
||||||
</entry>
|
|
||||||
|
|
||||||
<entry name="SplitterProxyWidth" type="Int">
|
|
||||||
<default>12</default>
|
|
||||||
</entry>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
this enables WidgetExplorer debugging tool.
|
this enables WidgetExplorer debugging tool.
|
||||||
it provides information about widgets,
|
it provides information about widgets,
|
||||||
|
|
|
@ -1,354 +0,0 @@
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
// oxygensplitterproxy.cpp
|
|
||||||
// Extended hit area for Splitters
|
|
||||||
// -------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 2011 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
|
||||||
//
|
|
||||||
// Based on Bespin splitterproxy code
|
|
||||||
// Copyright (C) 2011 Thomas Luebking <thomas.luebking@web.de>
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU Library General Public
|
|
||||||
// License version 2 as published by the Free Software Foundation.
|
|
||||||
//
|
|
||||||
// This library is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Library General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Library General Public License
|
|
||||||
// along with this library; see the file COPYING.LIB. If not, write to
|
|
||||||
// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
// Boston, MA 02110-1301, USA.
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "oxygensplitterproxy.h"
|
|
||||||
#include "oxygenstyleconfigdata.h"
|
|
||||||
#include "oxygenmetrics.h"
|
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtGui/QPainter>
|
|
||||||
|
|
||||||
namespace Oxygen
|
|
||||||
{
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
void SplitterFactory::setEnabled( bool value )
|
|
||||||
{
|
|
||||||
if( _enabled != value )
|
|
||||||
{
|
|
||||||
// store
|
|
||||||
_enabled = value;
|
|
||||||
|
|
||||||
// assign to existing splitters
|
|
||||||
for( WidgetMap::iterator iter = _widgets.begin(); iter != _widgets.end(); ++iter )
|
|
||||||
{ if( iter.value() ) iter.value().data()->setEnabled( value ); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
bool SplitterFactory::registerWidget( QWidget *widget )
|
|
||||||
{
|
|
||||||
|
|
||||||
// check widget type
|
|
||||||
if( qobject_cast<QMainWindow*>( widget ) )
|
|
||||||
{
|
|
||||||
|
|
||||||
WidgetMap::iterator iter( _widgets.find( widget ) );
|
|
||||||
if( iter == _widgets.end() || !iter.value() )
|
|
||||||
{
|
|
||||||
widget->installEventFilter( &_addEventFilter );
|
|
||||||
SplitterProxy* proxy( new SplitterProxy( widget, _enabled ) );
|
|
||||||
widget->removeEventFilter( &_addEventFilter );
|
|
||||||
|
|
||||||
widget->installEventFilter( proxy );
|
|
||||||
_widgets.insert( widget, proxy );
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
widget->removeEventFilter( iter.value().data() );
|
|
||||||
widget->installEventFilter( iter.value().data() );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if( qobject_cast<QSplitterHandle*>( widget ) ) {
|
|
||||||
|
|
||||||
QWidget* window( widget->window() );
|
|
||||||
WidgetMap::iterator iter( _widgets.find( window ) );
|
|
||||||
if( iter == _widgets.end() || !iter.value() )
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
window->installEventFilter( &_addEventFilter );
|
|
||||||
SplitterProxy* proxy( new SplitterProxy( window, _enabled ) );
|
|
||||||
window->removeEventFilter( &_addEventFilter );
|
|
||||||
|
|
||||||
widget->installEventFilter( proxy );
|
|
||||||
_widgets.insert( window, proxy );
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
widget->removeEventFilter( iter.value().data() );
|
|
||||||
widget->installEventFilter( iter.value().data() );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
void SplitterFactory::unregisterWidget( QWidget *widget )
|
|
||||||
{
|
|
||||||
WidgetMap::iterator iter( _widgets.find( widget ) );
|
|
||||||
if( iter != _widgets.end() )
|
|
||||||
{
|
|
||||||
if( iter.value() ) iter.value().data()->deleteLater();
|
|
||||||
_widgets.erase( iter );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
SplitterProxy::SplitterProxy( QWidget* parent, bool enabled ):
|
|
||||||
QWidget( parent ),
|
|
||||||
_enabled( enabled ),
|
|
||||||
_timerId( 0 )
|
|
||||||
{
|
|
||||||
setAttribute( Qt::WA_TranslucentBackground, true );
|
|
||||||
setAttribute( Qt::WA_OpaquePaintEvent, false );
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
SplitterProxy::~SplitterProxy( void )
|
|
||||||
{}
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
void SplitterProxy::setEnabled( bool value )
|
|
||||||
{
|
|
||||||
// make sure status has changed
|
|
||||||
if( _enabled != value )
|
|
||||||
{
|
|
||||||
_enabled = value;
|
|
||||||
if( _enabled ) clearSplitter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
bool SplitterProxy::eventFilter( QObject* object, QEvent* event )
|
|
||||||
{
|
|
||||||
|
|
||||||
// do nothing if disabled
|
|
||||||
if( !_enabled ) return false;
|
|
||||||
|
|
||||||
// do nothing in case of mouse grab
|
|
||||||
if( mouseGrabber() ) return false;
|
|
||||||
|
|
||||||
switch( event->type() )
|
|
||||||
{
|
|
||||||
|
|
||||||
case QEvent::HoverEnter:
|
|
||||||
if( !isVisible() )
|
|
||||||
{
|
|
||||||
|
|
||||||
// cast to splitter handle
|
|
||||||
if( QSplitterHandle* handle = qobject_cast<QSplitterHandle*>( object ) )
|
|
||||||
{ setSplitter( handle ); }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case QEvent::HoverMove:
|
|
||||||
case QEvent::HoverLeave:
|
|
||||||
return isVisible() && object == _splitter.data();
|
|
||||||
|
|
||||||
case QEvent::MouseMove:
|
|
||||||
case QEvent::Timer:
|
|
||||||
case QEvent::Move:
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case QEvent::CursorChange:
|
|
||||||
if( QWidget *window = qobject_cast<QMainWindow*>( object ) )
|
|
||||||
{
|
|
||||||
if( window->cursor().shape() == Qt::SplitHCursor || window->cursor().shape() == Qt::SplitVCursor )
|
|
||||||
{ setSplitter( window ); }
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
case QEvent::WindowDeactivate:
|
|
||||||
case QEvent::MouseButtonRelease:
|
|
||||||
clearSplitter();
|
|
||||||
return false;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
bool SplitterProxy::event( QEvent *event )
|
|
||||||
{
|
|
||||||
switch( event->type() )
|
|
||||||
{
|
|
||||||
|
|
||||||
case QEvent::MouseMove:
|
|
||||||
case QEvent::MouseButtonPress:
|
|
||||||
case QEvent::MouseButtonRelease:
|
|
||||||
{
|
|
||||||
|
|
||||||
// check splitter
|
|
||||||
if( !_splitter ) return false;
|
|
||||||
|
|
||||||
event->accept();
|
|
||||||
|
|
||||||
// grab on mouse press
|
|
||||||
if( event->type() == QEvent::MouseButtonPress) grabMouse();
|
|
||||||
|
|
||||||
parentWidget()->setUpdatesEnabled(false);
|
|
||||||
resize(1,1);
|
|
||||||
parentWidget()->setUpdatesEnabled(true);
|
|
||||||
|
|
||||||
// cast to mouse event
|
|
||||||
QMouseEvent *mouseEvent( static_cast<QMouseEvent*>( event ) );
|
|
||||||
|
|
||||||
// get relevant position to post mouse drag event to application
|
|
||||||
if( event->type() == QEvent::MouseButtonPress )
|
|
||||||
{
|
|
||||||
|
|
||||||
// use hook, to make sure splitter is properly dragged
|
|
||||||
QMouseEvent mouseEvent2(
|
|
||||||
mouseEvent->type(),
|
|
||||||
_hook,
|
|
||||||
_splitter.data()->mapToGlobal(_hook),
|
|
||||||
mouseEvent->button(),
|
|
||||||
mouseEvent->buttons(), mouseEvent->modifiers());
|
|
||||||
|
|
||||||
QCoreApplication::sendEvent( _splitter.data(), &mouseEvent2 );
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// map event position to current splitter and post.
|
|
||||||
QMouseEvent mouseEvent2(
|
|
||||||
mouseEvent->type(),
|
|
||||||
_splitter.data()->mapFromGlobal( mouseEvent->globalPos() ),
|
|
||||||
mouseEvent->globalPos(),
|
|
||||||
mouseEvent->button(),
|
|
||||||
mouseEvent->buttons(), mouseEvent->modifiers());
|
|
||||||
|
|
||||||
QCoreApplication::sendEvent( _splitter.data(), &mouseEvent2 );
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// release grab on mouse-Release
|
|
||||||
if( event->type() == QEvent::MouseButtonRelease && mouseGrabber() == this )
|
|
||||||
{ releaseMouse(); }
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
case QEvent::Timer:
|
|
||||||
if( static_cast<QTimerEvent*>( event )->timerId() != _timerId )
|
|
||||||
{ return QWidget::event( event ); }
|
|
||||||
|
|
||||||
if( mouseGrabber() == this )
|
|
||||||
{ return true; }
|
|
||||||
|
|
||||||
/*
|
|
||||||
Fall through is intended.
|
|
||||||
We somehow lost a QEvent::Leave and gonna fix that from here
|
|
||||||
*/
|
|
||||||
|
|
||||||
case QEvent::HoverLeave:
|
|
||||||
case QEvent::Leave:
|
|
||||||
{
|
|
||||||
|
|
||||||
// reset splitter
|
|
||||||
if( isVisible() && !rect().contains( mapFromGlobal( QCursor::pos() ) ) )
|
|
||||||
{ clearSplitter(); }
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
|
||||||
return QWidget::event( event );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
void SplitterProxy::setSplitter( QWidget* widget )
|
|
||||||
{
|
|
||||||
|
|
||||||
// check if changed
|
|
||||||
if( _splitter.data() == widget ) return;
|
|
||||||
|
|
||||||
_splitter = widget;
|
|
||||||
_hook = _splitter.data()->mapFromGlobal(QCursor::pos());
|
|
||||||
|
|
||||||
//
|
|
||||||
QRect r( 0, 0, 2*StyleConfigData::splitterProxyWidth(), 2*StyleConfigData::splitterProxyWidth() );
|
|
||||||
r.moveCenter( parentWidget()->mapFromGlobal( QCursor::pos() ) );
|
|
||||||
setGeometry(r);
|
|
||||||
setCursor( _splitter.data()->cursor().shape() );
|
|
||||||
|
|
||||||
raise();
|
|
||||||
show();
|
|
||||||
|
|
||||||
/*
|
|
||||||
timer used to automatically hide proxy
|
|
||||||
in case leave events are lost
|
|
||||||
*/
|
|
||||||
if( !_timerId ) _timerId = startTimer(150);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//____________________________________________________________________
|
|
||||||
void SplitterProxy::clearSplitter( void )
|
|
||||||
{
|
|
||||||
|
|
||||||
// check if changed
|
|
||||||
if( !_splitter ) return;
|
|
||||||
|
|
||||||
// release mouse
|
|
||||||
if( mouseGrabber() == this ) releaseMouse();
|
|
||||||
|
|
||||||
// hide
|
|
||||||
parentWidget()->setUpdatesEnabled(false);
|
|
||||||
hide();
|
|
||||||
parentWidget()->setUpdatesEnabled(true);
|
|
||||||
|
|
||||||
// set hover event
|
|
||||||
if( _splitter )
|
|
||||||
{
|
|
||||||
QHoverEvent hoverEvent(
|
|
||||||
qobject_cast<QSplitterHandle*>(_splitter.data()) ? QEvent::HoverLeave : QEvent::HoverMove,
|
|
||||||
_splitter.data()->mapFromGlobal(QCursor::pos()), _hook);
|
|
||||||
QCoreApplication::sendEvent( _splitter.data(), &hoverEvent );
|
|
||||||
_splitter.clear();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// kill timer if any
|
|
||||||
if( _timerId )
|
|
||||||
{
|
|
||||||
killTimer( _timerId );
|
|
||||||
_timerId = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,141 +0,0 @@
|
||||||
#ifndef OXYGENSPLITTERPROXY_H
|
|
||||||
#define OXYGENSPLITTERPROXY_H
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
// oxygensplitterproxy.h
|
|
||||||
// Extended hit area for Splitters
|
|
||||||
// -------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 2011 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
|
||||||
//
|
|
||||||
// Based on Bespin splitterproxy code
|
|
||||||
// Copyright (C) 2011 Thomas Luebking <thomas.luebking@web.de>
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU Library General Public
|
|
||||||
// License version 2 as published by the Free Software Foundation.
|
|
||||||
//
|
|
||||||
// This library is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Library General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Library General Public License
|
|
||||||
// along with this library; see the file COPYING.LIB. If not, write to
|
|
||||||
// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
||||||
// Boston, MA 02110-1301, USA.
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <QtCore/QEvent>
|
|
||||||
#include <QtCore/QMap>
|
|
||||||
#include <QtCore/qsharedpointer.h>
|
|
||||||
#include <QtGui/qevent.h>
|
|
||||||
#include <QtGui/QMainWindow>
|
|
||||||
#include <QtGui/qevent.h>
|
|
||||||
#include <QtGui/qsplitter.h>
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
#include "oxygenaddeventfilter.h"
|
|
||||||
|
|
||||||
namespace Oxygen
|
|
||||||
{
|
|
||||||
|
|
||||||
class SplitterProxy;
|
|
||||||
|
|
||||||
//! factory
|
|
||||||
class SplitterFactory: public QObject
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! constructor
|
|
||||||
explicit SplitterFactory( QObject* parent ):
|
|
||||||
QObject( parent ),
|
|
||||||
_enabled( false )
|
|
||||||
{}
|
|
||||||
|
|
||||||
//! destructor
|
|
||||||
virtual ~SplitterFactory( void )
|
|
||||||
{}
|
|
||||||
|
|
||||||
//! enabled state
|
|
||||||
void setEnabled( bool );
|
|
||||||
|
|
||||||
//! register widget
|
|
||||||
bool registerWidget( QWidget* );
|
|
||||||
|
|
||||||
//! unregister widget
|
|
||||||
void unregisterWidget( QWidget* );
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
//! enabled state
|
|
||||||
bool _enabled;
|
|
||||||
|
|
||||||
//! needed to block ChildAdded events when creating proxy
|
|
||||||
AddEventFilter _addEventFilter;
|
|
||||||
|
|
||||||
//! pointer to SplitterProxy
|
|
||||||
typedef QWeakPointer<SplitterProxy> SplitterProxyPointer;
|
|
||||||
|
|
||||||
//! registered widgets
|
|
||||||
typedef QMap<QWidget*, SplitterProxyPointer > WidgetMap;
|
|
||||||
WidgetMap _widgets;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
//! splitter 'proxy' widget, with extended hit area
|
|
||||||
class SplitterProxy : public QWidget
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! constructor
|
|
||||||
explicit SplitterProxy( QWidget*, bool = false );
|
|
||||||
|
|
||||||
//! destructor
|
|
||||||
virtual ~SplitterProxy( void );
|
|
||||||
|
|
||||||
//! event filter
|
|
||||||
virtual bool eventFilter( QObject*, QEvent* );
|
|
||||||
|
|
||||||
//! enable state
|
|
||||||
void setEnabled( bool );
|
|
||||||
|
|
||||||
//! enable state
|
|
||||||
bool enabled( void ) const
|
|
||||||
{ return _enabled; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
//! event handler
|
|
||||||
virtual bool event( QEvent* );
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
//! reset 'true' splitter widget
|
|
||||||
void clearSplitter( void );
|
|
||||||
|
|
||||||
//! keep track of 'true' splitter widget
|
|
||||||
void setSplitter( QWidget* );
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
//! enabled state
|
|
||||||
bool _enabled;
|
|
||||||
|
|
||||||
//! splitter object
|
|
||||||
QWeakPointer<QWidget> _splitter;
|
|
||||||
|
|
||||||
//! hook
|
|
||||||
QPoint _hook;
|
|
||||||
|
|
||||||
//! timer id
|
|
||||||
int _timerId;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -54,7 +54,6 @@
|
||||||
#include "oxygenmdiwindowshadow.h"
|
#include "oxygenmdiwindowshadow.h"
|
||||||
#include "oxygenmnemonics.h"
|
#include "oxygenmnemonics.h"
|
||||||
#include "oxygenshadowhelper.h"
|
#include "oxygenshadowhelper.h"
|
||||||
#include "oxygensplitterproxy.h"
|
|
||||||
#include "oxygenstyleconfigdata.h"
|
#include "oxygenstyleconfigdata.h"
|
||||||
#include "oxygenwidgetexplorer.h"
|
#include "oxygenwidgetexplorer.h"
|
||||||
#include "oxygenwindowmanager.h"
|
#include "oxygenwindowmanager.h"
|
||||||
|
@ -172,7 +171,6 @@ namespace Oxygen
|
||||||
_blurHelper( new BlurHelper( this, helper() ) ),
|
_blurHelper( new BlurHelper( this, helper() ) ),
|
||||||
_widgetExplorer( new WidgetExplorer( this ) ),
|
_widgetExplorer( new WidgetExplorer( this ) ),
|
||||||
_tabBarData( new TabBarData( this ) ),
|
_tabBarData( new TabBarData( this ) ),
|
||||||
_splitterFactory( new SplitterFactory( this ) ),
|
|
||||||
_frameFocusPrimitive( 0 ),
|
_frameFocusPrimitive( 0 ),
|
||||||
_tabBarTabShapeControl( 0 ),
|
_tabBarTabShapeControl( 0 ),
|
||||||
_hintCounter( X_KdeBase+1 ),
|
_hintCounter( X_KdeBase+1 ),
|
||||||
|
@ -207,7 +205,6 @@ namespace Oxygen
|
||||||
frameShadowFactory().registerWidget( widget, helper() );
|
frameShadowFactory().registerWidget( widget, helper() );
|
||||||
mdiWindowShadowFactory().registerWidget( widget );
|
mdiWindowShadowFactory().registerWidget( widget );
|
||||||
shadowHelper().registerWidget( widget );
|
shadowHelper().registerWidget( widget );
|
||||||
splitterFactory().registerWidget( widget );
|
|
||||||
|
|
||||||
// scroll areas
|
// scroll areas
|
||||||
if( QAbstractScrollArea* scrollArea = qobject_cast<QAbstractScrollArea*>( widget ) )
|
if( QAbstractScrollArea* scrollArea = qobject_cast<QAbstractScrollArea*>( widget ) )
|
||||||
|
@ -443,7 +440,6 @@ namespace Oxygen
|
||||||
frameShadowFactory().unregisterWidget( widget );
|
frameShadowFactory().unregisterWidget( widget );
|
||||||
mdiWindowShadowFactory().unregisterWidget( widget );
|
mdiWindowShadowFactory().unregisterWidget( widget );
|
||||||
shadowHelper().unregisterWidget( widget );
|
shadowHelper().unregisterWidget( widget );
|
||||||
splitterFactory().unregisterWidget( widget );
|
|
||||||
blurHelper().unregisterWidget( widget );
|
blurHelper().unregisterWidget( widget );
|
||||||
|
|
||||||
if( isKTextEditFrame( widget ) )
|
if( isKTextEditFrame( widget ) )
|
||||||
|
@ -7399,9 +7395,6 @@ namespace Oxygen
|
||||||
widgetExplorer().setEnabled( StyleConfigData::widgetExplorerEnabled() );
|
widgetExplorer().setEnabled( StyleConfigData::widgetExplorerEnabled() );
|
||||||
widgetExplorer().setDrawWidgetRects( StyleConfigData::drawWidgetRects() );
|
widgetExplorer().setDrawWidgetRects( StyleConfigData::drawWidgetRects() );
|
||||||
|
|
||||||
// splitter proxy
|
|
||||||
splitterFactory().setEnabled( StyleConfigData::splitterProxyEnabled() );
|
|
||||||
|
|
||||||
// scrollbar button dimentions.
|
// scrollbar button dimentions.
|
||||||
/* it has to be reinitialized here because scrollbar width might have changed */
|
/* it has to be reinitialized here because scrollbar width might have changed */
|
||||||
_noButtonHeight = 0;
|
_noButtonHeight = 0;
|
||||||
|
|
|
@ -72,7 +72,6 @@ namespace Oxygen
|
||||||
class MdiWindowShadowFactory;
|
class MdiWindowShadowFactory;
|
||||||
class Mnemonics;
|
class Mnemonics;
|
||||||
class ShadowHelper;
|
class ShadowHelper;
|
||||||
class SplitterFactory;
|
|
||||||
class StyleHelper;
|
class StyleHelper;
|
||||||
class Transitions;
|
class Transitions;
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
|
@ -372,10 +371,6 @@ namespace Oxygen
|
||||||
WidgetExplorer& widgetExplorer( void ) const
|
WidgetExplorer& widgetExplorer( void ) const
|
||||||
{ return *_widgetExplorer; }
|
{ return *_widgetExplorer; }
|
||||||
|
|
||||||
//! splitter factory
|
|
||||||
SplitterFactory& splitterFactory( void ) const
|
|
||||||
{ return *_splitterFactory; }
|
|
||||||
|
|
||||||
//! tabBar data
|
//! tabBar data
|
||||||
TabBarData& tabBarData( void ) const
|
TabBarData& tabBarData( void ) const
|
||||||
{ return *_tabBarData; }
|
{ return *_tabBarData; }
|
||||||
|
@ -856,9 +851,6 @@ namespace Oxygen
|
||||||
//! tabBar data
|
//! tabBar data
|
||||||
TabBarData* _tabBarData;
|
TabBarData* _tabBarData;
|
||||||
|
|
||||||
//! splitter Factory, to extend splitters hit area
|
|
||||||
SplitterFactory* _splitterFactory;
|
|
||||||
|
|
||||||
//! pointer to primitive specialized function
|
//! pointer to primitive specialized function
|
||||||
typedef bool (Style::*StylePrimitive)( const QStyleOption*, QPainter*, const QWidget* ) const;
|
typedef bool (Style::*StylePrimitive)( const QStyleOption*, QPainter*, const QWidget* ) const;
|
||||||
StylePrimitive _frameFocusPrimitive;
|
StylePrimitive _frameFocusPrimitive;
|
||||||
|
|
Loading…
Add table
Reference in a new issue