chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 1 | |
| 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.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 13 | #include "SkMatrix.h" |
| 14 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 15 | #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 | */ |
| 27 | class SkInspectorWidget : public QWidget { |
| 28 | Q_OBJECT |
| 29 | |
| 30 | public: |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 31 | enum TabType { |
| 32 | kOverview_TabType, |
| 33 | kDetail_TabType, |
| 34 | kTotalTabCount, |
| 35 | }; |
| 36 | |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 37 | /** |
| 38 | Constructs a widget with the specified parent for layout purposes. |
| 39 | @param parent The parent container of this widget |
| 40 | */ |
chudy@google.com | 2d537a1 | 2012-07-31 12:49:52 +0000 | [diff] [blame] | 41 | SkInspectorWidget(); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 42 | |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 43 | void setDisabled(bool isDisabled) { |
| 44 | fMatrixAndClipWidget.setDisabled(isDisabled); |
| 45 | } |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 46 | |
| 47 | /** |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 48 | Sets the text in tab at the specified index. |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 49 | @param text |
| 50 | */ |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 51 | void setText(QString text, TabType type); |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 52 | |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 53 | /** |
| 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.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 65 | 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.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 81 | private: |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 82 | QHBoxLayout fHorizontalLayout; |
| 83 | QTabWidget fTabWidget; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 84 | |
chudy@google.com | 6bd109a | 2012-08-14 19:34:13 +0000 | [diff] [blame] | 85 | QWidget fTabs[kTotalTabCount]; |
| 86 | QHBoxLayout fTabLayouts[kTotalTabCount]; |
| 87 | QTextEdit fTabTexts[kTotalTabCount]; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 88 | |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 89 | QWidget fMatrixAndClipWidget; |
| 90 | QVBoxLayout fVerticalLayout; |
chudy@google.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 91 | |
chudy@google.com | 2f89179 | 2012-07-03 16:05:59 +0000 | [diff] [blame] | 92 | 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.com | 902ebe5 | 2012-06-29 14:21:22 +0000 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | #endif |