Warning, file /office/calligra/gemini/lib/GeminiModeSwitchEvent.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * This file is part of the KDE project
0003  * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  * Copyright (C) 2015 Dan Leinir Turthra Jensen <admin@leinir.dk>
0005  *
0006  * This program is free software; you can redistribute it and/or modify
0007  * it under the terms of the GNU General Public License as published by
0008  * the Free Software Foundation; either version 2 of the License, or
0009  * (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program; if not, write to the Free Software
0018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0019  */
0020 
0021 #ifndef GEMINIMODESWITCHEVENT_H
0022 #define GEMINIMODESWITCHEVENT_H
0023 
0024 #include <QEvent>
0025 
0026 struct GeminiModeSynchronisationObject {
0027     GeminiModeSynchronisationObject() : initialized(false) { }
0028     bool initialized;
0029 };
0030 
0031 class GeminiModeSwitchEvent : public QEvent
0032 {
0033 public:
0034     /**
0035      * Which type of event you are dealing with. You will only receive this in two cases:
0036      * When you are about to switch away from a particular mode (sent to fromView before switching)
0037      * When you have been made the current mode (sent to toView after switching)
0038      */
0039     enum GeminiModeEventType {
0040         AboutToSwitchViewModeEvent = QEvent::User + 1, ///< Write information into the event (and mark the sync object as initialized)
0041         SwitchedToThisModeEvent ///< Read information out of the event
0042     };
0043 
0044     inline GeminiModeSwitchEvent(GeminiModeEventType type, QObject* fromView, QObject* toView, GeminiModeSynchronisationObject* syncObject)
0045             : QEvent(static_cast<QEvent::Type>(type))
0046             , m_fromView(fromView)
0047             , m_toView(toView)
0048             , m_syncObject(syncObject) {
0049 
0050     }
0051 
0052     inline QObject* fromView() const {
0053         return m_fromView;
0054     }
0055     inline QObject* toView() const {
0056         return m_toView;
0057     }
0058 
0059     inline GeminiModeSynchronisationObject* synchronisationObject() const {
0060         return m_syncObject;
0061     }
0062 
0063 private:
0064     QObject* m_fromView;
0065     QObject* m_toView;
0066     GeminiModeSynchronisationObject* m_syncObject;
0067 };
0068 
0069 #endif // GEMINIMODESWITCHEVENT_H
0070