From 120dff5f18d13aab7d2731de84e64c898728dc60 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 1 Feb 2013 17:25:43 -0600 Subject: Fix FTBFS --- arts/gui/kde/kpopupbox_impl.cpp | 134 ---------------------- arts/gui/kde/kpopupbox_impl.h | 70 ------------ arts/gui/kde/kpopupbox_private.h | 222 ------------------------------------- arts/gui/kde/tdepopupbox_impl.cpp | 134 ++++++++++++++++++++++ arts/gui/kde/tdepopupbox_impl.h | 70 ++++++++++++ arts/gui/kde/tdepopupbox_private.h | 222 +++++++++++++++++++++++++++++++++++++ 6 files changed, 426 insertions(+), 426 deletions(-) delete mode 100644 arts/gui/kde/kpopupbox_impl.cpp delete mode 100644 arts/gui/kde/kpopupbox_impl.h delete mode 100644 arts/gui/kde/kpopupbox_private.h create mode 100644 arts/gui/kde/tdepopupbox_impl.cpp create mode 100644 arts/gui/kde/tdepopupbox_impl.h create mode 100644 arts/gui/kde/tdepopupbox_private.h (limited to 'arts') diff --git a/arts/gui/kde/kpopupbox_impl.cpp b/arts/gui/kde/kpopupbox_impl.cpp deleted file mode 100644 index a4ac6fa2..00000000 --- a/arts/gui/kde/kpopupbox_impl.cpp +++ /dev/null @@ -1,134 +0,0 @@ - /* - - Copyright ( C ) 2002, 2003 Arnold Krille - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or ( at your option ) any later version. - - 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 "kpopupbox_impl.h" -#include "kpopupbox_private.h" - -#include - -using namespace Arts; - -TDEPopupBox_impl::TDEPopupBox_impl( TDEPopupBox_widget *w ) : KFrame_impl( w ? w : new TDEPopupBox_widget ) -{ - self().framestyle( Box ); self().margin( 1 ); self().linewidth( 1 ); - self().vSizePolicy( spFixed ); self().hSizePolicy( spFixed ); - - if( !w ) w = static_cast( _qframe ); - - _widget = w; -// _mapper = new TDEPopupBoxEventMapper( _widget, this ); -} -TDEPopupBox_impl::~TDEPopupBox_impl() { -} - -Direction TDEPopupBox_impl::direction() { return _widget->direction(); } -void TDEPopupBox_impl::direction( Direction n ) { _widget->direction( n ); } - -void TDEPopupBox_impl::widget( Arts::Widget widget ) { - widget.parent( self() ); - this->_addChild( widget, "PopupBox_child" ); - _widget->setWidget( widget ); -} -Arts::Widget TDEPopupBox_impl::widget() { return _widget->getWidget(); } - -std::string TDEPopupBox_impl::name() { return _name; } -void TDEPopupBox_impl::name( const std::string& n ) { _name = ""; _name = n; _widget->name( n ); } - -// Following the private class: - -TDEPopupBox_widget::TDEPopupBox_widget( TQWidget *parent, const char* name ) : TQFrame( parent,name ) -{ - this->setFrameShape( TQFrame::Box ); - this->setMargin( 1 ); this->setLineWidth( 1 ); - - _titlebar = new TQFrame( this ); - _titlebarlayout = new TQBoxLayout( _titlebar, TQBoxLayout::BottomToTop ); - _titlebarlayout->setAutoAdd( true ); - - _showbutton = new ShowButton( _titlebar ); - connect( _showbutton, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( hide( bool ) ) ); - _drag = new HandleDrag( _titlebar ); - connect( _drag, TQT_SIGNAL( clicked() ), _showbutton, TQT_SLOT( toggle() ) ); - _ownbutton = new OwnButton( _titlebar ); - connect( _ownbutton, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( own( bool ) ) ); - - _artswidget = new OwnWidget( _showbutton, this ); - - _layout = new TQBoxLayout( this, TQBoxLayout::LeftToRight ); - _layout->addWidget( _titlebar , -1 ); - _layout->addWidget( _artswidget, 20 ); - _layout->addStretch( 0 ); -} -TDEPopupBox_widget::~TDEPopupBox_widget() { -} - -Arts::Direction TDEPopupBox_widget::direction() { - return Arts::Direction( _layout->direction() ); -} - -void TDEPopupBox_widget::direction( Arts::Direction n ) { - _layout->setDirection( TQBoxLayout::Direction( n ) ); - _showbutton->direction( TQBoxLayout::Direction( n ) ); - switch( n ) { - case LeftToRight: - case RightToLeft: - _titlebarlayout->setDirection( TQBoxLayout::BottomToTop ); - _drag->setMinimumHeight( 30 ); - _drag->setMinimumWidth( 0 ); - break; - case TopToBottom: - case BottomToTop: - _titlebarlayout->setDirection( TQBoxLayout::RightToLeft ); - _drag->setMinimumHeight( 0 ); - _drag->setMinimumWidth( 30 ); - } -} - -void TDEPopupBox_widget::setWidget( Arts::Widget widget ) { _artswidget->setContent( widget ); } -Arts::Widget TDEPopupBox_widget::getWidget() { return _artswidget->content(); } - -void TDEPopupBox_widget::hide( bool n ) { - if( n ) - _artswidget->hide(); - else - _artswidget->show(); -} - -void TDEPopupBox_widget::own( bool n ) { - if ( n ) - _artswidget->reparent( 0, _artswidget->mapToGlobal( _artswidget->pos() ), !( _artswidget->isHidden() ) ); - else - { - _artswidget->reparent( this, TQPoint( 0,0 ), !( _artswidget->isHidden() ) ); - _layout->insertWidget( 1, _artswidget, 20 ); - } -} - -void TDEPopupBox_widget::name( std::string n ) { - _artswidget->setCaption( n.c_str() ); -} - -REGISTER_IMPLEMENTATION( TDEPopupBox_impl ); - -#include "kpopupbox_private.moc" - -// vim: sw=4 ts=4 - diff --git a/arts/gui/kde/kpopupbox_impl.h b/arts/gui/kde/kpopupbox_impl.h deleted file mode 100644 index 0cd44a4e..00000000 --- a/arts/gui/kde/kpopupbox_impl.h +++ /dev/null @@ -1,70 +0,0 @@ - /* - - Copyright ( C ) 2002, 2003 Arnold Krille - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or ( at your option ) any later version. - - 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. - - */ - -#ifndef KPOPUPBOX_IMPL_H -#define KPOPUPBOX_IMPL_H - -#include -#include - -class TQBoxLayout; -class TDEPopupBox_widget; -//class TDEPopupBoxEventMapper; // The EventMapper isn't needed at present, but perhaps in the future... - -namespace Arts { - -/// The PopupBox - -class TDEPopupBox_impl : virtual public Arts::PopupBox_skel, public Arts::KFrame_impl -{ -public: - /// selfreference like 'this' - PopupBox self() { return PopupBox::_from_base( _copy() ); } - /// Constructor - TDEPopupBox_impl( TDEPopupBox_widget *w=0 ); - ~TDEPopupBox_impl(); - - /// The name of the widget - std::string name(); - void name( const std::string & ); - - /// The direction. LeftToRight (true) or TopToBottom (false). May get other values in the future. - Direction direction(); - void direction( Direction ); - - /// Set and Get the Widget. - void widget( Arts::Widget ); - Arts::Widget widget(); - -private: - std::string _name; - bool _lefttoright; - TDEPopupBox_widget *_widget; -// TDEPopupBoxEventMapper *_mapper; - -}; // class TDEPopupBox - -} // namespace Arts - -#endif - -// vim: sw=4 ts=4 - diff --git a/arts/gui/kde/kpopupbox_private.h b/arts/gui/kde/kpopupbox_private.h deleted file mode 100644 index 9750625b..00000000 --- a/arts/gui/kde/kpopupbox_private.h +++ /dev/null @@ -1,222 +0,0 @@ - /* - - Copyright ( C ) 2002, 2003 Arnold Krille - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or ( at your option ) any later version. - - 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. - - */ - -#ifndef KPOPUPBOX_PRIVATE_H -#define KPOPUPBOX_PRIVATE_H - - -class HandleDrag; -class ShowButton; -class OwnButton; -class KArtsWidget; -class OwnWidget; -class TQBoxLayout; - -#include - -class TDEPopupBox_widget : public TQFrame -{ - Q_OBJECT - -public: - TDEPopupBox_widget( TQWidget* =0, const char* =0); - ~TDEPopupBox_widget(); - - Arts::Direction direction(); - void direction( Arts::Direction ); - - void setWidget( Arts::Widget widget ); - Arts::Widget getWidget(); - - void name( std::string ); -private slots: - void hide( bool ); - void own( bool ); -private: - TQBoxLayout *_layout; - - TQFrame *_titlebar; - TQBoxLayout *_titlebarlayout; - HandleDrag *_drag; - ShowButton *_showbutton; - OwnButton *_ownbutton; - - OwnWidget *_artswidget; -}; - -// See kpopupbox_impl.h - The eventmapper isn't needed at present, but perhaps in the future... - -/*class TDEPopupBoxEventMapper : public TQObject { - Q_OBJECT - -public: - TDEPopupBoxEventMapper( TDEPopupBox_widget *widget, Arts::TDEPopupBox_impl *impl ) - : TQObject( widget,"" ), _widget( widget ), _impl( impl ) - {} -private: - TDEPopupBox_widget *_widget; - Arts::TDEPopupBox_impl *_impl; -};*/ - -#include -#include - -class HandleDrag : public TQWidget { - Q_OBJECT - -public: - HandleDrag( TQWidget *parent, const char* name=0 ) : TQWidget( parent,name ) {} - void paintEvent( TQPaintEvent * ) { - TQPainter p( this ); - TQStyle::SFlags flags = TQStyle::Style_Default; - if( width() < height() ) flags |= TQStyle::Style_Horizontal; - style().tqdrawPrimitive( TQStyle::PE_DockWindowHandle, &p, rect(), colorGroup(), flags ); - } -signals: - void clicked(); -protected: - virtual void mouseDoubleClickEvent( TQMouseEvent * ) { - emit clicked(); - } -}; - -static const char* const close_xpm[] = { "5 5 2 1", "# c black", ". c None", "#...#", ".#.#.", "..#..", ".#.#.", "#...#"}; -static const char* const up_xpm[] = { "5 5 2 1", "# c black", ". c None", ".....", "..#..", ".###.", "#####", "....."}; -static const char* const down_xpm[] = { "5 5 2 1", "# c black", ". c None", ".....", "#####", ".###.", "..#..", "....."}; -static const char* const left_xpm[] = { "5 5 2 1", "# c black", ". c None", "...#.", "..##.", ".###.", "..##.", "...#."}; -static const char* const right_xpm[] = { "5 5 2 1", "# c black", ". c None", ".#...", ".##..", ".###.", ".##..", ".#..."}; -static const char* const inside_xpm[] = { "5 5 2 1", "# c black", ". c None", "#####", "#...#", "#...#", "#...#", "#####"}; -static const char* const own_xpm[] = { "5 5 2 1", "# c black", ". c None", "###..", "#.###", "###.#", ".#..#", ".####"}; - -#include -#include - -class ShowButton : public TQPushButton { - Q_OBJECT - -private: - TQBoxLayout::Direction _dir; - TQPixmap _pmleft, _pmright, _pmup, _pmdown; -public: - ShowButton( TQWidget *parent, const char* name=0 ) : TQPushButton( parent,name ), _dir( TQBoxLayout::LeftToRight ) - { - connect( this, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( owntoggle( bool ) ) ); - setToggleButton( true ); - _pmleft = TQPixmap( const_cast( left_xpm ) ); - _pmright = TQPixmap( const_cast( right_xpm ) ); - _pmup = TQPixmap( const_cast( up_xpm ) ); - _pmdown = TQPixmap( const_cast( down_xpm ) ); - setPixmap( _pmright ); - } - - void direction( TQBoxLayout::Direction n ) { _dir=n; } -public slots: - void owntoggle( bool b ) { - switch( _dir ) - { - case TQBoxLayout::BottomToTop: - if( b ) setPixmap( _pmdown ); - else setPixmap( _pmup ); - break; - case TQBoxLayout::TopToBottom: - if( b ) setPixmap( _pmup ); - else setPixmap( _pmdown ); - break; - case TQBoxLayout::LeftToRight: - if( b ) setPixmap( _pmright ); - else setPixmap( _pmleft ); - break; - case TQBoxLayout::RightToLeft: - if( b ) setPixmap( _pmleft ); - else setPixmap( _pmright ); - break; - } - } -public: - TQSize minimumSizeHint() const { - int wh = style().pixelMetric( TQStyle::PM_DockWindowHandleExtent, this ); - return TQSize( wh, wh ); - } - TQSizePolicy sizePolicy() const { return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); } - TQSize minimumSize() const { return minimumSizeHint(); } - TQSize sizeHint() const { return minimumSize(); } - - void drawButton( TQPainter * p ) - { - p->fillRect( 0,0, width(), height(), TQBrush( colorGroup().brush( TQColorGroup::Background ) ) ); - p->drawPixmap( ( width() - pixmap()->width() ) / 2, ( height() - pixmap()->height() ) / 2, *pixmap() ); - } -}; - -class OwnButton : public TQPushButton { - Q_OBJECT - -private: - TQPixmap _pmown, _pminside; -public: - OwnButton( TQWidget *parent, const char* name=0 ) : TQPushButton( parent,name ) - { - connect( this, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( toggle( bool ) ) ); - setToggleButton( true ); - _pmown = TQPixmap( const_cast( own_xpm ) ); - _pminside = TQPixmap( const_cast( inside_xpm ) ); - setPixmap( _pmown ); - } - -public slots: - void toggle( bool b ) { - if( b ) setPixmap( _pminside ); - else setPixmap( _pmown ); - } -public: - TQSize minimumSizeHint() const { - int wh = style().pixelMetric( TQStyle::PM_DockWindowHandleExtent, this ); - return TQSize( wh, wh ); - } - TQSizePolicy sizePolicy() const { return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); } - TQSize minimumSize() const { return minimumSizeHint(); } - TQSize sizeHint() const { return minimumSize(); } - - void drawButton( TQPainter * p ) - { - p->fillRect( 0,0, width(), height(), TQBrush( colorGroup().brush( TQColorGroup::Background ) ) ); - p->drawPixmap( ( width() - pixmap()->width() ) / 2, ( height() - pixmap()->height() ) / 2, *pixmap() ); - } -}; - -#include - -class OwnWidget : public KArtsWidget -{ - Q_OBJECT - - ShowButton *_b; -public: - OwnWidget( ShowButton* b, TQWidget* p, const char* n=0, WFlags f=0 ) : KArtsWidget( p,n,f ) { _b = b; } - ~OwnWidget() {} -public slots: - void closeEvent( TQCloseEvent * ) { _b->toggle(); } -}; - -#endif - -// vim: sw=4 ts=4 - diff --git a/arts/gui/kde/tdepopupbox_impl.cpp b/arts/gui/kde/tdepopupbox_impl.cpp new file mode 100644 index 00000000..a4ac6fa2 --- /dev/null +++ b/arts/gui/kde/tdepopupbox_impl.cpp @@ -0,0 +1,134 @@ + /* + + Copyright ( C ) 2002, 2003 Arnold Krille + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or ( at your option ) any later version. + + 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 "kpopupbox_impl.h" +#include "kpopupbox_private.h" + +#include + +using namespace Arts; + +TDEPopupBox_impl::TDEPopupBox_impl( TDEPopupBox_widget *w ) : KFrame_impl( w ? w : new TDEPopupBox_widget ) +{ + self().framestyle( Box ); self().margin( 1 ); self().linewidth( 1 ); + self().vSizePolicy( spFixed ); self().hSizePolicy( spFixed ); + + if( !w ) w = static_cast( _qframe ); + + _widget = w; +// _mapper = new TDEPopupBoxEventMapper( _widget, this ); +} +TDEPopupBox_impl::~TDEPopupBox_impl() { +} + +Direction TDEPopupBox_impl::direction() { return _widget->direction(); } +void TDEPopupBox_impl::direction( Direction n ) { _widget->direction( n ); } + +void TDEPopupBox_impl::widget( Arts::Widget widget ) { + widget.parent( self() ); + this->_addChild( widget, "PopupBox_child" ); + _widget->setWidget( widget ); +} +Arts::Widget TDEPopupBox_impl::widget() { return _widget->getWidget(); } + +std::string TDEPopupBox_impl::name() { return _name; } +void TDEPopupBox_impl::name( const std::string& n ) { _name = ""; _name = n; _widget->name( n ); } + +// Following the private class: + +TDEPopupBox_widget::TDEPopupBox_widget( TQWidget *parent, const char* name ) : TQFrame( parent,name ) +{ + this->setFrameShape( TQFrame::Box ); + this->setMargin( 1 ); this->setLineWidth( 1 ); + + _titlebar = new TQFrame( this ); + _titlebarlayout = new TQBoxLayout( _titlebar, TQBoxLayout::BottomToTop ); + _titlebarlayout->setAutoAdd( true ); + + _showbutton = new ShowButton( _titlebar ); + connect( _showbutton, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( hide( bool ) ) ); + _drag = new HandleDrag( _titlebar ); + connect( _drag, TQT_SIGNAL( clicked() ), _showbutton, TQT_SLOT( toggle() ) ); + _ownbutton = new OwnButton( _titlebar ); + connect( _ownbutton, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( own( bool ) ) ); + + _artswidget = new OwnWidget( _showbutton, this ); + + _layout = new TQBoxLayout( this, TQBoxLayout::LeftToRight ); + _layout->addWidget( _titlebar , -1 ); + _layout->addWidget( _artswidget, 20 ); + _layout->addStretch( 0 ); +} +TDEPopupBox_widget::~TDEPopupBox_widget() { +} + +Arts::Direction TDEPopupBox_widget::direction() { + return Arts::Direction( _layout->direction() ); +} + +void TDEPopupBox_widget::direction( Arts::Direction n ) { + _layout->setDirection( TQBoxLayout::Direction( n ) ); + _showbutton->direction( TQBoxLayout::Direction( n ) ); + switch( n ) { + case LeftToRight: + case RightToLeft: + _titlebarlayout->setDirection( TQBoxLayout::BottomToTop ); + _drag->setMinimumHeight( 30 ); + _drag->setMinimumWidth( 0 ); + break; + case TopToBottom: + case BottomToTop: + _titlebarlayout->setDirection( TQBoxLayout::RightToLeft ); + _drag->setMinimumHeight( 0 ); + _drag->setMinimumWidth( 30 ); + } +} + +void TDEPopupBox_widget::setWidget( Arts::Widget widget ) { _artswidget->setContent( widget ); } +Arts::Widget TDEPopupBox_widget::getWidget() { return _artswidget->content(); } + +void TDEPopupBox_widget::hide( bool n ) { + if( n ) + _artswidget->hide(); + else + _artswidget->show(); +} + +void TDEPopupBox_widget::own( bool n ) { + if ( n ) + _artswidget->reparent( 0, _artswidget->mapToGlobal( _artswidget->pos() ), !( _artswidget->isHidden() ) ); + else + { + _artswidget->reparent( this, TQPoint( 0,0 ), !( _artswidget->isHidden() ) ); + _layout->insertWidget( 1, _artswidget, 20 ); + } +} + +void TDEPopupBox_widget::name( std::string n ) { + _artswidget->setCaption( n.c_str() ); +} + +REGISTER_IMPLEMENTATION( TDEPopupBox_impl ); + +#include "kpopupbox_private.moc" + +// vim: sw=4 ts=4 + diff --git a/arts/gui/kde/tdepopupbox_impl.h b/arts/gui/kde/tdepopupbox_impl.h new file mode 100644 index 00000000..0cd44a4e --- /dev/null +++ b/arts/gui/kde/tdepopupbox_impl.h @@ -0,0 +1,70 @@ + /* + + Copyright ( C ) 2002, 2003 Arnold Krille + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or ( at your option ) any later version. + + 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. + + */ + +#ifndef KPOPUPBOX_IMPL_H +#define KPOPUPBOX_IMPL_H + +#include +#include + +class TQBoxLayout; +class TDEPopupBox_widget; +//class TDEPopupBoxEventMapper; // The EventMapper isn't needed at present, but perhaps in the future... + +namespace Arts { + +/// The PopupBox + +class TDEPopupBox_impl : virtual public Arts::PopupBox_skel, public Arts::KFrame_impl +{ +public: + /// selfreference like 'this' + PopupBox self() { return PopupBox::_from_base( _copy() ); } + /// Constructor + TDEPopupBox_impl( TDEPopupBox_widget *w=0 ); + ~TDEPopupBox_impl(); + + /// The name of the widget + std::string name(); + void name( const std::string & ); + + /// The direction. LeftToRight (true) or TopToBottom (false). May get other values in the future. + Direction direction(); + void direction( Direction ); + + /// Set and Get the Widget. + void widget( Arts::Widget ); + Arts::Widget widget(); + +private: + std::string _name; + bool _lefttoright; + TDEPopupBox_widget *_widget; +// TDEPopupBoxEventMapper *_mapper; + +}; // class TDEPopupBox + +} // namespace Arts + +#endif + +// vim: sw=4 ts=4 + diff --git a/arts/gui/kde/tdepopupbox_private.h b/arts/gui/kde/tdepopupbox_private.h new file mode 100644 index 00000000..9750625b --- /dev/null +++ b/arts/gui/kde/tdepopupbox_private.h @@ -0,0 +1,222 @@ + /* + + Copyright ( C ) 2002, 2003 Arnold Krille + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or ( at your option ) any later version. + + 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. + + */ + +#ifndef KPOPUPBOX_PRIVATE_H +#define KPOPUPBOX_PRIVATE_H + + +class HandleDrag; +class ShowButton; +class OwnButton; +class KArtsWidget; +class OwnWidget; +class TQBoxLayout; + +#include + +class TDEPopupBox_widget : public TQFrame +{ + Q_OBJECT + +public: + TDEPopupBox_widget( TQWidget* =0, const char* =0); + ~TDEPopupBox_widget(); + + Arts::Direction direction(); + void direction( Arts::Direction ); + + void setWidget( Arts::Widget widget ); + Arts::Widget getWidget(); + + void name( std::string ); +private slots: + void hide( bool ); + void own( bool ); +private: + TQBoxLayout *_layout; + + TQFrame *_titlebar; + TQBoxLayout *_titlebarlayout; + HandleDrag *_drag; + ShowButton *_showbutton; + OwnButton *_ownbutton; + + OwnWidget *_artswidget; +}; + +// See kpopupbox_impl.h - The eventmapper isn't needed at present, but perhaps in the future... + +/*class TDEPopupBoxEventMapper : public TQObject { + Q_OBJECT + +public: + TDEPopupBoxEventMapper( TDEPopupBox_widget *widget, Arts::TDEPopupBox_impl *impl ) + : TQObject( widget,"" ), _widget( widget ), _impl( impl ) + {} +private: + TDEPopupBox_widget *_widget; + Arts::TDEPopupBox_impl *_impl; +};*/ + +#include +#include + +class HandleDrag : public TQWidget { + Q_OBJECT + +public: + HandleDrag( TQWidget *parent, const char* name=0 ) : TQWidget( parent,name ) {} + void paintEvent( TQPaintEvent * ) { + TQPainter p( this ); + TQStyle::SFlags flags = TQStyle::Style_Default; + if( width() < height() ) flags |= TQStyle::Style_Horizontal; + style().tqdrawPrimitive( TQStyle::PE_DockWindowHandle, &p, rect(), colorGroup(), flags ); + } +signals: + void clicked(); +protected: + virtual void mouseDoubleClickEvent( TQMouseEvent * ) { + emit clicked(); + } +}; + +static const char* const close_xpm[] = { "5 5 2 1", "# c black", ". c None", "#...#", ".#.#.", "..#..", ".#.#.", "#...#"}; +static const char* const up_xpm[] = { "5 5 2 1", "# c black", ". c None", ".....", "..#..", ".###.", "#####", "....."}; +static const char* const down_xpm[] = { "5 5 2 1", "# c black", ". c None", ".....", "#####", ".###.", "..#..", "....."}; +static const char* const left_xpm[] = { "5 5 2 1", "# c black", ". c None", "...#.", "..##.", ".###.", "..##.", "...#."}; +static const char* const right_xpm[] = { "5 5 2 1", "# c black", ". c None", ".#...", ".##..", ".###.", ".##..", ".#..."}; +static const char* const inside_xpm[] = { "5 5 2 1", "# c black", ". c None", "#####", "#...#", "#...#", "#...#", "#####"}; +static const char* const own_xpm[] = { "5 5 2 1", "# c black", ". c None", "###..", "#.###", "###.#", ".#..#", ".####"}; + +#include +#include + +class ShowButton : public TQPushButton { + Q_OBJECT + +private: + TQBoxLayout::Direction _dir; + TQPixmap _pmleft, _pmright, _pmup, _pmdown; +public: + ShowButton( TQWidget *parent, const char* name=0 ) : TQPushButton( parent,name ), _dir( TQBoxLayout::LeftToRight ) + { + connect( this, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( owntoggle( bool ) ) ); + setToggleButton( true ); + _pmleft = TQPixmap( const_cast( left_xpm ) ); + _pmright = TQPixmap( const_cast( right_xpm ) ); + _pmup = TQPixmap( const_cast( up_xpm ) ); + _pmdown = TQPixmap( const_cast( down_xpm ) ); + setPixmap( _pmright ); + } + + void direction( TQBoxLayout::Direction n ) { _dir=n; } +public slots: + void owntoggle( bool b ) { + switch( _dir ) + { + case TQBoxLayout::BottomToTop: + if( b ) setPixmap( _pmdown ); + else setPixmap( _pmup ); + break; + case TQBoxLayout::TopToBottom: + if( b ) setPixmap( _pmup ); + else setPixmap( _pmdown ); + break; + case TQBoxLayout::LeftToRight: + if( b ) setPixmap( _pmright ); + else setPixmap( _pmleft ); + break; + case TQBoxLayout::RightToLeft: + if( b ) setPixmap( _pmleft ); + else setPixmap( _pmright ); + break; + } + } +public: + TQSize minimumSizeHint() const { + int wh = style().pixelMetric( TQStyle::PM_DockWindowHandleExtent, this ); + return TQSize( wh, wh ); + } + TQSizePolicy sizePolicy() const { return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); } + TQSize minimumSize() const { return minimumSizeHint(); } + TQSize sizeHint() const { return minimumSize(); } + + void drawButton( TQPainter * p ) + { + p->fillRect( 0,0, width(), height(), TQBrush( colorGroup().brush( TQColorGroup::Background ) ) ); + p->drawPixmap( ( width() - pixmap()->width() ) / 2, ( height() - pixmap()->height() ) / 2, *pixmap() ); + } +}; + +class OwnButton : public TQPushButton { + Q_OBJECT + +private: + TQPixmap _pmown, _pminside; +public: + OwnButton( TQWidget *parent, const char* name=0 ) : TQPushButton( parent,name ) + { + connect( this, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( toggle( bool ) ) ); + setToggleButton( true ); + _pmown = TQPixmap( const_cast( own_xpm ) ); + _pminside = TQPixmap( const_cast( inside_xpm ) ); + setPixmap( _pmown ); + } + +public slots: + void toggle( bool b ) { + if( b ) setPixmap( _pminside ); + else setPixmap( _pmown ); + } +public: + TQSize minimumSizeHint() const { + int wh = style().pixelMetric( TQStyle::PM_DockWindowHandleExtent, this ); + return TQSize( wh, wh ); + } + TQSizePolicy sizePolicy() const { return TQSizePolicy( TQSizePolicy::Fixed, TQSizePolicy::Fixed ); } + TQSize minimumSize() const { return minimumSizeHint(); } + TQSize sizeHint() const { return minimumSize(); } + + void drawButton( TQPainter * p ) + { + p->fillRect( 0,0, width(), height(), TQBrush( colorGroup().brush( TQColorGroup::Background ) ) ); + p->drawPixmap( ( width() - pixmap()->width() ) / 2, ( height() - pixmap()->height() ) / 2, *pixmap() ); + } +}; + +#include + +class OwnWidget : public KArtsWidget +{ + Q_OBJECT + + ShowButton *_b; +public: + OwnWidget( ShowButton* b, TQWidget* p, const char* n=0, WFlags f=0 ) : KArtsWidget( p,n,f ) { _b = b; } + ~OwnWidget() {} +public slots: + void closeEvent( TQCloseEvent * ) { _b->toggle(); } +}; + +#endif + +// vim: sw=4 ts=4 + -- cgit v1.2.1