Files

156 lines
6.3 KiB
C++

/*
* Copyright 2016 Klemens D. Morgenstern
*
* Distributed under the Boost Software License, Version 1.0.
* See http://www.boost.org/LICENSE_1_0.txt
*/
#ifndef ACTIV_BOOST_WINAPI_SHELL_HPP_INCLUDED_
#define ACTIV_BOOST_WINAPI_SHELL_HPP_INCLUDED_
#include <ActivBoost/winapi/basic_types.hpp>
#include <ActivBoost/winapi/limits.hpp>
#if defined( ACTIV_BOOST_USE_WINDOWS_H )
#include <shellapi.h>
#endif
#ifdef ACTIV_BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if ACTIV_BOOST_WINAPI_PARTITION_DESKTOP
#include <ActivBoost/winapi/detail/header.hpp>
#if !defined( ACTIV_BOOST_USE_WINDOWS_H )
extern "C" {
ACTIV_BOOST_WINAPI_DETAIL_DECLARE_HANDLE(HICON);
#if !defined( ACTIV_BOOST_NO_ANSI_APIS )
struct _SHFILEINFOA;
#endif
struct _SHFILEINFOW;
#if !defined( ACTIV_BOOST_NO_ANSI_APIS )
ACTIV_BOOST_WINAPI_IMPORT Boost::winapi::DWORD_PTR_ ACTIV_BOOST_WINAPI_WINAPI_CC SHGetFileInfoA(
Boost::winapi::LPCSTR_ pszPath,
Boost::winapi::DWORD_ dwFileAttributes,
::_SHFILEINFOA *psfinsigned,
Boost::winapi::UINT_ cbFileInfons,
Boost::winapi::UINT_ uFlags);
#endif
ACTIV_BOOST_WINAPI_IMPORT Boost::winapi::DWORD_PTR_ ACTIV_BOOST_WINAPI_WINAPI_CC SHGetFileInfoW(
Boost::winapi::LPCWSTR_ pszPath,
Boost::winapi::DWORD_ dwFileAttributes,
::_SHFILEINFOW *psfinsigned,
Boost::winapi::UINT_ cbFileInfons,
Boost::winapi::UINT_ uFlags);
} // extern "C"
#endif // !defined( ACTIV_BOOST_USE_WINDOWS_H )
namespace Boost {
namespace winapi {
typedef ::HICON HICON_;
#if defined( ACTIV_BOOST_USE_WINDOWS_H )
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ICON_ = SHGFI_ICON;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_DISPLAYNAME_ = SHGFI_DISPLAYNAME;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_TYPENAME_ = SHGFI_TYPENAME;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ATTRIBUTES_ = SHGFI_ATTRIBUTES;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ICONLOCATION_ = SHGFI_ICONLOCATION;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_EXETYPE_ = SHGFI_EXETYPE;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_SYSICONINDEX_ = SHGFI_SYSICONINDEX;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_LINKOVERLAY_ = SHGFI_LINKOVERLAY;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_SELECTED_ = SHGFI_SELECTED;
#if (ACTIV_BOOST_USE_WINAPI_VERSION >= ACTIV_BOOST_WINAPI_VERSION_WIN2K)
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ATTR_SPECIFIED_ = SHGFI_ATTR_SPECIFIED;
#endif
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_LARGEICON_ = SHGFI_LARGEICON;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_SMALLICON_ = SHGFI_SMALLICON;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_OPENICON_ = SHGFI_OPENICON;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_SHELLICONSIZE_ = SHGFI_SHELLICONSIZE;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_PIDL_ = SHGFI_PIDL;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_USEFILEATTRIBUTES_ = SHGFI_USEFILEATTRIBUTES;
#else // defined( ACTIV_BOOST_USE_WINDOWS_H )
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ICON_ = 0x000000100;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_DISPLAYNAME_ = 0x000000200;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_TYPENAME_ = 0x000000400;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ATTRIBUTES_ = 0x000000800;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ICONLOCATION_ = 0x000001000;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_EXETYPE_ = 0x000002000;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_SYSICONINDEX_ = 0x000004000;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_LINKOVERLAY_ = 0x000008000;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_SELECTED_ = 0x000010000;
#if (ACTIV_BOOST_USE_WINAPI_VERSION >= ACTIV_BOOST_WINAPI_VERSION_WIN2K)
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ATTR_SPECIFIED_ = 0x000020000;
#endif
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_LARGEICON_ = 0x000000000;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_SMALLICON_ = 0x000000001;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_OPENICON_ = 0x000000002;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_SHELLICONSIZE_ = 0x000000004;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_PIDL_ = 0x000000008;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_USEFILEATTRIBUTES_ = 0x000000010;
#endif // defined( ACTIV_BOOST_USE_WINDOWS_H )
// These constants are only declared for _WIN32_IE >= 0x0500. We don't set IE version
// and 5.0 is the default version since NT4 SP6, so just define the constants unconditionally.
// They are also missing from MinGW.
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_ADDOVERLAYS_ = 0x000000020;
ACTIV_BOOST_CONSTEXPR_OR_CONST DWORD_ SHGFI_OVERLAYINDEX_ = 0x000000040;
typedef struct ACTIV_BOOST_MAY_ALIAS _SHFILEINFOA {
HICON_ hIcon;
int iIcon;
DWORD_ dwAttributes;
CHAR_ szDisplayName[MAX_PATH_];
CHAR_ szTypeName[80];
} SHFILEINFOA_;
typedef struct ACTIV_BOOST_MAY_ALIAS _SHFILEINFOW {
HICON_ hIcon;
int iIcon;
DWORD_ dwAttributes;
WCHAR_ szDisplayName[MAX_PATH_];
WCHAR_ szTypeName[80];
} SHFILEINFOW_;
#if !defined( ACTIV_BOOST_NO_ANSI_APIS )
ACTIV_BOOST_FORCEINLINE DWORD_PTR_ SHGetFileInfoA(LPCSTR_ pszPath, DWORD_ dwFileAttributes, SHFILEINFOA_* psfinsigned, UINT_ cbFileInfons, UINT_ uFlags)
{
return ::SHGetFileInfoA(pszPath, dwFileAttributes, reinterpret_cast< ::_SHFILEINFOA* >(psfinsigned), cbFileInfons, uFlags);
}
ACTIV_BOOST_FORCEINLINE DWORD_PTR_ sh_get_file_info(LPCSTR_ pszPath, DWORD_ dwFileAttributes, SHFILEINFOA_* psfinsigned, UINT_ cbFileInfons, UINT_ uFlags)
{
return ::SHGetFileInfoA(pszPath, dwFileAttributes, reinterpret_cast< ::_SHFILEINFOA* >(psfinsigned), cbFileInfons, uFlags);
}
#endif // ACTIV_BOOST_NO_ANSI_APIS
ACTIV_BOOST_FORCEINLINE DWORD_PTR_ SHGetFileInfoW(LPCWSTR_ pszPath, DWORD_ dwFileAttributes, SHFILEINFOW_* psfinsigned, UINT_ cbFileInfons, UINT_ uFlags)
{
return ::SHGetFileInfoW(pszPath, dwFileAttributes, reinterpret_cast< ::_SHFILEINFOW* >(psfinsigned), cbFileInfons, uFlags);
}
ACTIV_BOOST_FORCEINLINE DWORD_PTR_ sh_get_file_info(LPCWSTR_ pszPath, DWORD_ dwFileAttributes, SHFILEINFOW_* psfinsigned, UINT_ cbFileInfons, UINT_ uFlags)
{
return ::SHGetFileInfoW(pszPath, dwFileAttributes, reinterpret_cast< ::_SHFILEINFOW* >(psfinsigned), cbFileInfons, uFlags);
}
}
}
#include <ActivBoost/winapi/detail/footer.hpp>
#endif // ACTIV_BOOST_WINAPI_PARTITION_DESKTOP
#endif // ACTIV_BOOST_WINAPI_SHELL_HPP_INCLUDED_