summaryrefslogtreecommitdiffstats
path: root/kget/dockindividual.cpp
blob: e8f02645bf12de9d2d0f2140b4ad6dc93d1cea0f (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/***************************************************************************
*                               dockindividual.cpp
*                             -------------------
*
*    Revision     : $Id$
*    begin        : Tue Jan 29 2002
*    copyright    : (C) 2002 by Patrick Charbonnier
*                 :
*    email        : [email protected]
*
****************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 ***************************************************************************/

#include <tqtooltip.h>

#include <kpopupmenu.h>

#include "dockindividual.h"
DockIndividual::DockIndividual(TQWidget *parent, const char *name ) : KSystemTray(parent,name)
{
    nPic=0;
    setPixmap( loadIcon("bar0") );
}

DockIndividual::~DockIndividual()
{
    TQToolTip::remove(this);
}


void DockIndividual::setValue(int value){
#ifdef _DEBUG
    //sDebugIn<<" value ="<<value<<endl;
#endif
    int tmpPic=0;
    if (value<20)
        tmpPic=1;
    else if(value<40)
        tmpPic=2;

    else if(value<60)
        tmpPic=3;

    else if(value<80)
        tmpPic=4;

    else if(value<=95)
        tmpPic=5;

    else if(value>=96)
        tmpPic=6;

    if (tmpPic!=nPic)
    {
        nPic=tmpPic;
        TQString str = "bar" + TQString::number( nPic );
        setPixmap( loadIcon( str ) );
    }

#ifdef _DEBUG
    //sDebugOut<<endl;
#endif
}



void DockIndividual::setTip(const TQString & _tip)
{
#ifdef _DEBUG
    //sDebugIn<<"_tip="<<_tip<<endl;
#endif


    TQToolTip::add( this, _tip );

#ifdef _DEBUG
    //sDebugOut<<endl;
#endif
}

#include "dockindividual.moc"
/** No descriptions */
void DockIndividual::contextMenuAboutToShow ( KPopupMenu* menu )
{
    menu->removeItemAt (3);
}