ASPiK SDK
win32frame.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __win32frame__
6 #define __win32frame__
7 
8 #include "../platform_win32.h"
9 
10 #if WINDOWS
11 
12 #include "../../cframe.h"
13 
14 namespace VSTGUI {
15 
16 //-----------------------------------------------------------------------------
17 class Win32Frame : public IPlatformFrame, public IWin32PlatformFrame
18 {
19 public:
20  Win32Frame (IPlatformFrameCallback* frame, const CRect& size, HWND parent, PlatformType parentType);
21  ~Win32Frame () noexcept;
22 
23  HWND getHWND () const override { return windowHandle; }
24  HWND getPlatformWindow () const { return windowHandle; }
25  HWND getParentPlatformWindow () const { return parentWindow; }
26  HWND getOuterWindow () const;
27  IPlatformFrameCallback* getFrame () const { return frame; }
28 
29  // IPlatformFrame
30  bool getGlobalPosition (CPoint& pos) const override;
31  bool setSize (const CRect& newSize) override;
32  bool getSize (CRect& size) const override;
33  bool getCurrentMousePosition (CPoint& mousePosition) const override;
34  bool getCurrentMouseButtons (CButtonState& buttons) const override;
35  bool setMouseCursor (CCursorType type) override;
36  bool invalidRect (const CRect& rect) override;
37  bool scrollRect (const CRect& src, const CPoint& distance) override;
38  bool showTooltip (const CRect& rect, const char* utf8Text) override;
39  bool hideTooltip () override;
40  void* getPlatformRepresentation () const override { return windowHandle; }
41  SharedPointer<IPlatformTextEdit> createPlatformTextEdit (IPlatformTextEditCallback* textEdit) override;
42  SharedPointer<IPlatformOptionMenu> createPlatformOptionMenu () override;
43 #if VSTGUI_OPENGL_SUPPORT
44  SharedPointer<IPlatformOpenGLView> createPlatformOpenGLView () override;
45 #endif
46  SharedPointer<IPlatformViewLayer> createPlatformViewLayer (IPlatformViewLayerDelegate* drawDelegate, IPlatformViewLayer* parentLayer = nullptr) override { return 0; } // not yet supported
47  SharedPointer<COffscreenContext> createOffscreenContext (CCoord width, CCoord height, double scaleFactor = 1.) override;
48  DragResult doDrag (IDataPackage* source, const CPoint& offset, CBitmap* dragBitmap) override;
49 
50  void setClipboard (const SharedPointer<IDataPackage>& data) override;
51  SharedPointer<IDataPackage> getClipboard () override;
52  PlatformType getPlatformType () const override { return PlatformType::kHWND; }
53 
54  LONG_PTR WINAPI proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
55 //-----------------------------------------------------------------------------
56 protected:
57  void initTooltip ();
58  void paint (HWND hwnd);
59 
60  static void initWindowClass ();
61  static void destroyWindowClass ();
62  static LONG_PTR WINAPI WindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
63  static int32_t gUseCount;
64 
65  HWND parentWindow;
66  HWND windowHandle;
67  HWND tooltipWindow;
68  HWND oldFocusWindow;
69 
70  COffscreenContext* backBuffer;
71  CDrawContext* deviceContext;
72 
73  CRect paintRect;
74  bool inPaint;
75  bool mouseInside;
76 
77  RGNDATA* updateRegionList;
78  DWORD updateRegionListSize;
79 };
80 
81 } // namespace
82 
83 #endif // WINDOWS
84 
85 #endif // __win32frame__
Definition: customcontrols.cpp:8