ReactOS  0.4.14-dev-49-gfb4591c
Icon Struct Reference

#include <globals.h>

Inheritance diagram for Icon:
Collaboration diagram for Icon:

Public Member Functions

 Icon ()
 
 Icon (ICON_ID id, UINT nid)
 
 Icon (ICON_ID id, UINT nid, int icon_size)
 
 Icon (ICON_TYPE itype, int id, HICON hIcon)
 
 Icon (ICON_TYPE itype, int id, int sys_idx)
 
 operator ICON_ID () const
 
void draw (HDC hdc, int x, int y, int cx, int cy, COLORREF bk_color, HBRUSH bk_brush) const
 
HBITMAP create_bitmap (COLORREF bk_color, HBRUSH hbrBkgnd, HDC hdc_wnd) const
 
int add_to_imagelist (HIMAGELIST himl, HDC hdc_wnd, COLORREF bk_color=GetSysColor(COLOR_WINDOW), HBRUSH bk_brush=GetSysColorBrush(COLOR_WINDOW)) const
 
int get_sysiml_idx () const
 
HICON get_hicon () const
 
ICON_TYPE get_icontype () const
 
bool destroy ()
 

Protected Attributes

ICON_ID _id
 
ICON_TYPE _itype
 
HICON _hicon
 
int _sys_idx
 

Detailed Description

Definition at line 96 of file globals.h.

Constructor & Destructor Documentation

◆ Icon() [1/5]

Icon::Icon ( )

Definition at line 242 of file explorer.cpp.

243  : _id(ICID_UNKNOWN),
244  _itype(IT_STATIC),
245  _hicon(0)
246 {
247 }
HICON _hicon
Definition: globals.h:118
ICON_TYPE _itype
Definition: globals.h:117
ICON_ID _id
Definition: globals.h:116

◆ Icon() [2/5]

Icon::Icon ( ICON_ID  id,
UINT  nid 
)

Definition at line 249 of file explorer.cpp.

250  : _id(id),
251  _itype(IT_STATIC),
252  _hicon(ResIcon(nid)) // ResIconEx(nid, cx, cy)
253 {
254 }
convenient loading of standard (32x32) icon resources
Definition: globals.h:309
NOTIFYICONDATA nid
Definition: magnifier.c:44
HICON _hicon
Definition: globals.h:118
ICON_TYPE _itype
Definition: globals.h:117
ICON_ID _id
Definition: globals.h:116

◆ Icon() [3/5]

Icon::Icon ( ICON_ID  id,
UINT  nid,
int  icon_size 
)

Definition at line 256 of file explorer.cpp.

257  : _id(id),
258  _itype(IT_STATIC),
260 {
261 }
NOTIFYICONDATA nid
Definition: magnifier.c:44
HICON _hicon
Definition: globals.h:118
ICON_TYPE _itype
Definition: globals.h:117
convenient loading of icon resources with specified sizes
Definition: globals.h:331
ICON_ID _id
Definition: globals.h:116
iconPos iconPos icon_size
Definition: startmenu.cpp:1416

◆ Icon() [4/5]

Icon::Icon ( ICON_TYPE  itype,
int  id,
HICON  hIcon 
)

Definition at line 263 of file explorer.cpp.

264  : _id((ICON_ID)id),
265  _itype(itype),
266  _hicon(hIcon)
267 {
268 }
HICON _hicon
Definition: globals.h:118
ICON_ID
Definition: globals.h:62
ICON_TYPE _itype
Definition: globals.h:117
ICON_ID _id
Definition: globals.h:116
HICON hIcon
Definition: msconfig.c:44

◆ Icon() [5/5]

Icon::Icon ( ICON_TYPE  itype,
int  id,
int  sys_idx 
)

Definition at line 270 of file explorer.cpp.

271  : _id((ICON_ID)id),
272  _itype(itype),
273  _sys_idx(sys_idx)
274 {
275 }
ICON_ID
Definition: globals.h:62
int _sys_idx
Definition: globals.h:119
ICON_TYPE _itype
Definition: globals.h:117
ICON_ID _id
Definition: globals.h:116

Member Function Documentation

◆ add_to_imagelist()

int Icon::add_to_imagelist ( HIMAGELIST  himl,
HDC  hdc_wnd,
COLORREF  bk_color = GetSysColor(COLOR_WINDOW),
HBRUSH  bk_brush = GetSysColorBrush(COLOR_WINDOW) 
) const

Definition at line 306 of file explorer.cpp.

307 {
308  int ret;
309 
310  if (_itype == IT_SYSCACHE) {
312 
313  int cx, cy;
315 
316  HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
317  HDC hdc = CreateCompatibleDC(hdc_wnd);
318  HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
320  SelectBitmap(hdc, hbmp_old);
321  DeleteDC(hdc);
322 
323  ret = ImageList_Add(himl, hbmp, 0);
324 
326  } else
328 
329  return ret;
330 }
int ImageList_AddAlphaIcon(HIMAGELIST himl, HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
add icon with alpha channel to imagelist using the specified background color
Definition: explorer.cpp:366
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
HICON _hicon
Definition: globals.h:118
int _sys_idx
Definition: globals.h:119
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HIMAGELIST himl
COLORREF bk_color
Definition: startmenu.cpp:1409
ICON_TYPE _itype
Definition: globals.h:117
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
HBITMAP hbmp
int ret
HDC hdc
Definition: main.c:9
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
BOOL WINAPI DeleteDC(_In_ HDC)
#define SelectBitmap(hdc, hbm)
Definition: windowsx.h:489
#define CLR_DEFAULT
Definition: commctrl.h:305
_Out_opt_ int * cx
Definition: commctrl.h:570
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
static HBITMAP
Definition: button.c:44
#define ILD_NORMAL
Definition: commctrl.h:402
HBRUSH bk_brush
Definition: startmenu.cpp:1410
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264
IconCache _icon_cache
Definition: globals.h:285
HIMAGELIST get_sys_imagelist() const
Definition: globals.h:143

Referenced by BookmarkList::fill_tree(), and MainFrameBase::FillBookmarks().

◆ create_bitmap()

HBITMAP Icon::create_bitmap ( COLORREF  bk_color,
HBRUSH  hbrBkgnd,
HDC  hdc_wnd 
) const

Definition at line 285 of file explorer.cpp.

286 {
287  if (_itype == IT_SYSCACHE) {
289 
290  int cx, cy;
292 
293  HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, cx, cy);
294  HDC hdc = CreateCompatibleDC(hdc_wnd);
295  HBITMAP hbmp_old = SelectBitmap(hdc, hbmp);
297  SelectBitmap(hdc, hbmp_old);
298  DeleteDC(hdc);
299 
300  return hbmp;
301  } else
302  return create_bitmap_from_icon(_hicon, hbrBkgnd, hdc_wnd);
303 }
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
HICON _hicon
Definition: globals.h:118
int _sys_idx
Definition: globals.h:119
static HDC
Definition: imagelist.c:92
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HIMAGELIST himl
COLORREF bk_color
Definition: startmenu.cpp:1409
ICON_TYPE _itype
Definition: globals.h:117
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
HBITMAP hbmp
HDC hdc
Definition: main.c:9
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
BOOL WINAPI DeleteDC(_In_ HDC)
#define SelectBitmap(hdc, hbm)
Definition: windowsx.h:489
#define CLR_DEFAULT
Definition: commctrl.h:305
_Out_opt_ int * cx
Definition: commctrl.h:570
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
static HBITMAP
Definition: button.c:44
#define ILD_NORMAL
Definition: commctrl.h:402
HBITMAP create_bitmap_from_icon(HICON hIcon, HBRUSH hbrush_bkgnd, HDC hdc_wnd)
create a bitmap from an icon
Definition: explorer.cpp:332
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264
IconCache _icon_cache
Definition: globals.h:285
HIMAGELIST get_sys_imagelist() const
Definition: globals.h:143

Referenced by QuickLaunchBar::AddShortcuts().

◆ destroy()

bool Icon::destroy ( )
inline

Definition at line 113 of file globals.h.

113 {if (_itype == IT_DYNAMIC) {DestroyIcon(_hicon); return true;} else return false;}
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
HICON _hicon
Definition: globals.h:118
ICON_TYPE _itype
Definition: globals.h:117

Referenced by IconCache::free_icon().

◆ draw()

void Icon::draw ( HDC  hdc,
int  x,
int  y,
int  cx,
int  cy,
COLORREF  bk_color,
HBRUSH  bk_brush 
) const

Definition at line 277 of file explorer.cpp.

278 {
279  if (_itype == IT_SYSCACHE)
281  else
283 }
HICON _hicon
Definition: globals.h:118
int _sys_idx
Definition: globals.h:119
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
COLORREF bk_color
Definition: startmenu.cpp:1409
ICON_TYPE _itype
Definition: globals.h:117
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:1997
HDC hdc
Definition: main.c:9
#define DI_NORMAL
Definition: wingdi.h:72
ExplorerGlobals g_Globals
Definition: explorer.cpp:52
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define CLR_DEFAULT
Definition: commctrl.h:305
_Out_opt_ int * cx
Definition: commctrl.h:570
#define ILD_NORMAL
Definition: commctrl.h:402
HBRUSH bk_brush
Definition: startmenu.cpp:1410
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264
IconCache _icon_cache
Definition: globals.h:285
HIMAGELIST get_sys_imagelist() const
Definition: globals.h:143

Referenced by Pane::draw_item().

◆ get_hicon()

HICON Icon::get_hicon ( ) const
inline

Definition at line 110 of file globals.h.

110 {return _itype!=IT_SYSCACHE? _hicon: 0;}
HICON _hicon
Definition: globals.h:118
ICON_TYPE _itype
Definition: globals.h:117

Referenced by ShellBrowser::get_image_idx().

◆ get_icontype()

ICON_TYPE Icon::get_icontype ( ) const
inline

Definition at line 111 of file globals.h.

111 { return _itype; }
ICON_TYPE _itype
Definition: globals.h:117

◆ get_sysiml_idx()

int Icon::get_sysiml_idx ( ) const
inline

Definition at line 109 of file globals.h.

109 {return _itype==IT_SYSCACHE? _sys_idx: -1;}
int _sys_idx
Definition: globals.h:119
ICON_TYPE _itype
Definition: globals.h:117

Referenced by FindProgramDlg::Notify().

◆ operator ICON_ID()

Icon::operator ICON_ID ( ) const
inline

Definition at line 103 of file globals.h.

103 {return _id;}
ICON_ID _id
Definition: globals.h:116

Member Data Documentation

◆ _hicon

HICON Icon::_hicon
protected

Definition at line 118 of file globals.h.

Referenced by add_to_imagelist(), create_bitmap(), and draw().

◆ _id

ICON_ID Icon::_id
protected

Definition at line 116 of file globals.h.

◆ _itype

ICON_TYPE Icon::_itype
protected

Definition at line 117 of file globals.h.

Referenced by add_to_imagelist(), create_bitmap(), and draw().

◆ _sys_idx

int Icon::_sys_idx
protected

Definition at line 119 of file globals.h.

Referenced by add_to_imagelist(), create_bitmap(), and draw().


The documentation for this struct was generated from the following files: