summaryrefslogtreecommitdiffstats
path: root/kalzium/src/kalziumtip.h
blob: c819e32bec556165960087e9f0b68585d3de661a (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
#ifndef KALZIUMTIP_H
#define KALZIUMTIP_H
/***************************************************************************

                           The header for the tooltip class of Kalzium
                             -------------------
    begin                : June 2003
    copyright            : (C) 2003, 2004, 2005 by Zack Rusin <zrusin@kde.org>
						Sami Kyostil <skyostil@kempele.fi>
                   				Aaron J. Seigo <aseigo@kde.org>
						Martin Pfeiffer <hubipete@gmx.net>
   
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/


#include <tqwidget.h>
#include <tqbitmap.h>
#include <tqtimer.h>

class TQPaintEvent;
class TQSimpleRichText;
class TQPixmap;
class Element;
class TQTimer;


/**
 * @short tooltip for kalzium
 * @author Martin Pfeiffer
 */
class KalziumTip : public TQWidget
{
	Q_OBJECT
	

	public:
		enum MaskEffect { Plain, Dissolve };

		KalziumTip( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 );

		void showTip( TQPoint, Element* element, int visibleWidth, int visibleHeight ); //show the tip
		void hide(); // hide it

	protected:
		void paintEvent(TQPaintEvent * e);

     		void plainMask();
    		void dissolveMask();
    	// if the mouse pointer hovers us, send the event to the parent
    	// so we are some-what 'mouse transparent'
    	void mouseMoveEvent(TQMouseEvent * e);
		void displayInternal();
		void display();	
		
		void loadIcon(); //loads the elements icon
	
	protected slots:
		void internalUpdate();
		
	private:
		TQBitmap m_mask;
		TQPoint m_mousePointer;
    		TQPixmap m_pixmap;
    		TQPixmap m_icon; //icon shown on the tip
		TQPixmap m_noElemIcon; //icon for element wich have no image

    		MaskEffect m_maskEffect; //inidicates to show mask effect or plain
    		TQSimpleRichText* m_richText;

    		int m_dissolveSize;
    		int m_dissolveDelta;

    		TQTimer m_frameTimer; //timer for the dissolve effect
    		bool m_dirty;	//indicates repainting the tooltip internal

		const Element* m_tippedElement; //the element the tip is about
};

#endif