webengine/osswebengine/WebCore/platform/graphics/Icon.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 "Shared.h"
       
    25 #include <wtf/Forward.h>
       
    26 
       
    27 #if PLATFORM(MAC)
       
    28 #include <wtf/RetainPtr.h>
       
    29 #ifdef __OBJC__
       
    30 @class NSImage;
       
    31 #else
       
    32 class NSImage;
       
    33 #endif
       
    34 #elif PLATFORM(WIN)
       
    35 typedef struct HICON__* HICON;
       
    36 #elif PLATFORM(QT)
       
    37 #include <QIcon>
       
    38 #endif
       
    39 
       
    40 namespace WebCore {
       
    41 
       
    42 class GraphicsContext;
       
    43 class IntRect;
       
    44 class String;
       
    45     
       
    46 class Icon : public Shared<Icon> {
       
    47 public:
       
    48     Icon();
       
    49     ~Icon();
       
    50     
       
    51     static PassRefPtr<Icon> newIconForFile(const String& filename);
       
    52 
       
    53     void paint(GraphicsContext*, const IntRect&);
       
    54 
       
    55 #if PLATFORM(WIN)
       
    56     Icon(HICON);
       
    57 #endif
       
    58 
       
    59 private:
       
    60 #if PLATFORM(MAC)
       
    61     Icon(NSImage*);
       
    62 #endif
       
    63 #if PLATFORM(MAC)
       
    64     RetainPtr<NSImage> m_nsImage;
       
    65 #elif PLATFORM(WIN)
       
    66     HICON m_hIcon;
       
    67 #elif PLATFORM(QT)
       
    68     QIcon m_icon;
       
    69 #endif
       
    70 };
       
    71 
       
    72 }
       
    73 
       
    74 #endif