-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 @@ | |||
1 | #include <qwidgetstack.h> | ||
2 | #include <qlayout.h> | ||
3 | |||
4 | #include "ofileselectormain.h" | ||
5 | |||
6 | OFileSelectorMain::OFileSelectorMain( QWidget* parent ) | ||
7 | : QWidget( parent ), m_tool(0) | ||
8 | { | ||
9 | m_lay = 0; | ||
10 | init(); | ||
11 | } | ||
12 | OFileSelectorMain::~OFileSelectorMain() { | ||
13 | |||
14 | } | ||
15 | void OFileSelectorMain::setToolbar( QWidget* tool ) { | ||
16 | delete m_tool; | ||
17 | m_tool = tool; | ||
18 | add(); | ||
19 | } | ||
20 | void OFileSelectorMain::setWidget( QWidget* wid ) { | ||
21 | static int i = 0; | ||
22 | m_stack->addWidget( wid, i ); | ||
23 | m_stack->raiseWidget( i ); | ||
24 | i++; | ||
25 | } | ||
26 | void OFileSelectorMain::add() { | ||
27 | qWarning("adding items "); | ||
28 | if (m_tool ) | ||
29 | m_lay->addWidget( m_tool, 0, 0 ); | ||
30 | |||
31 | } | ||
32 | void OFileSelectorMain::init() { | ||
33 | delete m_lay; | ||
34 | |||
35 | m_lay = new QGridLayout( this, 2, 1 ); | ||
36 | m_lay->setRowStretch( 0, 1 ); | ||
37 | m_lay->setRowStretch( 1, 500 ); | ||
38 | |||
39 | m_stack = new QWidgetStack( this ); | ||
40 | m_lay->addWidget( m_stack, 1, 0 ); | ||
41 | } | ||
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 @@ | |||
1 | #ifndef OPIE_FILESELECTOR_MAIN_H | ||
2 | #define OPIE_FILESELECTOR_MAIN_H | ||
3 | |||
4 | #include <qwidget.h> | ||
5 | |||
6 | class QGridLayout; | ||
7 | class QWidgetStack; | ||
8 | class OFileSelectorMain : public QWidget { | ||
9 | Q_OBJECT | ||
10 | public: | ||
11 | OFileSelectorMain( QWidget* parent ); | ||
12 | ~OFileSelectorMain(); | ||
13 | void setToolbar( QWidget* tool ); | ||
14 | void setWidget( QWidget* view ); | ||
15 | private: | ||
16 | void init(); | ||
17 | void add(); | ||
18 | QGridLayout *m_lay; | ||
19 | QWidget* m_tool; | ||
20 | QWidgetStack *m_stack; | ||
21 | }; | ||
22 | |||
23 | #endif | ||