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
26class SalFrame;
27
28#ifdef MACOSX
29// predeclare the native classes to avoid header/include problems
30typedef struct CGContext *CGContextRef;
31typedef struct CGLayer *CGLayerRef;
32typedef const struct __CTFont * CTFontRef;
33#ifdef __OBJC__
34@class NSView;
35#else
36class NSView;
37#endif
38#endif
39
40#ifdef IOS
41typedef const struct __CTFont * CTFontRef;
42typedef struct CGContext *CGContextRef;
43#endif
44
45#if defined(_WIN32)
46#include <prewin.h>
47#include <windef.h>
48#include <postwin.h>
49#endif
50
52{
53 enum class Toolkit { Invalid, Gen, Gtk, Qt };
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 { Invalid, Wayland, Xcb, WASM };
66
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
76private:
77 sal_uIntPtr aWindow; // the window of the object
78public:
79
80 void SetWindowHandle(sal_uIntPtr nWindow)
81 {
82 aWindow = nWindow;
83 }
84
85 // SalFrame can be any SalFrame, just needed to determine which backend to use
86 // to resolve the window handle
87 sal_uIntPtr GetWindowHandle(const SalFrame* pReference) const;
88
89#endif
90
93#if defined(_WIN32)
94 , hWnd(nullptr)
95#elif defined( MACOSX )
96 , mpNSView(nullptr)
97 , mbOpenGL(false)
98#elif defined( ANDROID )
99#elif defined( IOS )
100#elif defined( UNX )
101 , pDisplay(nullptr)
102 , pSalFrame(nullptr)
103 , pWidget(nullptr)
104 , pVisual(nullptr)
105 , nScreen(0)
106 , aShellWindow(0)
107 , platform(Platform::Invalid)
108 , aWindow(0)
109#endif
110 {
111 }
112};
113
115{
116 sal_uInt32 nSize; // size in bytes of this structure
117#if defined(_WIN32)
118 HWND hWnd; // the window hwnd
119#elif defined( MACOSX )
120 NSView* pView; // the cocoa (NSView *) implementing this object
121#elif defined( ANDROID )
122 // Nothing
123#elif defined( IOS )
124 // Nothing
125#elif defined( UNX )
126 sal_uIntPtr aWindow; // the window of the object
127 bool bXEmbedSupport:1; // decides whether the object in question
128 // should support the XEmbed protocol
129#endif
130};
131
133{
134#if defined(_WIN32)
135 HMENU hMenu; // the menu handle of the menu bar
136#else
137 // Nothing
138#endif
139};
140
142{
143 sal_uInt32 nSize; // size in bytes of this structure
144#if defined(_WIN32)
145 HDC hDC; // handle to a device context
146 HWND hWnd; // optional handle to a window
147#elif defined( MACOSX )
148 CGContextRef rCGContext; // CoreGraphics graphic context
149#elif defined( ANDROID )
150 // Nothing
151#elif defined( IOS )
152 CGContextRef rCGContext; // CoreGraphics graphic context
153#elif defined( UNX )
154 void* pDisplay; // the relevant display connection
155 sal_uIntPtr hDrawable; // a drawable
156 void* pVisual; // the visual in use
157 int nScreen; // the current screen of the drawable
158 void* pXRenderFormat; // render format for drawable
159 void* pSurface; // the cairo surface when using svp-based backends
160#endif
162 : nSize( sizeof( SystemGraphicsData ) )
163#if defined(_WIN32)
164 , hDC( nullptr )
165 , hWnd( nullptr )
166#elif defined( MACOSX )
167 , rCGContext( nullptr )
168#elif defined( ANDROID )
169 // Nothing
170#elif defined( IOS )
171 , rCGContext( NULL )
172#elif defined( UNX )
173 , pDisplay( nullptr )
174 , hDrawable( 0 )
175 , pVisual( nullptr )
176 , nScreen( 0 )
177 , pXRenderFormat( nullptr )
178 , pSurface( nullptr )
179#endif
180 { }
181};
182
184{
185#if defined(_WIN32) // meaningless on Windows
186#elif defined( MACOSX )
187 bool bOpenGL; // create an OpenGL providing NSView
188 bool bLegacy; // create a 2.1 legacy context, only valid if bOpenGL == true
189#elif defined( ANDROID )
190 // Nothing
191#elif defined( IOS )
192 // Nothing
193#elif defined( UNX )
194 void* pVisual; // the visual to be used
195 bool bClipUsingNativeWidget; // default is false, true will attempt to clip the childwindow with a native widget
196#endif
197};
198
199#endif // INCLUDED_VCL_SYSDATA_HXX
200
201/* 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:80
void * pWidget
Definition: sysdata.hxx:69
Toolkit toolkit
Definition: sysdata.hxx:54
SalFrame * pSalFrame
Definition: sysdata.hxx:68
sal_uIntPtr aWindow
Definition: sysdata.hxx:77
sal_IntPtr aShellWindow
Definition: sysdata.hxx:74
void * pVisual
Definition: sysdata.hxx:70
void * pDisplay
Definition: sysdata.hxx:67
Platform platform
Definition: sysdata.hxx:75
sal_uInt32 nSize
Definition: sysdata.hxx:143
void * pXRenderFormat
Definition: sysdata.hxx:158
sal_uIntPtr hDrawable
Definition: sysdata.hxx:155
sal_uInt32 nSize
Definition: sysdata.hxx:116
sal_uIntPtr aWindow
Definition: sysdata.hxx:126
bool bClipUsingNativeWidget
Definition: sysdata.hxx:195