Port to new api
[kdeaccessibility.git] / kmag / kmag.h
blobbf4caff59d2ec5bdb5edd074fb0ef05cf34d5487
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
24 #include "kmagzoomview.h"
26 #include <vector>
27 // include files for Qt
28 #include <QStringList>
29 //Added by qt3to4:
30 #include <QContextMenuEvent>
32 // include files for KDE
33 #include <kxmlguiwindow.h>
34 #include <k3dockwidget.h>
35 #include <kaction.h>
36 #include <knuminput.h>
37 #include <kconfig.h>
39 /**
40 * The base class for Kmag application windows. It sets up the main
41 * window and reads the config file as well as providing a menubar, toolbar
42 * and statusbar. An instance of KmagView creates your center view, which is connected
43 * to the window's Doc object.
44 * KmagApp reimplements the methods that KXmlGuiWindow provides for main window handling and supports
45 * full session management as well as using KActions.
46 * @see KXmlGuiWindow
47 * @see KApplication
48 * @see KConfig
50 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
51 * @version KDevelop version 1.2 code generation
53 class KmagApp : public KXmlGuiWindow
55 Q_OBJECT
57 public:
58 /**
59 * Construtor of KmagApp, calls all init functions to create the application.
61 KmagApp(QWidget* parent=0, const char* name=0);
63 /// Default destructor
64 ~KmagApp();
68 protected:
69 /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
70 * file
72 void saveOptions();
73 /** read general Options again and initialize all variables like the recent file list
75 void readOptions();
76 /** initializes the KActions of the application */
77 void initActions();
79 /** creates the centerwidget of the KTMainWindow instance and sets it as the view
81 void initView();
83 /// Initialize all connections
84 void initConnections();
86 virtual bool queryClose();
88 /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
89 * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
90 * properties.
91 * @see KTMainWindow#queryExit
92 * @see KTMainWindow#closeEvent
94 virtual bool queryExit();
96 /// Catch context menu events
97 void contextMenuEvent ( QContextMenuEvent * e );
99 public slots:
100 /** open a new application window by creating a new instance of KmagApp */
101 void slotFileNewWindow();
103 /** print the actual file */
104 void slotFilePrint();
106 void slotFileQuit();
108 /** put the marked text/object into the clipboard
110 void copyToClipBoard();
112 /// Toggle the refreshing of the window
113 void slotToggleRefresh();
115 void slotModeFollowMouse();
116 void slotModeWholeScreen();
117 void slotModeSelWin();
119 /// Zooms in
120 void zoomIn();
122 /// Zooms out
123 void zoomOut();
125 /// Save the zoomed image
126 void saveZoomPixmap();
128 /// Sets the zoom index to index
129 void setZoomIndex(int index);
131 /// Sets the rotation index to index
132 void setRotationIndex(int index);
134 /// Sets the fps index to index
135 void setFPSIndex(int index);
137 /// Shows/hides the mouse cursor
138 void showMouseCursor(bool show);
140 void slotShowMenu();
141 void slotShowMainToolBar();
142 void slotShowViewToolBar();
143 void slotShowSettingsToolBar();
145 void slotToggleHideCursor();
147 /// Opens shortcut key configuration dialog
148 void slotConfKeys();
150 /// Called when toolbar config is updated
151 void slotNewToolbarConfig();
153 /// Called when "configure toolbar" is clicked
154 void slotEditToolbars();
156 void slotChangeZoomBoxIndex(int index);
157 void slotChangeRotationBoxIndex(int index);
158 void slotChangeFPSIndex(int index);
161 signals:
162 /// This signal is raised whenever the index into the zoom array is changed
163 void updateZoomIndex(int);
165 /// This signal is raised whenever the zoom value changes
166 void updateZoomValue(float);
168 /// This signal is raised whenever the index into the rotation array is changed
169 void updateRotationIndex(int);
171 /// This signal is raised whenever the rotation value changes
172 void updateRotationValue(int);
174 /// This signal is raised whenever the index into the fps array is changed
175 void updateFPSIndex(int);
177 /// This signal is raised whenever the fps value changes
178 void updateFPSValue(float);
180 private:
181 /// the configuration object of the application
182 KSharedConfigPtr config;
184 // KAction pointers to enable/disable actions
185 QAction *fileNewWindow, *m_pSnapshot, *m_pCopy, *m_keyConf, *m_toolConf;
186 QAction *m_pPrint;
187 QAction *m_pZoomIn;
188 QAction *m_pZoomOut;
189 QAction *m_pQuit;
190 QAction *refreshSwitch;
191 KToggleAction *m_pShowMenu, *m_pShowMainToolBar, *m_pShowViewToolBar, *m_pShowSettingsToolBar;
192 KSelectAction *m_pZoomBox, *m_pRotationBox, *m_pFPSBox;
194 /// zoom slider
195 KIntNumInput *m_zoomSlider;
197 /// Current index into the zoomArray
198 unsigned int m_zoomIndex;
200 /// Current index into the rotationArray
201 unsigned int m_rotationIndex;
203 /// Current index into the fpsArray
204 unsigned int m_fpsIndex;
206 QStringList zoomArrayString;
207 std::vector<float> zoomArray;
209 QStringList rotationArrayString;
210 std::vector<int> rotationArray;
212 QStringList fpsArrayString;
213 std::vector<float> fpsArray;
215 KMagZoomView* m_zoomView;
216 KToggleAction *m_hideCursor;
217 KToggleAction *m_modeFollowMouse, *m_modeWholeScreen, *m_modeSelWin;
219 /// Stores the non-zero cursor type to be used
220 unsigned int m_mouseCursorType;
222 unsigned int m_defaultMouseCursorType;
226 #endif // KMAG_H