summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/GraphicWin.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/GraphicWin.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/GraphicWin.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/GraphicWin.h b/noncore/apps/opie-reader/GraphicWin.h
new file mode 100644
index 0000000..31811d2
--- a/dev/null
+++ b/noncore/apps/opie-reader/GraphicWin.h
@@ -0,0 +1,65 @@
1#ifndef __GRAPHICWIN_H
2#define __GRAPHICWIN_H
3
4#include <qscrollview.h>
5#include <qpixmap.h>
6#include <qpushbutton.h>
7#include <qlayout.h>
8
9class GraphicScroll : public QScrollView
10{
11 Q_OBJECT
12 QWidget* m_picture;
13 protected:
14 void hideEvent( QHideEvent * p)
15 {
16 m_picture->setFixedSize(1,1);
17 }
18 public:
19 GraphicScroll( QWidget *parent=0, const char *name=0, WFlags f = 0)
20 : QScrollView(parent, name, f)
21 {
22 m_picture = new QWidget(viewport());
23 addChild(m_picture);
24 }
25 void setPixmap(QPixmap& pm)
26 {
27 m_picture->setFixedSize(pm.size());
28 m_picture->setBackgroundPixmap(pm);
29 }
30/*
31 private slots:
32 void graphicClose() { emit Close(); }
33 signals:
34 void Close();
35*/
36
37};
38
39
40class GraphicWin : public QWidget
41{
42 Q_OBJECT
43
44 GraphicScroll* m_scroll;
45 signals:
46 void Closed();
47 private slots:
48 void slotClosed() { emit Closed(); }
49
50 public:
51
52 void setPixmap(QPixmap& pm) { m_scroll->setPixmap(pm); }
53 GraphicWin( QWidget *parent=0, const char *name=0, WFlags f = 0)
54 : QWidget(parent, name, f)
55 {
56 QVBoxLayout* grid = new QVBoxLayout(this);
57 m_scroll = new GraphicScroll(this);
58 QPushButton* exitButton = new QPushButton("Close", this);
59 connect(exitButton, SIGNAL( released() ), this, SLOT( slotClosed() ) );
60 grid->addWidget(m_scroll,1);
61 grid->addWidget(exitButton);
62 }
63};
64
65#endif