summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediawidget.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediawidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 7891a7e..c0ebd63 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -94,39 +94,48 @@ bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const
buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 );
}
void MediaWidget::paintAllButtons( QPainter &p )
{
for ( ButtonVector::const_iterator it = buttons.begin();
it != buttons.end(); ++it )
paintButton( p, *it );
}
void MediaWidget::paintButton( const Button &button )
{
QPainter p( this );
paintButton( p, button );
}
void MediaWidget::paintButton( QPainter &p, const Button &button )
{
if ( button.isDown )
p.drawPixmap( upperLeftOfButtonMask, button.pixDown );
else
p.drawPixmap( upperLeftOfButtonMask, button.pixUp );
}
+void MediaWidget::setToggleButton( Command command, bool down )
+{
+ for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it )
+ if ( it->command == command ) {
+ setToggleButton( *it, down );
+ return;
+ }
+}
+
void MediaWidget::setToggleButton( Button &button, bool down )
{
if ( down != button.isDown )
toggleButton( button );
}
void MediaWidget::toggleButton( Button &button )
{
button.isDown = !button.isDown;
paintButton( button );
}
/* vim: et sw=4 ts=4
*/