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

Contents of /trunk/Src/wptImagelist.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (show annotations)
Thu Jan 12 16:28:06 2006 UTC (19 years, 1 month ago) by twoaday
File size: 2671 byte(s)
2006-01-12  Timo Schulz  <ts@g10code.com>
 
        * wptListView.cpp (listview_set_image_list): Make icons
        always transparent.
        * wptImageList.cpp (imagelist_load): New icons.
        * wptGPGMEData.cpp (gpg_data_putc): New.
        * wptKeyManagerDlg.cpp (load_toolbar): Include new icons.
        (keymanager_dlg_proc): Add tooltips.
        * wptKeyserverDlg.cpp (keyserver_list_build): Use icons.
        * wptKeyserver.cpp (URL_encode): New.
        (URL_must_encode): New.
        (kserver_search_init): Properly encode pattern.
        (parse_iso_date): New.
        (keyserver_search): Be more strict to prevent buffer overflows.
         
2006-01-11  Timo Schulz  <ts@g10code.com>
 
        * wptKeyManagerDlg.cpp (load_toolbar): 2 new icons.
        (keymanager_dlg_proc): Adjust tooltips.
        (update_ui_items): Handle new icons.
        * wptImageList.cpp (imagelist_load): New icons.


1 /* wptImagelist.cpp - Imagelist helper routines
2 * Copyright (C) 2003 Andreas Jobs
3 * Copyright (C) 2004, 2006 Timo Schulz
4 *
5 * This file is part of WinPT.
6 *
7 * WinPT is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * WinPT is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with WinPT; if not, write to the Free Software Foundation,
19 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24
25 #include <windows.h>
26 #include <commctrl.h>
27
28 #include "wptTypes.h"
29 #include "wptErrors.h"
30 #include "wptNLS.h"
31 #include "wptW32API.h"
32 #include "resource.h"
33 #include "wptCommonCtl.h"
34 #include "wptVersion.h"
35
36 int il_map[IMAGELIST_NUMIMAGES];
37
38
39 #define replace_icon(resid) \
40 ImageList_ReplaceIcon (glob_imagelist, -1, \
41 LoadIcon (glob_hinst, MAKEINTRESOURCE (resid)))
42
43
44 /* Load the image list with the default icons.
45 Return value: 0 on success. */
46 int
47 imagelist_load (HWND hwnd)
48 {
49 glob_imagelist = ImageList_Create (16, 16, ILC_COLOR|ILC_MASK,
50 IMAGELIST_NUMIMAGES, 0);
51 if (!glob_imagelist) {
52 msg_box (hwnd, "Could not create imagelist.", _("Key Manager"), MB_ERR);
53 return -1;
54 }
55
56 il_map[IMI_KEY_NEW] = replace_icon (IDI_KEY_NEW);
57 il_map[IMI_KEY_DELETE] = replace_icon (IDI_KEY_DELETE);
58 il_map[IMI_KEY_PROPS] = replace_icon (IDI_KEY_PROPS);
59 il_map[IMI_KEY_SIGN] = replace_icon (IDI_KEY_SIGN);
60 il_map[IMI_KEY_SEARCH] = replace_icon (IDI_KEY_SEARCH);
61 il_map[IMI_KEY_FILE_IMPORT]= replace_icon (IDI_KEY_FILE_IMPORT);
62 il_map[IMI_KEY_FILE_EXPORT]= replace_icon (IDI_KEY_FILE_EXPORT);
63 il_map[IMI_KEY_IMPORT] = replace_icon (IDI_KEY_IMPORT);
64 il_map[IMI_KEY_EXPORT] = replace_icon (IDI_KEY_EXPORT);
65 il_map[IMI_SORT_UPARROW] = replace_icon (IDI_SORT_UPARROW);
66 il_map[IMI_SORT_DOWNARROW] = replace_icon (IDI_SORT_DOWNARROW);
67 return 0;
68 }
69
70
71 /* Free image list. */
72 int
73 imagelist_destroy (void)
74 {
75 ImageList_Destroy (glob_imagelist);
76 glob_imagelist = NULL;
77 return 0;
78 }
79
80
81 /* Map an index to an icon. */
82 int
83 imagelist_getindex (int icon)
84 {
85 if ((icon < 0) || (icon >= IMAGELIST_NUMIMAGES))
86 return -1;
87 return il_map[icon];
88 }

Properties

Name Value
svn:eol-style native

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26