bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / unx / gtk / gtkgdi.hxx
blob44bcec7fd5d63e14517266c8c44e19fc3d886ddf
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 #ifndef INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
21 #define INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
23 #include <config_cairo_canvas.h>
25 #include <gtk/gtk.h>
26 #include "gtkbackend.hxx"
27 #include <gdk/gdkkeysyms.h>
29 #include <unx/gtk/gtkframe.hxx>
30 #include <ControlCacheKey.hxx>
32 #include <headless/svpgdi.hxx>
33 #include <textrender.hxx>
35 enum class GtkControlPart
37 ToplevelWindow,
38 Button,
39 LinkButton,
40 CheckButton,
41 CheckButtonCheck,
42 RadioButton,
43 RadioButtonRadio,
44 Entry,
45 Combobox,
46 ComboboxBox,
47 ComboboxBoxEntry,
48 ComboboxBoxButton,
49 ComboboxBoxButtonBox,
50 ComboboxBoxButtonBoxArrow,
51 Listbox,
52 ListboxBox,
53 ListboxBoxButton,
54 ListboxBoxButtonBox,
55 ListboxBoxButtonBoxArrow,
56 SpinButton,
57 SpinButtonUpButton,
58 SpinButtonDownButton,
59 ScrollbarVertical,
60 ScrollbarVerticalContents,
61 ScrollbarVerticalTrough,
62 ScrollbarVerticalSlider,
63 ScrollbarVerticalButton,
64 ScrollbarHorizontal,
65 ScrollbarHorizontalContents,
66 ScrollbarHorizontalTrough,
67 ScrollbarHorizontalSlider,
68 ScrollbarHorizontalButton,
69 ProgressBar,
70 ProgressBarTrough,
71 ProgressBarProgress,
72 Notebook,
73 NotebookHeader,
74 NotebookStack,
75 NotebookHeaderTabs,
76 NotebookHeaderTabsTab,
77 NotebookHeaderTabsTabLabel,
78 NotebookHeaderTabsTabActiveLabel,
79 NotebookHeaderTabsTabHoverLabel,
80 FrameBorder,
81 MenuBar,
82 MenuBarItem,
83 MenuWindow,
84 Menu,
85 MenuItem,
86 MenuItemLabel,
87 MenuItemArrow,
88 CheckMenuItem,
89 CheckMenuItemCheck,
90 RadioMenuItem,
91 RadioMenuItemRadio,
92 SeparatorMenuItem,
93 SeparatorMenuItemSeparator,
96 class GtkSalGraphics : public SvpSalGraphics
98 GtkSalFrame * const mpFrame;
100 protected:
101 #if !GTK_CHECK_VERSION(4, 0, 0)
102 bool isNativeControlSupported(ControlType, ControlPart) override;
103 virtual bool drawNativeControl( ControlType nType, ControlPart nPart,
104 const tools::Rectangle& rControlRegion,
105 ControlState nState, const ImplControlValue& aValue,
106 const OUString& rCaption,
107 const Color& rBackgroundColor ) override;
108 virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart,
109 const tools::Rectangle& rControlRegion,
110 ControlState nState,
111 const ImplControlValue& aValue,
112 const OUString& rCaption,
113 tools::Rectangle &rNativeBoundingRegion,
114 tools::Rectangle &rNativeContentRegion ) override;
115 #endif
116 bool updateSettings(AllSettings&) override;
117 void handleDamage(const tools::Rectangle&) override;
119 public:
120 GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow );
122 #if ENABLE_CAIRO_CANVAS
123 virtual bool SupportsCairo() const override;
124 virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
125 virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
126 #endif
128 void WidgetQueueDraw() const;
130 virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
132 virtual OUString getRenderBackendName() const override { return "gtk3svp"; }
134 GtkStyleContext* createStyleContext(GtkControlPart ePart);
135 #if !GTK_CHECK_VERSION(4, 0, 0)
136 GtkStyleContext* makeContext(GtkWidgetPath *pPath, GtkStyleContext *pParent);
137 #endif
138 private:
139 GtkWidget *mpWindow;
140 static GtkStyleContext *mpWindowStyle;
141 static GtkStyleContext *mpButtonStyle;
142 static GtkStyleContext *mpLinkButtonStyle;
143 static GtkStyleContext *mpEntryStyle;
144 static GtkStyleContext *mpTextViewStyle;
145 static GtkStyleContext *mpVScrollbarStyle;
146 static GtkStyleContext *mpVScrollbarContentsStyle;
147 static GtkStyleContext *mpVScrollbarTroughStyle;
148 static GtkStyleContext *mpVScrollbarSliderStyle;
149 static GtkStyleContext *mpVScrollbarButtonStyle;
150 static GtkStyleContext *mpHScrollbarStyle;
151 static GtkStyleContext *mpHScrollbarContentsStyle;
152 static GtkStyleContext *mpHScrollbarTroughStyle;
153 static GtkStyleContext *mpHScrollbarSliderStyle;
154 static GtkStyleContext *mpHScrollbarButtonStyle;
155 static GtkStyleContext *mpToolbarStyle;
156 static GtkStyleContext *mpToolButtonStyle;
157 static GtkStyleContext *mpToolbarSeparatorStyle;
158 static GtkStyleContext *mpCheckButtonStyle;
159 static GtkStyleContext *mpCheckButtonCheckStyle;
160 static GtkStyleContext *mpRadioButtonStyle;
161 static GtkStyleContext *mpRadioButtonRadioStyle;
162 static GtkStyleContext *mpSpinStyle;
163 static GtkStyleContext *mpSpinUpStyle;
164 static GtkStyleContext *mpSpinDownStyle;
165 static GtkStyleContext *mpComboboxStyle;
166 static GtkStyleContext *mpComboboxBoxStyle;
167 static GtkStyleContext *mpComboboxEntryStyle;
168 static GtkStyleContext *mpComboboxButtonStyle;
169 static GtkStyleContext *mpComboboxButtonBoxStyle;
170 static GtkStyleContext *mpComboboxButtonArrowStyle;
171 static GtkStyleContext *mpListboxStyle;
172 static GtkStyleContext *mpListboxBoxStyle;
173 static GtkStyleContext *mpListboxButtonStyle;
174 static GtkStyleContext *mpListboxButtonBoxStyle;
175 static GtkStyleContext *mpListboxButtonArrowStyle;
176 static GtkStyleContext *mpFrameInStyle;
177 static GtkStyleContext *mpFrameOutStyle;
178 static GtkStyleContext *mpFixedHoriLineStyle;
179 static GtkStyleContext *mpFixedVertLineStyle;
180 static GtkStyleContext *mpTreeHeaderButtonStyle;
181 static GtkStyleContext *mpProgressBarStyle;
182 static GtkStyleContext *mpProgressBarTroughStyle;
183 static GtkStyleContext *mpProgressBarProgressStyle;
184 static GtkStyleContext *mpNotebookStyle;
185 static GtkStyleContext *mpNotebookStackStyle;
186 static GtkStyleContext *mpNotebookHeaderStyle;
187 static GtkStyleContext *mpNotebookHeaderTabsStyle;
188 static GtkStyleContext *mpNotebookHeaderTabsTabStyle;
189 static GtkStyleContext *mpNotebookHeaderTabsTabLabelStyle;
190 static GtkStyleContext *mpNotebookHeaderTabsTabActiveLabelStyle;
191 static GtkStyleContext *mpNotebookHeaderTabsTabHoverLabelStyle;
192 static GtkStyleContext *mpMenuBarStyle;
193 static GtkStyleContext *mpMenuBarItemStyle;
194 static GtkStyleContext *mpMenuWindowStyle;
195 static GtkStyleContext *mpMenuStyle;
196 static GtkStyleContext *mpMenuItemStyle;
197 static GtkStyleContext *mpMenuItemLabelStyle;
198 static GtkStyleContext *mpMenuItemArrowStyle;
199 static GtkStyleContext *mpCheckMenuItemStyle;
200 static GtkStyleContext *mpCheckMenuItemCheckStyle;
201 static GtkStyleContext *mpRadioMenuItemStyle;
202 static GtkStyleContext *mpRadioMenuItemRadioStyle;
203 static GtkStyleContext *mpSeparatorMenuItemStyle;
204 static GtkStyleContext *mpSeparatorMenuItemSeparatorStyle;
206 #if !GTK_CHECK_VERSION(4, 0, 0)
207 static tools::Rectangle NWGetScrollButtonRect( ControlPart nPart, tools::Rectangle aAreaRect );
208 static tools::Rectangle NWGetSpinButtonRect( ControlPart nPart, tools::Rectangle aAreaRect);
209 static tools::Rectangle NWGetComboBoxButtonRect(ControlType nType, ControlPart nPart, tools::Rectangle aAreaRect);
211 static void PaintScrollbar(GtkStyleContext *context,
212 cairo_t *cr,
213 const tools::Rectangle& rControlRectangle,
214 ControlPart nPart,
215 const ImplControlValue& aValue );
216 void PaintOneSpinButton( GtkStyleContext *context,
217 cairo_t *cr,
218 ControlPart nPart,
219 tools::Rectangle aAreaRect,
220 ControlState nState );
221 void PaintSpinButton(GtkStateFlags flags,
222 cairo_t *cr,
223 const tools::Rectangle& rControlRectangle,
224 ControlPart nPart,
225 const ImplControlValue& aValue);
226 static void PaintCombobox(GtkStateFlags flags,
227 cairo_t *cr,
228 const tools::Rectangle& rControlRectangle,
229 ControlType nType,
230 ControlPart nPart);
231 static void PaintCheckOrRadio(cairo_t *cr, GtkStyleContext *context,
232 const tools::Rectangle& rControlRectangle,
233 bool bIsCheck, bool bInMenu);
235 static void PaintCheck(cairo_t *cr, GtkStyleContext *context,
236 const tools::Rectangle& rControlRectangle, bool bInMenu);
238 static void PaintRadio(cairo_t *cr, GtkStyleContext *context,
239 const tools::Rectangle& rControlRectangle, bool bInMenu);
240 #endif
242 static bool style_loaded;
245 #endif // INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
247 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */