⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iconmanager.h

📁 Last change: 2008-02-03 This is the source code of KCeasy。
💻 H
字号:
/*
This file is part of KCeasy (http://www.kceasy.com)
Copyright (C) 2002-2004 Markus Kern <mkern@kceasy.com>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
*/
//---------------------------------------------------------------------------
#ifndef IconManagerH
#define IconManagerH

#include <OleCtrls.hpp> // TImageList
#include <map>
#include "istring.h"
#include "MetaData.h"
#include "Searching.h"
//---------------------------------------------------------------------------

#define GET_ICONS_FROM_SHELL

using namespace KCeasyEngine;
using std::map;

// ImageList layout:
// Index == 0: all nets icon
// Index == 1: unknown net icon
// Index == 2: openft icon
// Index == 3: kazaa icon
// Index == 4: gnutella icon
// Index == 5: napster icon
// Index == 6: http icon
// Index == 7: ares icon
// Index == 8: closed folder icon
// Index == 9: open folder icon
// Index == 10: unknown file icon
// Index == 11: audio file
// Index == 12: video file
// Index == 13: image file
// Index == 14: document file
// Index == 15: software file
// Index == 16: torrent file
// Index >= 17: dynamically loaded icon for extension

class TIconManager
{
public:
    TIconManager(TImageList* NImageList);

    int GetIconIndex(const string& File);
    int GetIconIndex(const TFileType FileType);
    const string& GetFileDesc(const string& File);
    int GetNetworkIconIndex(const string& Network);
    int GetFolderIconIndex(bool Open = false);
    int GetSearchRealmIconIndex(TSearchRealm Realm);

    TImageList* GetImageList() { return ImageList; }

    // image indexes
    // networks
    static const AllNetsIndex = 0;
    static const UnknownNetIndex = 1;
    static const OpenftIndex = 2;
    static const KazaaIndex = 3;
    static const GnutellaIndex = 4;
    static const NapsterIndex = 5;
    static const HttpIndex = 6;
    static const AresIndex = 7;
    // folders
    static const ClosedFolderIndex = 8;
    static const OpenFolderIndex = 9;
    // media types
    static const UnknownFileIndex = 10;
    static const AudioFileIndex = 11;
    static const VideoFileIndex = 12;
    static const ImageFileIndex = 13;
    static const DocumentFileIndex = 14;
    static const SoftwareFileIndex = 15;
    static const TorrentFileIndex = 16;

private:
    class TIconInfo
    {
    public:
        TIconInfo() : Index(-1) {}
        int Index;
        string Description;
    };

    const TIconInfo& GetIconInfo(const string& Ext);
#ifndef GET_ICONS_FROM_SHELL
    map<string,TIconInfo>::iterator AddIconFromReg(const string& Ext);
#else
    map<string,TIconInfo>::iterator AddIconFromShell(const string& Ext);
#endif // !GET_ICONS_FROM_SHELL

    TImageList* ImageList;
    map<string,TIconInfo> IconMap;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -