Icon.h revision d8543bb6618c17b12da906afa77d216f58cf4058
1/*
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB.  If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21#ifndef Icon_h
22#define Icon_h
23
24#include <wtf/RefCounted.h>
25#include <wtf/Forward.h>
26
27#if PLATFORM(MAC)
28#include <wtf/RetainPtr.h>
29#ifdef __OBJC__
30@class NSImage;
31#else
32class NSImage;
33#endif
34#elif PLATFORM(WIN)
35typedef struct HICON__* HICON;
36#elif PLATFORM(QT)
37#include <QIcon>
38#elif PLATFORM(GTK)
39#include <gdk/gdk.h>
40#endif
41
42namespace WebCore {
43
44class GraphicsContext;
45class IntRect;
46class String;
47
48class Icon : public RefCounted<Icon> {
49public:
50    Icon();
51    ~Icon();
52
53    static PassRefPtr<Icon> newIconForFile(const String& filename);
54
55    void paint(GraphicsContext*, const IntRect&);
56
57#if PLATFORM(WIN)
58    Icon(HICON);
59#endif
60
61private:
62#if PLATFORM(MAC)
63    Icon(NSImage*);
64#endif
65#if PLATFORM(MAC)
66    RetainPtr<NSImage> m_nsImage;
67#elif PLATFORM(WIN)
68    HICON m_hIcon;
69#elif PLATFORM(QT)
70    QIcon m_icon;
71#elif PLATFORM(GTK)
72    GdkPixbuf* m_icon;
73#endif
74};
75
76}
77
78#endif
79