nss: upgrade to release 3.73
[LibreOffice.git] / include / vcl / sysdata.hxx
blob0cd0e037c8239d36a8867ff405fca4fd4324cd74
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_SYSDATA_HXX
21 #define INCLUDED_VCL_SYSDATA_HXX
23 #include <sal/types.h>
24 #include <vcl/dllapi.h>
26 class SalFrame;
28 #ifdef MACOSX
29 // predeclare the native classes to avoid header/include problems
30 typedef struct CGContext *CGContextRef;
31 typedef struct CGLayer *CGLayerRef;
32 typedef const struct __CTFont * CTFontRef;
33 #ifdef __OBJC__
34 @class NSView;
35 #else
36 class NSView;
37 #endif
38 #endif
40 #ifdef IOS
41 typedef const struct __CTFont * CTFontRef;
42 typedef struct CGContext *CGContextRef;
43 #endif
45 #if defined(_WIN32)
46 #include <prewin.h>
47 #include <windef.h>
48 #include <postwin.h>
49 #endif
51 struct VCL_DLLPUBLIC SystemEnvData
53 enum class Toolkit { Gen, Gtk3, Qt5 };
54 Toolkit toolkit; // the toolkit in use
55 #if defined(_WIN32)
56 HWND hWnd; // the window hwnd
57 #elif defined( MACOSX )
58 NSView* mpNSView; // the cocoa (NSView *) implementing this object
59 bool mbOpenGL; // use an OpenGL providing NSView
60 #elif defined( ANDROID )
61 // Nothing
62 #elif defined( IOS )
63 // Nothing
64 #elif defined( UNX )
65 enum class Platform { Wayland, Xcb };
67 void* pDisplay; // the relevant display connection
68 SalFrame* pSalFrame; // contains a salframe, if object has one
69 void* pWidget; // the corresponding widget
70 void* pVisual; // the visual in use
71 int nScreen; // the current screen of the window
72 // note: this is a "long" in Xlib *but* in the protocol it's only 32-bit
73 // however, the GTK3 vclplug wants to store pointers in here!
74 sal_IntPtr aShellWindow; // the window of the frame's shell
75 Platform platform; // the windowing system in use
76 public:
77 sal_uIntPtr aWindow; // the window of the object
79 void SetWindowHandle(sal_uIntPtr nWindow)
81 aWindow = nWindow;
84 // SalFrame can be any SalFrame, just needed to determine which backend to use
85 // to resolve the window handle
86 sal_uIntPtr GetWindowHandle(const SalFrame* pReference) const;
88 #endif
90 SystemEnvData()
91 : toolkit(Toolkit::Gen)
92 #if defined(_WIN32)
93 , hWnd(nullptr)
94 #elif defined( MACOSX )
95 , mpNSView(nullptr)
96 , mbOpenGL(false)
97 #elif defined( ANDROID )
98 #elif defined( IOS )
99 #elif defined( UNX )
100 , pDisplay(nullptr)
101 , pSalFrame(nullptr)
102 , pWidget(nullptr)
103 , pVisual(nullptr)
104 , nScreen(0)
105 , aShellWindow(0)
106 , platform(Platform())
107 , aWindow(0)
108 #endif
113 struct SystemParentData
115 sal_uInt32 nSize; // size in bytes of this structure
116 #if defined(_WIN32)
117 HWND hWnd; // the window hwnd
118 #elif defined( MACOSX )
119 NSView* pView; // the cocoa (NSView *) implementing this object
120 #elif defined( ANDROID )
121 // Nothing
122 #elif defined( IOS )
123 // Nothing
124 #elif defined( UNX )
125 sal_uIntPtr aWindow; // the window of the object
126 bool bXEmbedSupport:1; // decides whether the object in question
127 // should support the XEmbed protocol
128 #endif
131 struct SystemMenuData
133 #if defined(_WIN32)
134 HMENU hMenu; // the menu handle of the menu bar
135 #else
136 // Nothing
137 #endif
140 struct SystemGraphicsData
142 sal_uInt32 nSize; // size in bytes of this structure
143 #if defined(_WIN32)
144 HDC hDC; // handle to a device context
145 HWND hWnd; // optional handle to a window
146 #elif defined( MACOSX )
147 CGContextRef rCGContext; // CoreGraphics graphic context
148 #elif defined( ANDROID )
149 // Nothing
150 #elif defined( IOS )
151 CGContextRef rCGContext; // CoreGraphics graphic context
152 #elif defined( UNX )
153 void* pDisplay; // the relevant display connection
154 sal_uIntPtr hDrawable; // a drawable
155 void* pVisual; // the visual in use
156 int nScreen; // the current screen of the drawable
157 void* pXRenderFormat; // render format for drawable
158 void* pSurface; // the cairo surface when using svp-based backends
159 #endif
160 SystemGraphicsData()
161 : nSize( sizeof( SystemGraphicsData ) )
162 #if defined(_WIN32)
163 , hDC( nullptr )
164 , hWnd( nullptr )
165 #elif defined( MACOSX )
166 , rCGContext( nullptr )
167 #elif defined( ANDROID )
168 // Nothing
169 #elif defined( IOS )
170 , rCGContext( NULL )
171 #elif defined( UNX )
172 , pDisplay( nullptr )
173 , hDrawable( 0 )
174 , pVisual( nullptr )
175 , nScreen( 0 )
176 , pXRenderFormat( nullptr )
177 , pSurface( nullptr )
178 #endif
182 struct SystemWindowData
184 #if defined(_WIN32) // meaningless on Windows
185 #elif defined( MACOSX )
186 bool bOpenGL; // create an OpenGL providing NSView
187 bool bLegacy; // create a 2.1 legacy context, only valid if bOpenGL == true
188 #elif defined( ANDROID )
189 // Nothing
190 #elif defined( IOS )
191 // Nothing
192 #elif defined( UNX )
193 void* pVisual; // the visual to be used
194 bool bClipUsingNativeWidget; // default is false, true will attempt to clip the childwindow with a native widget
195 #endif
198 #endif // INCLUDED_VCL_SYSDATA_HXX
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */