Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/src/icon.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 112 - (show annotations) (download) (as text)
Mon Sep 10 13:12:57 2012 UTC (11 years, 8 months ago) by z0rac
File MIME type: text/x-chdr
File size: 1761 byte(s)
Change mail address.
1 #ifndef H_ICON /* -*- mode: c++ -*- */
2 /*
3 * Copyright (C) 2010-2011 TSUBAKIMOTO Hiroya <z0rac@users.sourceforge.jp>
4 *
5 * This software comes with ABSOLUTELY NO WARRANTY; for details of
6 * the license terms, see the LICENSE.txt file included with the program.
7 */
8 #define H_ICON
9
10 #include "win32.h"
11
12 /** iconmodule - module includes animation icons
13 */
14 class icon;
15 class iconmodule {
16 struct rep {
17 HMODULE module;
18 size_t count;
19 rep(HMODULE module) : module(module), count(1) {}
20 ~rep() { module && module != win32::exe && FreeLibrary(module); }
21 };
22 rep* _rep;
23 void _release();
24 public:
25 iconmodule(const string& fn = string());
26 iconmodule(const iconmodule& module);
27 ~iconmodule() { _release(); }
28 iconmodule& operator=(const iconmodule& module);
29 operator HMODULE() const { return _rep->module; }
30 static string path(LPCSTR fn = NULL);
31 public:
32 struct accept {
33 virtual void operator()(int id, const icon& icon) = 0;
34 };
35 void collect(accept& accept) const;
36 };
37
38 /** icon - animation icons
39 */
40 class icon {
41 iconmodule _mod;
42 PWORD _rc;
43 struct anim { WORD id, ticks; };
44 const anim* _anim;
45 int _size;
46 int _step;
47 HICON _icon;
48 HICON _read(int id, int size = 0) const;
49 icon& _load(int step = 0);
50 public:
51 icon(int id, const iconmodule& mod = iconmodule());
52 icon(const icon& copy) : _icon(NULL) { *this = copy; }
53 ~icon();
54 icon& operator=(const icon& copy);
55 operator HICON() const { return _icon; }
56 int size() const { return _rc[1]; }
57 icon& resize(int size);
58 icon& reset() { return _load(_step); }
59 icon& reset(int type);
60 icon& next();
61 UINT delay() const;
62 HICON read(int size = 0) const { return _read(_rc[3], size); }
63 };
64
65 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26