source: trunk/examples/showimg/showimg.h@ 7

Last change on this file since 7 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1/****************************************************************************
2** $Id: showimg.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
5**
6** This file is part of an example program for Qt. This example
7** program may be used, distributed and modified without limitation.
8**
9*****************************************************************************/
10
11#ifndef SHOWIMG_H
12#define SHOWIMG_H
13
14#include <qwidget.h>
15#include <qimage.h>
16
17
18class QLabel;
19class QMenuBar;
20class QPopupMenu;
21
22class ImageViewer : public QWidget
23{
24 Q_OBJECT
25public:
26 ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 );
27 ~ImageViewer();
28 bool loadImage( const QString& );
29protected:
30 void paintEvent( QPaintEvent * );
31 void resizeEvent( QResizeEvent * );
32 void mousePressEvent( QMouseEvent * );
33 void mouseReleaseEvent( QMouseEvent * );
34 void mouseMoveEvent( QMouseEvent * );
35
36private:
37 void scale();
38 int conversion_flags;
39 bool smooth() const;
40 bool useColorContext() const;
41 int alloc_context;
42 bool convertEvent( QMouseEvent* e, int& x, int& y );
43 QString filename;
44 QImage image; // the loaded image
45 QPixmap pm; // the converted pixmap
46 QPixmap pmScaled; // the scaled pixmap
47
48 QMenuBar *menubar;
49 QPopupMenu *file;
50 QPopupMenu *saveimage;
51 QPopupMenu *savepixmap;
52 QPopupMenu *edit;
53 QPopupMenu *options;
54
55 QWidget *helpmsg;
56 QLabel *status;
57 int si, sp, ac, co, mo, fd, bd, // Menu item ids
58 td, ta, ba, fa, au, ad, dd,
59 ss, cc, t1, t8, t32;
60 void updateStatus();
61 void setMenuItemFlags();
62 bool reconvertImage();
63 int pickx, picky;
64 int clickx, clicky;
65 bool may_be_other;
66 static ImageViewer* other;
67 void setImage(const QImage& newimage);
68
69private slots:
70 void to1Bit();
71 void to8Bit();
72 void to32Bit();
73 void toBitDepth(int);
74
75 void copy();
76 void paste();
77
78 void hFlip();
79 void vFlip();
80 void rot180();
81
82 void editText();
83
84 void newWindow();
85 void openFile();
86 void saveImage(int);
87 void savePixmap(int);
88 void giveHelp();
89 void doOption(int);
90 void copyFrom(ImageViewer*);
91};
92
93
94#endif // SHOWIMG_H
Note: See TracBrowser for help on using the repository browser.