summaryrefslogtreecommitdiffstats
path: root/amarok/src/systray.h
blob: 6e4e4da2e5c958dfbf17602589c93c40387d8bf6 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// AmarokSystray
//
// Author: Stanislav Karchebny <berkus@users.sf.net>, (C) 2003
//
// Copyright: like rest of Amarok
//

#ifndef AMAROKSYSTRAY_H
#define AMAROKSYSTRAY_H

#include "engineobserver.h" //baseclass
#include <ksystemtray.h>
#include <tqpixmap.h>

class App;

namespace Amarok {

class TrayIcon : public KSystemTray, public EngineObserver
{
public:
    TrayIcon( TQWidget* );
    friend class ::App;

protected:
    // reimpl from engineobserver
    virtual void engineStateChanged( Engine::State state, Engine::State oldState = Engine::Empty );
    virtual void engineNewMetaData( const MetaBundle &bundle, bool trackChanged );
    virtual void engineTrackPositionChanged( long position, bool /*userSeek*/ );
    // get notified of 'highlight' color change
    virtual void paletteChange( const TQPalette & oldPalette );
    void resizeEvent ( TQResizeEvent * );
    void showEvent ( TQShowEvent * );

private:
    bool event( TQEvent* );
    void setLastFm( bool );

    // repaints trayIcon showing progress (and overlay if present)
    void paintIcon( int mergePixels = -1, bool force = false );
    // blend an overlay icon over 'sourcePixmap' and repaint trayIcon
    void blendOverlay( TQPixmap &sourcePixmap );
    void resizeTrayIcon();

    long trackLength, mergeLevel;
    TQPixmap baseIcon, grayedIcon, alternateIcon;
    TQPixmap playOverlay, pauseOverlay;
    TQPixmap *overlay;   // the current overlay (may be NULL)
    int blinkTimerID;   // timer ID returned by TQObject::startTimer()
    bool overlayVisible;// used for blinking / hiding overlay
    /** whether the last.fm icons are visible **/
    bool m_lastFmMode;
};

}

#endif