-rw-r--r-- | libopie/ofileselector/ofileselectormain.cpp | 41 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselectormain.h | 23 |
2 files changed, 64 insertions, 0 deletions
diff --git a/libopie/ofileselector/ofileselectormain.cpp b/libopie/ofileselector/ofileselectormain.cpp new file mode 100644 index 0000000..dd3b08c --- a/dev/null +++ b/libopie/ofileselector/ofileselectormain.cpp @@ -0,0 +1,41 @@ +#include <qwidgetstack.h> +#include <qlayout.h> + +#include "ofileselectormain.h" + +OFileSelectorMain::OFileSelectorMain( QWidget* parent ) + : QWidget( parent ), m_tool(0) +{ + m_lay = 0; + init(); +} +OFileSelectorMain::~OFileSelectorMain() { + +} +void OFileSelectorMain::setToolbar( QWidget* tool ) { + delete m_tool; + m_tool = tool; + add(); +} +void OFileSelectorMain::setWidget( QWidget* wid ) { + static int i = 0; + m_stack->addWidget( wid, i ); + m_stack->raiseWidget( i ); + i++; +} +void OFileSelectorMain::add() { + qWarning("adding items "); + if (m_tool ) + m_lay->addWidget( m_tool, 0, 0 ); + +} +void OFileSelectorMain::init() { + delete m_lay; + + m_lay = new QGridLayout( this, 2, 1 ); + m_lay->setRowStretch( 0, 1 ); + m_lay->setRowStretch( 1, 500 ); + + m_stack = new QWidgetStack( this ); + m_lay->addWidget( m_stack, 1, 0 ); +} diff --git a/libopie/ofileselector/ofileselectormain.h b/libopie/ofileselector/ofileselectormain.h new file mode 100644 index 0000000..b540b9a --- a/dev/null +++ b/libopie/ofileselector/ofileselectormain.h @@ -0,0 +1,23 @@ +#ifndef OPIE_FILESELECTOR_MAIN_H +#define OPIE_FILESELECTOR_MAIN_H + +#include <qwidget.h> + +class QGridLayout; +class QWidgetStack; +class OFileSelectorMain : public QWidget { + Q_OBJECT +public: + OFileSelectorMain( QWidget* parent ); + ~OFileSelectorMain(); + void setToolbar( QWidget* tool ); + void setWidget( QWidget* view ); +private: + void init(); + void add(); + QGridLayout *m_lay; + QWidget* m_tool; + QWidgetStack *m_stack; +}; + +#endif |