summaryrefslogtreecommitdiffstats
path: root/kompare/komparepart/kompareconnectwidget.h
blob: 1c96d7520563d5f6ec61bddab0abeaca9ec5bed4 (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
/***************************************************************************
                          kompareconnectwidget.h  -  description
                             -------------------
    begin                : Tue Jun 26 2001
    copyright            : (C) 2001-2003 John Firebaugh
                           (C) 2001-2004 Otto Bruggeman
                           (C) 2004      Jeff Snyder
    email                : jfirebaugh@kde.org
                           otto.bruggeman@home.nl
                           jeff@caffeinated.me.uk
 ***************************************************************************/

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

#ifndef KOMPARECONNECTWIDGET_H
#define KOMPARECONNECTWIDGET_H

#include "kompare_qsplitter.h"
#include <tqwidget.h>

namespace Diff2 {
class DiffModel;
}
class ViewSettings;
class KompareListView;
class KompareSplitter;

class KompareConnectWidget : public TQWidget
{
	Q_OBJECT
  TQ_OBJECT

public:
	KompareConnectWidget( KompareListView* left, KompareListView* right,
	      ViewSettings* settings, TQWidget* tqparent, const char* name = 0 );
	~KompareConnectWidget();

public slots:
	void slotSetSelection( const Diff2::DiffModel* model, const Diff2::Difference* diff );
	void slotSetSelection( const Diff2::Difference* diff );

	void slotDelayedRepaint();

signals:
	void selectionChanged(const Diff2::Difference* diff);

protected:
	void paintEvent( TQPaintEvent* e );
	TQPointArray makeTopBezier( int tl, int tr );
	TQPointArray makeBottomBezier( int bl, int br );
	TQPointArray makeConnectPoly( const TQPointArray& topBezier, const TQPointArray& bottomBezier );

private:
	ViewSettings*             m_settings;

	KompareListView*          m_leftView;
	KompareListView*          m_rightView;

	const Diff2::DiffModel*   m_selectedModel;
	const Diff2::Difference*  m_selectedDifference;
};

class KompareConnectWidgetFrame : public KQSplitterHandle
{
	Q_OBJECT
  TQ_OBJECT
public:
	KompareConnectWidgetFrame( KompareListView* left, KompareListView* right,
	      ViewSettings* settings, KompareSplitter* tqparent, const char* name = 0 );
	~KompareConnectWidgetFrame();
	
	TQSize tqsizeHint() const;

	KompareConnectWidget*     wid() { return &m_wid; }

protected:
	// stop the tqparent KQSplitterHandle painting
	void paintEvent( TQPaintEvent* /* e */ ) { }

	void mouseMoveEvent( TQMouseEvent * );
	void mousePressEvent( TQMouseEvent * );
	void mouseReleaseEvent( TQMouseEvent * );

private:
	KompareConnectWidget      m_wid;
	TQLabel                    m_label;
	TQVBoxLayout               m_layout;
};

#endif