tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / vcl / inc / unx / gtk / gtkobject.hxx
blobdc79de17c02d68e3b98b012f0c42cbb21fb12489
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <tools/solar.h>
23 #include <vcl/sysdata.hxx>
24 #include <salobj.hxx>
25 #include <unx/gtk/gtkframe.hxx>
27 class GtkSalObjectBase : public SalObject
29 protected:
30 SystemEnvData m_aSystemData;
31 GtkWidget* m_pSocket;
32 GtkSalFrame* m_pParent;
33 cairo_region_t* m_pRegion;
35 void Init();
37 public:
38 GtkSalObjectBase(GtkSalFrame* pParent);
39 virtual ~GtkSalObjectBase() override;
41 virtual void BeginSetClipRegion( sal_uInt32 nRects ) override;
42 virtual void UnionClipRegion( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
44 virtual void SetForwardKey( bool bEnable ) override;
46 virtual const SystemEnvData& GetSystemData() const override;
48 virtual Size GetOptimalSize() const override;
50 private:
51 // signals
52 #if !GTK_CHECK_VERSION(4, 0, 0)
53 static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer );
54 static gboolean signalFocus( GtkWidget*, GdkEventFocus*, gpointer );
55 #endif
58 // this attempts to clip the hosted native window using gdk_window_shape_combine_region
59 class GtkSalObject final : public GtkSalObjectBase
61 // signals
62 static void signalDestroy( GtkWidget*, gpointer );
64 public:
65 GtkSalObject(GtkSalFrame* pParent, bool bShow);
66 virtual ~GtkSalObject() override;
68 // override all pure virtual methods
69 virtual void ResetClipRegion() override;
70 virtual void EndSetClipRegion() override;
72 virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
73 virtual void Show( bool bVisible ) override;
74 virtual void Reparent(SalFrame* pFrame) override;
77 // this attempts to clip the hosted native GtkWidget by using a GtkScrolledWindow as a viewport
78 // only a rectangular area is going to work
79 class GtkSalObjectWidgetClip final : public GtkSalObjectBase
81 tools::Rectangle m_aRect;
82 tools::Rectangle m_aClipRect;
83 GtkWidget* m_pScrolledWindow;
84 GtkWidget* m_pViewPort;
85 GtkCssProvider* m_pBgCssProvider;
87 // signals
88 #if !GTK_CHECK_VERSION(4, 0, 0)
89 static gboolean signalScroll(GtkWidget*, GdkEvent*, gpointer);
90 #else
91 static gboolean signalScroll(GtkEventControllerScroll* pController, double delta_x, double delta_y, gpointer object);
92 #endif
93 static void signalDestroy( GtkWidget*, gpointer );
95 #if !GTK_CHECK_VERSION(4, 0, 0)
96 bool signal_scroll(GtkWidget* pScrolledWindow, GdkEvent* pEvent);
97 #else
98 bool signal_scroll(GtkEventControllerScroll* pController, double delta_x, double delta_y);
99 #endif
101 void ApplyClipRegion();
103 void SetViewPortBackground();
105 DECL_LINK(SettingsChangedHdl, VclWindowEvent&, void);
107 public:
108 GtkSalObjectWidgetClip(GtkSalFrame* pParent, bool bShow);
109 virtual ~GtkSalObjectWidgetClip() override;
111 // override all pure virtual methods
112 virtual void ResetClipRegion() override;
113 virtual void EndSetClipRegion() override;
115 virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override;
116 virtual void Show( bool bVisible ) override;
117 virtual void Reparent(SalFrame* pFrame) override;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */