Port to qt4
[kdeaccessibility.git] / kmag / kmag.h
blobf147bc1ff82d387f74e2f2eaa3dd82c250b51283
1 /***************************************************************************
2 kmag.h - description
3 -------------------
4 begin : Mon Feb 12 23:45:41 EST 2001
5 copyright : (C) 2001 by Sarang Lakare
6 email : sarang@users.sourceforge.net
7 copyright : (C) 2003-2004 by Olaf Schmidt
8 email : ojschmidt@kde.org
9 ***************************************************************************/
11 /***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
21 #ifndef KMAG_H
22 #define KMAG_H
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
29 #include "kmagzoomview.h"
31 #include <vector>
32 // include files for Qt
33 #include <qstringlist.h>
34 //Added by qt3to4:
35 #include <QContextMenuEvent>
37 // include files for KDE
38 #include <kapplication.h>
39 #include <kmainwindow.h>
40 #include <kdockwidget.h>
41 #include <kaction.h>
42 #include <kaccel.h>
43 #include <knuminput.h>
45 /**
46 * The base class for Kmag application windows. It sets up the main
47 * window and reads the config file as well as providing a menubar, toolbar
48 * and statusbar. An instance of KmagView creates your center view, which is connected
49 * to the window's Doc object.
50 * KmagApp reimplements the methods that KMainWindow provides for main window handling and supports
51 * full session management as well as using KActions.
52 * @see KMainWindow
53 * @see KApplication
54 * @see KConfig
56 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
57 * @version KDevelop version 1.2 code generation
59 class KmagApp : public KMainWindow
61 Q_OBJECT
63 public:
64 /**
65 * Construtor of KmagApp, calls all init functions to create the application.
67 KmagApp(QWidget* parent=0, const char* name=0);
69 /// Default destructor
70 ~KmagApp();
74 protected:
75 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
76 * file
78 void saveOptions();
79 /** read general Options again and initialize all variables like the recent file list
81 void readOptions();
82 /** initializes the KActions of the application */
83 void initActions();
85 /** creates the centerwidget of the KTMainWindow instance and sets it as the view
87 void initView();
89 /// Initialize all connections
90 void initConnections();
92 virtual bool queryClose();
94 /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
95 * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
96 * properties.
97 * @see KTMainWindow#queryExit
98 * @see KTMainWindow#closeEvent
100 virtual bool queryExit();
102 /// Catch context menu events
103 void contextMenuEvent ( QContextMenuEvent * e );
105 public slots:
106 /** open a new application window by creating a new instance of KmagApp */
107 void slotFileNewWindow();
109 /** print the actual file */
110 void slotFilePrint();
112 void slotFileQuit();
114 /** put the marked text/object into the clipboard
116 void copyToClipBoard();
118 /// Toggle the refreshing of the window
119 void slotToggleRefresh();
121 void slotModeFollowMouse();
122 void slotModeWholeScreen();
123 void slotModeSelWin();
125 /// Zooms in
126 void zoomIn();
128 /// Zooms out
129 void zoomOut();
131 /// Save the zoomed image
132 void saveZoomPixmap();
134 /// Sets the zoom index to index
135 void setZoomIndex(int index);
137 /// Sets the rotation index to index
138 void setRotationIndex(int index);
140 /// Sets the fps index to index
141 void setFPSIndex(int index);
143 /// Shows/hides the mouse cursor
144 void showMouseCursor(bool show);
146 void slotShowMenu();
147 void slotShowMainToolBar();
148 void slotShowViewToolBar();
149 void slotShowSettingsToolBar();
151 void slotToggleHideCursor();
153 /// Opens shortcut key configuration dialogue
154 void slotConfKeys();
156 /// Called when toolbar config is updated
157 void slotNewToolbarConfig();
159 /// Called when "configure toolbar" is clicked
160 void slotEditToolbars();
162 signals:
163 /// This signal is raised whenever the index into the zoom array is changed
164 void updateZoomIndex(int);
166 /// This signal is raised whenever the zoom value changes
167 void updateZoomValue(float);
169 /// This signal is raised whenever the index into the rotation array is changed
170 void updateRotationIndex(int);
172 /// This signal is raised whenever the rotation value changes
173 void updateRotationValue(int);
175 /// This signal is raised whenever the index into the fps array is changed
176 void updateFPSIndex(int);
178 /// This signal is raised whenever the fps value changes
179 void updateFPSValue(float);
181 private:
182 /// the configuration object of the application
183 KConfig *config;
185 // KAction pointers to enable/disable actions
186 KAction *fileNewWindow, *m_pSnapshot, *m_pCopy, *m_keyConf, *m_toolConf;
187 KAction *m_pPrint;
188 KAction *m_pZoomIn;
189 KAction *m_pZoomOut;
190 KAction *m_pQuit;
191 KAction *refreshSwitch;
192 KToggleAction *m_pShowMenu, *m_pShowMainToolBar, *m_pShowViewToolBar, *m_pShowSettingsToolBar;
193 KSelectAction *m_pZoomBox, *m_pRotationBox, *m_pFPSBox;
195 /// zoom slider
196 KIntNumInput *m_zoomSlider;
198 /// Current index into the zoomArray
199 unsigned int m_zoomIndex;
201 /// Current index into the rotationArray
202 unsigned int m_rotationIndex;
204 /// Current index into the fpsArray
205 unsigned int m_fpsIndex;
207 QStringList zoomArrayString;
208 std::vector<float> zoomArray;
210 QStringList rotationArrayString;
211 std::vector<int> rotationArray;
213 QStringList fpsArrayString;
214 std::vector<float> fpsArray;
216 KMagZoomView* m_zoomView;
217 KToggleAction *m_hideCursor;
218 KRadioAction *m_modeFollowMouse, *m_modeWholeScreen, *m_modeSelWin;
220 /// Stores the non-zero cursor type to be used
221 unsigned int m_mouseCursorType;
223 unsigned int m_defaultMouseCursorType;
227 #endif // KMAG_H