summaryrefslogtreecommitdiff
path: root/examples/opieui/osplitter_example
Side-by-side diff
Diffstat (limited to 'examples/opieui/osplitter_example') (more/less context) (ignore whitespace changes)
-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
6 files changed, 210 insertions, 0 deletions
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 @@
+#include "osplitter_example.h"
+
+/* OPIE */
+
+#include <opie2/osplitter.h>
+#include <opie2/ofileselector.h>
+#include <qpe/qpeapplication.h>
+#include <opie2/oapplicationfactory.h>
+
+/* QT*/
+#include <qdir.h>
+#include <qlayout.h>
+
+using namespace Opie::Ui;
+using namespace Opie::Core;
+
+OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> )
+
+OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f )
+ : QWidget( w, n, f ){
+ QVBoxLayout * lay = new QVBoxLayout(this);
+ OSplitter * splitter = new OSplitter( Horizontal, this );
+ lay->addWidget( splitter );
+
+ OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector,
+ OFileSelector::Normal, QDir::homeDirPath(),
+ QString::null );
+ splitter->addWidget( selector, "zoom", tr("Selector 1") );
+
+ selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal,
+ QDir::homeDirPath(), QString::null );
+ splitter->addWidget( selector, "zoom", tr("Selector 2") );
+
+}
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 @@
+/*
+ * May be used, copied and modified wihtout any limitation
+ */
+
+#ifndef OSPlitter_EXAMPLE_H
+#define OSPlitter_EXAMPLE_H
+
+#include <qvbox.h>
+
+class OSplitterExample : public QWidget {
+ Q_OBJECT
+public:
+ static QString appName() { return QString::fromLatin1("osplitter_example"); }
+ OSplitterExample( QWidget *parent, const char* name, WFlags fl );
+
+};
+
+
+#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 @@
+CONFIG = qt warn_on
+TEMPLATE = app
+TARGET = osplitter_example
+
+HEADERS = osplitter_example.h
+SOURCES = osplitter_example.cpp
+
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDSPATH += $(OPIEDIR)/include
+
+LIBS += -lqpe -lopieui2
+
+include( $(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 @@
+
+#include <qstring.h>
+#include <qlabel.h>
+#include <qheader.h>
+#include <qlayout.h>
+
+#include <qpe/qpeapplication.h>
+
+#include <opie2/oapplicationfactory.h>
+#include "osplitter_mail.h"
+
+using namespace Opie::Ui;
+
+OPIE_EXPORT_APP( OApplicationFactory<ListViews> )
+
+class Folder {
+ int dummy;
+};
+
+// -----------------------------------------------------------------
+
+ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
+ : QWidget( p, name, fl ) {
+ qApp->installEventFilter( this );
+ m_lstFolders.setAutoDelete( true );
+ QHBoxLayout *lay = new QHBoxLayout(this);
+
+ m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" );
+ lay->addWidget( m_splitter );
+ connect(m_splitter, SIGNAL(sizeChanged(bool,Orientation) ),
+ this, SLOT(slotSizeChange(bool,Orientation) ) );
+
+ m_overview = new QListView( m_splitter );
+ m_overview->header()->setClickEnabled( FALSE );
+ m_overview->addColumn( tr("Folder") );
+// m_overview->setMaximumWidth( 200 );
+ m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") );
+ m_splitter->setSizeChange( 300 );
+
+ /* OSplitter starts with the small mode */
+ m_messages = 0;
+ m_message = m_attach = 0;
+
+ splitti = new OSplitter( Vertical, m_splitter, "Splitti2" );
+ splitti->setSizeChange( 300 );
+ splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
+
+ QLabel *lbl = new QLabel(splitti);
+ lbl->setTextFormat ( Qt::RichText );
+ lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>");
+
+ m_messages = new QListView( splitti );
+ m_messages->addColumn(" Messages ");
+
+ folder1 = new QListView( splitti );
+ folder1->addColumn( "Messages 2 " );
+
+ splitti->addWidget(m_messages, "mail", tr("Mails") );
+ splitti->addWidget(folder1, "folder", tr("Folder") );
+ splitti->addWidget( lbl, "logo", tr("Label") );
+ m_message = lbl;
+
+ m_splitter->addWidget( splitti );
+
+}
+
+
+ListViews::~ListViews() {
+
+}
+
+
+bool ListViews::eventFilter( QObject* obj, QEvent* ev ) {
+ if (!obj->isWidgetType() )
+ return false;
+ if ( ev->type() == QEvent::MouseButtonRelease ) {
+ owarn << " name " << obj->name() << ", class " << obj->className() << "" << oendl;
+ }
+
+ return false;
+}
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 @@
+/*
+ * You may use, modify and distribute this code without any limitation
+ */
+
+/*
+ * Header file for a more complete email client like
+ * layout
+ */
+
+#ifndef OPIE_SPLITTER_MAIL_EXAMPLE_H
+#define OPIE_SPLITTER_MAIL_EXAMPLE_H
+
+#include <qwidget.h>
+#include <qlist.h>
+#include <qlistview.h>
+
+#include <opie2/osplitter.h>
+
+
+class Folder;
+class QLabel;
+
+class ListViews : public QWidget {
+ Q_OBJECT
+public:
+ static QString appName() { return QString::fromLatin1("osplitter-mail"); }
+ ListViews( QWidget* parent, const char * name, WFlags fl );
+ ~ListViews();
+
+ bool eventFilter( QObject* , QEvent* );
+private:
+ void initFolders();
+ void initFolder( Folder *folder, unsigned int &count );
+
+ QListView *m_messages, *m_overview;
+ QLabel *m_message, *m_attach;
+ QList<QListView> m_folders; // used in tab mode
+ QList<Folder> m_lstFolders;
+ bool m_mode : 1; // bitfield
+ Opie::Ui::OSplitter *m_splitter;
+ Opie::Ui::OSplitter *splitti;
+ QListView *folder1;
+#if 0
+//private slots:
+// void slotFolderChanged( QListViewItem* );
+// void slotMessageChanged();
+// void slotSizeChange( bool, const QSize& );
+#endif
+};
+
+#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 @@
+CONFIG += qt warn_on
+TEMPLATE = app
+TARGET = osplitter-mail
+
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDSPATH += $(OPIEDIR)/include
+
+HEADERS = osplitter_mail.h
+SOURCES = osplitter_mail.cpp
+
+LIBS += -lqpe -lopieui2
+include( $(OPIEDIR)/include.pro )