blob: 8925302f74c730e47151d89b7121e12790334e23 (
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
|
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libmeegotouch.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef MSTYLABLEWIDGETVIEW_H
#define MSTYLABLEWIDGETVIEW_H
#include <mwidgetview.h>
class MStylableWidget;
/*!
\class MStylableWidgetView
\brief MStylableWidgetView is a specialised view to be used within simple non-MVC widgets.
MStylableWidget class is a specialised view to be used only withing MStylableWidget class.
It allows the MStylableWidget to provide style attributes information to child widgets.
*/
class MStylableWidgetView : public MWidgetView
{
Q_OBJECT
public:
/*!
* \brief Constructor
* \param controller Pointer to the stylable widget controller
*/
MStylableWidgetView(MStylableWidget *controller);
/*!
\brief Destructor.
*/
virtual ~MStylableWidgetView();
protected:
virtual MWidgetStyleContainer *createStyleContainer() const;
/*!
* Draws the background for this view.
*/
virtual void drawBackground(QPainter *painter, const QStyleOptionGraphicsItem *option) const;
/*!
* Draws the contents for this view.
*/
virtual void drawContents(QPainter *painter, const QStyleOptionGraphicsItem *option) const;
/*!
* Draws the foreground for this view.
*/
virtual void drawForeground(QPainter *painter, const QStyleOptionGraphicsItem *option) const;
/*!
Notification for derived classes. This method gets called when a new style is applied for this view.
This happens e.g. when the object is constructed and when a new object name is given to the widget.
This method routes the call back to the simple widget controller.
*/
virtual void applyStyle();
private:
// This is a private class, we can store it inside.
MStylableWidget *controller;
inline MWidgetModel *model() {
return MWidgetView::model();
}
inline const MWidgetModel *model() const {
return MWidgetView::model();
}
Q_DISABLE_COPY(MStylableWidgetView)
};
#endif // MSTYLABLEWIDGETVIEW_H
|