bibletime
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.

cbooktreechooser.h 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 CBOOKTREECHOOSER_H
  10. #define CBOOKTREECHOOSER_H
  11. /** The treechooser implementation for books.
  12. * @author The BibleTime team
  13. */
  14. //BibleTime includes
  15. #include "ckeychooser.h"
  16. #include "ckeychooserwidget.h"
  17. //Sword includes
  18. //TQt includes
  19. #include <tqwidget.h>
  20. #include <tqsize.h>
  21. #include <tqmap.h>
  22. #include <tqptrlist.h>
  23. #include <tqstringlist.h>
  24. //KDE includes
  25. #include <klistview.h>
  26. class CSwordKey;
  27. class CSwordBookModuleInfo;
  28. class CSwordTreeKey;
  29. namespace sword {
  30. class TreeKeyIdx;
  31. }
  32. /** The keychooser implementeation for books.
  33. * @author The BibleTime team
  34. */
  35. class CBookTreeChooser : public CKeyChooser {
  36. Q_OBJECT
  37. public:
  38. CBookTreeChooser(ListCSwordModuleInfo modules, CSwordKey *key=0, TQWidget *parent=0, const char *name=0);
  39. ~CBookTreeChooser();
  40. /**
  41. * Refreshes the content.
  42. */
  43. virtual void refreshContent();
  44. /**
  45. * Sets another module to this keychooser
  46. */
  47. virtual void setModules(const ListCSwordModuleInfo& modules, const bool refresh = true);
  48. /**
  49. * Returns the key of this kechooser.
  50. */
  51. virtual CSwordKey* const key();
  52. /**
  53. * Sets a new key to this keychooser
  54. */
  55. virtual void setKey(CSwordKey*);
  56. void setKey(CSwordKey*, const bool emitSinal);
  57. public slots: // Public slots
  58. virtual void updateKey( CSwordKey* );
  59. /**
  60. * Reimplementationm to handle tree creation on show.
  61. */
  62. virtual void show();
  63. protected: // Protected methods
  64. /**
  65. * Creates the first level of the tree structure.
  66. */
  67. void setupTree();
  68. virtual void adjustFont();
  69. protected slots: // Protected slots
  70. void itemActivated( TQListViewItem* item );
  71. private:
  72. class TreeItem : public TDEListViewItem {
  73. public:
  74. TreeItem(TQListViewItem* parent, TQListViewItem* after, CSwordTreeKey* key, const TQString keyName);
  75. TreeItem(TQListViewItem* parent, CSwordTreeKey* key, const TQString keyName);
  76. TreeItem(TQListView* view,TQListViewItem* after, CSwordTreeKey* key, const TQString keyName);
  77. const TQString& key() const;
  78. void createChilds();
  79. virtual void setOpen(bool);
  80. protected:
  81. /**
  82. * Initializes this item with the correct caption.
  83. */
  84. virtual void setup();
  85. private:
  86. CSwordTreeKey* m_key;
  87. TQString m_keyName;
  88. };
  89. TQPtrList<CSwordBookModuleInfo> m_modules;
  90. CSwordTreeKey* m_key;
  91. TDEListView* m_treeView;
  92. };
  93. #endif