LibreOffice Module vcl (master) 1
sysdata.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_VCL_SYSDATA_HXX
21#define INCLUDED_VCL_SYSDATA_HXX
22
23#include <sal/types.h>
24#include <vcl/dllapi.h>
25#include <config_vclplug.h>
26
27class SalFrame;
28
29#ifdef MACOSX
30// predeclare the native classes to avoid header/include problems
31typedef struct CGContext *CGContextRef;
32typedef struct CGLayer *CGLayerRef;
33typedef const struct __CTFont * CTFontRef;
34#ifdef __OBJC__
35@class NSView;
36#else
37class NSView;
38#endif
39#endif
40
41#ifdef IOS
42typedef const struct __CTFont * CTFontRef;
43typedef struct CGContext *CGContextRef;
44#endif
45
46#if defined(_WIN32)
47#include <prewin.h>
48#include <windef.h>
49#include <postwin.h>
50#endif
51
53{
54 enum class Toolkit { Invalid, Gen, Gtk, Qt };
55 Toolkit toolkit; // the toolkit in use
56#if defined(_WIN32)
57 HWND hWnd; // the window hwnd
58#elif defined( MACOSX )
59 NSView* mpNSView; // the cocoa (NSView *) implementing this object
60 bool mbOpenGL; // use an OpenGL providing NSView
61#elif defined( ANDROID )
62 // Nothing
63#elif defined( IOS )
64 // Nothing
65#elif defined( UNX )
66 enum class Platform { Invalid, Wayland, Xcb, WASM };
67
68 void* pDisplay; // the relevant display connection
69 SalFrame* pSalFrame; // contains a salframe, if object has one
70 void* pWidget; // the corresponding widget
71 void* pVisual; // the visual in use
72 int nScreen; // the current screen of the window
73 // note: this is a "long" in Xlib *but* in the protocol it's only 32-bit
74 // however, the GTK3 vclplug wants to store pointers in here!
75 sal_IntPtr aShellWindow; // the window of the frame's shell
76 Platform platform; // the windowing system in use
77private:
78 sal_uIntPtr aWindow; // the window of the object
79public:
80
81 void SetWindowHandle(sal_uIntPtr nWindow)
82 {
83 aWindow = nWindow;
84 }
85
86 // SalFrame can be any SalFrame, just needed to determine which backend to use
87 // to resolve the window handle
88 sal_uIntPtr GetWindowHandle(const SalFrame* pReference) const;
89
90#endif
91
94#if defined(_WIN32)
95 , hWnd(nullptr)
96#elif defined( MACOSX )
97 , mpNSView(nullptr)
98 , mbOpenGL(false)
99#elif defined( ANDROID )
100#elif defined( IOS )
101#elif defined( UNX )
102 , pDisplay(nullptr)
103 , pSalFrame(nullptr)
104 , pWidget(nullptr)
105 , pVisual(nullptr)
106 , nScreen(0)
107 , aShellWindow(0)
108 , platform(Platform::Invalid)
109 , aWindow(0)
110#endif
111 {
112 }
113};
114
116{
117 sal_uInt32 nSize; // size in bytes of this structure
118#if defined(_WIN32)
119 HWND hWnd; // the window hwnd
120#elif defined( MACOSX )
121 NSView* pView; // the cocoa (NSView *) implementing this object
122#elif defined( ANDROID )
123 // Nothing
124#elif defined( IOS )
125 // Nothing
126#elif defined( UNX )
127 sal_uIntPtr aWindow; // the window of the object
128 bool bXEmbedSupport:1; // decides whether the object in question
129 // should support the XEmbed protocol
130#endif
131};
132
134{
135#if defined(_WIN32)
136 HMENU hMenu; // the menu handle of the menu bar
137#else
138 // Nothing
139#endif
140};
141
143{
144 sal_uInt32 nSize; // size in bytes of this structure
145#if defined(_WIN32)
146 HDC hDC; // handle to a device context
147 HWND hWnd; // optional handle to a window
148#elif defined( MACOSX )
149 CGContextRef rCGContext; // CoreGraphics graphic context
150#elif defined( ANDROID )
151 // Nothing
152#elif defined( IOS )
153 CGContextRef rCGContext; // CoreGraphics graphic context
154#elif defined( UNX )
155 void* pDisplay; // the relevant display connection
156 sal_uIntPtr hDrawable; // a drawable
157 void* pVisual; // the visual in use
158 int nScreen; // the current screen of the drawable
159#endif
160#if USE_HEADLESS_CODE
161 void* pSurface; // the cairo surface when using svp-based backends, which includes gtk[3|4]
162#endif
164 : nSize( sizeof( SystemGraphicsData ) )
165#if defined(_WIN32)
166 , hDC( nullptr )
167 , hWnd( nullptr )
168#elif defined( MACOSX )
169 , rCGContext( nullptr )
170#elif defined( ANDROID )
171 // Nothing
172#elif defined( IOS )
173 , rCGContext( NULL )
174#elif defined( UNX )
175 , pDisplay( nullptr )
176 , hDrawable( 0 )
177 , pVisual( nullptr )
178 , nScreen( 0 )
179#endif
180#if USE_HEADLESS_CODE
181 , pSurface( nullptr )
182#endif
183 { }
184};
185
187{
188#if defined(_WIN32) // meaningless on Windows
189#elif defined( MACOSX )
190 bool bOpenGL; // create an OpenGL providing NSView
191 bool bLegacy; // create a 2.1 legacy context, only valid if bOpenGL == true
192#elif defined( ANDROID )
193 // Nothing
194#elif defined( IOS )
195 // Nothing
196#elif defined( UNX )
197 void* pVisual; // the visual to be used
198 bool bClipUsingNativeWidget; // default is false, true will attempt to clip the childwindow with a native widget
199#endif
200};
201
202#endif // INCLUDED_VCL_SYSDATA_HXX
203
204/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
return NULL
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
void SetWindowHandle(sal_uIntPtr nWindow)
Definition: sysdata.hxx:81
void * pWidget
Definition: sysdata.hxx:70
Toolkit toolkit
Definition: sysdata.hxx:55
SalFrame * pSalFrame
Definition: sysdata.hxx:69
sal_uIntPtr aWindow
Definition: sysdata.hxx:78
sal_IntPtr aShellWindow
Definition: sysdata.hxx:75
void * pVisual
Definition: sysdata.hxx:71
void * pDisplay
Definition: sysdata.hxx:68
Platform platform
Definition: sysdata.hxx:76
sal_uInt32 nSize
Definition: sysdata.hxx:144
sal_uIntPtr hDrawable
Definition: sysdata.hxx:156
sal_uInt32 nSize
Definition: sysdata.hxx:117
sal_uIntPtr aWindow
Definition: sysdata.hxx:127
bool bClipUsingNativeWidget
Definition: sysdata.hxx:198