aboutsummaryrefslogtreecommitdiffhomepage
path: root/debugger/QT/SkInspectorWidget.h
blob: 7adf84fd709ef5b1c9ca0f67a6d89225cbf352f4 (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
100
101
102
103
104
105

/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#ifndef SKINSPECTORWIDGET_H_
#define SKINSPECTORWIDGET_H_

#include "SkMatrix.h"

#include <QWidget>
#include <QTabWidget>
#include <QTextEdit>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QGroupBox>
#include <QGridLayout>

/** \class SkInspectorWidget

    The InspectorWidget contains the overview and details tab. These contain
    information about the whole picture and details about each draw command.
 */
class SkInspectorWidget : public QWidget {
    Q_OBJECT

public:
    enum TabType {
        kOverview_TabType,
        kDetail_TabType,
        kClipStack_TabType,
        kTotalTabCount,
    };

    /**
        Constructs a widget with the specified parent for layout purposes.
        @param parent  The parent container of this widget
     */
    SkInspectorWidget();

    void setDisabled(bool isDisabled) {
        fMatrixAndClipWidget.setDisabled(isDisabled);
    }

    /**
        Sets the text in tab at the specified index.
        @param text
     */
    void setText(QString text, TabType type);

    /**
        Sets the text in the current matrix.
        @param matrixValues
     */
    void setMatrix(const SkMatrix& matrix);

    /**
        Sets the text in the current clip.
        @param clipValues
     */
    void setClip(const SkIRect& clip);

    class Tab : public QWidget {
        QWidget fTab;
        QHBoxLayout fTabLayout;
        QTextEdit fTabText;
        QString fName;

        Tab(const char* name) {
            fTabText.setReadOnly(true);
            fTabLayout.addWidget(&fTabText);
            fTab.setLayout(&fTabLayout);
            fName = QString(name);
        }
    };

private:
    QHBoxLayout fHorizontalLayout;
    QTabWidget fTabWidget;

    QWidget fTabs[kTotalTabCount];
    QHBoxLayout fTabLayouts[kTotalTabCount];
    QTextEdit fTabTexts[kTotalTabCount];

    QFrame fMatrixAndClipWidget;
    QVBoxLayout fVerticalLayout;

    QGroupBox fMatrixGroup;
    QGridLayout fMatrixLayout;
    QLineEdit fMatrixEntry[9];

    QGroupBox fClipGroup;
    QGridLayout fClipLayout;
    QLineEdit fClipEntry[4];

    void setupMatrix();
    void setupClip();
};

#endif