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 @@ +CONFIG += qt + +TEMPLATE = app +SOURCES = testwidget.cpp +HEADERS = testwidget.h + +INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/noncore/graphics/opie-eye/lib/ +DESTPATH += $(OPIEDIR)/include + +LIBS += -lopieui2 -lopiecore2 + +include( $(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 @@ +#include "testwidget.h" + +#include <opie2/okeyconfigwidget.h> + +#include <opie2/oapplicationfactory.h> +#include <opie2/otabwidget.h> + +#include <qpe/qpeapplication.h> + +#include <qevent.h> +#include <qlayout.h> +#include <qpushbutton.h> +#include <qmainwindow.h> +#include <qdialog.h> + + +/** + * QObject with signals and slots inside a .cpp + * requires the .moc at the bottom! and a run of qmake + */ +class MainWindow : public QMainWindow { + Q_OBJECT +public: + static QString appName() { + return QString::fromLatin1("keyconfig"); + } + MainWindow( QWidget*, const char*, WFlags fl ); + ~MainWindow() {} +private slots: + void slotClicked(); +private: + Opie::Core::OKeyConfigManager *m_manager; +}; + + +OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> ) + + +MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl ) + : QMainWindow( parent, name, fl ) +{ + QVBoxLayout *lay = new QVBoxLayout( this ); + QPushButton *btn = new QPushButton( tr("Configure" ), this ); + TestMainWindow *wid = new TestMainWindow( this, "name", 0 ); + + lay->addWidget( btn ); + lay->addWidget( wid ); + m_manager = wid->manager(); + + connect( btn, SIGNAL(clicked()), this, SLOT(slotClicked()) ); +} + +void MainWindow::slotClicked() { + QDialog diag( this, "name", true ); + diag.setCaption( tr( "Manage Keys" ) ); + + QHBoxLayout *lay = new QHBoxLayout( &diag ); + Opie::Ui::OKeyConfigWidget *wid = new Opie::Ui::OKeyConfigWidget( &diag, "key config" ); + wid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); + wid->insert( tr("MainWindow Options" ), m_manager ); + wid->load(); + + lay->addWidget( wid ); + + if ( QPEApplication::execDialog( &diag ) == QDialog::Accepted ) { + wid->save(); + } +} + +TestMainWindow::TestMainWindow( QWidget* parent, const char* slot, WFlags fl ) + : Opie::Ui::OListView( parent, slot, fl) +{ + addColumn( tr( "A Doo" ) ); + addColumn( tr( "B Doo" ) ); + + m_config = new Opie::Core::OConfig( "test_config_foo" ); + + /* generate the black list */ + Opie::Core::OKeyPair::List blackList; + blackList.append( Opie::Core::OKeyPair::leftArrowKey() ); + blackList.append( Opie::Core::OKeyPair::rightArrowKey() ); + blackList.append( Opie::Core::OKeyPair::downArrowKey() ); + blackList.append( Opie::Core::OKeyPair::upArrowKey() ); + + m_manager = new Opie::Core::OKeyConfigManager( m_config, "Key Group", + blackList, false, this, "Key Manager" ); + + m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(), + 10, Opie::Core::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this, + SLOT(slotDelete(QWidget*,QKeyEvent*)) ) ); + m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(), + 11, Opie::Core::OKeyPair( Qt::Key_S, Qt::AltButton ) ) ); + + connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Core::OKeyConfigItem&)), + this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem&)) ); +// when commenting the line below out the keyPressEvent will work + m_manager->handleWidget( this ); + m_manager->load(); +} + +TestMainWindow::~TestMainWindow() { + m_manager->save(); + delete m_config; +} + +Opie::Core::OKeyConfigManager* TestMainWindow::manager() { + return m_manager; +} + +/* + * This only works if we do not handle the even with m_manager->handleWidget( this ) + * So this is only for demo purposes + */ +void TestMainWindow::keyPressEvent( QKeyEvent* ev ) { + owarn << "String is "+ m_manager->handleKeyEvent( ev ).text() << oendl; + owarn << "Id was " << m_manager->handleKeyEventId( ev ) << " " << ev->key() << " " << ev->state() << " " << ev->ascii() << "" << oendl; + ev->ignore(); +} + +void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) { + owarn << "Slot Delete " << wid << " " << ev->key() << " " << ev->state() << "" << oendl; +} + +void TestMainWindow::slotAction( QWidget* wid, QKeyEvent* ev, const Opie::Core::OKeyConfigItem& item) { + owarn << "Slot Action " << wid << " " << ev->key() << " " << ev->state() << " " << item.text() << " " << item.id() << "" << oendl; +} + +#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 @@ +#ifndef TEST_WIDGET_H +#define TEST_WIDGET_H + +#include <qmainwindow.h> + +#include <opie2/olistview.h> + +namespace Opie{ +namespace Ui{ + class OTabWidget; + class OListView; +} +namespace Core { + class OConfig; + class OKeyConfigManager; + class OKeyConfigItem; +} +} +class QKeyEvent; + + +class TestMainWindow : public Opie::Ui::OListView { + Q_OBJECT +public: + + TestMainWindow(QWidget* parent, const char*, WFlags fl ); + ~TestMainWindow(); + + Opie::Core::OKeyConfigManager *manager(); +protected: + void keyPressEvent( QKeyEvent* ); +private slots: + void slotDelete( QWidget*, QKeyEvent* ); + void slotAction( QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem& ); +private: + Opie::Core::OConfig *m_config; + Opie::Core::OKeyConfigManager *m_manager; +}; + +#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 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include "olistviewdemo.h" +#include <opie2/oapplication.h> + +using namespace Opie::Ui; +using namespace Opie::Core; + +int main( int argc, char **argv ) +{ + OApplication a( argc, argv, "OListViewDemo" ); + OListViewDemo e; + a.showMainWidget(&e); + return a.exec(); +} + 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 @@ +/* + This file is part of the Opie Project + + Copyright (C) 2003 Michael 'Mickey' Lauer + <mickey@tm.informatik.uni-frankfurt.de> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#include "olistviewdemo.h" + +/* OPIE */ +#include <opie2/olistview.h> +#include <opie2/odebug.h> + +/* QT */ +#include <qstring.h> +#include <qpixmap.h> +#include <qlistview.h> + +using namespace Opie::Ui; + +OListViewDemo::OListViewDemo( QWidget* parent, const char* name, WFlags f ) + :QVBox( parent, name, f ) +{ + lv = new ONamedListView( this ); + lv->setRootIsDecorated( true ); + lv->addColumns( QStringList::split( ' ', "Column1 Column2 Column3 Column4" ) ); + + ONamedListViewItem* item = new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); + item->setText( "Column2", "ModifiedText" ); + item->setText( "Column5", "ThisColumnDoesNotExits" ); + + new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); + new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); + new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Minni" ) ); + item = new ONamedListViewItem( lv, QStringList::split( ' ', "XXX YYY ZZZ ***" ) ); + new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); + new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); + + new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); + new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); + new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); + item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComes" ) ); + item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComesSoon" ) ); + item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 Mickey" ) ); + + if ( lv->find( 3, "Mickey", 3 ) ) + odebug << "found Mickey :-)" << oendl; + else + odebug << "did not found Mickey :-(" << oendl; + + if ( lv->find( 3, "Minni", 0 ) ) + odebug << "found Minni :-)" << oendl; + else + odebug << "did not found Minni :-(" << oendl; + +} + +OListViewDemo::~OListViewDemo() +{ +} + 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 @@ +/* + This file is part of the Opie Project + + Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef OLISTVIEWDEMO_H +#define OLISTVIEWDEMO_H + +#include <qvbox.h> +#include <opie2/olistview.h> + +class OListViewDemo: public QVBox +{ + Q_OBJECT + + public: + OListViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 ); + virtual ~OListViewDemo(); + + private: + Opie::Ui::ONamedListView* lv; + +}; + +#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 @@ +TEMPLATE = app +CONFIG = qt warn_on +HEADERS = olistviewdemo.h +SOURCES = olistviewdemo.cpp \ + main.cpp +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lopieui2 -lopiecore2 -lqpe +TARGET = olistviewdemo +MOC_DIR = moc +OBJECTS_DIR = obj + + + + +!contains( platform, x11 ) { + include( $(OPIEDIR)/include.pro ) +} + +contains( platform, x11 ) { + LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib +} + 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 @@ +TEMPLATE = subdirs +SUBDIRS = olistviewdemo owidgetstack_example osplitter_example + + + 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 ) diff --git a/examples/opieui/oversatileviewdemo/1.png b/examples/opieui/oversatileviewdemo/1.png Binary files differnew file mode 100644 index 0000000..0e2e41b --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/1.png diff --git a/examples/opieui/oversatileviewdemo/1small.png b/examples/opieui/oversatileviewdemo/1small.png Binary files differnew file mode 100644 index 0000000..ce6b262 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/1small.png diff --git a/examples/opieui/oversatileviewdemo/2.png b/examples/opieui/oversatileviewdemo/2.png Binary files differnew file mode 100644 index 0000000..8a0181d --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/2.png diff --git a/examples/opieui/oversatileviewdemo/2small.png b/examples/opieui/oversatileviewdemo/2small.png Binary files differnew file mode 100644 index 0000000..82a4431 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/2small.png diff --git a/examples/opieui/oversatileviewdemo/3.png b/examples/opieui/oversatileviewdemo/3.png Binary files differnew file mode 100644 index 0000000..8a58d6c --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/3.png diff --git a/examples/opieui/oversatileviewdemo/3small.png b/examples/opieui/oversatileviewdemo/3small.png Binary files differnew file mode 100644 index 0000000..073ba55 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/3small.png diff --git a/examples/opieui/oversatileviewdemo/4.png b/examples/opieui/oversatileviewdemo/4.png Binary files differnew file mode 100644 index 0000000..198891b --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/4.png diff --git a/examples/opieui/oversatileviewdemo/4small.png b/examples/opieui/oversatileviewdemo/4small.png Binary files differnew file mode 100644 index 0000000..7f1cc01 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/4small.png diff --git a/examples/opieui/oversatileviewdemo/5.png b/examples/opieui/oversatileviewdemo/5.png Binary files differnew file mode 100644 index 0000000..ee7344a --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/5.png diff --git a/examples/opieui/oversatileviewdemo/5small.png b/examples/opieui/oversatileviewdemo/5small.png Binary files differnew file mode 100644 index 0000000..105b038 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/5small.png diff --git a/examples/opieui/oversatileviewdemo/6.png b/examples/opieui/oversatileviewdemo/6.png Binary files differnew file mode 100644 index 0000000..72c3692 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/6.png diff --git a/examples/opieui/oversatileviewdemo/6small.png b/examples/opieui/oversatileviewdemo/6small.png Binary files differnew file mode 100644 index 0000000..1db2a30 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/6small.png diff --git a/examples/opieui/oversatileviewdemo/folder_closed.png b/examples/opieui/oversatileviewdemo/folder_closed.png Binary files differnew file mode 100644 index 0000000..4157333 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/folder_closed.png diff --git a/examples/opieui/oversatileviewdemo/folder_closed32.png b/examples/opieui/oversatileviewdemo/folder_closed32.png Binary files differnew file mode 100644 index 0000000..acc992c --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/folder_closed32.png diff --git a/examples/opieui/oversatileviewdemo/folder_opened.png b/examples/opieui/oversatileviewdemo/folder_opened.png Binary files differnew file mode 100644 index 0000000..5e7e37e --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/folder_opened.png diff --git a/examples/opieui/oversatileviewdemo/folder_opened32.png b/examples/opieui/oversatileviewdemo/folder_opened32.png Binary files differnew file mode 100644 index 0000000..acd3265 --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/folder_opened32.png diff --git a/examples/opieui/oversatileviewdemo/leaf.png b/examples/opieui/oversatileviewdemo/leaf.png Binary files differnew file mode 100644 index 0000000..c8435ec --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/leaf.png diff --git a/examples/opieui/oversatileviewdemo/leaf32.png b/examples/opieui/oversatileviewdemo/leaf32.png Binary files differnew file mode 100644 index 0000000..5e90ead --- a/dev/null +++ b/examples/opieui/oversatileviewdemo/leaf32.png 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 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#include "opieuidemo.h" + +#include <opie2/oapplication.h> + +using namespace Opie::Core; +using namespace Opie::Ui; + +int main( int argc, char **argv ) +{ + OApplication a( argc, argv, "Opie UI Demo" ); + odebug << "." << oendl; + OpieUIDemo e; + odebug << "." << oendl; + a.showMainWidget(&e); + odebug << "." << oendl; + return a.exec(); +} 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 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +***********************************************************************/ + +// Qt + +#include <qcolor.h> +#include <qpopupmenu.h> +#include <qmenubar.h> +#include <qmessagebox.h> +#include <qvbox.h> +#include <qstring.h> +#include <qstringlist.h> + +// Qtopia + +#include <qpe/qpeapplication.h> +#include <qpe/global.h> + +// Opie + +#include <opie2/odevice.h> + +#include <opie2/ocompletionbox.h> +#include <opie2/olineedit.h> +#include <opie2/ocombobox.h> +#include <opie2/oeditlistbox.h> +#include <opie2/oselector.h> +#include <opie2/opopupmenu.h> + +#include <qtabwidget.h> +#include "oversatileviewdemo.h" + +// Local + +#include "opieuidemo.h" + +using namespace Opie::Core; +using namespace Opie::Ui; + +enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; + +OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) + : QMainWindow( parent, name, fl ) +{ + + QMenuBar* mbar = this->menuBar(); + OPopupMenu* demo = new OPopupMenu( this ); + demo->setTitle( "Title" ); + demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); + demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); + demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); + demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); + demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); + mbar->insertItem( "Demonstrate", demo ); + + build(); + +} + +OpieUIDemo::~OpieUIDemo() +{ +} + +void OpieUIDemo::build() +{ + main = new QTabWidget( this, "tabwidget" ); + setCentralWidget( main ); + main->show(); + + main->addTab( new OVersatileViewDemo( main ), "VersatileView" ); +} + + +void OpieUIDemo::demo( int d ) +{ + switch (d) + { + case ocompletionbox: demoOCompletionBox(); break; + case olineedit: demoOLineEdit(); break; + case ocombobox: demoOComboBox(); break; + case oeditlistbox: demoOEditListBox(); break; + case oselector: demoOSelector(); break; + + } + +} + +void OpieUIDemo::demoOCompletionBox() +{ + odebug << "ocompletionbox" << oendl; + + OCompletionBox* box = new OCompletionBox( 0 ); + box->insertItem( "This CompletionBox" ); + box->insertItem( "Says 'Hello World'" ); + box->insertItem( "Here are some" ); + box->insertItem( "Additional Items" ); + box->insertItem( "Complete Completion Box" ); + + connect( box, SIGNAL( activated(const QString&) ), this, SLOT( messageBox(const QString&) ) ); + box->popup(); + +} + +void OpieUIDemo::demoOLineEdit() +{ + odebug << "olineedit" << oendl; + + OLineEdit *edit = new OLineEdit( 0, "lineedit" ); + + edit->setCompletionMode( OGlobalSettings::CompletionPopup ); + OCompletion* comp = edit->completionObject(); + + QStringList list; + list << "mickeyl@handhelds.org"; + list << "mickey@tm.informatik.uni-frankfurt.de"; + list << "mickey@vanille.de"; + + comp->setItems( list ); + + edit->show(); + +} + +void OpieUIDemo::demoOComboBox() +{ + odebug << "ocombobox" << oendl; + + OComboBox *combo = new OComboBox( true, 0, "combobox" ); + + combo->setCompletionMode( OGlobalSettings::CompletionPopup ); + OCompletion* comp = combo->completionObject(); + + QStringList ilist; + ilist << "kergoth@handhelds.org"; + ilist << "harlekin@handhelds.org"; + ilist << "groucho@handhelds.org"; + combo->insertStringList( ilist ); + + QStringList clist; + clist << "mickeyl@handhelds.org"; + clist << "mickey@tm.informatik.uni-frankfurt.de"; + clist << "mickey@vanille.de"; + comp->setItems( clist ); + + combo->show(); + +} + +void OpieUIDemo::demoOEditListBox() +{ + odebug << "oeditlistbox" << oendl; + + OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" ); + + edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup ); + OCompletion* comp = edit->lineEdit()->completionObject(); + QStringList clist; + clist << "Completion everywhere"; + clist << "Cool Completion everywhere"; + clist << "History History History"; + comp->setItems( clist ); + + QStringList list; + list << "kergoth@handhelds.org"; + list << "harlekin@handhelds.org"; + list << "groucho@handhelds.org"; + list << "mickeyl@handhelds.org"; + edit->insertStringList( list ); + + edit->show(); + +} + +void OpieUIDemo::demoOSelector() +{ + odebug << "oselector" << oendl; + + OHSSelector* sel = new OHSSelector( 0, "gradientselector" ); + //#sel->resize( QSize( 200, 30 ) ); + //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) ); + //#sel->setText( "Dark", "Light" ); + + sel->show(); +} + +void OpieUIDemo::messageBox( const QString& text ) +{ + QString info; + info = "You have selected '" + text + "'"; + QMessageBox::information( this, "OpieUIDemo", info ); +} 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 @@ +/********************************************************************** +** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. +** +** This file is part of Opie Environment. +** +** This file may be distributed and/or modified under the terms of the +** GNU General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +**********************************************************************/ + +#ifndef OPIEUIDEMO_H +#define OPIEUIDEMO_H + +#include <qmainwindow.h> + +namespace Opie { +namespace Ui { +class OVersatileView; +} +} +class QTabWidget; +class QVBox; + +class OpieUIDemo : public QMainWindow { + Q_OBJECT + +public: + + OpieUIDemo( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel ); + ~OpieUIDemo(); + + void demoOCompletionBox(); + void demoOLineEdit(); + void demoOComboBox(); + void demoOEditListBox(); + void demoOSelector(); + +public slots: + void demo( int ); + void messageBox( const QString& text ); + +protected: + void build(); + void buildVV( QVBox* b ); + +private: + QTabWidget* main; + + Opie::Ui::OVersatileView* vv; + +}; + + + +#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 @@ +/* + This file is part of the Opie Project + + Copyright (C) 2003 Michael 'Mickey' Lauer + <mickey@tm.informatik.uni-frankfurt.de> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#include "oversatileviewdemo.h" +#include <opie2/oversatileview.h> +#include <opie2/oversatileviewitem.h> + +#include <qstring.h> +#include <qpixmap.h> +#include <qlistview.h> + +using namespace Opie::Ui; + +OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) + :QVBox( parent, name, f ) +{ + vv = new OVersatileView( this ); + + vv->addColumn( "First" ); + vv->addColumn( "2nd" ); + vv->addColumn( "IIIrd" ); + + QString counter; + + QPixmap leaf( "leaf.png" ); + QPixmap opened( "folder_opened.png" ); + QPixmap closed( "folder_closed.png" ); + + QPixmap leaf32( "leaf32.png" ); + QPixmap opened32( "folder_opened32.png" ); + QPixmap closed32( "folder_closed32.png" ); + + vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed ); + vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 ); + + OVersatileViewItem* item; + OVersatileViewItem* item2; + + for ( int i = 0; i < 5; ++i ) + { + counter.sprintf( "%d", i ); + item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter ); + item->setRenameEnabled( true ); + item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter ); + item2->setRenameEnabled( true ); + + } + + connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); + connect( vv, SIGNAL( selectionChanged(OVersatileViewItem*) ), this, SLOT( selectionChanged(OVersatileViewItem*) ) ); + connect( vv, SIGNAL( currentChanged(OVersatileViewItem*) ), this, SLOT( currentChanged(OVersatileViewItem*) ) ); + connect( vv, SIGNAL( clicked(OVersatileViewItem*) ), this, SLOT( clicked(OVersatileViewItem*) ) ); + connect( vv, SIGNAL( pressed(OVersatileViewItem*) ), this, SLOT( pressed(OVersatileViewItem*) ) ); + + connect( vv, SIGNAL( doubleClicked(OVersatileViewItem*) ), this, SLOT( doubleClicked(OVersatileViewItem*) ) ); + connect( vv, SIGNAL( returnPressed(OVersatileViewItem*) ), this, SLOT( returnPressed(OVersatileViewItem*) ) ); + + connect( vv, SIGNAL( onItem(OVersatileViewItem*) ), this, SLOT( onItem(OVersatileViewItem*) ) ); + connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) ); + + connect( vv, SIGNAL( expanded(OVersatileViewItem*) ), this, SLOT( expanded(OVersatileViewItem*) ) ); + connect( vv, SIGNAL( collapsed(OVersatileViewItem*) ), this, SLOT( collapsed(OVersatileViewItem*) ) ); + + connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) ); + + connect( vv, SIGNAL( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ) ); + +} + +OVersatileViewDemo::~OVersatileViewDemo() +{ +} + +void OVersatileViewDemo::selectionChanged() +{ + odebug << "received signal selectionChanged()" << oendl; +} +void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item ) +{ + odebug << "received signal selectionChanged(OVersatileViewItem*)" << oendl; +} +void OVersatileViewDemo::currentChanged( OVersatileViewItem * item ) +{ + odebug << "received signal currentChanged( OVersatileViewItem * )" << oendl; +} +void OVersatileViewDemo::clicked( OVersatileViewItem * item ) +{ + odebug << "received signal clicked( OVersatileViewItem * )" << oendl; +} +void OVersatileViewDemo::pressed( OVersatileViewItem * item ) +{ + odebug << "received signal pressed( OVersatileViewItem * )" << oendl; +} + +void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item ) +{ + odebug << "received signal doubleClicked( OVersatileViewItem *item )" << oendl; +} +void OVersatileViewDemo::returnPressed( OVersatileViewItem *item ) +{ + odebug << "received signal returnPressed( OVersatileViewItem *item )" << oendl; +} + +void OVersatileViewDemo::onItem( OVersatileViewItem *item ) +{ + odebug << "received signal onItem( OVersatileViewItem *item )" << oendl; +} +void OVersatileViewDemo::onViewport() +{ + odebug << "received signal onViewport()" << oendl; +} + +void OVersatileViewDemo::expanded( OVersatileViewItem *item ) +{ + odebug << "received signal expanded( OVersatileViewItem *item )" << oendl; +} + +void OVersatileViewDemo::collapsed( OVersatileViewItem *item ) +{ + odebug << "received signal collapsed( OVersatileViewItem *item )" << oendl; +} + +void OVersatileViewDemo::moved() +{ + odebug << "received signal moved( OVersatileViewItem *item )" << oendl; +} + +void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col ) +{ + odebug << "received signal contextMenuRequested( OVersatileViewItem *item )" << oendl; +} 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 @@ +/* + This file is part of the Opie Project + + Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef OVERSATILEVIEWDEMO_H +#define OVERSATILEVIEWDEMO_H + +#include <qvbox.h> + +namespace Opie { +namespace Ui { +class OVersatileView; +class OVersatileViewItem; +} +} + +class OVersatileViewDemo: public QVBox +{ + Q_OBJECT + + public: + OVersatileViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 ); + virtual ~OVersatileViewDemo(); + + public slots: + void selectionChanged(); + void selectionChanged( Opie::Ui::OVersatileViewItem * ); + void currentChanged( Opie::Ui::OVersatileViewItem * ); + void clicked( Opie::Ui::OVersatileViewItem * ); + void pressed( OPie::Ui::OVersatileViewItem * ); + + void doubleClicked( Opie::Ui::OVersatileViewItem *item ); + void returnPressed( Opie::Ui::OVersatileViewItem *item ); + + void onItem( Opie::Ui::OVersatileViewItem *item ); + void onViewport(); + + void expanded( Opie::Ui::OVersatileViewItem *item ); + void collapsed( Opie::Ui::OVersatileViewItem *item ); + + void moved(); + + void contextMenuRequested( Opie::Ui::OVersatileViewItem *item, const QPoint&, int col ); + + private: + Opie::Ui::OVersatileView* vv; + +}; + +#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 @@ +TEMPLATE = app +CONFIG = qt warn_on +HEADERS = opieuidemo.h \ + oversatileviewdemo.h +SOURCES = opieuidemo.cpp \ + oversatileviewdemo.cpp \ + main.cpp +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lopieui2 -lopiecore2 +TARGET = opieuidemo +MOC_DIR = moc +OBJECTS_DIR = obj + +include( $(OPIEDIR)/include.pro ) + + 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 @@ +/* + * You may use, modify and distribute this example without any limitation + */ + +#include "owidgetstack_example.h" + +/* OPIE */ +#include <opie2/oapplicationfactory.h> +#include <opie2/owidgetstack.h> +#include <qpe/resource.h> + +/* QT */ +#include <qaction.h> +#include <qtoolbar.h> +#include <qpopupmenu.h> +#include <qmenubar.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qpushbutton.h> +#include <qsignalmapper.h> + +using namespace Opie::Core; +using namespace Opie::Ui; + +OPIE_EXPORT_APP( OApplicationFactory<StackExample> ) + +StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) + : QMainWindow( parent, name, fl ) +{ + m_stack = new OWidgetStack( this ); + setCentralWidget( m_stack ); + + /* nice Signal Mapper ;) */ + QSignalMapper *sm = new QSignalMapper(this); + connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); + + /* toolbar first but this should be known from the other examples */ + setToolBarsMovable( false ); + + /* only a menubar here */ + QToolBar* holder = new QToolBar( this ); + holder->setHorizontalStretchable( true ); + + QMenuBar *bar = new QMenuBar( holder ); + QPopupMenu *menu = new QPopupMenu( this ); + + QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"), + QString::null, 0, this, 0 ); + sm->setMapping(a, 1 ); + connect(a, SIGNAL(activated() ), + sm, SLOT(map() ) ); + a->addTo( menu ); + + a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"), + QString::null, 0, this, 0 ); + sm->setMapping(a, 2 ); + connect(a, SIGNAL(activated() ), + sm, SLOT(map() ) ); + a->addTo( menu ); + + a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"), + QString::null, 0, this, 0 ); + sm->setMapping(a, 3 ); + connect(a, SIGNAL(activated() ), + sm, SLOT(map() ) ); + a->addTo( menu ); + + a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"), + QString::null, 0, this, 0 ); + sm->setMapping(a, 4 ); + connect(a, SIGNAL(activated() ), + sm, SLOT(map() ) ); + + bar->insertItem( tr("Actions"), menu ); + + /* now the gui */ + + /* first widget, main widget */ + QWidget * wid = new QWidget( m_stack ); + QGridLayout *grid = new QGridLayout(wid, 2, 2 ); + + QPushButton *btn = new QPushButton( tr("Show Details Small"), wid, "details1" ); + sm->setMapping(btn, 2 ); + connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); + grid->addWidget( btn, 0, 0 ); + + btn = new QPushButton( tr("Show Details Medium"), wid, "details2"); + sm->setMapping(btn, 3 ); + connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); + grid->addWidget( btn, 0, 1 ); + + btn = new QPushButton( tr("Show Details All"), wid, "details3"); + sm->setMapping(btn, 4 ); + connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); + grid->addWidget( btn, 1, 1 ); + + m_stack->addWidget( wid, 1 ); + m_main = wid; + + QLabel *lbl = new QLabel(m_stack ); + lbl->setText(tr("Only small Details are shown here. Määh") ); + m_stack->addWidget( lbl, 2 ); + + lbl = new QLabel( m_stack ); + lbl->setText( tr("Some more details....Wo ist das Schaf?") ); + m_stack->addWidget( lbl, 3 ); + + lbl = new QLabel( m_stack ); + 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") ); + m_stack->addWidget( lbl, 4 ); + + + /* THE signal mapper does all the magic */ + m_stack->raiseWidget( m_main ); +} + + +StackExample::~StackExample() { + +} + + + +void StackExample::closeEvent( QCloseEvent* ev) { + /* if the close even came when we displayed a details */ + if (m_stack->visibleWidget() != m_main ) { + m_stack->raiseWidget( m_main ); + ev->ignore(); + return; + } + + ev->accept(); +} 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 @@ +/* + * You may use, modify and distribute this example without any limitation + */ + +#ifndef O_STACK_EXAMPLE_SIMPLE_H +#define O_STACK_EXAMPLE_SIMPLE_H + +#include <qmainwindow.h> +#include <opie2/owidgetstack.h> + + +class StackExample : public QMainWindow { + Q_OBJECT +public: + StackExample( QWidget* paren, const char* name, WFlags fl ); + ~StackExample(); + static QString appName() { return QString::fromLatin1("owidgetstack-example"); } + +protected: + void closeEvent( QCloseEvent* e ); +private: + Opie::Ui::OWidgetStack* m_stack; + QWidget* m_main; + +}; + +#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 @@ +CONFIG += qt warn_on +TEMPLATE = app +TARGET = owidgetstack-example + +SOURCES = owidgetstack_example.cpp +HEADERS = owidgetstack_example.h + +INCLUDEPATH += $(OPIEDIR)/include +DEPENDSPATH += $(OPIEDIR)/include + +LIBS += -lqpe -lopieui2 + +include( $(OPIEDIR)/include.pro ) |