~neon/kompare/master

« back to all changes in this revision

Viewing changes to src/komparepart/komparesplitter.h

  • Committer: Friedrich W. H. Kossebau
  • Date: 2020-11-13 21:43:33 UTC
  • Revision ID: git-v1:79fce0df862602a8e2790d7d14f4037744a006f6
Reorganize sources into src/ subfolder

NO_CHANGELOG

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                                komparesplitter.h
 
3
                                -----------------
 
4
        begin                   : Wed Jan 14 2004
 
5
        Copyright 2004      Jeff Snyder  <jeff@caffeinated.me.uk>
 
6
        Copyright 2007-2011 Kevin Kofler <kevin.kofler@chello.at>
 
7
****************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
**
 
11
**   This program is free software; you can redistribute it and/or modify
 
12
**   it under the terms of the GNU General Public License as published by
 
13
**   the Free Software Foundation; either version 2 of the License, or
 
14
**   (at your option) any later version.
 
15
**
 
16
***************************************************************************/
 
17
 
 
18
#ifndef _KOMPARESPLITTER_H_
 
19
#define _KOMPARESPLITTER_H_
 
20
 
 
21
#include <QSplitter>
 
22
 
 
23
#include <libkomparediff2/komparemodellist.h>
 
24
 
 
25
class QSplitterHandle;
 
26
class QTimer;
 
27
class QScrollBar;
 
28
class QWheelEvent;
 
29
class QKeyEvent;
 
30
 
 
31
namespace Diff2 {
 
32
class DiffModel;
 
33
class Difference;
 
34
}
 
35
class ViewSettings;
 
36
 
 
37
class KompareListView;
 
38
class KompareConnectWidget;
 
39
 
 
40
class KompareSplitter : public QSplitter
 
41
{
 
42
    Q_OBJECT
 
43
 
 
44
public:
 
45
    KompareSplitter(ViewSettings* settings, QWidget* parent);
 
46
    ~KompareSplitter() override;
 
47
 
 
48
Q_SIGNALS:
 
49
    void configChanged();
 
50
 
 
51
    void scrollViewsToId(int id);
 
52
    void setXOffset(int x);
 
53
 
 
54
    void selectionChanged(const Diff2::Difference* diff);
 
55
 
 
56
public Q_SLOTS:
 
57
    void slotScrollToId(int id);
 
58
    void slotDelayedUpdateScrollBars();
 
59
    void slotUpdateScrollBars();
 
60
    void slotDelayedUpdateVScrollValue();
 
61
    void slotUpdateVScrollValue();
 
62
    void keyPressEvent(QKeyEvent* e) override;
 
63
 
 
64
    void slotApplyDifference(bool apply);
 
65
    void slotApplyAllDifferences(bool apply);
 
66
    void slotApplyDifference(const Diff2::Difference* diff, bool apply);
 
67
 
 
68
    void slotSetSelection(const Diff2::DiffModel* model, const Diff2::Difference* diff);
 
69
    void slotSetSelection(const Diff2::Difference* diff);
 
70
 
 
71
    void slotDifferenceClicked(const Diff2::Difference* diff);
 
72
 
 
73
    void slotConfigChanged();
 
74
 
 
75
protected:
 
76
    void wheelEvent(QWheelEvent* e) override;
 
77
 
 
78
    ViewSettings* settings() const { return m_settings; }
 
79
 
 
80
protected Q_SLOTS:
 
81
    void slotDelayedRepaintHandles();
 
82
    void slotRepaintHandles();
 
83
    void timerTimeout();
 
84
 
 
85
private:
 
86
    // override from QSplitter
 
87
    QSplitterHandle* createHandle() override;
 
88
 
 
89
    void               setCursor(int id, const QCursor& cursor);
 
90
    void               unsetCursor(int id);
 
91
 
 
92
protected:
 
93
    KompareListView* listView(int index);
 
94
    KompareConnectWidget* connectWidget(int index);
 
95
 
 
96
private:
 
97
 
 
98
    // Scrollbars. all this just for the goddamn scrollbars. i hate them.
 
99
    int  scrollId();
 
100
    int  lineHeight();
 
101
    int  pageSize();
 
102
    bool needVScrollBar();
 
103
    int  minVScrollId();
 
104
    int  maxVScrollId();
 
105
    bool needHScrollBar();
 
106
    int  minHScrollId();
 
107
    int  maxHScrollId();
 
108
    int  maxContentsX();
 
109
    int  minVisibleWidth();
 
110
 
 
111
    QTimer*            m_scrollTimer;
 
112
    bool               m_restartTimer;
 
113
    int                m_scrollTo;
 
114
 
 
115
    ViewSettings*      m_settings;
 
116
    QScrollBar*        m_vScroll;
 
117
    QScrollBar*        m_hScroll;
 
118
 
 
119
    friend class KompareConnectWidgetFrame;
 
120
};
 
121
#endif //_KOMPARESPLITTER_H_