summaryrefslogtreecommitdiff
path: root/muse2/muse/widgets/ttoolbutton.cpp
blob: bf9234c6917b8eaee744916bdd2e6e929f319660 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//=========================================================
//  MusE
//  Linux Music Editor
//    $Id: ttoolbutton.cpp,v 1.1 2004/02/21 16:53:50 wschweer Exp $
//  (C) Copyright 2004 Werner Schweer (ws@seh.de)
//=========================================================

#include <qpainter.h>
//Added by qt3to4:
#include <QPixmap>

#include "ttoolbutton.h"
#include "gconfig.h"
#include "icons.h"

//---------------------------------------------------------
//   drawButton
//---------------------------------------------------------

void TransparentToolButton::drawButton(QPainter* p)
      {
      int w = width();
      int h = height();
      QIcon::Mode mode = isEnabled() ? QIcon::Normal : QIcon::Disabled;
      QIcon::State state = isOn() ? QIcon::On : QIcon::Off;
      const QPixmap pm(iconSet().pixmap(QIcon::Automatic, mode, state));
      p->drawPixmap(QPoint((w - pm.width())/2, (h - pm.height())/2), pm);
      }