/[winpt]/trunk/Src/wptImagelist.cpp
ViewVC logotype

Diff of /trunk/Src/wptImagelist.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by twoaday, Mon Oct 24 08:03:48 2005 UTC revision 36 by werner, Thu Oct 27 15:25:13 2005 UTC
# Line 1  Line 1 
1  /* wptImagelist.cpp - Imagelist helper routines  /* wptImagelist.cpp - Imagelist helper routines
2   *      Copyright (C) 2003 Andreas Jobs   *      Copyright (C) 2003 Andreas Jobs
3   *      Copyright (C) 2004 Timo Schulz   *      Copyright (C) 2004 Timo Schulz
4   *   *
5   * This file is part of WinPT.   * This file is part of WinPT.
# Line 19  Line 19 
19   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20   */   */
21    
22    #ifdef HAVE_CONFIG_H
23    #include <config.h>
24    #endif
25    
26    #include <windows.h>
27  #include <windows.h>  #include <windows.h>
28  #include <commctrl.h>  #include <commctrl.h>
29    
# Line 30  Line 35 
35  #include "wptCommonCtl.h"  #include "wptCommonCtl.h"
36  #include "wptVersion.h"  #include "wptVersion.h"
37    
38  int il_map[IMAGELIST_NUMIMAGES];  int il_map[IMAGELIST_NUMIMAGES];
39    
40    
41    #define replace_icon(resid) \
42  #define replace_icon(resid) \      ImageList_ReplaceIcon (glob_imagelist, -1, \
43      ImageList_ReplaceIcon (glob_imagelist, -1, \                             LoadIcon (glob_hinst, MAKEINTRESOURCE (resid)))
                            LoadIcon (glob_hinst, MAKEINTRESOURCE (resid)))  
44    
45  int  int
46  imagelist_load (HWND hwnd)  imagelist_load (HWND hwnd)
47  {  {
48      glob_imagelist = ImageList_Create (16, 16, ILC_COLOR|ILC_MASK,      glob_imagelist = ImageList_Create (16, 16, ILC_COLOR|ILC_MASK,
49                                         IMAGELIST_NUMIMAGES, 0);                                         IMAGELIST_NUMIMAGES, 0);
50      if (!glob_imagelist) {      if (!glob_imagelist) {
51          msg_box (hwnd, "Could not create imagelist.", _("Key Manager"), MB_ERR);          msg_box (hwnd, "Could not create imagelist.", _("Key Manager"), MB_ERR);
52          return -1;          return -1;
53      }      }
54    
55      il_map[IMI_KEY_DELETE]     = replace_icon (IDI_KEY_DELETE);      il_map[IMI_KEY_DELETE]     = replace_icon (IDI_KEY_DELETE);
56      il_map[IMI_KEY_PROPS]      = replace_icon (IDI_KEY_PROPS);      il_map[IMI_KEY_PROPS]      = replace_icon (IDI_KEY_PROPS);
57      il_map[IMI_KEY_SIGN]       = replace_icon (IDI_KEY_SIGN);      il_map[IMI_KEY_SIGN]       = replace_icon (IDI_KEY_SIGN);
58      il_map[IMI_KEY_IMPORT]     = replace_icon (IDI_KEY_IMPORT);      il_map[IMI_KEY_IMPORT]     = replace_icon (IDI_KEY_IMPORT);
# Line 57  imagelist_load (HWND hwnd) Line 62  imagelist_load (HWND hwnd)
62      /*il_map[IMI_EXIT]         = replace_icon (IDI_EXIT);*/      /*il_map[IMI_EXIT]         = replace_icon (IDI_EXIT);*/
63      return 0;      return 0;
64  } /* imagelist_load */  } /* imagelist_load */
65    
66    
67  int  int
68  imagelist_destroy (void)  imagelist_destroy (void)
# Line 65  imagelist_destroy (void) Line 70  imagelist_destroy (void)
70      ImageList_Destroy (glob_imagelist);      ImageList_Destroy (glob_imagelist);
71      glob_imagelist = NULL;      glob_imagelist = NULL;
72      return 0;      return 0;
73  } /* imagelist_destroy */  } /* imagelist_destroy */
74    
75    
76  int  int
# Line 74  imagelist_getindex (int icon) Line 79  imagelist_getindex (int icon)
79      if ((icon < 0) || (icon >= IMAGELIST_NUMIMAGES))      if ((icon < 0) || (icon >= IMAGELIST_NUMIMAGES))
80          return -1;          return -1;
81      return il_map[icon];      return il_map[icon];
82  } /* imagelist_getindex */  } /* imagelist_getindex */

Legend:
Removed from v.32  
changed lines
  Added in v.36

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26