xref: /reactos/dll/win32/shimgvw/shimgvw.h (revision 7f26a396)
1 /*
2  * PROJECT:     ReactOS Picture and Fax Viewer
3  * LICENSE:     GPL-2.0 (https://spdx.org/licenses/GPL-2.0)
4  * PURPOSE:     Image file browsing and manipulation
5  * COPYRIGHT:   Copyright Dmitry Chapyshev (dmitry@reactos.org)
6  *              Copyright 2018-2023 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #pragma once
10 
11 #define WIN32_NO_STATUS
12 #define _INC_WINDOWS
13 #define COM_NO_WINDOWS_H
14 #define INITGUID
15 
16 #include <windef.h>
17 #include <winbase.h>
18 #include <winnls.h>
19 #include <winreg.h>
20 #include <wingdi.h>
21 #include <wincon.h>
22 #include <objbase.h>
23 #include <gdiplus.h>
24 #include <shlwapi.h>
25 #include <strsafe.h>
26 
27 #include <debug.h>
28 
29 #include "resource.h"
30 
31 extern HINSTANCE g_hInstance;
32 extern GpImage *g_pImage;
33 
34 typedef struct
35 {
36     BOOL Maximized;
37     INT X;
38     INT Y;
39     INT Width;
40     INT Height;
41 } SHIMGVW_SETTINGS;
42 
43 typedef struct tagSHIMGVW_FILENODE
44 {
45     WCHAR FileName[MAX_PATH];
46     struct tagSHIMGVW_FILENODE *Prev;
47     struct tagSHIMGVW_FILENODE *Next;
48 } SHIMGVW_FILENODE;
49 
50 #define WC_PREVIEW L"ShImgVw:CPreviewWnd"
51 #define WC_ZOOM L"ShImgVw:CZoomWnd"
52 
53 /* Animation */
54 typedef struct tagANIME
55 {
56     UINT           m_nFrameIndex;
57     UINT           m_nFrameCount;
58     UINT           m_nLoopIndex;
59     UINT           m_nLoopCount;
60     PropertyItem  *m_pDelayItem;
61     HWND           m_hwndTimer;
62 } ANIME, *PANIME;
63 
64 void Anime_FreeInfo(PANIME pAnime);
65 BOOL Anime_LoadInfo(PANIME pAnime);
66 void Anime_SetTimerWnd(PANIME pAnime, HWND hwndTimer);
67 void Anime_SetFrameIndex(PANIME pAnime, UINT nFrameIndex);
68 void Anime_Start(PANIME pAnime, DWORD dwDelay);
69 void Anime_Pause(PANIME pAnime);
70 BOOL Anime_OnTimer(PANIME pAnime, WPARAM wParam);
71 
72 static inline LPVOID QuickAlloc(SIZE_T cbSize, BOOL bZero)
73 {
74     return HeapAlloc(GetProcessHeap(), (bZero ? HEAP_ZERO_MEMORY : 0), cbSize);
75 }
76 
77 static inline VOID QuickFree(LPVOID ptr)
78 {
79     HeapFree(GetProcessHeap(), 0, ptr);
80 }
81