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.
 
 
 
 
 
 

53 lines
1.7 KiB

  1. /**
  2. * This file is part of the System Settings package
  3. * Copyright (C) 2005 Benjamin C Meyer
  4. * <ben+systempreferences at meyerhome dot net>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public License
  17. * along with this library; see the file COPYING.LIB. If not, write to
  18. * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
  19. * Boston, MA 02110-1301, USA.
  20. */
  21. #include "moduleiconitem.h"
  22. #include <kiconloader.h>
  23. #define IMAGE_SIZE 32
  24. ModuleIconItem::ModuleIconItem( KIconView *parent, KCModuleInfo module)
  25. : TQIconViewItem( parent, module.moduleName(),
  26. SmallIcon( module.icon(), IMAGE_SIZE ) ),
  27. currentState( KIcon::ActiveState), imageName(module.icon())
  28. {
  29. modules.append(module);
  30. }
  31. ModuleIconItem::ModuleIconItem( KIconView *parent, const TQString &text,
  32. const TQString &imageName )
  33. : TQIconViewItem( parent, text, SmallIcon( imageName, IMAGE_SIZE ) ),
  34. currentState( KIcon::ActiveState )
  35. {
  36. this->imageName = imageName;
  37. }
  38. void ModuleIconItem::loadIcon( bool enabled )
  39. {
  40. int newState = enabled ? KIcon::DefaultState : KIcon::DisabledState;
  41. if( newState == currentState )
  42. return;
  43. currentState = newState;
  44. setPixmap( SmallIcon( imageName, IMAGE_SIZE, currentState ) );
  45. }