Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

oversatileviewdemo.cpp

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003 
00004                              Copyright (C) 2003 Michael 'Mickey' Lauer
00005                              <mickey@tm.informatik.uni-frankfurt.de>
00006               =.
00007             .=l.
00008            .>+-=
00009  _;:,     .>    :=|.         This program is free software; you can
00010 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00011 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00012 .="- .-=="i,     .._         License as published by the Free Software
00013  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00014      ._= =}       :          or (at your option) any later version.
00015     .%`+i>       _;_.
00016     .i_,=:_.      -<s.       This program is distributed in the hope that
00017      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00018     : ..    .:,     . . .    without even the implied warranty of
00019     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00020   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00021 ..}^=.=       =       ;      Library General Public License for more
00022 ++=   -.     .`     .:       details.
00023  :     =  ...= . :.=-
00024  -.   .:....=;==+<;          You should have received a copy of the GNU
00025   -_. . .   )=.  =           Library General Public License along with
00026     --        :-=`           this library; see the file COPYING.LIB.
00027                              If not, write to the Free Software Foundation,
00028                              Inc., 59 Temple Place - Suite 330,
00029                              Boston, MA 02111-1307, USA.
00030 
00031 */
00032 
00033 #include "oversatileviewdemo.h"
00034 #include <opie2/oversatileview.h>
00035 #include <opie2/oversatileviewitem.h>
00036 
00037 #include <qstring.h>
00038 #include <qpixmap.h>
00039 #include <qlistview.h>
00040 
00041 using namespace Opie::Ui;
00042 
00043 OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f )
00044                    :QVBox( parent, name, f )
00045 {
00046     vv = new OVersatileView( this );
00047     
00048     vv->addColumn( "First" );
00049     vv->addColumn( "2nd" );
00050     vv->addColumn( "IIIrd" );
00051     
00052     QString counter;
00053     
00054     QPixmap leaf( "leaf.png" );
00055     QPixmap opened( "folder_opened.png" );
00056     QPixmap closed( "folder_closed.png" );
00057     
00058     QPixmap leaf32( "leaf32.png" );
00059     QPixmap opened32( "folder_opened32.png" );
00060     QPixmap closed32( "folder_closed32.png" );
00061     
00062     vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed );
00063     vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 );
00064     
00065     OVersatileViewItem* item;
00066     OVersatileViewItem* item2;
00067     
00068     for ( int i = 0; i < 5; ++i )
00069     {
00070         counter.sprintf( "%d", i );
00071         item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter );
00072         item->setRenameEnabled( true );
00073         item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter );
00074         item2->setRenameEnabled( true );
00075 
00076     }
00077    
00078     connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );
00079     connect( vv, SIGNAL( selectionChanged(OVersatileViewItem*) ), this, SLOT( selectionChanged(OVersatileViewItem*) ) );
00080     connect( vv, SIGNAL( currentChanged(OVersatileViewItem*) ), this, SLOT( currentChanged(OVersatileViewItem*) ) );
00081     connect( vv, SIGNAL( clicked(OVersatileViewItem*) ), this, SLOT( clicked(OVersatileViewItem*) ) );
00082     connect( vv, SIGNAL( pressed(OVersatileViewItem*) ), this, SLOT( pressed(OVersatileViewItem*) ) );
00083 
00084     connect( vv, SIGNAL( doubleClicked(OVersatileViewItem*) ), this, SLOT( doubleClicked(OVersatileViewItem*) ) );
00085     connect( vv, SIGNAL( returnPressed(OVersatileViewItem*) ), this, SLOT( returnPressed(OVersatileViewItem*) ) );
00086   
00087     connect( vv, SIGNAL( onItem(OVersatileViewItem*) ), this, SLOT( onItem(OVersatileViewItem*) ) );
00088     connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) );
00089     
00090     connect( vv, SIGNAL( expanded(OVersatileViewItem*) ), this, SLOT( expanded(OVersatileViewItem*) ) );
00091     connect( vv, SIGNAL( collapsed(OVersatileViewItem*) ), this, SLOT( collapsed(OVersatileViewItem*) ) );
00092 
00093     connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) );
00094 
00095     connect( vv, SIGNAL( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ) );
00096     
00097 }
00098 
00099 OVersatileViewDemo::~OVersatileViewDemo()
00100 {
00101 }
00102 
00103 void OVersatileViewDemo::selectionChanged()
00104 {
00105     odebug << "received signal selectionChanged()" << oendl; 
00106 }
00107 void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item )
00108 {
00109     odebug << "received signal selectionChanged(OVersatileViewItem*)" << oendl; 
00110 }
00111 void OVersatileViewDemo::currentChanged( OVersatileViewItem * item )
00112 {
00113     odebug << "received signal currentChanged( OVersatileViewItem * )" << oendl; 
00114 }
00115 void OVersatileViewDemo::clicked( OVersatileViewItem * item )
00116 {
00117     odebug << "received signal clicked( OVersatileViewItem * )" << oendl; 
00118 }
00119 void OVersatileViewDemo::pressed( OVersatileViewItem * item )
00120 {
00121     odebug << "received signal pressed( OVersatileViewItem * )" << oendl; 
00122 }
00123 
00124 void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item )
00125 {
00126     odebug << "received signal doubleClicked( OVersatileViewItem *item )" << oendl; 
00127 }
00128 void OVersatileViewDemo::returnPressed( OVersatileViewItem *item )
00129 {
00130     odebug << "received signal returnPressed( OVersatileViewItem *item )" << oendl; 
00131 }
00132 
00133 void OVersatileViewDemo::onItem( OVersatileViewItem *item )
00134 {
00135     odebug << "received signal onItem( OVersatileViewItem *item )" << oendl; 
00136 }
00137 void OVersatileViewDemo::onViewport()
00138 {
00139     odebug << "received signal onViewport()" << oendl; 
00140 }
00141 
00142 void OVersatileViewDemo::expanded( OVersatileViewItem *item )
00143 {
00144     odebug << "received signal expanded( OVersatileViewItem *item )" << oendl; 
00145 }
00146 
00147 void OVersatileViewDemo::collapsed( OVersatileViewItem *item )
00148 {
00149     odebug << "received signal collapsed( OVersatileViewItem *item )" << oendl; 
00150 }
00151 
00152 void OVersatileViewDemo::moved()
00153 {
00154     odebug << "received signal moved( OVersatileViewItem *item )" << oendl; 
00155 }
00156 
00157 void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col )
00158 {
00159     odebug << "received signal contextMenuRequested( OVersatileViewItem *item )" << oendl; 
00160 }

Generated on Sat Nov 5 16:15:59 2005 for OPIE by  doxygen 1.4.2