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 {
30 protected:
32  GtkWidget* m_pSocket;
34  cairo_region_t* m_pRegion;
35 
36  void Init();
37 
38 public:
39  GtkSalObjectBase(GtkSalFrame* pParent);
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 
51 private:
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
60 class GtkSalObject final : public GtkSalObjectBase
61 {
62  // signals
63  static void signalDestroy( GtkWidget*, gpointer );
64 
65 public:
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 {
84  GtkWidget* m_pScrolledWindow;
85 
86  // signals
87  static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer );
88  static void signalDestroy( GtkWidget*, gpointer );
89 
90  bool signal_scroll(GtkWidget* pScrolledWindow, GdkEvent* pEvent);
91 
92  void ApplyClipRegion();
93 public:
94  GtkSalObjectWidgetClip(GtkSalFrame* pParent, bool bShow);
95  virtual ~GtkSalObjectWidgetClip() override;
96 
97  // override all pure virtual methods
98  virtual void ResetClipRegion() override;
99  virtual void EndSetClipRegion() override;
100 
101  virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
102  virtual void Show( bool bVisible ) override;
103  virtual void Reparent(SalFrame* pFrame) override;
104 };
105 
106 
107 #endif // INCLUDED_VCL_INC_UNX_GTK_GTKOBJECT_HXX
108 
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~GtkSalObjectBase() override
virtual void ResetClipRegion() override
bool bVisible
GtkSalObjectBase(GtkSalFrame *pParent)
static gboolean signalScroll(GtkWidget *, GdkEvent *, gpointer)
static void signalDestroy(GtkWidget *, gpointer)
virtual const SystemEnvData * GetSystemData() const override
virtual void Show(bool bVisible) override
long Long
virtual Size GetOptimalSize() const override
static void signalDestroy(GtkWidget *, gpointer)
static gboolean signalButton(GtkWidget *, GdkEventButton *, gpointer)
GtkSalFrame * m_pParent
Definition: gtkobject.hxx:33
virtual ~GtkSalObject() override
virtual void Reparent(SalFrame *pFrame) override
virtual void UnionClipRegion(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
static gboolean signalFocus(GtkWidget *, GdkEventFocus *, gpointer)
virtual void Reparent(SalFrame *pFrame) override
GtkWidget * m_pSocket
Definition: gtkobject.hxx:32
virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
GtkSalObjectWidgetClip(GtkSalFrame *pParent, bool bShow)
cairo_region_t * m_pRegion
Definition: gtkobject.hxx:34
virtual void BeginSetClipRegion(sal_uInt32 nRects) override
bool signal_scroll(GtkWidget *pScrolledWindow, GdkEvent *pEvent)
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
tools::Rectangle m_aClipRect
Definition: gtkobject.hxx:83
virtual void SetPosSize(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight) override
GtkWidget * m_pScrolledWindow
Definition: gtkobject.hxx:84
GtkSalObject(GtkSalFrame *pParent, bool bShow)
tools::Rectangle m_aRect
Definition: gtkobject.hxx:82
virtual void SetForwardKey(bool bEnable) override
virtual void EndSetClipRegion() override
SystemEnvData m_aSystemData
Definition: gtkobject.hxx:31
virtual void Show(bool bVisible) override
virtual ~GtkSalObjectWidgetClip() override
virtual void EndSetClipRegion() override
virtual void ResetClipRegion() override