TDE System Settings – easy to use control center
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.
 
 
 
 
 
 

102 lines
2.7 KiB

  1. /**
  2. * This file is part of the System Preferences package
  3. * Copyright (C) 2005 Benjamin C Meyer (ben+systempreferences at meyerhome dot net)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public License
  16. * along with this library; see the file COPYING.LIB. If not, write to
  17. * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef MODULESVIEW_H
  21. #define MODULESVIEW_H
  22. #include <kiconview.h>
  23. /**
  24. * Overloaded to give a larger default size that fits with text of two lines.
  25. */
  26. class RowIconView : public KIconView
  27. {
  28. public:
  29. RowIconView( TQWidget* parent, const char *name=0 )
  30. : KIconView( parent, name ){ };
  31. // Figure out the hight/width to have only one row
  32. TQSize tqminimumSizeHint() const {
  33. int width = 0;
  34. /*
  35. for ( TQIconViewItem *item = firstItem(); item; item = item->nextItem() )
  36. width += item->width();
  37. width += spacing()*(count())+(margin()+frameWidth()+lineWidth()+midLineWidth())*2 ;
  38. */
  39. width = count()*gridX()+frameWidth()*2;
  40. int height = 0;
  41. for ( TQIconViewItem *item = firstItem(); item; item = item->nextItem() )
  42. if(item->height() > height)
  43. height = item->height();
  44. // I honestly don't know where the 4+4 is coming from...
  45. // What other spacing did I miss?
  46. height += (margin()+frameWidth()+spacing()+lineWidth()+midLineWidth())*2+8;
  47. /*
  48. int h = fontMetrics().height();
  49. if ( h < 10 )
  50. h = 10;
  51. int f = 2 * frameWidth();
  52. int height = ( 2*h ) + f + spacing() * 2 + 32 + lineWidth()*2 + 10;
  53. */
  54. return TQSize( width, height );
  55. };
  56. };
  57. class TQBoxLayout;
  58. class KCModuleMenu;
  59. /**
  60. * This widget contains the IconView's of all of the modules etc
  61. * It is the basic thing that users see.
  62. */
  63. class ModulesView : public TQWidget
  64. {
  65. // To search the groups
  66. friend class KcmSearch;
  67. Q_OBJECT
  68. TQ_OBJECT
  69. public:
  70. void clearSelection();
  71. TQString displayName;
  72. signals:
  73. void itemSelected( TQIconViewItem* item );
  74. public:
  75. ModulesView( KCModuleMenu *rootMenu, const TQString &menuPath, TQWidget *parent=0, const char *name=0 );
  76. ~ModulesView();
  77. private:
  78. TQValueList<RowIconView*> groups;
  79. KCModuleMenu *rootMenu;
  80. TQString menuPath;
  81. void createRow( const TQString &parentPath, TQBoxLayout *tqlayout );
  82. };
  83. #endif // MODULESVIEW_H