CTK
0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Libs
Widgets
ctkPixmapIconEngine.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Library: CTK
4
5
Copyright (c) Kitware Inc.
6
7
Licensed under the Apache License, Version 2.0 (the "License");
8
you may not use this file except in compliance with the License.
9
You may obtain a copy of the License at
10
11
http://www.apache.org/licenses/LICENSE-2.0.txt
12
13
Unless required by applicable law or agreed to in writing, software
14
distributed under the License is distributed on an "AS IS" BASIS,
15
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
See the License for the specific language governing permissions and
17
limitations under the License.
18
19
=========================================================================*/
20
// ctkPixmapIconEngine is based on QPixmapIconEngine in qicon_p.h
21
22
#ifndef __ctkPixmapIconEngine_h
23
#define __ctkPixmapIconEngine_h
24
25
#include <QtGlobal>
26
27
#if QT_VERSION >= 0x050000
28
# include <QIconEngine>
29
#else
30
# include <QIconEngineV2>
31
#endif
32
33
#include <QPixmap>
34
#include <QVector>
35
36
#include "ctkWidgetsExport.h"
37
39
struct
ctkPixmapIconEngineEntry
40
{
41
ctkPixmapIconEngineEntry
():
mode
(QIcon::Normal),
state
(QIcon::Off){}
42
ctkPixmapIconEngineEntry
(
const
QPixmap &pm, QIcon::Mode m = QIcon::Normal,
QIcon::State
s = QIcon::Off)
43
:
pixmap
(pm),
size
(pm.
size
()),
mode
(m),
state
(s){}
44
ctkPixmapIconEngineEntry
(
const
QString &file,
const
QSize &sz = QSize(), QIcon::Mode m = QIcon::Normal,
QIcon::State
s = QIcon::Off)
45
:
fileName
(file),
size
(sz),
mode
(m),
state
(s){}
46
QPixmap
pixmap
;
47
QString
fileName
;
48
QSize
size
;
49
QIcon::Mode
mode
;
50
QIcon::State
state
;
51
bool
isNull
()
const
{
return
(fileName.isEmpty() && pixmap.isNull()); }
52
};
53
55
class
CTK_WIDGETS_EXPORT
ctkPixmapIconEngine
56
#if QT_VERSION >= 0x050000
57
:
public
QIconEngine
58
#else
59
:
public
QIconEngineV2
60
#endif
61
{
62
public
:
63
ctkPixmapIconEngine
();
64
ctkPixmapIconEngine
(
const
ctkPixmapIconEngine
&);
65
~
ctkPixmapIconEngine
();
66
void
paint(QPainter *painter,
const
QRect &rect, QIcon::Mode
mode
,
QIcon::State
state
);
67
QPixmap
pixmap
(
const
QSize &
size
, QIcon::Mode mode,
QIcon::State
state);
68
ctkPixmapIconEngineEntry
*bestMatch(
const
QSize &size, QIcon::Mode mode,
QIcon::State
state,
bool
sizeOnly);
69
QSize actualSize(
const
QSize &size, QIcon::Mode mode,
QIcon::State
state);
70
void
addPixmap(
const
QPixmap &pixmap, QIcon::Mode mode,
QIcon::State
state);
71
void
addFile(
const
QString &
fileName
,
const
QSize &size, QIcon::Mode mode,
QIcon::State
state);
72
73
// v2 functions
74
QString key()
const
;
75
#if QT_VERSION >= 0x050000
76
QIconEngine *clone()
const
;
77
#else
78
QIconEngineV2 *clone()
const
;
79
#endif
80
bool
read(QDataStream &in);
81
bool
write(QDataStream &out)
const
;
82
void
virtual_hook(
int
id
,
void
*data);
83
84
private
:
85
ctkPixmapIconEngineEntry
*tryMatch(
const
QSize &size, QIcon::Mode mode,
QIcon::State
state);
86
QVector<ctkPixmapIconEngineEntry> pixmaps;
87
88
friend
class
QIconThemeEngine;
89
};
90
91
92
#endif
ctkPixmapIconEngineEntry::size
QSize size
Definition:
ctkPixmapIconEngine.h:48
ctkPixmapIconEngineEntry::mode
QIcon::Mode mode
Definition:
ctkPixmapIconEngine.h:49
ctkDicomAppHosting::State
State
Definition:
ctkDicomAppHostingTypes.h:45
ctkPixmapIconEngineEntry
Definition:
ctkPixmapIconEngine.h:39
ctkPixmapIconEngineEntry::ctkPixmapIconEngineEntry
ctkPixmapIconEngineEntry()
Definition:
ctkPixmapIconEngine.h:41
ctkPixmapIconEngineEntry::pixmap
QPixmap pixmap
Definition:
ctkPixmapIconEngine.h:46
ctkPixmapIconEngineEntry::isNull
bool isNull() const
Definition:
ctkPixmapIconEngine.h:51
ctkPixmapIconEngineEntry::ctkPixmapIconEngineEntry
ctkPixmapIconEngineEntry(const QPixmap &pm, QIcon::Mode m=QIcon::Normal, QIcon::State s=QIcon::Off)
Definition:
ctkPixmapIconEngine.h:42
ctkPixmapIconEngine
Definition:
ctkPixmapIconEngine.h:55
ctkPixmapIconEngineEntry::state
QIcon::State state
Definition:
ctkPixmapIconEngine.h:50
ctkPixmapIconEngineEntry::fileName
QString fileName
Definition:
ctkPixmapIconEngine.h:47
ctkPixmapIconEngineEntry::ctkPixmapIconEngineEntry
ctkPixmapIconEngineEntry(const QString &file, const QSize &sz=QSize(), QIcon::Mode m=QIcon::Normal, QIcon::State s=QIcon::Off)
Definition:
ctkPixmapIconEngine.h:44
Generated on Wed May 4 2016 05:55:06 for CTK by
1.8.11