blob: 7adf84fd709ef5b1c9ca0f67a6d89225cbf352f4 [file] [log] [blame]
chudy@google.com902ebe52012-06-29 14:21:22 +00001
2/*
3 * Copyright 2012 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10#ifndef SKINSPECTORWIDGET_H_
11#define SKINSPECTORWIDGET_H_
12
chudy@google.com2f891792012-07-03 16:05:59 +000013#include "SkMatrix.h"
14
chudy@google.com902ebe52012-06-29 14:21:22 +000015#include <QWidget>
16#include <QTabWidget>
17#include <QTextEdit>
18#include <QHBoxLayout>
19#include <QLabel>
20#include <QLineEdit>
kkinnunen7c339ae2015-01-02 06:35:43 -080021#include <QGroupBox>
22#include <QGridLayout>
chudy@google.com902ebe52012-06-29 14:21:22 +000023
24/** \class SkInspectorWidget
25
26 The InspectorWidget contains the overview and details tab. These contain
27 information about the whole picture and details about each draw command.
28 */
29class SkInspectorWidget : public QWidget {
30 Q_OBJECT
31
32public:
chudy@google.com6bd109a2012-08-14 19:34:13 +000033 enum TabType {
34 kOverview_TabType,
35 kDetail_TabType,
commit-bot@chromium.org2a67e122014-05-19 13:53:10 +000036 kClipStack_TabType,
chudy@google.com6bd109a2012-08-14 19:34:13 +000037 kTotalTabCount,
38 };
39
chudy@google.com902ebe52012-06-29 14:21:22 +000040 /**
41 Constructs a widget with the specified parent for layout purposes.
42 @param parent The parent container of this widget
43 */
chudy@google.com2d537a12012-07-31 12:49:52 +000044 SkInspectorWidget();
chudy@google.com902ebe52012-06-29 14:21:22 +000045
chudy@google.com2f891792012-07-03 16:05:59 +000046 void setDisabled(bool isDisabled) {
47 fMatrixAndClipWidget.setDisabled(isDisabled);
48 }
chudy@google.com902ebe52012-06-29 14:21:22 +000049
50 /**
chudy@google.com6bd109a2012-08-14 19:34:13 +000051 Sets the text in tab at the specified index.
chudy@google.com902ebe52012-06-29 14:21:22 +000052 @param text
53 */
chudy@google.com6bd109a2012-08-14 19:34:13 +000054 void setText(QString text, TabType type);
chudy@google.com902ebe52012-06-29 14:21:22 +000055
chudy@google.com2f891792012-07-03 16:05:59 +000056 /**
57 Sets the text in the current matrix.
58 @param matrixValues
59 */
60 void setMatrix(const SkMatrix& matrix);
61
62 /**
63 Sets the text in the current clip.
64 @param clipValues
65 */
66 void setClip(const SkIRect& clip);
67
chudy@google.com6bd109a2012-08-14 19:34:13 +000068 class Tab : public QWidget {
69 QWidget fTab;
70 QHBoxLayout fTabLayout;
71 QTextEdit fTabText;
72 QString fName;
73
74 Tab(const char* name) {
75 fTabText.setReadOnly(true);
chudy@google.com6bd109a2012-08-14 19:34:13 +000076 fTabLayout.addWidget(&fTabText);
77 fTab.setLayout(&fTabLayout);
78 fName = QString(name);
79 }
80 };
81
chudy@google.com902ebe52012-06-29 14:21:22 +000082private:
chudy@google.com2f891792012-07-03 16:05:59 +000083 QHBoxLayout fHorizontalLayout;
84 QTabWidget fTabWidget;
chudy@google.com902ebe52012-06-29 14:21:22 +000085
chudy@google.com6bd109a2012-08-14 19:34:13 +000086 QWidget fTabs[kTotalTabCount];
87 QHBoxLayout fTabLayouts[kTotalTabCount];
88 QTextEdit fTabTexts[kTotalTabCount];
chudy@google.com902ebe52012-06-29 14:21:22 +000089
kkinnunen7c339ae2015-01-02 06:35:43 -080090 QFrame fMatrixAndClipWidget;
chudy@google.com2f891792012-07-03 16:05:59 +000091 QVBoxLayout fVerticalLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +000092
kkinnunen7c339ae2015-01-02 06:35:43 -080093 QGroupBox fMatrixGroup;
94 QGridLayout fMatrixLayout;
chudy@google.com2f891792012-07-03 16:05:59 +000095 QLineEdit fMatrixEntry[9];
96
kkinnunen7c339ae2015-01-02 06:35:43 -080097 QGroupBox fClipGroup;
98 QGridLayout fClipLayout;
chudy@google.com2f891792012-07-03 16:05:59 +000099 QLineEdit fClipEntry[4];
100
kkinnunen7c339ae2015-01-02 06:35:43 -0800101 void setupMatrix();
102 void setupClip();
chudy@google.com902ebe52012-06-29 14:21:22 +0000103};
104
105#endif