LibreOffice Module vcl (master) 1
gtkobject.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_INC_UNX_GTK_GTKOBJECT_HXX
21#define INCLUDED_VCL_INC_UNX_GTK_GTKOBJECT_HXX
22
23#include <tools/solar.h>
24#include <vcl/sysdata.hxx>
25#include <salobj.hxx>
26#include <unx/gtk/gtkframe.hxx>
27
29{
30protected:
34 cairo_region_t* m_pRegion;
35
36 void Init();
37
38public:
40 virtual ~GtkSalObjectBase() override;
41
42 virtual void BeginSetClipRegion( sal_uInt32 nRects ) override;
43 virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
44
45 virtual void SetForwardKey( bool bEnable ) override;
46
47 virtual const SystemEnvData* GetSystemData() const override;
48
49 virtual Size GetOptimalSize() const override;
50
51private:
52 // signals
53#if !GTK_CHECK_VERSION(4, 0, 0)
54 static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer );
55 static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer );
56#endif
57};
58
59// this attempts to clip the hosted native window using gdk_window_shape_combine_region
60class GtkSalObject final : public GtkSalObjectBase
61{
62 // signals
63 static void signalDestroy( GtkWidget*, gpointer );
64
65public:
66 GtkSalObject(GtkSalFrame* pParent, bool bShow);
67 virtual ~GtkSalObject() override;
68
69 // override all pure virtual methods
70 virtual void ResetClipRegion() override;
71 virtual void EndSetClipRegion() override;
72
73 virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
74 virtual void Show( bool bVisible ) override;
75 virtual void Reparent(SalFrame* pFrame) override;
76};
77
78// this attempts to clip the hosted native GtkWidget by using a GtkScrolledWindow as a viewport
79// only a rectangular area is going to work
81{
86 GtkCssProvider* m_pBgCssProvider;
87
88 // signals
89#if !GTK_CHECK_VERSION(4, 0, 0)
90 static gboolean signalScroll(GtkWidget*, GdkEvent*, gpointer);
91#else
92 static gboolean signalScroll(GtkEventControllerScroll* pController, double delta_x, double delta_y, gpointer object);
93#endif
94 static void signalDestroy( GtkWidget*, gpointer );
95
96#if !GTK_CHECK_VERSION(4, 0, 0)
97 bool signal_scroll(GtkWidget* pScrolledWindow, GdkEvent* pEvent);
98#else
99 bool signal_scroll(GtkEventControllerScroll* pController, double delta_x, double delta_y);
100#endif
101
103
105
106 DECL_LINK(SettingsChangedHdl, VclWindowEvent&, void);
107
108public:
109 GtkSalObjectWidgetClip(GtkSalFrame* pParent, bool bShow);
110 virtual ~GtkSalObjectWidgetClip() override;
111
112 // override all pure virtual methods
113 virtual void ResetClipRegion() override;
114 virtual void EndSetClipRegion() override;
115
116 virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
117 virtual void Show( bool bVisible ) override;
118 virtual void Reparent(SalFrame* pFrame) override;
119};
120
121
122#endif // INCLUDED_VCL_INC_UNX_GTK_GTKOBJECT_HXX
123
124/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static gboolean signalButton(GtkWidget *, GdkEventButton *, gpointer)
static gboolean signalFocus(GtkWidget *, GdkEventFocus *, gpointer)
virtual const SystemEnvData * GetSystemData() const override
GtkWidget * m_pSocket
Definition: gtkobject.hxx:32
virtual Size GetOptimalSize() const override
virtual void BeginSetClipRegion(sal_uInt32 nRects) override
SystemEnvData m_aSystemData
Definition: gtkobject.hxx:31
virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
cairo_region_t * m_pRegion
Definition: gtkobject.hxx:34
virtual ~GtkSalObjectBase() override
GtkSalFrame * m_pParent
Definition: gtkobject.hxx:33
virtual void SetForwardKey(bool bEnable) override
GtkSalObjectBase(GtkSalFrame *pParent)
virtual ~GtkSalObjectWidgetClip() override
static void signalDestroy(GtkWidget *, gpointer)
GtkSalObjectWidgetClip(GtkSalFrame *pParent, bool bShow)
GtkWidget * m_pScrolledWindow
Definition: gtkobject.hxx:84
virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
virtual void EndSetClipRegion() override
static gboolean signalScroll(GtkWidget *, GdkEvent *, gpointer)
tools::Rectangle m_aRect
Definition: gtkobject.hxx:82
virtual void Reparent(SalFrame *pFrame) override
GtkCssProvider * m_pBgCssProvider
Definition: gtkobject.hxx:86
GtkWidget * m_pViewPort
Definition: gtkobject.hxx:85
virtual void Show(bool bVisible) override
tools::Rectangle m_aClipRect
Definition: gtkobject.hxx:83
virtual void ResetClipRegion() override
bool signal_scroll(GtkWidget *pScrolledWindow, GdkEvent *pEvent)
DECL_LINK(SettingsChangedHdl, VclWindowEvent &, void)
virtual void EndSetClipRegion() override
static void signalDestroy(GtkWidget *, gpointer)
virtual void Show(bool bVisible) override
virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
virtual ~GtkSalObject() override
virtual void Reparent(SalFrame *pFrame) override
GtkSalObject(GtkSalFrame *pParent, bool bShow)
virtual void ResetClipRegion() override
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
struct _GtkWidget GtkWidget
long Long