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 
25 #ifdef MACOSX
26 // predeclare the native classes to avoid header/include problems
27 typedef struct CGContext *CGContextRef;
28 typedef struct CGLayer *CGLayerRef;
29 typedef const struct __CTFont * CTFontRef;
30 #ifdef __OBJC__
31 @class NSView;
32 #else
33 class NSView;
34 #endif
35 #endif
36 
37 #ifdef IOS
38 typedef const struct __CTFont * CTFontRef;
39 typedef struct CGContext *CGContextRef;
40 #endif
41 
42 #if defined(_WIN32)
43 #include <prewin.h>
44 #include <windef.h>
45 #include <postwin.h>
46 #endif
47 
49 {
50 #if defined(_WIN32)
51  HWND hWnd; // the window hwnd
52 #elif defined( MACOSX )
53  NSView* mpNSView; // the cocoa (NSView *) implementing this object
54  bool mbOpenGL; // use an OpenGL providing NSView
55 #elif defined( ANDROID )
56  // Nothing
57 #elif defined( IOS )
58  // Nothing
59 #elif defined( UNX )
60  enum class Toolkit { Gtk3, Qt5, Gen };
61  enum class Platform { Wayland, Xcb };
62 
63  void* pDisplay; // the relevant display connection
64  unsigned long aWindow; // the window of the object
65  void* pSalFrame; // contains a salframe, if object has one
66  void* pWidget; // the corresponding widget
67  void* pVisual; // the visual in use
68  int nScreen; // the current screen of the window
69  // note: this is a "long" in Xlib *but* in the protocol it's only 32-bit
70  // however, the GTK3 vclplug wants to store pointers in here!
71  sal_IntPtr aShellWindow; // the window of the frame's shell
72  Toolkit toolkit; // the toolkit in use
73  Platform platform; // the windowing system in use
74 #endif
75 
77 #if defined(_WIN32)
78  : hWnd(nullptr)
79 #elif defined( MACOSX )
80  : mpNSView(nullptr)
81  , mbOpenGL(false)
82 #elif defined( ANDROID )
83 #elif defined( IOS )
84 #elif defined( UNX )
85  : pDisplay(nullptr)
86  , aWindow(0)
87  , pSalFrame(nullptr)
88  , pWidget(nullptr)
89  , pVisual(nullptr)
90  , nScreen(0)
91  , aShellWindow(0)
92  , toolkit(Toolkit())
93  , platform(Platform())
94 #endif
95  {
96  }
97 };
98 
100 {
101  sal_uInt32 nSize; // size in bytes of this structure
102 #if defined(_WIN32)
103  HWND hWnd; // the window hwnd
104 #elif defined( MACOSX )
105  NSView* pView; // the cocoa (NSView *) implementing this object
106 #elif defined( ANDROID )
107  // Nothing
108 #elif defined( IOS )
109  // Nothing
110 #elif defined( UNX )
111  long aWindow; // the window of the object
112  bool bXEmbedSupport:1; // decides whether the object in question
113  // should support the XEmbed protocol
114 #endif
115 };
116 
118 {
119 #if defined(_WIN32)
120  HMENU hMenu; // the menu handle of the menu bar
121 #else
122  // Nothing
123 #endif
124 };
125 
127 {
128  sal_uInt32 nSize; // size in bytes of this structure
129 #if defined(_WIN32)
130  HDC hDC; // handle to a device context
131  HWND hWnd; // optional handle to a window
132 #elif defined( MACOSX )
133  CGContextRef rCGContext; // CoreGraphics graphic context
134 #elif defined( ANDROID )
135  // Nothing
136 #elif defined( IOS )
137  CGContextRef rCGContext; // CoreGraphics graphic context
138 #elif defined( UNX )
139  void* pDisplay; // the relevant display connection
140  long hDrawable; // a drawable
141  void* pVisual; // the visual in use
142  int nScreen; // the current screen of the drawable
143  void* pXRenderFormat; // render format for drawable
144  void* pSurface; // the cairo surface when using svp-based backends
145 #endif
147  : nSize( sizeof( SystemGraphicsData ) )
148 #if defined(_WIN32)
149  , hDC( nullptr )
150  , hWnd( nullptr )
151 #elif defined( MACOSX )
152  , rCGContext( nullptr )
153 #elif defined( ANDROID )
154  // Nothing
155 #elif defined( IOS )
156  , rCGContext( NULL )
157 #elif defined( UNX )
158  , pDisplay( nullptr )
159  , hDrawable( 0 )
160  , pVisual( nullptr )
161  , nScreen( 0 )
162  , pXRenderFormat( nullptr )
163  , pSurface( nullptr )
164 #endif
165  { }
166 };
167 
169 {
170 #if defined(_WIN32) // meaningless on Windows
171 #elif defined( MACOSX )
172  bool bOpenGL; // create an OpenGL providing NSView
173  bool bLegacy; // create a 2.1 legacy context, only valid if bOpenGL == true
174 #elif defined( ANDROID )
175  // Nothing
176 #elif defined( IOS )
177  // Nothing
178 #elif defined( UNX )
179  void* pVisual; // the visual to be used
180  bool bClipUsingNativeWidget; // default is false, true will attempt to clip the childwindow with a native widget
181 #endif
182 };
183 
184 #endif // INCLUDED_VCL_SYSDATA_HXX
185 
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void * pXRenderFormat
Definition: sysdata.hxx:143
void * pDisplay
Definition: sysdata.hxx:63
void * pVisual
Definition: sysdata.hxx:67
return NULL
unsigned long aWindow
Definition: sysdata.hxx:64
sal_uInt32 nSize
Definition: sysdata.hxx:128
void * pWidget
Definition: sysdata.hxx:66
Toolkit toolkit
Definition: sysdata.hxx:72
sal_uInt32 nSize
Definition: sysdata.hxx:101
Platform platform
Definition: sysdata.hxx:73
bool bClipUsingNativeWidget
Definition: sysdata.hxx:180
sal_IntPtr aShellWindow
Definition: sysdata.hxx:71
if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
void * pSalFrame
Definition: sysdata.hxx:65