Diffstat (limited to 'libopie2/opieui/oversatileview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/oversatileview.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp index 6808539..65fe3d8 100644 --- a/libopie2/opieui/oversatileview.cpp +++ b/libopie2/opieui/oversatileview.cpp @@ -1,100 +1,101 @@ /* This file is part of the Opie Project =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> .=l. .>+-= _;:, .> :=|. This program is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* OPIE */ + +#include <opie2/odebug.h> +#include <opie2/oversatileview.h> +#include <opie2/oversatileviewitem.h> +#include <opie2/olistview.h> + /* QT */ #include <qaction.h> #include <qbrush.h> #include <qfont.h> #include <qiconset.h> #include <qiconview.h> #include <qlistview.h> #include <qpalette.h> #include <qpoint.h> #include <qpopupmenu.h> #include <qrect.h> #include <qsize.h> #include <qstring.h> #include <qwidgetstack.h> -/* OPIE */ - -#include <opie2/oversatileview.h> -#include <opie2/oversatileviewitem.h> -#include <opie2/olistview.h> - /* XPM */ static const char * view_icon_xpm[] = { "16 16 16 1", " c None", ". c #87BD88", "+ c #8BBE8B", "@ c #81BA81", "# c #6DAF6D", "$ c #87BD87", "% c #FCFDFC", "& c #AED0AE", "* c #4E9C4C", "= c #91BD91", "- c #72B172", "; c #448643", "> c #519F50", ", c #499247", "' c #356A35", ") c #686868", " ", " .+@# .+@# ", " $%&* $%&* ", " @=-; @=-; ", " #>,' #>,' ", " ", " )))))) )))))) ", " ", " ", " .+@# .+@# ", " $%&* $%&* ", " @=-; @=-; ", " #>,' #>,' ", " ", " )))))) )))))) ", " "}; /* XPM */ static const char * view_tree_xpm[] = { "16 16 17 1", " c None", ". c #3A3A3A", "+ c #87BD88", "@ c #8BBE8B", "# c #81BA81", "$ c #6DAF6D", "% c #87BD87", "& c #FCFDFC", "* c #AED0AE", @@ -244,256 +245,256 @@ QPopupMenu* OVersatileView::contextMenu() const void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) { // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, // do not inherit from QObject - assuming here the programmer is // disciplined enough to only add OVersatileViewItems to an OVersatileView popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col ); } void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos ) { // see above popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 ); } void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col ) { if ( !item ) _contextmenu->exec( pos ); else emit( contextMenuRequested( item, pos, col ) ); } void OVersatileView::setSynchronization( bool sync ) { _synchronization = sync; } bool OVersatileView::synchronization() { return _synchronization; } void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ) { if ( mode == Tree ) { _treeleaf = leaf; _treeopened = opened; _treeclosed = closed; } else if ( mode == Icons ) { _iconleaf = leaf; _iconopened = opened; _iconclosed = closed; } else { - qDebug( "OVersatileView::setDefaultPixmaps(): invalid mode" ); + odebug << "OVersatileView::setDefaultPixmaps(): invalid mode" << oendl; } } QIconView* OVersatileView::iconView() const { return _iconview; } OListView* OVersatileView::listView() const { return _listview; } void OVersatileView::setViewMode( int mode ) { if ( mode == Tree ) { _viewmode = mode; raiseWidget( _listview ); } else if ( mode == Icons ) { _viewmode = mode; raiseWidget( _iconview ); } else { - qDebug( "OVersatileView::setViewMode(): invalid mode" ); + odebug << "OVersatileView::setViewMode(): invalid mode" << oendl; } } void OVersatileView::setIconViewMode() { setViewMode( Icons ); } void OVersatileView::setTreeViewMode() { setViewMode( Tree ); } bool OVersatileView::isValidViewMode( int mode ) const { switch ( _warningpolicy ) { case OVersatileView::None: { return true; } case OVersatileView::Warn: { if ( _viewmode != mode ) { - qDebug( "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." ); + odebug << "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." << oendl; return true; } } case OVersatileView::WarnReturn: { if ( _viewmode != mode ) { - qDebug( "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." ); + odebug << "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." << oendl; return false; } } default: { - qWarning( "OVersatileView::isValidViewMode(): Inconsistent object state!" ); + owarn << "OVersatileView::isValidViewMode(): Inconsistent object state!" << oendl; return true; } } } void OVersatileView::setWarningPolicy( int policy ) const { _warningpolicy = policy; } bool OVersatileView::warningPolicy() const { return _warningpolicy; } //==============================================================================================// // Stupid Signal forwarders... // Folks, this is why I like python with its dynamic typing: // I can code the following dozens of lines C++ in four Python lines... //==============================================================================================// void OVersatileView::selectionChanged( QListViewItem * item ) { emit( selectionChanged( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::selectionChanged( QIconViewItem * item ) { emit( selectionChanged( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::currentChanged( QListViewItem * item ) { emit( currentChanged( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::currentChanged( QIconViewItem * item ) { emit( currentChanged( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::clicked( QListViewItem * item ) { emit( clicked( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::clicked( QIconViewItem * item ) { emit( clicked( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::pressed( QListViewItem * item ) { emit( pressed( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::pressed( QIconViewItem * item ) { emit( pressed( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::doubleClicked( QListViewItem * item ) { emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::doubleClicked( QIconViewItem * item ) { emit( doubleClicked( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::returnPressed( QListViewItem * item ) { emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::returnPressed( QIconViewItem * item ) { emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::onItem( QListViewItem * item ) { emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::onItem( QIconViewItem * item ) { emit( onItem( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::expanded( QListViewItem *item ) // QListView { - //qDebug( "OVersatileView::expanded(): opening tree..." ); + //odebug << "OVersatileView::expanded(): opening tree..." << oendl; if ( !_treeopened.isNull() ) item->setPixmap( 0, _treeopened ); emit( expanded( static_cast<OVersatileViewItem*>( item ) ) ); } void OVersatileView::collapsed( QListViewItem *item ) // QListView { if ( !_treeclosed.isNull() ) item->setPixmap( 0, _treeclosed ); emit( collapsed( static_cast<OVersatileViewItem*>( item ) ) ); } //=============================================================================================// // OVersatileView Case I - API only existing in QListView or QIconView but not in both! //==============================================================================================// int OVersatileView::treeStepSize() const // QListView { if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->treeStepSize(); } void OVersatileView::setTreeStepSize( int size ) // QListView { if ( !isValidViewMode( Tree ) ) { return; } _listview->setTreeStepSize( size ); } QHeader * OVersatileView::header() const // QListView { if ( !isValidViewMode( Tree ) ) { return 0; } return _listview->header(); } int OVersatileView::addColumn( const QString &label, int size ) // QListView { if ( !isValidViewMode( Tree ) ) { return -1; } return _listview->addColumn( label, size ); |