summaryrefslogtreecommitdiff
path: root/libopie2/examples/opieui
Unidiff
Diffstat (limited to 'libopie2/examples/opieui') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opieui/opieui.pro4
-rw-r--r--libopie2/examples/opieui/osplitter_example/.cvsignore6
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_example.cpp32
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_example.h20
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_example.pro13
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp82
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_mail.h49
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_mail.pro12
-rw-r--r--libopie2/examples/opieui/owidgetstack_example/.cvsignore6
-rw-r--r--libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp132
-rw-r--r--libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.h28
-rw-r--r--libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.pro13
12 files changed, 396 insertions, 1 deletions
diff --git a/libopie2/examples/opieui/opieui.pro b/libopie2/examples/opieui/opieui.pro
index ad66f47..853ac50 100644
--- a/libopie2/examples/opieui/opieui.pro
+++ b/libopie2/examples/opieui/opieui.pro
@@ -1,3 +1,5 @@
1TEMPLATE = subdirs 1TEMPLATE = subdirs
2SUBDIRS = olistviewdemo 2SUBDIRS = olistviewdemo owidgetstack_example osplitter_example
3
4
3 5
diff --git a/libopie2/examples/opieui/osplitter_example/.cvsignore b/libopie2/examples/opieui/osplitter_example/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/libopie2/examples/opieui/osplitter_example/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp
new file mode 100644
index 0000000..7ba0f0d
--- a/dev/null
+++ b/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp
@@ -0,0 +1,32 @@
1#include "osplitter_example.h"
2
3/* OPIE */
4
5#include <opie2/osplitter.h>
6#include <qpe/qpeapplication.h>
7#include <opie2/oapplicationfactory.h>
8
9/* QT*/
10#include <qdir.h>
11#include <qlayout.h>
12
13using namespace Opie;
14
15OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> )
16
17OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f )
18 : QWidget( w, n, f ){
19 QVBoxLayout * lay = new QVBoxLayout(this);
20 OSplitter * splitter = new OSplitter( Horizontal, this );
21 lay->addWidget( splitter );
22
23 OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector,
24 OFileSelector::Normal, QDir::homeDirPath(),
25 QString::null );
26 splitter->addWidget( selector, "zoom", tr("Selector 1") );
27
28 selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal,
29 QDir::homeDirPath(), QString::null );
30 splitter->addWidget( selector, "zoom", tr("Selector 2") );
31
32}
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_example.h b/libopie2/examples/opieui/osplitter_example/osplitter_example.h
new file mode 100644
index 0000000..176ad62
--- a/dev/null
+++ b/libopie2/examples/opieui/osplitter_example/osplitter_example.h
@@ -0,0 +1,20 @@
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#include <opie2/ofileselector.h>
10
11class OSplitterExample : public QWidget {
12 Q_OBJECT
13public:
14 static QString appName() { return QString::fromLatin1("osplitter_example"); }
15 OSplitterExample( QWidget *parent, const char* name, WFlags fl );
16
17};
18
19
20#endif
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_example.pro b/libopie2/examples/opieui/osplitter_example/osplitter_example.pro
new file mode 100644
index 0000000..224a1ee
--- a/dev/null
+++ b/libopie2/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/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp
new file mode 100644
index 0000000..4eaf3a9
--- a/dev/null
+++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp
@@ -0,0 +1,82 @@
1
2#include <qstring.h>
3#include <qlabel.h>
4#include <qheader.h>
5#include <qlayout.h>
6
7#include <qpe/qpeapplication.h>
8#include <opie/oapplicationfactory.h>
9
10#include "../osplitter.h"
11
12#include "osplitter_mail.h"
13
14
15OPIE_EXPORT_APP( OApplicationFactory<ListViews> )
16
17class Folder {
18 int dummy;
19};
20
21// -----------------------------------------------------------------
22
23ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
24 : QWidget( p, name, fl ) {
25 qApp->installEventFilter( this );
26 m_lstFolders.setAutoDelete( true );
27 QHBoxLayout *lay = new QHBoxLayout(this);
28
29 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" );
30 lay->addWidget( m_splitter );
31 connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ),
32 this, SLOT(slotSizeChange(bool, const QSize& ) ) );
33
34 m_overview = new QListView( m_splitter );
35 m_overview->header()->setClickEnabled( FALSE );
36 m_overview->addColumn( tr("Folder") );
37 m_overview->setMaximumWidth( 200 );
38 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") );
39 m_splitter->setSizeChange( 300 );
40
41 /* OSplitter starts with the small mode */
42 m_messages = 0;
43 m_message = m_attach = 0;
44
45 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" );
46 splitti->setSizeChange( 300 );
47 splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
48
49 QLabel *lbl = new QLabel(splitti);
50 lbl->setTextFormat ( Qt::RichText );
51 lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>");
52
53 m_messages = new QListView( splitti );
54 m_messages->addColumn(" Messages ");
55
56 folder1 = new QListView( splitti );
57 folder1->addColumn( "Messages 2 " );
58
59 splitti->addWidget(m_messages, "mail", tr("Mails") );
60 splitti->addWidget(folder1, "folder", tr("Folder") );
61 splitti->addWidget( lbl, "logo", tr("Label") );
62 m_message = lbl;
63
64 m_splitter->addWidget( splitti );
65
66}
67
68
69ListViews::~ListViews() {
70
71}
72
73
74bool ListViews::eventFilter( QObject* obj, QEvent* ev ) {
75 if (!obj->isWidgetType() )
76 return false;
77 if ( ev->type() == QEvent::MouseButtonRelease ) {
78 qWarning(" name %s, class %s", obj->name(), obj->className() );
79 }
80
81 return false;
82}
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.h b/libopie2/examples/opieui/osplitter_example/osplitter_mail.h
new file mode 100644
index 0000000..b7e7efe
--- a/dev/null
+++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.h
@@ -0,0 +1,49 @@
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
17class Folder;
18class QLabel;
19
20class OSplitter;
21class ListViews : public QWidget {
22 Q_OBJECT
23public:
24 static QString appName() { return QString::fromLatin1("osplitter-mail"); }
25 ListViews( QWidget* parent, const char * name, WFlags fl );
26 ~ListViews();
27
28 bool eventFilter( QObject* , QEvent* );
29private:
30 void initFolders();
31 void initFolder( Folder *folder, unsigned int &count );
32
33 QListView *m_messages, *m_overview;
34 QLabel *m_message, *m_attach;
35 QList<QListView> m_folders; // used in tab mode
36 QList<Folder> m_lstFolders;
37 bool m_mode : 1; // bitfield
38 OSplitter *m_splitter;
39 OSplitter *splitti;
40 QListView *folder1;
41#if 0
42//private slots:
43// void slotFolderChanged( QListViewItem* );
44// void slotMessageChanged();
45// void slotSizeChange( bool, const QSize& );
46#endif
47};
48
49#endif
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.pro b/libopie2/examples/opieui/osplitter_example/osplitter_mail.pro
new file mode 100644
index 0000000..ec6e626
--- a/dev/null
+++ b/libopie2/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 -lopie
12include ( $(OPIEDIR)/include.pro )
diff --git a/libopie2/examples/opieui/owidgetstack_example/.cvsignore b/libopie2/examples/opieui/owidgetstack_example/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/libopie2/examples/opieui/owidgetstack_example/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp
new file mode 100644
index 0000000..b1c5e70
--- a/dev/null
+++ b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp
@@ -0,0 +1,132 @@
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;
23
24OPIE_EXPORT_APP( OApplicationFactory<StackExample> )
25
26StackExample::StackExample( QWidget* parent, const char* name, WFlags fl )
27 : QMainWindow( parent, name, fl )
28{
29 m_stack = new OWidgetStack( this );
30 setCentralWidget( m_stack );
31
32 /* nice Signal Mapper ;) */
33 QSignalMapper *sm = new QSignalMapper(this);
34 connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) );
35
36 /* toolbar first but this should be known from the other examples */
37 setToolBarsMovable( false );
38
39 /* only a menubar here */
40 QToolBar* holder = new QToolBar( this );
41 holder->setHorizontalStretchable( true );
42
43 QMenuBar *bar = new QMenuBar( holder );
44 QPopupMenu *menu = new QPopupMenu( this );
45
46 QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"),
47 QString::null, 0, this, 0 );
48 sm->setMapping(a, 1 );
49 connect(a, SIGNAL(activated() ),
50 sm, SLOT(map() ) );
51 a->addTo( menu );
52
53 a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"),
54 QString::null, 0, this, 0 );
55 sm->setMapping(a, 2 );
56 connect(a, SIGNAL(activated() ),
57 sm, SLOT(map() ) );
58 a->addTo( menu );
59
60 a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"),
61 QString::null, 0, this, 0 );
62 sm->setMapping(a, 3 );
63 connect(a, SIGNAL(activated() ),
64 sm, SLOT(map() ) );
65 a->addTo( menu );
66
67 a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"),
68 QString::null, 0, this, 0 );
69 sm->setMapping(a, 4 );
70 connect(a, SIGNAL(activated() ),
71 sm, SLOT(map() ) );
72
73 bar->insertItem( tr("Actions"), menu );
74
75 /* now the gui */
76
77 /* first widget, main widget */
78 QWidget * wid = new QWidget( m_stack );
79 QGridLayout *grid = new QGridLayout(wid, 2, 2 );
80
81 QPushButton *btn = new QPushButton( tr("Show Details Small"), wid, "details1" );
82 sm->setMapping(btn, 2 );
83 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
84 grid->addWidget( btn, 0, 0 );
85
86 btn = new QPushButton( tr("Show Details Medium"), wid, "details2");
87 sm->setMapping(btn, 3 );
88 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
89 grid->addWidget( btn, 0, 1 );
90
91 btn = new QPushButton( tr("Show Details All"), wid, "details3");
92 sm->setMapping(btn, 4 );
93 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
94 grid->addWidget( btn, 1, 1 );
95
96 m_stack->addWidget( wid, 1 );
97 m_main = wid;
98
99 QLabel *lbl = new QLabel(m_stack );
100 lbl->setText(tr("Only small Details are shown here. Määh") );
101 m_stack->addWidget( lbl, 2 );
102
103 lbl = new QLabel( m_stack );
104 lbl->setText( tr("Some more details....Wo ist das Schaf?") );
105 m_stack->addWidget( lbl, 3 );
106
107 lbl = new QLabel( m_stack );
108 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") );
109 m_stack->addWidget( lbl, 4 );
110
111
112 /* THE signal mapper does all the magic */
113 m_stack->raiseWidget( m_main );
114}
115
116
117StackExample::~StackExample() {
118
119}
120
121
122
123void StackExample::closeEvent( QCloseEvent* ev) {
124 /* if the close even came when we displayed a details */
125 if (m_stack->visibleWidget() != m_main ) {
126 m_stack->raiseWidget( m_main );
127 ev->ignore();
128 return;
129 }
130
131 ev->accept();
132}
diff --git a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.h b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.h
new file mode 100644
index 0000000..aea85cb
--- a/dev/null
+++ b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.h
@@ -0,0 +1,28 @@
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
11using namespace Opie;
12
13class StackExample : public QMainWindow {
14 Q_OBJECT
15public:
16 StackExample( QWidget* paren, const char* name, WFlags fl );
17 ~StackExample();
18 static QString appName() { return QString::fromLatin1("owidgetstack-example"); }
19
20protected:
21 void closeEvent( QCloseEvent* e );
22private:
23 OWidgetStack* m_stack;
24 QWidget* m_main;
25
26};
27
28#endif
diff --git a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.pro b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.pro
new file mode 100644
index 0000000..395a4fb
--- a/dev/null
+++ b/libopie2/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 )