1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
8 #define FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
9 
10 typedef FX_LPVOID				FX_HWND;
11 typedef FX_LPVOID				FX_HMENU;
12 typedef void					(*TimerCallback)(FX_INT32 idEvent);
13 
14 typedef struct _FX_SYSTEMTIME
15 {
_FX_SYSTEMTIME_FX_SYSTEMTIME16     _FX_SYSTEMTIME()
17       : wYear(0),
18         wMonth(0),
19         wDayOfWeek(0),
20         wDay(0),
21         wHour(0),
22         wMinute(0),
23         wSecond(0),
24         wMilliseconds(0) {}
25     FX_WORD wYear;
26     FX_WORD wMonth;
27     FX_WORD wDayOfWeek;
28     FX_WORD wDay;
29     FX_WORD wHour;
30     FX_WORD wMinute;
31     FX_WORD wSecond;
32     FX_WORD wMilliseconds;
33 }FX_SYSTEMTIME;
34 
35 //cursor style
36 #define FXCT_ARROW				0
37 #define FXCT_NESW				1
38 #define FXCT_NWSE				2
39 #define FXCT_VBEAM				3
40 #define FXCT_HBEAM				4
41 #define FXCT_HAND				5
42 
43 class IFX_SystemHandler
44 {
45 public:
~IFX_SystemHandler()46 	virtual ~IFX_SystemHandler() {}
47 	virtual void				InvalidateRect(FX_HWND hWnd, FX_RECT rect) = 0;
48     virtual void				OutputSelectedRect(void* pFormFiller, CPDF_Rect&rect) = 0;
49 
50 	virtual FX_BOOL				IsSelectionImplemented() = 0;
51 
52 	virtual CFX_WideString		GetClipboardText(FX_HWND hWnd) = 0;
53 	virtual FX_BOOL				SetClipboardText(FX_HWND hWnd, CFX_WideString string) = 0;
54 
55 	virtual void				ClientToScreen(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0;
56 	virtual void				ScreenToClient(FX_HWND hWnd, FX_INT32& x, FX_INT32& y) = 0;
57 
58 	/*cursor style
59 	FXCT_ARROW
60 	FXCT_NESW
61 	FXCT_NWSE
62 	FXCT_VBEAM
63 	FXCT_HBEAM
64 	FXCT_HAND
65 	*/
66 	virtual void				SetCursor(FX_INT32 nCursorType) = 0;
67 
68 	virtual FX_HMENU			CreatePopupMenu() = 0;
69 	virtual FX_BOOL				AppendMenuItem(FX_HMENU hMenu, FX_INT32 nIDNewItem, CFX_WideString string) = 0;
70 	virtual FX_BOOL				EnableMenuItem(FX_HMENU hMenu, FX_INT32 nIDItem, FX_BOOL bEnabled) = 0;
71 	virtual FX_INT32			TrackPopupMenu(FX_HMENU hMenu, FX_INT32 x, FX_INT32 y, FX_HWND hParent) = 0;
72 	virtual void				DestroyMenu(FX_HMENU hMenu) = 0;
73 
74 	virtual CFX_ByteString		GetNativeTrueTypeFont(FX_INT32 nCharset) = 0;
75 	virtual FX_BOOL				FindNativeTrueTypeFont(FX_INT32 nCharset, CFX_ByteString sFontFaceName) = 0;
76 	virtual CPDF_Font*			AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, CFX_ByteString sFontFaceName, FX_BYTE nCharset) = 0;
77 
78 	virtual FX_INT32			SetTimer(FX_INT32 uElapse, TimerCallback lpTimerFunc) = 0;
79 	virtual void				KillTimer(FX_INT32 nID) = 0;
80 
81 
82 	virtual FX_BOOL				IsSHIFTKeyDown(FX_DWORD nFlag) = 0;
83 	virtual FX_BOOL				IsCTRLKeyDown(FX_DWORD nFlag) = 0;
84 	virtual FX_BOOL				IsALTKeyDown(FX_DWORD nFlag) = 0;
85 	virtual FX_BOOL				IsINSERTKeyDown(FX_DWORD nFlag) = 0;
86 
87 	virtual	FX_SYSTEMTIME		GetLocalTime() = 0;
88 
89 	virtual FX_INT32			GetCharSet() = 0;
90 	virtual void 				SetCharSet(FX_INT32 nCharSet) = 0;
91 };
92 
93 #endif  // FPDFSDK_INCLUDE_FX_SYSTEMHANDLER_H_
94