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( long nX, long nY, long nWidth, 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  static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer );
54  static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer );
55 };
56 
57 // this attempts to clip the hosted native window using gdk_window_shape_combine_region
58 class GtkSalObject final : public GtkSalObjectBase
59 {
60  // signals
61  static void signalDestroy( GtkWidget*, gpointer );
62 
63 public:
64  GtkSalObject(GtkSalFrame* pParent, bool bShow);
65  virtual ~GtkSalObject() override;
66 
67  // override all pure virtual methods
68  virtual void ResetClipRegion() override;
69  virtual void EndSetClipRegion() override;
70 
71  virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ) override;
72  virtual void Show( bool bVisible ) override;
73  virtual void Reparent(SalFrame* pFrame) override;
74 };
75 
76 // this attempts to clip the hosted native GtkWidget by using a GtkScrolledWindow as a viewport
77 // only a rectangular area is going to work
79 {
82  GtkWidget* m_pScrolledWindow;
83 
84  // signals
85  static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer );
86  static void signalDestroy( GtkWidget*, gpointer );
87 
88  bool signal_scroll(GtkWidget* pScrolledWindow, GdkEvent* pEvent);
89 
90  void ApplyClipRegion();
91 public:
92  GtkSalObjectWidgetClip(GtkSalFrame* pParent, bool bShow);
93  virtual ~GtkSalObjectWidgetClip() override;
94 
95  // override all pure virtual methods
96  virtual void ResetClipRegion() override;
97  virtual void EndSetClipRegion() override;
98 
99  virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ) override;
100  virtual void Show( bool bVisible ) override;
101  virtual void Reparent(SalFrame* pFrame) override;
102 };
103 
104 
105 #endif // INCLUDED_VCL_INC_UNX_GTK_GTKOBJECT_HXX
106 
107 /* 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
virtual Size GetOptimalSize() const override
static void signalDestroy(GtkWidget *, gpointer)
static gboolean signalButton(GtkWidget *, GdkEventButton *, gpointer)
virtual void SetPosSize(long nX, long nY, long nWidth, long nHeight) override
GtkSalFrame * m_pParent
Definition: gtkobject.hxx:33
virtual ~GtkSalObject() override
virtual void Reparent(SalFrame *pFrame) override
static gboolean signalFocus(GtkWidget *, GdkEventFocus *, gpointer)
virtual void Reparent(SalFrame *pFrame) override
GtkWidget * m_pSocket
Definition: gtkobject.hxx:32
virtual void SetPosSize(long nX, long nY, long nWidth, 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:81
GtkWidget * m_pScrolledWindow
Definition: gtkobject.hxx:82
GtkSalObject(GtkSalFrame *pParent, bool bShow)
tools::Rectangle m_aRect
Definition: gtkobject.hxx:80
virtual void UnionClipRegion(long nX, long nY, long nWidth, long nHeight) override
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