From: vsr Date: Tue, 9 Sep 2008 12:40:48 +0000 (+0000) Subject: Remove obsolete files X-Git-Tag: TG_TRIPOLI_qt4_porting~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5bfa467afa06c0b396ee99ab844e057e2d4d94c9;p=modules%2Fgui.git Remove obsolete files --- diff --git a/src/ObjBrowser/OB_ListItem.cxx b/src/ObjBrowser/OB_ListItem.cxx deleted file mode 100755 index a66072a1b..000000000 --- a/src/ObjBrowser/OB_ListItem.cxx +++ /dev/null @@ -1,385 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "OB_ListItem.h" - -#include "OB_ListView.h" - -#include - -#include -#include - -#include -using namespace std; - -#ifdef WIN32 -#define min(a, b) (((a) < (b)) ? (a) : (b)) -#endif - -/*! - Constructor -*/ -template -ListItemF::ListItemF( T* theT, SUIT_DataObject* obj ) : -myT( theT ), -myObject( obj ) -{ -} - -/*! - Paints item -*/ -template -void ListItemF::paintC( QPainter* p, QColorGroup& cg, int c, int w, int align ) -{ -// QColorGroup colorGrp( cg ); - if ( myObject ) - { - if ( myObject->color( SUIT_DataObject::Text ).isValid() ) - cg.setColor( QColorGroup::Text, myObject->color( SUIT_DataObject::Text ) ); - if ( myObject->color( SUIT_DataObject::Base ).isValid() ) - cg.setColor( QColorGroup::Base, myObject->color( SUIT_DataObject::Base ) ); - if ( myObject->color( SUIT_DataObject::Foreground ).isValid() ) - cg.setColor( QColorGroup::Foreground, myObject->color( SUIT_DataObject::Foreground ) ); - if ( myObject->color( SUIT_DataObject::Background ).isValid() ) - cg.setColor( QColorGroup::Background, myObject->color( SUIT_DataObject::Background ) ); - if ( myObject->color( SUIT_DataObject::Highlight ).isValid() ) - cg.setColor( QColorGroup::Highlight, myObject->color( SUIT_DataObject::Highlight ) ); - if ( myObject->color( SUIT_DataObject::HighlightedText ).isValid() ) - cg.setColor( QColorGroup::HighlightedText, myObject->color( SUIT_DataObject::HighlightedText ) ); - } - - - p->fillRect( 0, 0, w, myT->height(), cg.brush( QColorGroup::Base ) ); - //int itemW = myT.width( p->fontMetrics(), myT.listView(), c ); - - //myT.paintCell( p, colorGrp, c, itemW, align ); -} - -/*! - Paints focused item -*/ -template -void ListItemF::paintFoc( QPainter* p, QColorGroup& cg, const QRect& r ) -{ - QRect rect = r; - rect.setWidth( myT->width( p->fontMetrics(), myT->listView(), 0 ) ); - //myT.paintFocus( p, cg, rect ); -} - -/*! - Set selection of item - \param s - selected state -*/ -template -void ListItemF::setSel( bool s ) -{ - QListView* lv = myT->listView(); - if ( s && lv && lv->inherits( "OB_ListView" ) ) - { - OB_ListView* objlv = (OB_ListView*)lv; - s = s && objlv->isOk( myT ); - } - - //myT.setSelected( s ); -} - -/*! - Updates name and pixmap of item -*/ -template -void ListItemF::update() -{ - SUIT_DataObject* obj = dataObject(); - if ( !obj ) - return; - - QString n = obj->name(); - if( myT->text( 0 )!=n ) - myT->setText( 0, n ); - - QPixmap p = obj->icon(); - int aIconW = p.width(); - if( aIconW > 0 ) - { - if( aIconW > 20 ) - { - QWMatrix aM; - double aScale = 20.0 / aIconW; - aM.scale( aScale, aScale ); - myT->setPixmap( 0, p.xForm( aM ) ); - } - else - myT->setPixmap( 0, p ); - } - else if ( p.isNull() ) - myT->setPixmap( 0, p ); - - myT->setDragEnabled( obj->isDragable() ); - myT->setDropEnabled( true ); -} - -/*! - Constructor -*/ -OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListView* parent ) -: ListItemF( this, obj ), - QListViewItem(parent) -{ - update(); -} - -/*! - Constructor -*/ -OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListViewItem* parent ) -: ListItemF( this, obj ), - QListViewItem(parent) -{ - update(); -} - -/*! - Constructor -*/ -OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListView* parent, QListViewItem* after ) -: ListItemF( this, obj), -QListViewItem(parent, after ) -{ - update(); -} - -/*! - Constructor -*/ -OB_ListItem::OB_ListItem( SUIT_DataObject* obj, QListViewItem* parent, QListViewItem* after ) -: ListItemF( this,obj), -QListViewItem(parent, after ) -{ - update(); -} - -/*! - Destructor -*/ -OB_ListItem::~OB_ListItem() -{ -} - -/*! - Sets selection state of item - \param s - new state -*/ -void OB_ListItem::setSelected( bool s ) -{ - setSel( s ); - QListViewItem::setSelected( s ); -} - -/*! - Paints focus - \param p - painter - \param cg - color group - \param r - focus rectangle -*/ -void OB_ListItem::paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r ) -{ - QColorGroup col_group( cg ); - paintFoc( p, col_group, r ); - - QRect R( r ); - if ( listView() && !listView()->allColumnsShowFocus() ) - R.setWidth( width( p->fontMetrics(), listView(), 0 ) ); - - QListViewItem::paintFocus( p, col_group, R ); -} - -/*! - Paints item - \param p - painter - \param cg - color group - \param c - not used - \param w - width of item - \param align - alignment -*/ -void OB_ListItem::paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align ) -{ - QColorGroup col_group( cg ); - paintC( p, col_group, c ,w, align ); - - int W = w; - if ( listView() && !listView()->allColumnsShowFocus() ) - W = width( p->fontMetrics(), listView(), c ); - - QListViewItem::paintCell( p, col_group, c, min( W, w ), align ); -} - -/*! - \return custom RTTI info -*/ -int OB_ListItem::RTTI() -{ - return 1000; -} - -/*! - \return custom RTTI info -*/ -int OB_ListItem::rtti() const -{ - return RTTI(); -} - -/*! - Sets item text - \param column - column index - \param text - new text -*/ -void OB_ListItem::setText( int column, const QString& text ) -{ - QListViewItem::setText( column, text ); - QFontMetrics fm = listView()->fontMetrics(); - int necessary = width( fm, listView(), column ), - current = listView()->columnWidth( column ); - - if( listView()->columnWidthMode( column )==QListView::Maximum && necessary>current ) - listView()->setColumnWidth( column, necessary ); -} - -/*! - Constructor -*/ -OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListView* parent, Type type ) -: ListItemF( this, obj), -QCheckListItem( parent, "", type ) -{ - update(); -} - -/*! - Constructor -*/ -OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListViewItem* parent, Type type ) -: ListItemF( this, obj), -QCheckListItem( parent, "", type ) -{ - update(); -} - -/*! - Constructor -*/ -OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListView* parent, QListViewItem* after, Type type ) -: ListItemF( this, obj), - QCheckListItem( parent, after, "", type ) -{ - update(); -} - -/*! - Constructor -*/ -OB_CheckListItem::OB_CheckListItem( SUIT_DataObject* obj, QListViewItem* parent, QListViewItem* after, Type type ) -: ListItemF( this, obj), - QCheckListItem( parent, after, "", type ) -{ - update(); -} - -/*! - Destructor -*/ -OB_CheckListItem::~OB_CheckListItem() -{ -} - -/*! - Sets selection state of item - \param s - new state -*/ -void OB_CheckListItem::setSelected( bool s ) -{ - setSel( s ); - QCheckListItem::setSelected( s ); -} - -/*! - Paints focus - \param p - painter - \param cg - color group - \param r - focus rectangle -*/ -void OB_CheckListItem::paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r ) -{ - QColorGroup col_group( cg ); - paintFoc( p, col_group, r ); - - QRect R( r ); - if ( listView() && !listView()->allColumnsShowFocus() ) - R.setWidth( width( p->fontMetrics(), listView(), 0 ) ); - - QCheckListItem::paintFocus( p, col_group, R ); -} - -/*! - Paints item - \param p - painter - \param cg - color group - \param c - not used - \param w - width of item - \param align - alignment -*/ -void OB_CheckListItem::paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align ) -{ - QColorGroup col_group( cg ); - paintC( p, col_group, c ,w, align ); - - int W = w; - if ( listView() && !listView()->allColumnsShowFocus() ) - W = width( p->fontMetrics(), listView(), c ); - - QCheckListItem::paintCell( p, col_group, c, min( W, w ), align ); -} - -/*! - \return custom RTTI info -*/ -int OB_CheckListItem::RTTI() -{ - return OB_ListItem::RTTI() + 1; -} - -/*! - \return custom RTTI info -*/ -int OB_CheckListItem::rtti() const -{ - return RTTI(); -} - -/*! - SLOT: called if checked state is changed, changes corresponding state of SUIT object -*/ -void OB_CheckListItem::stateChange( bool on ) -{ - QCheckListItem::stateChange( on ); - - if ( dataObject() ) - dataObject()->setOn( on ); -} diff --git a/src/ObjBrowser/OB_ListItem.h b/src/ObjBrowser/OB_ListItem.h deleted file mode 100755 index 40f7259e4..000000000 --- a/src/ObjBrowser/OB_ListItem.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef OB_LISTITEM_H -#define OB_LISTITEM_H - -#include "OB.h" - -#include - -class SUIT_DataObject; - -/*! - \class ListItemF - Base template class for ListViewItems and CheckListItems -*/ -template class ListItemF -{ -public: - ListItemF( T*, SUIT_DataObject* ); - /*ListItem( SUIT_DataObject*, QListView* ); - ListItem( SUIT_DataObject*, QListViewItem* ); - ListItem( SUIT_DataObject*, QListView*, QListViewItem* ); - ListItem( SUIT_DataObject*, QListViewItem*, QListViewItem* ); - - ListItem( SUIT_DataObject*, QListView*, int ); - ListItem( SUIT_DataObject*, QListViewItem*, int ); - ListItem( SUIT_DataObject*, QListView*, QListViewItem*, int ); - ListItem( SUIT_DataObject*, QListViewItem*, QListViewItem*, int );*/ - - void setSel( bool s ); - inline SUIT_DataObject* dataObject() const { return myObject; } - void paintFoc( QPainter* p, QColorGroup& cg, const QRect& r ); - void paintC( QPainter* p, QColorGroup& cg, int c, int w, int align ); - -//protected: - void update(); - -protected: - SUIT_DataObject* myObject; - T* myT; -}; - -/*! - \class OB_ListItem - Provides custom list item for Object Browser tree -*/ -class OB_EXPORT OB_ListItem : public ListItemF, public QListViewItem -{ -public: - OB_ListItem( SUIT_DataObject*, QListView* ); - OB_ListItem( SUIT_DataObject*, QListViewItem* ); - OB_ListItem( SUIT_DataObject*, QListView*, QListViewItem* ); - OB_ListItem( SUIT_DataObject*, QListViewItem*, QListViewItem* ); - - virtual ~OB_ListItem(); - - virtual void setSelected( bool s ); - virtual void paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r ); - virtual void paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align ); - - virtual void setText ( int column, const QString & text ); - - virtual int rtti() const; - - static int RTTI(); -}; - -/*! - \class OB_CheckListItem - Provides custom list item with check box -*/ -class OB_EXPORT OB_CheckListItem : public ListItemF, public QCheckListItem -{ -public: - OB_CheckListItem( SUIT_DataObject*, QListView*, Type = CheckBox ); - OB_CheckListItem( SUIT_DataObject*, QListViewItem*, Type = CheckBox ); - OB_CheckListItem( SUIT_DataObject*, QListView*, QListViewItem*, Type = CheckBox ); - OB_CheckListItem( SUIT_DataObject*, QListViewItem*, QListViewItem*, Type = CheckBox ); - - virtual ~OB_CheckListItem(); - - virtual void setSelected( bool s ); - virtual void paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r ); - virtual void paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align ); - - - virtual int rtti() const; - - static int RTTI(); - -protected: - void stateChange( bool ); - -//private: -// void update(); -}; - -#endif diff --git a/src/ObjBrowser/OB_ListView.cxx b/src/ObjBrowser/OB_ListView.cxx deleted file mode 100755 index 728e12c27..000000000 --- a/src/ObjBrowser/OB_ListView.cxx +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "OB_ListView.h" - -#include "OB_Filter.h" -#include "OB_ListItem.h" - -#include - -#include - -/*! - Constructor -*/ -OB_ListView::OB_ListView( QWidget* parent, const char* name, WFlags f ) -: QtxListView( parent, name, f ), -myFilter( 0 ) -{ -} - -/*! - Constructor -*/ -OB_ListView::OB_ListView( const int state, QWidget* parent, const char* name, WFlags f ) -: QtxListView( state, parent, name, f ), -myFilter( 0 ) -{ -} - -/*! - Destructor -*/ -OB_ListView::~OB_ListView() -{ - delete myFilter; -} - -/*! - \return filter -*/ -OB_Filter* OB_ListView::filter() const -{ - return myFilter; -} - -/*! - Changes filter - \param f - new filter -*/ -void OB_ListView::setFilter( OB_Filter* f ) -{ - if ( myFilter == f ) - return; - - delete myFilter; - myFilter = f; -} - -/*! - \return true if item passes filter -*/ -bool OB_ListView::isOk( QListViewItem* item ) const -{ - bool ok = true; - SUIT_DataObject* obj = dataObject( item ); - if ( obj && filter() ) - ok = filter()->isOk( obj ); - return ok; -} - -/*! - Creates new drag object -*/ -QDragObject* OB_ListView::dragObject() -{ - myItems.clear(); - - for ( QListViewItemIterator it( this ); it.current(); ++it ) - if ( it.current()->isSelected() ) - myItems.append( it.current() ); - - return new QTextDrag( "", this ); -} - -/*! - Custom drag enter event filter -*/ -void OB_ListView::dragEnterEvent( QDragEnterEvent* e ) -{ - e->accept(); -} - -/*! - Custom drag move event filter -*/ -void OB_ListView::dragMoveEvent( QDragMoveEvent* e ) -{ - QListViewItem* item = dropItem( e ); - - if ( isDropAccepted( item ) ) - { - setCurrentItem( item ); - e->accept( true ); - } - else - e->accept( false ); -} - -/*! - Custom drop event filter -*/ -void OB_ListView::dropEvent( QDropEvent* e ) -{ - QListViewItem* item = dropItem( e ); - if ( isDropAccepted( item ) ) - { - e->accept(); - emit dropped( myItems, item, e->action() ); - } - myItems.clear(); -} - -/*! - Custom key press event filter -*/ -void OB_ListView::keyPressEvent( QKeyEvent* ke ) -{ - if ( ( ke->key() == Qt::Key_Plus || ke->key() == Qt::Key_Minus ) && ke->state() & ControlButton ) - { - bool isOpen = ke->key() == Qt::Key_Plus; - for ( QListViewItemIterator it( this ); it.current(); ++it ) - if ( it.current()->childCount() ) - it.current()->setOpen( isOpen ); - } - else - QtxListView::keyPressEvent( ke ); -} - -/*! - Finds item, in that dragged objects are dropped by QDropEvent - \return tree item -*/ -QListViewItem* OB_ListView::dropItem( QDropEvent* e ) const -{ - QListViewItem* item = 0; - if ( e ) - item = itemAt( QPoint( e->pos().x() - viewport()->x(), e->pos().y() - viewport()->y() ) ); - - return item; -} - -/*! - \return SUIT object by tree item - \param item - tree item -*/ -SUIT_DataObject* OB_ListView::dataObject( QListViewItem* item ) const -{ - if ( !item ) - return 0; - - SUIT_DataObject* obj = 0; - - if ( dynamic_cast( item ) ) - obj = dynamic_cast( item )->dataObject(); - else if ( dynamic_cast( item ) ) - obj = dynamic_cast( item )->dataObject(); - - return obj; -} - -/*! - \return true if it is possible to drop into item - \param item - tree item to be checked -*/ -bool OB_ListView::isDropAccepted( QListViewItem* item ) const -{ - bool res = true; - - for ( QPtrListIterator it( myItems ); it.current() && res; ++it ) - res = res && isDropAccepted( it.current(), item ); - - return res; -} - -/*! - \return true if it is possible to drop one item into other - \param drag - dragged item - \param drop - destination item -*/ -bool OB_ListView::isDropAccepted( QListViewItem* drag, QListViewItem* drop ) const -{ - SUIT_DataObject* dragObj = dataObject( drag ); - SUIT_DataObject* dropObj = dataObject( drop ); - - if ( !dragObj || !dropObj ) - return false; - - return dropObj->isDropAccepted( dragObj ); -} - -/*! - Sets column width - \param col - column index - \param width - column width -*/ -void OB_ListView::setColumnWidth( int col, int width ) -{ - int max = columnMaxWidth( col ); - if ( max>0 && width>max ) - width = max; - - QtxListView::setColumnWidth( col, width ); -} - -/*! - \return column max width - \param col - column index -*/ -int OB_ListView::columnMaxWidth( const int col ) const -{ - int res = -1; - if( myMaxColWidth.contains( col ) ) - res = myMaxColWidth[col]; - else if( myMaxColRatio.contains( col ) ) - res = int( myMaxColRatio[col]*height() ); - return res; -} - -/*! - Changes column max width - \param col - column index - \param w - column max width -*/ -void OB_ListView::setColumnMaxWidth( const int col, const int w ) -{ - myMaxColWidth.insert( col, w ); -} - -/*! - \return column max ratio - \param col - column index -*/ -double OB_ListView::columnMaxRatio( const int col ) const -{ - double res = 0.0; - if( myMaxColRatio.contains( col ) ) - res = myMaxColRatio[col]; - return res; -} - -/*! - Changes column max ratio - \param col - column index - \param w - column max ratio -*/ -void OB_ListView::setColumnMaxRatio( const int col, const double r ) -{ - myMaxColRatio.insert( col, r ); -} diff --git a/src/ObjBrowser/OB_ListView.h b/src/ObjBrowser/OB_ListView.h deleted file mode 100755 index 7a591e5a2..000000000 --- a/src/ObjBrowser/OB_ListView.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef OB_LISTVIEW_H -#define OB_LISTVIEW_H - -#include "OB.h" - - -#include - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -#include - -class OB_Filter; -class QListViewItem; -class SUIT_DataObject; - -/*! - \class OB_ListView - Special list view for ObjectBrowser. - Allows drag-n-drop, filtering of selected objects, column management. -*/ -class OB_EXPORT OB_ListView : public QtxListView -{ - Q_OBJECT - -public: - OB_ListView( QWidget* = 0, const char* = 0, WFlags = 0 ); - OB_ListView( const int, QWidget* = 0, const char* = 0, WFlags = 0 ); - virtual ~OB_ListView(); - - OB_Filter* filter() const; - void setFilter( OB_Filter* ); - - bool isOk( QListViewItem* ) const; - virtual void setColumnWidth( int, int ); - int columnMaxWidth( const int ) const; - void setColumnMaxWidth( const int, const int ); - double columnMaxRatio( const int ) const; - void setColumnMaxRatio( const int, const double ); - -signals: - void dropped( QPtrList, QListViewItem*, int ); - -protected: - virtual QDragObject* dragObject(); - virtual void dropEvent( QDropEvent* ); - virtual void dragMoveEvent( QDragMoveEvent* ); - virtual void dragEnterEvent( QDragEnterEvent* ); - - virtual void keyPressEvent( QKeyEvent* ); - -private: - void updateHeader(); - QListViewItem* dropItem( QDropEvent* ) const; - SUIT_DataObject* dataObject( QListViewItem* ) const; - bool isDropAccepted( QListViewItem* ) const; - bool isDropAccepted( QListViewItem*, QListViewItem* ) const; - -protected: - QPtrList myItems; - OB_Filter* myFilter; - QMap myMaxColWidth; - QMap myMaxColRatio; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif