aboutsummaryrefslogtreecommitdiffhomepage
path: root/debugger/QT/SkListWidget.h
blob: d6e797ae9b58082f48e7bc752d434e74e1d1535f (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

/*
 * 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 SKLISTWIDGET_H_
#define SKLISTWIDGET_H_

#include <QAbstractItemDelegate>
#include <QPainter>

/** \class SkListWidget

    This widget contains the draw commands.
 */
class SkListWidget : public QAbstractItemDelegate {
public:
    enum IndexStyle {
        kIndex_IndexStyle,
        kOffset_IndexStyle,
    };

    /**
        Constructs the list widget with the specified parent for layout purposes.
        @param parent  The parent container of this widget
     */
    SkListWidget(QObject* parent = NULL) : fIndexStyle(kIndex_IndexStyle) {}

    virtual ~SkListWidget() {}

    /**
        Draws the current state of the widget. Overriden from QWidget.
     */
    void paint(QPainter* painter, const QStyleOptionViewItem& option,
               const QModelIndex& index ) const;

    /**
        Returns the default size of the widget. Overriden from QWidget.
     */
    QSize sizeHint(const QStyleOptionViewItem& option,
                   const QModelIndex& index) const;


    void setIndexStyle(IndexStyle indexStyle) {
        fIndexStyle = indexStyle;
    }

protected:
    IndexStyle fIndexStyle;
};

#endif