Bibletime – a bible study tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cdisplaywindow.h 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. /*********
  2. *
  3. * This file is part of BibleTime's source code, http://www.bibletime.info/.
  4. *
  5. * Copyright 1999-2006 by the BibleTime developers.
  6. * The BibleTime source code is licensed under the GNU General Public License version 2.0.
  7. *
  8. **********/
  9. #ifndef CDISPLAYWINDOW_H
  10. #define CDISPLAYWINDOW_H
  11. //BibleTime includes
  12. #include "util/cpointers.h"
  13. #include "backend/cswordmoduleinfo.h"
  14. #include "backend/cswordbackend.h"
  15. #include "backend/cswordkey.h"
  16. #include "backend/cswordversekey.h"
  17. #include "backend/cswordtreekey.h"
  18. #include "backend/cswordldkey.h"
  19. #include "frontend/cprofilewindow.h"
  20. //TQt includes
  21. #include <tqwidget.h>
  22. //KDE includes
  23. #include <kmainwindow.h>
  24. //Forward declarations
  25. class CMDIArea;
  26. class CReadWindow;
  27. class CWriteWindow;
  28. class CMDIArea;
  29. class CDisplaySettingsButton;
  30. class CDisplay;
  31. class CKeyChooser;
  32. class CModuleChooserBar;
  33. class CDisplaySettingsButton;
  34. class TDEAccel;
  35. class TDEToolBar;
  36. class TDEPopupMenu;
  37. /** The base class for all display windows of BibleTime.
  38. * @author The BibleTime team
  39. */
  40. class CDisplayWindow : public TDEMainWindow, public CPointers {
  41. Q_OBJECT
  42. public:
  43. enum WriteWindowType {
  44. HTMLWindow = 1,
  45. PlainTextWindow = 2
  46. };
  47. static CReadWindow* createReadInstance(ListCSwordModuleInfo modules, CMDIArea* parent, const char* name = 0);
  48. static CWriteWindow* createWriteInstance(ListCSwordModuleInfo modules, CMDIArea* parent, const WriteWindowType type = HTMLWindow, const char* name = 0);
  49. /**
  50. * Insert the keyboard accelerators of this window into the given TDEAccel object.
  51. */
  52. // static void insertKeyboardActions( TDEAccel* const accel );
  53. static void insertKeyboardActions( TDEActionCollection* const a );
  54. CMDIArea* const mdi() const;
  55. /**
  56. * Returns the right window caption.
  57. */
  58. const TQString windowCaption();
  59. /**
  60. * Returns the used modules as a TQPtrList
  61. */
  62. ListCSwordModuleInfo modules();
  63. /**
  64. * Store the settings of this window in the given CProfileWindow object.
  65. */
  66. virtual void storeProfileSettings( Profile::CProfileWindow* profileWindow ) = 0;
  67. /**
  68. * Store the settings of this window in the given profile window.
  69. */
  70. virtual void applyProfileSettings( Profile::CProfileWindow* profileWindow ) = 0;
  71. /**
  72. * Set the window caption.
  73. */
  74. virtual void setCaption( const TQString& );
  75. /**
  76. * Sets the new filter options of this window.
  77. */
  78. void setFilterOptions( CSwordBackend::FilterOptions& filterOptions );
  79. /**
  80. * Sets the new display options for this window.
  81. */
  82. void setDisplayOptions( const CSwordBackend::DisplayOptions& displayOptions );
  83. /**
  84. * Returns the display options used by this display window.
  85. */
  86. CSwordBackend::DisplayOptions& displayOptions();
  87. /**
  88. * Returns the filter options used by this window.
  89. */
  90. CSwordBackend::FilterOptions& filterOptions();
  91. /**
  92. * Set the ready status
  93. */
  94. void setReady( const bool& ready );
  95. /**
  96. * Returns true if the widget is ready for use.
  97. */
  98. const bool isReady() const;
  99. /**
  100. * Returns true if the window may be closed.
  101. */
  102. virtual bool queryClose();
  103. /**
  104. * Returns the keychooser widget of this display window.
  105. */
  106. CKeyChooser* const keyChooser() const;
  107. /**
  108. * Sets the new sword key.
  109. */
  110. void setKey( CSwordKey* key );
  111. /**
  112. * Returns the key of this display window.
  113. */
  114. CSwordKey* key() const;
  115. /**
  116. * Initialize the window. Call this method from the outside, because calling this in the constructor is not possible!
  117. */
  118. virtual const bool init();
  119. /**
  120. * Sets the main toolbar.
  121. */
  122. void setMainToolBar( TDEToolBar* bar );
  123. /**
  124. * Sets the buttons toolbar.
  125. */
  126. void setButtonsToolBar( TDEToolBar* bar );
  127. /**
  128. * Returns the main toolbar.
  129. */
  130. TDEToolBar* const mainToolBar() const;
  131. /**
  132. * Returns the buttons toolbar.
  133. */
  134. TDEToolBar* const buttonsToolBar() const;
  135. /**
  136. * Initialize the toolbars
  137. */
  138. virtual void initToolbars() = 0;
  139. /**
  140. * Returns the display settings button
  141. */
  142. CDisplaySettingsButton* const displaySettingsButton() const;
  143. /**
  144. * Sets the display settings button.
  145. */
  146. void setDisplaySettingsButton( CDisplaySettingsButton* button );
  147. virtual void setupPopupMenu() = 0;
  148. /**
  149. * Returns the display widget used by this implementation of CDisplayWindow.
  150. */
  151. virtual CDisplay* const displayWidget() const;
  152. /**
  153. * Sets the display widget used by this display window.
  154. */
  155. virtual void setDisplayWidget( CDisplay* newDisplay );
  156. /** Returns whether syncs to the active window are allowed at this time for this display window
  157. * @return boolean value whether sync is allowed
  158. */
  159. virtual const bool syncAllowed() const {
  160. return false;
  161. };
  162. public slots:
  163. /**
  164. * Lookup the specified key in the given module. If the module is not chosen withing
  165. * this display window create a new displaywindow with the right module in it.
  166. */
  167. virtual void lookup( const TQString& module, const TQString& key );
  168. /**
  169. * Lookup the key in the chosen modules.
  170. */
  171. virtual void lookup( const TQString& key );
  172. /**
  173. * Refresh the settings of this window.
  174. */
  175. virtual void reload();
  176. protected:
  177. friend class CMDIArea;
  178. friend class CBibleReadWindow;
  179. CDisplayWindow(ListCSwordModuleInfo modules, CMDIArea* parent, const char *name=0);
  180. virtual ~CDisplayWindow();
  181. /**
  182. * Initializes the intern keyboard actions.
  183. */
  184. virtual void initActions();
  185. /**
  186. Is called when this window gets the focus or looses the focus.
  187. */
  188. virtual void windowActivated( const bool hasFocus );
  189. /**
  190. * Sets the keychooser widget for this display window.
  191. */
  192. void setKeyChooser( CKeyChooser* ck );
  193. /**
  194. * Returns the module chooser bar.
  195. */
  196. CModuleChooserBar* const moduleChooserBar() const;
  197. /**
  198. * Lookup the given key.
  199. */
  200. virtual void lookup( CSwordKey* ) = 0;
  201. /**
  202. * Sets the module chooser bar.
  203. */
  204. void setModuleChooserBar( CModuleChooserBar* bar );
  205. /**
  206. * Sets the modules.
  207. */
  208. void setModules( const ListCSwordModuleInfo& modules );
  209. /**
  210. * Initializes the signal / slot connections of this display window.
  211. */
  212. virtual void initConnections() = 0;
  213. /**
  214. * Initialize the view of this display window.
  215. */
  216. virtual void initView() = 0;
  217. /**
  218. * Returns the installed popup menu.
  219. */
  220. TDEPopupMenu* const popup();
  221. virtual void closeEvent(TQCloseEvent* e);
  222. protected slots:
  223. virtual void modulesChanged();
  224. /**
  225. * Lookup the current key. Used to refresh the display.
  226. */
  227. void lookup();
  228. virtual void updatePopupMenu();
  229. void slotSearchInModules();
  230. void printAll();
  231. void printAnchorWithText();
  232. private:
  233. CMDIArea* m_mdi;
  234. //we may only cache the module names bacause after a backend relaod the pointers are invalid!
  235. TQStringList m_modules;
  236. CSwordBackend::FilterOptions m_filterOptions;
  237. CSwordBackend::DisplayOptions m_displayOptions;
  238. CDisplaySettingsButton* m_displaySettingsButton;
  239. CKeyChooser* m_keyChooser;
  240. CSwordKey* m_swordKey;
  241. bool m_isReady;
  242. CModuleChooserBar* m_moduleChooserBar;
  243. TDEToolBar* m_mainToolBar;
  244. TDEToolBar* m_buttonsToolBar;
  245. TDEPopupMenu* m_popupMenu;
  246. CDisplay* m_displayWidget;
  247. };
  248. #endif