summaryrefslogtreecommitdiff
path: root/src/frontend/displaywindow/btwindowmodulechooser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/displaywindow/btwindowmodulechooser.h')
-rw-r--r--src/frontend/displaywindow/btwindowmodulechooser.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/frontend/displaywindow/btwindowmodulechooser.h b/src/frontend/displaywindow/btwindowmodulechooser.h
new file mode 100644
index 0000000..c30c284
--- /dev/null
+++ b/src/frontend/displaywindow/btwindowmodulechooser.h
@@ -0,0 +1,61 @@
+/*********
+*
+* This file is part of BibleTime's source code, http://www.bibletime.info/.
+*
+* Copyright 1999-2008 by the BibleTime developers.
+* The BibleTime source code is licensed under the GNU General Public License version 2.0.
+*
+**********/
+
+#ifndef BT_WINDOWMODULECHOOSER
+#define BT_WINDOWMODULECHOOSER
+
+#include "backend/drivers/cswordmoduleinfo.h"
+#include <QStringList>
+
+class CDisplayWindow;
+
+/**
+* This is an abstract base class for buttonbar and text window header
+* which work as module choosers in a text window.
+*
+* Signals or slots can't be inherited from this class for Qt's
+* technical reasons. Add corresponding slots for the protected
+* modulesChanged methods and delegate the message.
+*
+* Add these signals to the subclass or to some part of it:
+* User selected a module from menu to replace another module:
+* void sigModuleReplace ( int index, QString newModule );
+* User selected a module from menu to add:
+* void sigModuleAdd ( int index, QString module );
+* User selected a module from menu to be removed:
+* void sigModuleRemove ( int index );
+*
+* Connect slots and signals to the window's corresponding signals and slots.
+*/
+class BtWindowModuleChooser {
+ public:
+ BtWindowModuleChooser ( CDisplayWindow* parentWindow, CSwordModuleInfo::ModuleType moduleType )
+ : m_window ( parentWindow ), m_moduleType ( moduleType ) {}
+
+ virtual ~BtWindowModuleChooser() {}
+
+ protected:
+ /**
+ * The backend module list was updated, module list and widgets must be updated.
+ * This expects that the window module list has already been updated, so
+ * the corresponding slot should be connected to the window, not to the backend.
+ */
+ virtual void backendModulesChanged() = 0;
+ /** Modules have been added, replaced or removed in the window without backend changing.*/
+ virtual void windowModulesChanged() = 0;
+
+
+ protected:
+ CDisplayWindow* m_window;
+ CSwordModuleInfo::ModuleType m_moduleType;
+ /** The cache of the window module list. Kept for convenience.*/
+ QStringList m_modules;
+};
+
+#endif