summaryrefslogtreecommitdiff
path: root/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp
Unidiff
Diffstat (limited to 'examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp') (more/less context) (show whitespace changes)
-rw-r--r--examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp160
1 files changed, 160 insertions, 0 deletions
diff --git a/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp b/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp
new file mode 100644
index 0000000..e8bbdb1
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp
@@ -0,0 +1,160 @@
1/*
2                 This file is part of the Opie Project
3
4              Copyright (C) 2003 Michael 'Mickey' Lauer
5 <mickey@tm.informatik.uni-frankfurt.de>
6 =.
7 .=l.
8           .>+-=
9 _;:,     .>    :=|. This program is free software; you can
10.> <`_,   >  .   <= redistribute it and/or modify it under
11:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
12.="- .-=="i,     .._ License as published by the Free Software
13 - .   .-<_>     .<> Foundation; either version 2 of the License,
14     ._= =}       : or (at your option) any later version.
15    .%`+i>       _;_.
16    .i_,=:_.      -<s. This program is distributed in the hope that
17     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
18    : ..    .:,     . . . without even the implied warranty of
19    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
20  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
21..}^=.=       =       ; Library General Public License for more
22++=   -.     .`     .: details.
23 :     =  ...= . :.=-
24 -.   .:....=;==+<; You should have received a copy of the GNU
25  -_. . .   )=.  = Library General Public License along with
26    --        :-=` this library; see the file COPYING.LIB.
27 If not, write to the Free Software Foundation,
28 Inc., 59 Temple Place - Suite 330,
29 Boston, MA 02111-1307, USA.
30
31*/
32
33#include "oversatileviewdemo.h"
34#include <opie2/oversatileview.h>
35#include <opie2/oversatileviewitem.h>
36
37#include <qstring.h>
38#include <qpixmap.h>
39#include <qlistview.h>
40
41using namespace Opie::Ui;
42
43OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f )
44 :QVBox( parent, name, f )
45{
46 vv = new OVersatileView( this );
47
48 vv->addColumn( "First" );
49 vv->addColumn( "2nd" );
50 vv->addColumn( "IIIrd" );
51
52 QString counter;
53
54 QPixmap leaf( "leaf.png" );
55 QPixmap opened( "folder_opened.png" );
56 QPixmap closed( "folder_closed.png" );
57
58 QPixmap leaf32( "leaf32.png" );
59 QPixmap opened32( "folder_opened32.png" );
60 QPixmap closed32( "folder_closed32.png" );
61
62 vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed );
63 vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 );
64
65 OVersatileViewItem* item;
66 OVersatileViewItem* item2;
67
68 for ( int i = 0; i < 5; ++i )
69 {
70 counter.sprintf( "%d", i );
71 item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter );
72 item->setRenameEnabled( true );
73 item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter );
74 item2->setRenameEnabled( true );
75
76 }
77
78 connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );
79 connect( vv, SIGNAL( selectionChanged(OVersatileViewItem*) ), this, SLOT( selectionChanged(OVersatileViewItem*) ) );
80 connect( vv, SIGNAL( currentChanged(OVersatileViewItem*) ), this, SLOT( currentChanged(OVersatileViewItem*) ) );
81 connect( vv, SIGNAL( clicked(OVersatileViewItem*) ), this, SLOT( clicked(OVersatileViewItem*) ) );
82 connect( vv, SIGNAL( pressed(OVersatileViewItem*) ), this, SLOT( pressed(OVersatileViewItem*) ) );
83
84 connect( vv, SIGNAL( doubleClicked(OVersatileViewItem*) ), this, SLOT( doubleClicked(OVersatileViewItem*) ) );
85 connect( vv, SIGNAL( returnPressed(OVersatileViewItem*) ), this, SLOT( returnPressed(OVersatileViewItem*) ) );
86
87 connect( vv, SIGNAL( onItem(OVersatileViewItem*) ), this, SLOT( onItem(OVersatileViewItem*) ) );
88 connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) );
89
90 connect( vv, SIGNAL( expanded(OVersatileViewItem*) ), this, SLOT( expanded(OVersatileViewItem*) ) );
91 connect( vv, SIGNAL( collapsed(OVersatileViewItem*) ), this, SLOT( collapsed(OVersatileViewItem*) ) );
92
93 connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) );
94
95 connect( vv, SIGNAL( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ) );
96
97}
98
99OVersatileViewDemo::~OVersatileViewDemo()
100{
101}
102
103void OVersatileViewDemo::selectionChanged()
104{
105 odebug << "received signal selectionChanged()" << oendl;
106}
107void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item )
108{
109 odebug << "received signal selectionChanged(OVersatileViewItem*)" << oendl;
110}
111void OVersatileViewDemo::currentChanged( OVersatileViewItem * item )
112{
113 odebug << "received signal currentChanged( OVersatileViewItem * )" << oendl;
114}
115void OVersatileViewDemo::clicked( OVersatileViewItem * item )
116{
117 odebug << "received signal clicked( OVersatileViewItem * )" << oendl;
118}
119void OVersatileViewDemo::pressed( OVersatileViewItem * item )
120{
121 odebug << "received signal pressed( OVersatileViewItem * )" << oendl;
122}
123
124void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item )
125{
126 odebug << "received signal doubleClicked( OVersatileViewItem *item )" << oendl;
127}
128void OVersatileViewDemo::returnPressed( OVersatileViewItem *item )
129{
130 odebug << "received signal returnPressed( OVersatileViewItem *item )" << oendl;
131}
132
133void OVersatileViewDemo::onItem( OVersatileViewItem *item )
134{
135 odebug << "received signal onItem( OVersatileViewItem *item )" << oendl;
136}
137void OVersatileViewDemo::onViewport()
138{
139 odebug << "received signal onViewport()" << oendl;
140}
141
142void OVersatileViewDemo::expanded( OVersatileViewItem *item )
143{
144 odebug << "received signal expanded( OVersatileViewItem *item )" << oendl;
145}
146
147void OVersatileViewDemo::collapsed( OVersatileViewItem *item )
148{
149 odebug << "received signal collapsed( OVersatileViewItem *item )" << oendl;
150}
151
152void OVersatileViewDemo::moved()
153{
154 odebug << "received signal moved( OVersatileViewItem *item )" << oendl;
155}
156
157void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col )
158{
159 odebug << "received signal contextMenuRequested( OVersatileViewItem *item )" << oendl;
160}