CS::Platform::Win32::IconTools Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Static Public Member Functions
CS::Platform::Win32::IconTools Class Reference

Helpers for dealing with Windows icons. More...

`#include <csplugincommon/win32/icontools.h>`

List of all members.

## Static Public Member Functions
static HICON CS_CSPLUGINCOMMON_WIN_EXPORT | IconFromImage (iImage *image, const _ICONINFO *iconTemplate=0)
| Create a Windows icon from a CS image.
static csPtr< iImage > CS_CSPLUGINCOMMON_WIN_EXPORT | IconToImage (HICON icon)
| Create a CS image from a Windows icon.
static HICON | LoadStockIconSize (LPCSTR id, int desiredSize)
| Load a stock icon (IDI_something) closest to a given size.
static HICON | LoadStockIconSize (LPCWSTR id, int desiredSize)
| Load a stock icon (IDI_something) closest to a given size.

## Detailed Description

Helpers for dealing with Windows icons.

Definition at line 41 of file icontools.h.

## Member Function Documentation

static HICON CS_CSPLUGINCOMMON_WIN_EXPORT CS::Platform::Win32::IconTools::IconFromImage | ( | iImage * | image,
|  | const _ICONINFO * | iconTemplate = `0`
| ) |  | `[static]`

Create a Windows icon from a CS image.

The color depth depends on the color depth of the screen. The handling of the alpha channel of the image - if it has one - depends on the Windows version and screen color depth: in particular, icons with alpha are only supported on Windows XP and a screen color depth of at least 24bpp. In other cases the alpha will be reduced to binary alpha.

Parameters:

  image | Image to create icon from.
  iconTemplate | (Optional) Template for information used to create icon.

static csPtr<iImage> CS_CSPLUGINCOMMON_WIN_EXPORT CS::Platform::Win32::IconTools::IconToImage | ( | HICON | icon | ) | `[static]`

Create a CS image from a Windows icon.

Useful when drawing an icon (stock or from somewhere else) inside CS is desired.

Parameters:

  icon | Icon to create image from.

static HICON CS::Platform::Win32::IconTools::LoadStockIconSize | ( | LPCSTR | id,
|  | int | desiredSize
| ) |  | `[inline, static]`

Load a stock icon (IDI_something) closest to a given size.

The main benefit over `LoadIcon (0, IDI_something)` is the possibility to specify a desired size. (All standard Win32 mechanisms to obtain an icon of a certain size either don't provide different sizes or deliver bad quality icons.)

Stock icons are likely available in the sizes 16x16, 32x32 and 48x48. Asking for a size other than that will actually return an icon with the size closest (well, what Windows deems to be close) to the requested size.

Parameters:

  id | Icon ID to load. Must be one of the default Win32 IDI_something constants (see http://msdn.microsoft.com/en-us/library/ms648072%28VS.85%29.aspx).
  desiredSize | Desired size of the icon.

Returns:
  An icon with a size that Windows deems closest to desiredSize, or 0 in case of error.

Definition at line 66 of file icontools.h.

static HICON CS::Platform::Win32::IconTools::LoadStockIconSize | ( | LPCWSTR | id,
|  | int | desiredSize
| ) |  | `[inline, static]`

Load a stock icon (IDI_something) closest to a given size.

The main benefit over `LoadIcon (0, IDI_something)` is the possibility to specify a desired size. (All standard Win32 mechanisms to obtain an icon of a certain size either don't provide different sizes or deliver bad quality icons.)

Stock icons are likely available in the sizes 16x16, 32x32 and 48x48. Asking for a size other than that will actually return an icon with the size closest (well, what Windows deems to be close) to the requested size.

Parameters:

  id | Icon ID to load. Must be one of the default Win32 IDI_something constants (see http://msdn.microsoft.com/en-us/library/ms648072%28VS.85%29.aspx).
  desiredSize | Desired size of the icon.

Returns:
  An icon with a size that Windows deems closest to desiredSize, or 0 in case of error.

Definition at line 68 of file icontools.h.

The documentation for this class was generated from the following file:

- csplugincommon/win32/icontools.h