summaryrefslogtreecommitdiff
path: root/examples/opieui
authormickeyl <mickeyl>2005-01-29 14:18:51 (UTC)
committer mickeyl <mickeyl>2005-01-29 14:18:51 (UTC)
commit555b999359a5aad999eaaf48632ce85f25125b85 (patch) (unidiff)
tree7414362241e49e06f49486e93a8f504113961b1c /examples/opieui
parent7b06e36fe27adc6a4fde2004eac13aaf8c0f0f02 (diff)
downloadopie-555b999359a5aad999eaaf48632ce85f25125b85.zip
opie-555b999359a5aad999eaaf48632ce85f25125b85.tar.gz
opie-555b999359a5aad999eaaf48632ce85f25125b85.tar.bz2
examples appear here
Diffstat (limited to 'examples/opieui') (more/less context) (ignore whitespace changes)
-rw-r--r--examples/opieui/okeyconfigwidget/keyconfig.pro12
-rw-r--r--examples/opieui/okeyconfigwidget/testwidget.cpp128
-rw-r--r--examples/opieui/okeyconfigwidget/testwidget.h40
-rw-r--r--examples/opieui/olistviewdemo/main.cpp29
-rw-r--r--examples/opieui/olistviewdemo/olistviewdemo.cpp86
-rw-r--r--examples/opieui/olistviewdemo/olistviewdemo.h51
-rw-r--r--examples/opieui/olistviewdemo/olistviewdemo.pro23
-rw-r--r--examples/opieui/opieui.pro5
-rw-r--r--examples/opieui/osplitter_example/osplitter_example.cpp34
-rw-r--r--examples/opieui/osplitter_example/osplitter_example.h19
-rw-r--r--examples/opieui/osplitter_example/osplitter_example.pro13
-rw-r--r--examples/opieui/osplitter_example/osplitter_mail.cpp81
-rw-r--r--examples/opieui/osplitter_example/osplitter_mail.h51
-rw-r--r--examples/opieui/osplitter_example/osplitter_mail.pro12
-rw-r--r--examples/opieui/oversatileviewdemo/1.pngbin0 -> 1969 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/1small.pngbin0 -> 708 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/2.pngbin0 -> 2333 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/2small.pngbin0 -> 875 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/3.pngbin0 -> 2009 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/3small.pngbin0 -> 921 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/4.pngbin0 -> 2076 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/4small.pngbin0 -> 762 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/5.pngbin0 -> 2266 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/5small.pngbin0 -> 743 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/6.pngbin0 -> 2491 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/6small.pngbin0 -> 894 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/folder_closed.pngbin0 -> 675 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/folder_closed32.pngbin0 -> 2105 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/folder_opened.pngbin0 -> 743 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/folder_opened32.pngbin0 -> 2112 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/leaf.pngbin0 -> 717 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/leaf32.pngbin0 -> 1904 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/main.cpp32
-rw-r--r--examples/opieui/oversatileviewdemo/opieuidemo.cpp203
-rw-r--r--examples/opieui/oversatileviewdemo/opieuidemo.h60
-rw-r--r--examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp160
-rw-r--r--examples/opieui/oversatileviewdemo/oversatileviewdemo.h77
-rw-r--r--examples/opieui/oversatileviewdemo/oversatileviewdemo.pro17
-rw-r--r--examples/opieui/owidgetstack_example/owidgetstack_example.cpp133
-rw-r--r--examples/opieui/owidgetstack_example/owidgetstack_example.h27
-rw-r--r--examples/opieui/owidgetstack_example/owidgetstack_example.pro13
41 files changed, 1306 insertions, 0 deletions
diff --git a/examples/opieui/okeyconfigwidget/keyconfig.pro b/examples/opieui/okeyconfigwidget/keyconfig.pro
new file mode 100644
index 0000000..5f379ef
--- a/dev/null
+++ b/examples/opieui/okeyconfigwidget/keyconfig.pro
@@ -0,0 +1,12 @@
1CONFIG += qt
2
3TEMPLATE = app
4SOURCES = testwidget.cpp
5HEADERS = testwidget.h
6
7INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/noncore/graphics/opie-eye/lib/
8DESTPATH += $(OPIEDIR)/include
9
10LIBS += -lopieui2 -lopiecore2
11
12include( $(OPIEDIR)/include.pro )
diff --git a/examples/opieui/okeyconfigwidget/testwidget.cpp b/examples/opieui/okeyconfigwidget/testwidget.cpp
new file mode 100644
index 0000000..6d2c773
--- a/dev/null
+++ b/examples/opieui/okeyconfigwidget/testwidget.cpp
@@ -0,0 +1,128 @@
1#include "testwidget.h"
2
3#include <opie2/okeyconfigwidget.h>
4
5#include <opie2/oapplicationfactory.h>
6#include <opie2/otabwidget.h>
7
8#include <qpe/qpeapplication.h>
9
10#include <qevent.h>
11#include <qlayout.h>
12#include <qpushbutton.h>
13#include <qmainwindow.h>
14#include <qdialog.h>
15
16
17/**
18 * QObject with signals and slots inside a .cpp
19 * requires the .moc at the bottom! and a run of qmake
20 */
21class MainWindow : public QMainWindow {
22 Q_OBJECT
23public:
24 static QString appName() {
25 return QString::fromLatin1("keyconfig");
26 }
27 MainWindow( QWidget*, const char*, WFlags fl );
28 ~MainWindow() {}
29private slots:
30 void slotClicked();
31private:
32 Opie::Core::OKeyConfigManager *m_manager;
33};
34
35
36OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> )
37
38
39MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl )
40 : QMainWindow( parent, name, fl )
41{
42 QVBoxLayout *lay = new QVBoxLayout( this );
43 QPushButton *btn = new QPushButton( tr("Configure" ), this );
44 TestMainWindow *wid = new TestMainWindow( this, "name", 0 );
45
46 lay->addWidget( btn );
47 lay->addWidget( wid );
48 m_manager = wid->manager();
49
50 connect( btn, SIGNAL(clicked()), this, SLOT(slotClicked()) );
51}
52
53void MainWindow::slotClicked() {
54 QDialog diag( this, "name", true );
55 diag.setCaption( tr( "Manage Keys" ) );
56
57 QHBoxLayout *lay = new QHBoxLayout( &diag );
58 Opie::Ui::OKeyConfigWidget *wid = new Opie::Ui::OKeyConfigWidget( &diag, "key config" );
59 wid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
60 wid->insert( tr("MainWindow Options" ), m_manager );
61 wid->load();
62
63 lay->addWidget( wid );
64
65 if ( QPEApplication::execDialog( &diag ) == QDialog::Accepted ) {
66 wid->save();
67 }
68}
69
70TestMainWindow::TestMainWindow( QWidget* parent, const char* slot, WFlags fl )
71 : Opie::Ui::OListView( parent, slot, fl)
72{
73 addColumn( tr( "A Doo" ) );
74 addColumn( tr( "B Doo" ) );
75
76 m_config = new Opie::Core::OConfig( "test_config_foo" );
77
78 /* generate the black list */
79 Opie::Core::OKeyPair::List blackList;
80 blackList.append( Opie::Core::OKeyPair::leftArrowKey() );
81 blackList.append( Opie::Core::OKeyPair::rightArrowKey() );
82 blackList.append( Opie::Core::OKeyPair::downArrowKey() );
83 blackList.append( Opie::Core::OKeyPair::upArrowKey() );
84
85 m_manager = new Opie::Core::OKeyConfigManager( m_config, "Key Group",
86 blackList, false, this, "Key Manager" );
87
88 m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(),
89 10, Opie::Core::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this,
90 SLOT(slotDelete(QWidget*,QKeyEvent*)) ) );
91 m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(),
92 11, Opie::Core::OKeyPair( Qt::Key_S, Qt::AltButton ) ) );
93
94 connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Core::OKeyConfigItem&)),
95 this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem&)) );
96// when commenting the line below out the keyPressEvent will work
97 m_manager->handleWidget( this );
98 m_manager->load();
99}
100
101TestMainWindow::~TestMainWindow() {
102 m_manager->save();
103 delete m_config;
104}
105
106Opie::Core::OKeyConfigManager* TestMainWindow::manager() {
107 return m_manager;
108}
109
110/*
111 * This only works if we do not handle the even with m_manager->handleWidget( this )
112 * So this is only for demo purposes
113 */
114void TestMainWindow::keyPressEvent( QKeyEvent* ev ) {
115 owarn << "String is "+ m_manager->handleKeyEvent( ev ).text() << oendl;
116 owarn << "Id was " << m_manager->handleKeyEventId( ev ) << " " << ev->key() << " " << ev->state() << " " << ev->ascii() << "" << oendl;
117 ev->ignore();
118}
119
120void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) {
121 owarn << "Slot Delete " << wid << " " << ev->key() << " " << ev->state() << "" << oendl;
122}
123
124void TestMainWindow::slotAction( QWidget* wid, QKeyEvent* ev, const Opie::Core::OKeyConfigItem& item) {
125 owarn << "Slot Action " << wid << " " << ev->key() << " " << ev->state() << " " << item.text() << " " << item.id() << "" << oendl;
126}
127
128#include "testwidget.moc"
diff --git a/examples/opieui/okeyconfigwidget/testwidget.h b/examples/opieui/okeyconfigwidget/testwidget.h
new file mode 100644
index 0000000..6ecb346
--- a/dev/null
+++ b/examples/opieui/okeyconfigwidget/testwidget.h
@@ -0,0 +1,40 @@
1#ifndef TEST_WIDGET_H
2#define TEST_WIDGET_H
3
4#include <qmainwindow.h>
5
6#include <opie2/olistview.h>
7
8namespace Opie{
9namespace Ui{
10 class OTabWidget;
11 class OListView;
12}
13namespace Core {
14 class OConfig;
15 class OKeyConfigManager;
16 class OKeyConfigItem;
17}
18}
19class QKeyEvent;
20
21
22class TestMainWindow : public Opie::Ui::OListView {
23 Q_OBJECT
24public:
25
26 TestMainWindow(QWidget* parent, const char*, WFlags fl );
27 ~TestMainWindow();
28
29 Opie::Core::OKeyConfigManager *manager();
30protected:
31 void keyPressEvent( QKeyEvent* );
32private slots:
33 void slotDelete( QWidget*, QKeyEvent* );
34 void slotAction( QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem& );
35private:
36 Opie::Core::OConfig *m_config;
37 Opie::Core::OKeyConfigManager *m_manager;
38};
39
40#endif
diff --git a/examples/opieui/olistviewdemo/main.cpp b/examples/opieui/olistviewdemo/main.cpp
new file mode 100644
index 0000000..cd49c28
--- a/dev/null
+++ b/examples/opieui/olistviewdemo/main.cpp
@@ -0,0 +1,29 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14**********************************************************************/
15
16#include "olistviewdemo.h"
17#include <opie2/oapplication.h>
18
19using namespace Opie::Ui;
20using namespace Opie::Core;
21
22int main( int argc, char **argv )
23{
24 OApplication a( argc, argv, "OListViewDemo" );
25 OListViewDemo e;
26 a.showMainWidget(&e);
27 return a.exec();
28}
29
diff --git a/examples/opieui/olistviewdemo/olistviewdemo.cpp b/examples/opieui/olistviewdemo/olistviewdemo.cpp
new file mode 100644
index 0000000..4c05620
--- a/dev/null
+++ b/examples/opieui/olistviewdemo/olistviewdemo.cpp
@@ -0,0 +1,86 @@
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 "olistviewdemo.h"
34
35/* OPIE */
36#include <opie2/olistview.h>
37#include <opie2/odebug.h>
38
39/* QT */
40#include <qstring.h>
41#include <qpixmap.h>
42#include <qlistview.h>
43
44using namespace Opie::Ui;
45
46OListViewDemo::OListViewDemo( QWidget* parent, const char* name, WFlags f )
47 :QVBox( parent, name, f )
48{
49 lv = new ONamedListView( this );
50 lv->setRootIsDecorated( true );
51 lv->addColumns( QStringList::split( ' ', "Column1 Column2 Column3 Column4" ) );
52
53 ONamedListViewItem* item = new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
54 item->setText( "Column2", "ModifiedText" );
55 item->setText( "Column5", "ThisColumnDoesNotExits" );
56
57 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
58 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
59 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Minni" ) );
60 item = new ONamedListViewItem( lv, QStringList::split( ' ', "XXX YYY ZZZ ***" ) );
61 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
62 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
63
64 new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) );
65 new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) );
66 new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) );
67 item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComes" ) );
68 item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComesSoon" ) );
69 item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 Mickey" ) );
70
71 if ( lv->find( 3, "Mickey", 3 ) )
72 odebug << "found Mickey :-)" << oendl;
73 else
74 odebug << "did not found Mickey :-(" << oendl;
75
76 if ( lv->find( 3, "Minni", 0 ) )
77 odebug << "found Minni :-)" << oendl;
78 else
79 odebug << "did not found Minni :-(" << oendl;
80
81}
82
83OListViewDemo::~OListViewDemo()
84{
85}
86
diff --git a/examples/opieui/olistviewdemo/olistviewdemo.h b/examples/opieui/olistviewdemo/olistviewdemo.h
new file mode 100644
index 0000000..0b5c498
--- a/dev/null
+++ b/examples/opieui/olistviewdemo/olistviewdemo.h
@@ -0,0 +1,51 @@
1/*
2                 This file is part of the Opie Project
3
4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29
30*/
31
32#ifndef OLISTVIEWDEMO_H
33#define OLISTVIEWDEMO_H
34
35#include <qvbox.h>
36#include <opie2/olistview.h>
37
38class OListViewDemo: public QVBox
39{
40 Q_OBJECT
41
42 public:
43 OListViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 );
44 virtual ~OListViewDemo();
45
46 private:
47 Opie::Ui::ONamedListView* lv;
48
49};
50
51#endif
diff --git a/examples/opieui/olistviewdemo/olistviewdemo.pro b/examples/opieui/olistviewdemo/olistviewdemo.pro
new file mode 100644
index 0000000..52c3ceb
--- a/dev/null
+++ b/examples/opieui/olistviewdemo/olistviewdemo.pro
@@ -0,0 +1,23 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS = olistviewdemo.h
4SOURCES = olistviewdemo.cpp \
5 main.cpp
6INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lopieui2 -lopiecore2 -lqpe
9TARGET = olistviewdemo
10MOC_DIR = moc
11OBJECTS_DIR = obj
12
13
14
15
16!contains( platform, x11 ) {
17 include( $(OPIEDIR)/include.pro )
18}
19
20contains( platform, x11 ) {
21 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
22}
23
diff --git a/examples/opieui/opieui.pro b/examples/opieui/opieui.pro
new file mode 100644
index 0000000..853ac50
--- a/dev/null
+++ b/examples/opieui/opieui.pro
@@ -0,0 +1,5 @@
1TEMPLATE = subdirs
2SUBDIRS = olistviewdemo owidgetstack_example osplitter_example
3
4
5
diff --git a/examples/opieui/osplitter_example/osplitter_example.cpp b/examples/opieui/osplitter_example/osplitter_example.cpp
new file mode 100644
index 0000000..07c7e51
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_example.cpp
@@ -0,0 +1,34 @@
1#include "osplitter_example.h"
2
3/* OPIE */
4
5#include <opie2/osplitter.h>
6#include <opie2/ofileselector.h>
7#include <qpe/qpeapplication.h>
8#include <opie2/oapplicationfactory.h>
9
10/* QT*/
11#include <qdir.h>
12#include <qlayout.h>
13
14using namespace Opie::Ui;
15using namespace Opie::Core;
16
17OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> )
18
19OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f )
20 : QWidget( w, n, f ){
21 QVBoxLayout * lay = new QVBoxLayout(this);
22 OSplitter * splitter = new OSplitter( Horizontal, this );
23 lay->addWidget( splitter );
24
25 OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector,
26 OFileSelector::Normal, QDir::homeDirPath(),
27 QString::null );
28 splitter->addWidget( selector, "zoom", tr("Selector 1") );
29
30 selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal,
31 QDir::homeDirPath(), QString::null );
32 splitter->addWidget( selector, "zoom", tr("Selector 2") );
33
34}
diff --git a/examples/opieui/osplitter_example/osplitter_example.h b/examples/opieui/osplitter_example/osplitter_example.h
new file mode 100644
index 0000000..0cf28aa
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_example.h
@@ -0,0 +1,19 @@
1/*
2 * May be used, copied and modified wihtout any limitation
3 */
4
5#ifndef OSPlitter_EXAMPLE_H
6#define OSPlitter_EXAMPLE_H
7
8#include <qvbox.h>
9
10class OSplitterExample : public QWidget {
11 Q_OBJECT
12public:
13 static QString appName() { return QString::fromLatin1("osplitter_example"); }
14 OSplitterExample( QWidget *parent, const char* name, WFlags fl );
15
16};
17
18
19#endif
diff --git a/examples/opieui/osplitter_example/osplitter_example.pro b/examples/opieui/osplitter_example/osplitter_example.pro
new file mode 100644
index 0000000..9f156a1
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_example.pro
@@ -0,0 +1,13 @@
1CONFIG = qt warn_on
2TEMPLATE = app
3TARGET = osplitter_example
4
5HEADERS = osplitter_example.h
6SOURCES = osplitter_example.cpp
7
8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDSPATH += $(OPIEDIR)/include
10
11LIBS += -lqpe -lopieui2
12
13include( $(OPIEDIR)/include.pro )
diff --git a/examples/opieui/osplitter_example/osplitter_mail.cpp b/examples/opieui/osplitter_example/osplitter_mail.cpp
new file mode 100644
index 0000000..d747bd9
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_mail.cpp
@@ -0,0 +1,81 @@
1
2#include <qstring.h>
3#include <qlabel.h>
4#include <qheader.h>
5#include <qlayout.h>
6
7#include <qpe/qpeapplication.h>
8
9#include <opie2/oapplicationfactory.h>
10#include "osplitter_mail.h"
11
12using namespace Opie::Ui;
13
14OPIE_EXPORT_APP( OApplicationFactory<ListViews> )
15
16class Folder {
17 int dummy;
18};
19
20// -----------------------------------------------------------------
21
22ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
23 : QWidget( p, name, fl ) {
24 qApp->installEventFilter( this );
25 m_lstFolders.setAutoDelete( true );
26 QHBoxLayout *lay = new QHBoxLayout(this);
27
28 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" );
29 lay->addWidget( m_splitter );
30 connect(m_splitter, SIGNAL(sizeChanged(bool,Orientation) ),
31 this, SLOT(slotSizeChange(bool,Orientation) ) );
32
33 m_overview = new QListView( m_splitter );
34 m_overview->header()->setClickEnabled( FALSE );
35 m_overview->addColumn( tr("Folder") );
36// m_overview->setMaximumWidth( 200 );
37 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") );
38 m_splitter->setSizeChange( 300 );
39
40 /* OSplitter starts with the small mode */
41 m_messages = 0;
42 m_message = m_attach = 0;
43
44 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" );
45 splitti->setSizeChange( 300 );
46 splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
47
48 QLabel *lbl = new QLabel(splitti);
49 lbl->setTextFormat ( Qt::RichText );
50 lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>");
51
52 m_messages = new QListView( splitti );
53 m_messages->addColumn(" Messages ");
54
55 folder1 = new QListView( splitti );
56 folder1->addColumn( "Messages 2 " );
57
58 splitti->addWidget(m_messages, "mail", tr("Mails") );
59 splitti->addWidget(folder1, "folder", tr("Folder") );
60 splitti->addWidget( lbl, "logo", tr("Label") );
61 m_message = lbl;
62
63 m_splitter->addWidget( splitti );
64
65}
66
67
68ListViews::~ListViews() {
69
70}
71
72
73bool ListViews::eventFilter( QObject* obj, QEvent* ev ) {
74 if (!obj->isWidgetType() )
75 return false;
76 if ( ev->type() == QEvent::MouseButtonRelease ) {
77 owarn << " name " << obj->name() << ", class " << obj->className() << "" << oendl;
78 }
79
80 return false;
81}
diff --git a/examples/opieui/osplitter_example/osplitter_mail.h b/examples/opieui/osplitter_example/osplitter_mail.h
new file mode 100644
index 0000000..67961fb
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_mail.h
@@ -0,0 +1,51 @@
1/*
2 * You may use, modify and distribute this code without any limitation
3 */
4
5/*
6 * Header file for a more complete email client like
7 * layout
8 */
9
10#ifndef OPIE_SPLITTER_MAIL_EXAMPLE_H
11#define OPIE_SPLITTER_MAIL_EXAMPLE_H
12
13#include <qwidget.h>
14#include <qlist.h>
15#include <qlistview.h>
16
17#include <opie2/osplitter.h>
18
19
20class Folder;
21class QLabel;
22
23class ListViews : public QWidget {
24 Q_OBJECT
25public:
26 static QString appName() { return QString::fromLatin1("osplitter-mail"); }
27 ListViews( QWidget* parent, const char * name, WFlags fl );
28 ~ListViews();
29
30 bool eventFilter( QObject* , QEvent* );
31private:
32 void initFolders();
33 void initFolder( Folder *folder, unsigned int &count );
34
35 QListView *m_messages, *m_overview;
36 QLabel *m_message, *m_attach;
37 QList<QListView> m_folders; // used in tab mode
38 QList<Folder> m_lstFolders;
39 bool m_mode : 1; // bitfield
40 Opie::Ui::OSplitter *m_splitter;
41 Opie::Ui::OSplitter *splitti;
42 QListView *folder1;
43#if 0
44//private slots:
45// void slotFolderChanged( QListViewItem* );
46// void slotMessageChanged();
47// void slotSizeChange( bool, const QSize& );
48#endif
49};
50
51#endif
diff --git a/examples/opieui/osplitter_example/osplitter_mail.pro b/examples/opieui/osplitter_example/osplitter_mail.pro
new file mode 100644
index 0000000..f9c43ef
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_mail.pro
@@ -0,0 +1,12 @@
1CONFIG += qt warn_on
2TEMPLATE = app
3TARGET = osplitter-mail
4
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDSPATH += $(OPIEDIR)/include
7
8HEADERS = osplitter_mail.h
9SOURCES = osplitter_mail.cpp
10
11LIBS += -lqpe -lopieui2
12include( $(OPIEDIR)/include.pro )
diff --git a/examples/opieui/oversatileviewdemo/1.png b/examples/opieui/oversatileviewdemo/1.png
new file mode 100644
index 0000000..0e2e41b
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/1.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/1small.png b/examples/opieui/oversatileviewdemo/1small.png
new file mode 100644
index 0000000..ce6b262
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/1small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/2.png b/examples/opieui/oversatileviewdemo/2.png
new file mode 100644
index 0000000..8a0181d
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/2.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/2small.png b/examples/opieui/oversatileviewdemo/2small.png
new file mode 100644
index 0000000..82a4431
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/2small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/3.png b/examples/opieui/oversatileviewdemo/3.png
new file mode 100644
index 0000000..8a58d6c
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/3.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/3small.png b/examples/opieui/oversatileviewdemo/3small.png
new file mode 100644
index 0000000..073ba55
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/3small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/4.png b/examples/opieui/oversatileviewdemo/4.png
new file mode 100644
index 0000000..198891b
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/4.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/4small.png b/examples/opieui/oversatileviewdemo/4small.png
new file mode 100644
index 0000000..7f1cc01
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/4small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/5.png b/examples/opieui/oversatileviewdemo/5.png
new file mode 100644
index 0000000..ee7344a
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/5.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/5small.png b/examples/opieui/oversatileviewdemo/5small.png
new file mode 100644
index 0000000..105b038
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/5small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/6.png b/examples/opieui/oversatileviewdemo/6.png
new file mode 100644
index 0000000..72c3692
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/6.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/6small.png b/examples/opieui/oversatileviewdemo/6small.png
new file mode 100644
index 0000000..1db2a30
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/6small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/folder_closed.png b/examples/opieui/oversatileviewdemo/folder_closed.png
new file mode 100644
index 0000000..4157333
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/folder_closed.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/folder_closed32.png b/examples/opieui/oversatileviewdemo/folder_closed32.png
new file mode 100644
index 0000000..acc992c
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/folder_closed32.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/folder_opened.png b/examples/opieui/oversatileviewdemo/folder_opened.png
new file mode 100644
index 0000000..5e7e37e
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/folder_opened.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/folder_opened32.png b/examples/opieui/oversatileviewdemo/folder_opened32.png
new file mode 100644
index 0000000..acd3265
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/folder_opened32.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/leaf.png b/examples/opieui/oversatileviewdemo/leaf.png
new file mode 100644
index 0000000..c8435ec
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/leaf.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/leaf32.png b/examples/opieui/oversatileviewdemo/leaf32.png
new file mode 100644
index 0000000..5e90ead
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/leaf32.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/main.cpp b/examples/opieui/oversatileviewdemo/main.cpp
new file mode 100644
index 0000000..e48395a
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/main.cpp
@@ -0,0 +1,32 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14**********************************************************************/
15
16#include "opieuidemo.h"
17
18#include <opie2/oapplication.h>
19
20using namespace Opie::Core;
21using namespace Opie::Ui;
22
23int main( int argc, char **argv )
24{
25 OApplication a( argc, argv, "Opie UI Demo" );
26 odebug << "." << oendl;
27 OpieUIDemo e;
28 odebug << "." << oendl;
29 a.showMainWidget(&e);
30 odebug << "." << oendl;
31 return a.exec();
32}
diff --git a/examples/opieui/oversatileviewdemo/opieuidemo.cpp b/examples/opieui/oversatileviewdemo/opieuidemo.cpp
new file mode 100644
index 0000000..a2cdd5a
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/opieuidemo.cpp
@@ -0,0 +1,203 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14***********************************************************************/
15
16// Qt
17
18#include <qcolor.h>
19#include <qpopupmenu.h>
20#include <qmenubar.h>
21#include <qmessagebox.h>
22#include <qvbox.h>
23#include <qstring.h>
24#include <qstringlist.h>
25
26// Qtopia
27
28#include <qpe/qpeapplication.h>
29#include <qpe/global.h>
30
31// Opie
32
33#include <opie2/odevice.h>
34
35#include <opie2/ocompletionbox.h>
36#include <opie2/olineedit.h>
37#include <opie2/ocombobox.h>
38#include <opie2/oeditlistbox.h>
39#include <opie2/oselector.h>
40#include <opie2/opopupmenu.h>
41
42#include <qtabwidget.h>
43#include "oversatileviewdemo.h"
44
45// Local
46
47#include "opieuidemo.h"
48
49using namespace Opie::Core;
50using namespace Opie::Ui;
51
52enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector };
53
54OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl )
55 : QMainWindow( parent, name, fl )
56{
57
58 QMenuBar* mbar = this->menuBar();
59 OPopupMenu* demo = new OPopupMenu( this );
60 demo->setTitle( "Title" );
61 demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox );
62 demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit );
63 demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox );
64 demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox );
65 demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector );
66 mbar->insertItem( "Demonstrate", demo );
67
68 build();
69
70}
71
72OpieUIDemo::~OpieUIDemo()
73{
74}
75
76void OpieUIDemo::build()
77{
78 main = new QTabWidget( this, "tabwidget" );
79 setCentralWidget( main );
80 main->show();
81
82 main->addTab( new OVersatileViewDemo( main ), "VersatileView" );
83}
84
85
86void OpieUIDemo::demo( int d )
87{
88 switch (d)
89 {
90 case ocompletionbox: demoOCompletionBox(); break;
91 case olineedit: demoOLineEdit(); break;
92 case ocombobox: demoOComboBox(); break;
93 case oeditlistbox: demoOEditListBox(); break;
94 case oselector: demoOSelector(); break;
95
96 }
97
98}
99
100void OpieUIDemo::demoOCompletionBox()
101{
102 odebug << "ocompletionbox" << oendl;
103
104 OCompletionBox* box = new OCompletionBox( 0 );
105 box->insertItem( "This CompletionBox" );
106 box->insertItem( "Says 'Hello World'" );
107 box->insertItem( "Here are some" );
108 box->insertItem( "Additional Items" );
109 box->insertItem( "Complete Completion Box" );
110
111 connect( box, SIGNAL( activated(const QString&) ), this, SLOT( messageBox(const QString&) ) );
112 box->popup();
113
114}
115
116void OpieUIDemo::demoOLineEdit()
117{
118 odebug << "olineedit" << oendl;
119
120 OLineEdit *edit = new OLineEdit( 0, "lineedit" );
121
122 edit->setCompletionMode( OGlobalSettings::CompletionPopup );
123 OCompletion* comp = edit->completionObject();
124
125 QStringList list;
126 list << "mickeyl@handhelds.org";
127 list << "mickey@tm.informatik.uni-frankfurt.de";
128 list << "mickey@vanille.de";
129
130 comp->setItems( list );
131
132 edit->show();
133
134}
135
136void OpieUIDemo::demoOComboBox()
137{
138 odebug << "ocombobox" << oendl;
139
140 OComboBox *combo = new OComboBox( true, 0, "combobox" );
141
142 combo->setCompletionMode( OGlobalSettings::CompletionPopup );
143 OCompletion* comp = combo->completionObject();
144
145 QStringList ilist;
146 ilist << "kergoth@handhelds.org";
147 ilist << "harlekin@handhelds.org";
148 ilist << "groucho@handhelds.org";
149 combo->insertStringList( ilist );
150
151 QStringList clist;
152 clist << "mickeyl@handhelds.org";
153 clist << "mickey@tm.informatik.uni-frankfurt.de";
154 clist << "mickey@vanille.de";
155 comp->setItems( clist );
156
157 combo->show();
158
159}
160
161void OpieUIDemo::demoOEditListBox()
162{
163 odebug << "oeditlistbox" << oendl;
164
165 OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" );
166
167 edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup );
168 OCompletion* comp = edit->lineEdit()->completionObject();
169 QStringList clist;
170 clist << "Completion everywhere";
171 clist << "Cool Completion everywhere";
172 clist << "History History History";
173 comp->setItems( clist );
174
175 QStringList list;
176 list << "kergoth@handhelds.org";
177 list << "harlekin@handhelds.org";
178 list << "groucho@handhelds.org";
179 list << "mickeyl@handhelds.org";
180 edit->insertStringList( list );
181
182 edit->show();
183
184}
185
186void OpieUIDemo::demoOSelector()
187{
188 odebug << "oselector" << oendl;
189
190 OHSSelector* sel = new OHSSelector( 0, "gradientselector" );
191 //#sel->resize( QSize( 200, 30 ) );
192 //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) );
193 //#sel->setText( "Dark", "Light" );
194
195 sel->show();
196}
197
198void OpieUIDemo::messageBox( const QString& text )
199{
200 QString info;
201 info = "You have selected '" + text + "'";
202 QMessageBox::information( this, "OpieUIDemo", info );
203}
diff --git a/examples/opieui/oversatileviewdemo/opieuidemo.h b/examples/opieui/oversatileviewdemo/opieuidemo.h
new file mode 100644
index 0000000..382885f
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/opieuidemo.h
@@ -0,0 +1,60 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14**********************************************************************/
15
16#ifndef OPIEUIDEMO_H
17#define OPIEUIDEMO_H
18
19#include <qmainwindow.h>
20
21namespace Opie {
22namespace Ui {
23class OVersatileView;
24}
25}
26class QTabWidget;
27class QVBox;
28
29class OpieUIDemo : public QMainWindow {
30 Q_OBJECT
31
32public:
33
34 OpieUIDemo( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel );
35 ~OpieUIDemo();
36
37 void demoOCompletionBox();
38 void demoOLineEdit();
39 void demoOComboBox();
40 void demoOEditListBox();
41 void demoOSelector();
42
43public slots:
44 void demo( int );
45 void messageBox( const QString& text );
46
47protected:
48 void build();
49 void buildVV( QVBox* b );
50
51private:
52 QTabWidget* main;
53
54 Opie::Ui::OVersatileView* vv;
55
56};
57
58
59
60#endif
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}
diff --git a/examples/opieui/oversatileviewdemo/oversatileviewdemo.h b/examples/opieui/oversatileviewdemo/oversatileviewdemo.h
new file mode 100644
index 0000000..35e2c3c
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/oversatileviewdemo.h
@@ -0,0 +1,77 @@
1/*
2                 This file is part of the Opie Project
3
4              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29
30*/
31
32#ifndef OVERSATILEVIEWDEMO_H
33#define OVERSATILEVIEWDEMO_H
34
35#include <qvbox.h>
36
37namespace Opie {
38namespace Ui {
39class OVersatileView;
40class OVersatileViewItem;
41}
42}
43
44class OVersatileViewDemo: public QVBox
45{
46 Q_OBJECT
47
48 public:
49 OVersatileViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 );
50 virtual ~OVersatileViewDemo();
51
52 public slots:
53 void selectionChanged();
54 void selectionChanged( Opie::Ui::OVersatileViewItem * );
55 void currentChanged( Opie::Ui::OVersatileViewItem * );
56 void clicked( Opie::Ui::OVersatileViewItem * );
57 void pressed( OPie::Ui::OVersatileViewItem * );
58
59 void doubleClicked( Opie::Ui::OVersatileViewItem *item );
60 void returnPressed( Opie::Ui::OVersatileViewItem *item );
61
62 void onItem( Opie::Ui::OVersatileViewItem *item );
63 void onViewport();
64
65 void expanded( Opie::Ui::OVersatileViewItem *item );
66 void collapsed( Opie::Ui::OVersatileViewItem *item );
67
68 void moved();
69
70 void contextMenuRequested( Opie::Ui::OVersatileViewItem *item, const QPoint&, int col );
71
72 private:
73 Opie::Ui::OVersatileView* vv;
74
75};
76
77#endif
diff --git a/examples/opieui/oversatileviewdemo/oversatileviewdemo.pro b/examples/opieui/oversatileviewdemo/oversatileviewdemo.pro
new file mode 100644
index 0000000..ff78095
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/oversatileviewdemo.pro
@@ -0,0 +1,17 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS = opieuidemo.h \
4 oversatileviewdemo.h
5SOURCES = opieuidemo.cpp \
6 oversatileviewdemo.cpp \
7 main.cpp
8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDPATH += $(OPIEDIR)/include
10LIBS += -lopieui2 -lopiecore2
11TARGET = opieuidemo
12MOC_DIR = moc
13OBJECTS_DIR = obj
14
15include( $(OPIEDIR)/include.pro )
16
17
diff --git a/examples/opieui/owidgetstack_example/owidgetstack_example.cpp b/examples/opieui/owidgetstack_example/owidgetstack_example.cpp
new file mode 100644
index 0000000..272e42b
--- a/dev/null
+++ b/examples/opieui/owidgetstack_example/owidgetstack_example.cpp
@@ -0,0 +1,133 @@
1/*
2 * You may use, modify and distribute this example without any limitation
3 */
4
5#include "owidgetstack_example.h"
6
7/* OPIE */
8#include <opie2/oapplicationfactory.h>
9#include <opie2/owidgetstack.h>
10#include <qpe/resource.h>
11
12/* QT */
13#include <qaction.h>
14#include <qtoolbar.h>
15#include <qpopupmenu.h>
16#include <qmenubar.h>
17#include <qlayout.h>
18#include <qlabel.h>
19#include <qpushbutton.h>
20#include <qsignalmapper.h>
21
22using namespace Opie::Core;
23using namespace Opie::Ui;
24
25OPIE_EXPORT_APP( OApplicationFactory<StackExample> )
26
27StackExample::StackExample( QWidget* parent, const char* name, WFlags fl )
28 : QMainWindow( parent, name, fl )
29{
30 m_stack = new OWidgetStack( this );
31 setCentralWidget( m_stack );
32
33 /* nice Signal Mapper ;) */
34 QSignalMapper *sm = new QSignalMapper(this);
35 connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) );
36
37 /* toolbar first but this should be known from the other examples */
38 setToolBarsMovable( false );
39
40 /* only a menubar here */
41 QToolBar* holder = new QToolBar( this );
42 holder->setHorizontalStretchable( true );
43
44 QMenuBar *bar = new QMenuBar( holder );
45 QPopupMenu *menu = new QPopupMenu( this );
46
47 QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"),
48 QString::null, 0, this, 0 );
49 sm->setMapping(a, 1 );
50 connect(a, SIGNAL(activated() ),
51 sm, SLOT(map() ) );
52 a->addTo( menu );
53
54 a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"),
55 QString::null, 0, this, 0 );
56 sm->setMapping(a, 2 );
57 connect(a, SIGNAL(activated() ),
58 sm, SLOT(map() ) );
59 a->addTo( menu );
60
61 a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"),
62 QString::null, 0, this, 0 );
63 sm->setMapping(a, 3 );
64 connect(a, SIGNAL(activated() ),
65 sm, SLOT(map() ) );
66 a->addTo( menu );
67
68 a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"),
69 QString::null, 0, this, 0 );
70 sm->setMapping(a, 4 );
71 connect(a, SIGNAL(activated() ),
72 sm, SLOT(map() ) );
73
74 bar->insertItem( tr("Actions"), menu );
75
76 /* now the gui */
77
78 /* first widget, main widget */
79 QWidget * wid = new QWidget( m_stack );
80 QGridLayout *grid = new QGridLayout(wid, 2, 2 );
81
82 QPushButton *btn = new QPushButton( tr("Show Details Small"), wid, "details1" );
83 sm->setMapping(btn, 2 );
84 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
85 grid->addWidget( btn, 0, 0 );
86
87 btn = new QPushButton( tr("Show Details Medium"), wid, "details2");
88 sm->setMapping(btn, 3 );
89 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
90 grid->addWidget( btn, 0, 1 );
91
92 btn = new QPushButton( tr("Show Details All"), wid, "details3");
93 sm->setMapping(btn, 4 );
94 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
95 grid->addWidget( btn, 1, 1 );
96
97 m_stack->addWidget( wid, 1 );
98 m_main = wid;
99
100 QLabel *lbl = new QLabel(m_stack );
101 lbl->setText(tr("Only small Details are shown here. Määh") );
102 m_stack->addWidget( lbl, 2 );
103
104 lbl = new QLabel( m_stack );
105 lbl->setText( tr("Some more details....Wo ist das Schaf?") );
106 m_stack->addWidget( lbl, 3 );
107
108 lbl = new QLabel( m_stack );
109 lbl->setText( tr("<qt>Ne nicht in Bayerisch Gmain sondern in Berlin<br>Vermiss und meine Augen werden nicht eckig, da mein Bildschirm abgerundet ist<br>Es lebe Hamburg Süd,weiss du, verstehst du? ;)<br>Susi ist dOOf, es lebe die Ofenecke...", "hard to translate that") );
110 m_stack->addWidget( lbl, 4 );
111
112
113 /* THE signal mapper does all the magic */
114 m_stack->raiseWidget( m_main );
115}
116
117
118StackExample::~StackExample() {
119
120}
121
122
123
124void StackExample::closeEvent( QCloseEvent* ev) {
125 /* if the close even came when we displayed a details */
126 if (m_stack->visibleWidget() != m_main ) {
127 m_stack->raiseWidget( m_main );
128 ev->ignore();
129 return;
130 }
131
132 ev->accept();
133}
diff --git a/examples/opieui/owidgetstack_example/owidgetstack_example.h b/examples/opieui/owidgetstack_example/owidgetstack_example.h
new file mode 100644
index 0000000..c9b70cb
--- a/dev/null
+++ b/examples/opieui/owidgetstack_example/owidgetstack_example.h
@@ -0,0 +1,27 @@
1/*
2 * You may use, modify and distribute this example without any limitation
3 */
4
5#ifndef O_STACK_EXAMPLE_SIMPLE_H
6#define O_STACK_EXAMPLE_SIMPLE_H
7
8#include <qmainwindow.h>
9#include <opie2/owidgetstack.h>
10
11
12class StackExample : public QMainWindow {
13 Q_OBJECT
14public:
15 StackExample( QWidget* paren, const char* name, WFlags fl );
16 ~StackExample();
17 static QString appName() { return QString::fromLatin1("owidgetstack-example"); }
18
19protected:
20 void closeEvent( QCloseEvent* e );
21private:
22 Opie::Ui::OWidgetStack* m_stack;
23 QWidget* m_main;
24
25};
26
27#endif
diff --git a/examples/opieui/owidgetstack_example/owidgetstack_example.pro b/examples/opieui/owidgetstack_example/owidgetstack_example.pro
new file mode 100644
index 0000000..4cfce9c
--- a/dev/null
+++ b/examples/opieui/owidgetstack_example/owidgetstack_example.pro
@@ -0,0 +1,13 @@
1CONFIG += qt warn_on
2TEMPLATE = app
3TARGET = owidgetstack-example
4
5SOURCES = owidgetstack_example.cpp
6HEADERS = owidgetstack_example.h
7
8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDSPATH += $(OPIEDIR)/include
10
11LIBS += -lqpe -lopieui2
12
13include( $(OPIEDIR)/include.pro )