18#include "IGraphicsWinFonts.h"
21BEGIN_IGRAPHICS_NAMESPACE
34 void SetWinModuleHandle(
void* pInstance)
override { mHInstance = (HINSTANCE) pInstance; }
35 void* GetWinModuleHandle()
override {
return mHInstance; }
37 void ForceEndUserEdit()
override;
38 float GetPlatformWindowScale()
const override {
return GetScreenScale(); }
40 void PlatformResize(
bool parentHasResized)
override;
42 void CheckTabletInput(UINT msg);
43 void DestroyEditWindow();
45 void HideMouseCursor(
bool hide,
bool lock)
override;
46 void MoveMouseCursor(
float x,
float y)
override;
47 ECursor SetMouseCursor(ECursor cursorType)
override;
49 void GetMouseLocation(
float& x,
float&y)
const override;
51 EMsgBoxResult ShowMessageBox(
const char* str,
const char* title, EMsgBoxType type, IMsgBoxCompletionHandlerFunc completionHandler)
override;
53 void* OpenWindow(
void* pParent)
override;
54 void CloseWindow()
override;
55 bool WindowIsOpen()
override {
return (mPlugWnd); }
57 void UpdateTooltips()
override {}
59 bool RevealPathInExplorerOrFinder(WDL_String& path,
bool select)
override;
60 void PromptForFile(WDL_String& fileName, WDL_String& path, EFileAction action,
const char* ext, IFileDialogCompletionHandlerFunc completionHandler)
override;
61 void PromptForDirectory(WDL_String& dir, IFileDialogCompletionHandlerFunc completionHandler)
override;
62 bool PromptForColor(
IColor& color,
const char* str, IColorPickerHandlerFunc func)
override;
65 HMENU CreateMenu(
IPopupMenu& menu,
long* pOffsetIdx);
67 bool OpenURL(
const char* url,
const char* msgWindowTitle,
const char* confirmMsg,
const char* errMsgOnFailure)
override;
69 void* GetWindow()
override {
return mPlugWnd; }
71 const char* GetPlatformAPIStr()
override {
return "win32"; };
73 bool GetTextFromClipboard(WDL_String& str)
override;
74 bool SetTextInClipboard(
const char* str)
override;
75 bool SetFilePathInClipboard(
const char* path)
override;
77 bool InitiateExternalFileDragDrop(
const char* path,
const IRECT& iconBounds)
override;
79 bool PlatformSupportsMultiTouch()
const override;
81 static LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
82 static LRESULT CALLBACK ParamEditProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
83 static BOOL CALLBACK FindMainWindow(HWND hWnd, LPARAM lParam);
89 void CreatePlatformTextEntry(
int paramIdx,
const IText& text,
const IRECT& bounds,
int length,
const char* str)
override;
91 void SetTooltip(
const char* tooltip);
96 IRECT GetWindowRECT();
102 void OnDisplayTimer(
int vBlankCount = 0);
113 PlatformFontPtr LoadPlatformFont(
const char* fontID,
const char* fileNameOrResID)
override;
114 PlatformFontPtr LoadPlatformFont(
const char* fontID,
const char* fontName, ETextStyle style)
override;
115 PlatformFontPtr LoadPlatformFont(
const char* fontID,
void* pData,
int dataSize)
override;
116 void CachePlatformFont(
const char* fontID,
const PlatformFontPtr& font)
override;
118 inline IMouseInfo GetMouseInfo(LPARAM lParam, WPARAM wParam);
119 bool MouseCursorIsLocked();
121 void ActivateGLContext()
override;
122 void DeactivateGLContext()
override;
125 void CreateGLContext();
126 void DestroyGLContext();
127 HGLRC mHGLRC =
nullptr;
128 HGLRC mStartHGLRC =
nullptr;
129 HDC mStartHDC =
nullptr;
132 HINSTANCE mHInstance =
nullptr;
133 HWND mPlugWnd =
nullptr;
134 HWND mParamEditWnd =
nullptr;
135 HWND mTooltipWnd =
nullptr;
136 HWND mParentWnd =
nullptr;
137 HWND mMainWnd =
nullptr;
138 WNDPROC mDefEditProc =
nullptr;
139 HFONT mEditFont =
nullptr;
142 void StartVBlankThread(HWND hWnd);
143 void StopVBlankThread();
146 HWND mVBlankWindow = 0;
147 volatile bool mVBlankShutdown =
false;
148 HANDLE mVBlankThread = INVALID_HANDLE_VALUE;
149 volatile DWORD mVBlankCount = 0;
150 int mVBlankSkipUntil = 0;
151 bool mVSYNCEnabled =
false;
153 const IParam* mEditParam =
nullptr;
157 EParamEditMsg mParamEditMsg = kNone;
158 bool mShowingTooltip =
false;
159 float mHiddenCursorX = 0.f;
160 float mHiddenCursorY = 0.f;
161 int mTooltipIdx = -1;
163 WDL_String mMainWndClassName;
165 static StaticStorage<InstalledFont> sPlatformFontCache;
166 static StaticStorage<HFontHolder> sHFontCache;
168 std::unordered_map<ITouchID, IMouseInfo> mDeltaCapture;
171END_IGRAPHICS_NAMESPACE
Used for choosing a drawing backend.
An editor delegate base class that uses IGraphics for the UI.
IGraphics platform class for Windows.
Used to group mouse coordinates with mouse modifier information.
Used to manage color data, independent of draw class/platform.
Used to manage a rectangular area, independent of draw class/platform.
IText is used to manage font and text/text entry style for a piece of text on the UI,...