blob: 1b962356f7021ebd8a5821645268f412a18485d1 [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>
21
22/** \class SkInspectorWidget
23
24 The InspectorWidget contains the overview and details tab. These contain
25 information about the whole picture and details about each draw command.
26 */
27class SkInspectorWidget : public QWidget {
28 Q_OBJECT
29
30public:
chudy@google.com6bd109a2012-08-14 19:34:13 +000031 enum TabType {
32 kOverview_TabType,
33 kDetail_TabType,
34 kTotalTabCount,
35 };
36
chudy@google.com902ebe52012-06-29 14:21:22 +000037 /**
38 Constructs a widget with the specified parent for layout purposes.
39 @param parent The parent container of this widget
40 */
chudy@google.com2d537a12012-07-31 12:49:52 +000041 SkInspectorWidget();
chudy@google.com902ebe52012-06-29 14:21:22 +000042
chudy@google.com2f891792012-07-03 16:05:59 +000043 void setDisabled(bool isDisabled) {
44 fMatrixAndClipWidget.setDisabled(isDisabled);
45 }
chudy@google.com902ebe52012-06-29 14:21:22 +000046
47 /**
chudy@google.com6bd109a2012-08-14 19:34:13 +000048 Sets the text in tab at the specified index.
chudy@google.com902ebe52012-06-29 14:21:22 +000049 @param text
50 */
chudy@google.com6bd109a2012-08-14 19:34:13 +000051 void setText(QString text, TabType type);
chudy@google.com902ebe52012-06-29 14:21:22 +000052
chudy@google.com2f891792012-07-03 16:05:59 +000053 /**
54 Sets the text in the current matrix.
55 @param matrixValues
56 */
57 void setMatrix(const SkMatrix& matrix);
58
59 /**
60 Sets the text in the current clip.
61 @param clipValues
62 */
63 void setClip(const SkIRect& clip);
64
chudy@google.com6bd109a2012-08-14 19:34:13 +000065 class Tab : public QWidget {
66 QWidget fTab;
67 QHBoxLayout fTabLayout;
68 QTextEdit fTabText;
69 QString fName;
70
71 Tab(const char* name) {
72 fTabText.setReadOnly(true);
73 fTabLayout.setSpacing(6);
74 fTabLayout.setContentsMargins(11, 11, 11, 11);
75 fTabLayout.addWidget(&fTabText);
76 fTab.setLayout(&fTabLayout);
77 fName = QString(name);
78 }
79 };
80
chudy@google.com902ebe52012-06-29 14:21:22 +000081private:
chudy@google.com2f891792012-07-03 16:05:59 +000082 QHBoxLayout fHorizontalLayout;
83 QTabWidget fTabWidget;
chudy@google.com902ebe52012-06-29 14:21:22 +000084
chudy@google.com6bd109a2012-08-14 19:34:13 +000085 QWidget fTabs[kTotalTabCount];
86 QHBoxLayout fTabLayouts[kTotalTabCount];
87 QTextEdit fTabTexts[kTotalTabCount];
chudy@google.com902ebe52012-06-29 14:21:22 +000088
chudy@google.com2f891792012-07-03 16:05:59 +000089 QWidget fMatrixAndClipWidget;
90 QVBoxLayout fVerticalLayout;
chudy@google.com902ebe52012-06-29 14:21:22 +000091
chudy@google.com2f891792012-07-03 16:05:59 +000092 QLabel fMatrixLabel;
93 QVBoxLayout fMatrixLayout;
94 QHBoxLayout fMatrixRow[3];
95 QLineEdit fMatrixEntry[9];
96
97 QLabel fClipLabel;
98 QVBoxLayout fClipLayout;
99 QHBoxLayout fClipRow[2];
100 QLineEdit fClipEntry[4];
101
102 QVBoxLayout* setupMatrix();
103 QVBoxLayout* setupClip();
chudy@google.com902ebe52012-06-29 14:21:22 +0000104};
105
106#endif