xref: /aoo42x/main/vcl/inc/unx/gtk/gtkgdi.hxx (revision 5f27b83c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _VCL_GTKGDI_HXX
25 #define _VCL_GTKGDI_HXX
26 
27 #include <tools/prex.h>
28 #include <gtk/gtk.h>
29 #include <gdk/gdkx.h>
30 #include <gdk/gdkkeysyms.h>
31 #include <tools/postx.h>
32 
33 #include <unx/salgdi.h>
34 
35 class GtkSalGraphics : public X11SalGraphics
36 {
37     GtkWidget           *m_pWindow;
38     Region               m_aClipRegion;
39 
40 public:
GtkSalGraphics(GtkWidget * window)41                         GtkSalGraphics( GtkWidget *window )
42                             : m_pWindow( window ),
43                               m_aClipRegion(true)
44                               {}
45     virtual             ~GtkSalGraphics();
46 
GetGtkWidget() const47     inline GtkWidget*  GetGtkWidget() const { return m_pWindow; }
GetGdkWindow() const48     inline GdkWindow*  GetGdkWindow() const { return m_pWindow->window; }
GetGtkFrame() const49     inline GtkSalFrame* GetGtkFrame() const { return static_cast<GtkSalFrame*>(m_pFrame); }
SetWindow(GtkWidget * window)50     void SetWindow( GtkWidget* window ) { m_pWindow = window; }
51 
52 
53     // will be set when UI theme was changed
54     static  sal_Bool        bThemeChanged;
55     static  sal_Bool        bNeedPixmapPaint;
56     static  sal_Bool        bGlobalNeedPixmapPaint;
57     static  sal_Bool        bToolbarGripWorkaround;
58     static  sal_Bool        bNeedButtonStyleAsEditBackgroundWorkaround;
59 
60     // native widget methods
61     virtual sal_Bool        IsNativeControlSupported( ControlType nType, ControlPart nPart );
62     virtual sal_Bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
63                                               const Point& aPos, sal_Bool& rIsInside );
64     virtual sal_Bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
65                                            ControlState nState, const ImplControlValue& aValue,
66                                            const rtl::OUString& rCaption );
67     virtual sal_Bool        drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
68                                                ControlState nState, const ImplControlValue& aValue,
69                                                const rtl::OUString& rCaption );
70     virtual sal_Bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
71                                                 const ImplControlValue& aValue, const rtl::OUString& rCaption,
72                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
73 
74     //helper methods for frame's UpdateSettings
75     void updateSettings( AllSettings& rSettings );
76 
77     virtual bool            setClipRegion( const Region& );
78     virtual void			ResetClipRegion();
79 
80     // some themes set the background pixmap of our window EVERY time
81     // a control is painted; but presentation effects need
82     // the background set to None; workaround: set the background
83     // before copyBits
84     virtual void			copyBits( const SalTwoRect& rPosAry,
85                                       SalGraphics* pSrcGraphics );
86 
87 protected:
88     typedef std::list< Rectangle > clipList;
89 
90     GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect );
91     sal_Bool NWRenderPixmapToScreen( GdkPixmap*	pPixmap, Rectangle dstRect );
92 
93     sal_Bool NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
94                            const Rectangle& rControlRectangle,
95                            const clipList& rClipList,
96                            ControlState nState, const ImplControlValue& aValue,
97                            const OUString& rCaption );
98     sal_Bool NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
99 						  const Rectangle& rControlRectangle,
100                           const clipList& rClipList,
101                           ControlState nState, const ImplControlValue& aValue,
102 						  const OUString& rCaption );
103     sal_Bool NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
104 						  const Rectangle& rControlRectangle,
105                           const clipList& rClipList,
106                           ControlState nState, const ImplControlValue& aValue,
107                           const OUString& rCaption );
108     sal_Bool NWPaintGTKScrollbar( ControlType nType, ControlPart nPart,
109 							  const Rectangle& rControlRectangle,
110                               const clipList& rClipList,
111                               ControlState nState, const ImplControlValue& aValue,
112                               const OUString& rCaption );
113     sal_Bool NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
114 							const Rectangle& rControlRectangle,
115                             const clipList& rClipList,
116                             ControlState nState, const ImplControlValue& aValue,
117 							const OUString& rCaption );
118     sal_Bool NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
119 							const Rectangle& rControlRectangle,
120                             const clipList& rClipList,
121                             ControlState nState, const ImplControlValue& aValue,
122 							const OUString& rCaption );
123     sal_Bool NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
124 							 const Rectangle& rControlRectangle,
125                              const clipList& rClipList,
126                              ControlState nState, const ImplControlValue& aValue,
127                              const OUString& rCaption );
128     sal_Bool NWPaintGTKTabItem( ControlType nType, ControlPart nPart,
129 							const Rectangle& rControlRectangle,
130                             const clipList& rClipList,
131                             ControlState nState, const ImplControlValue& aValue,
132 							const OUString& rCaption );
133     sal_Bool NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
134 							const Rectangle& rControlRectangle,
135                             const clipList& rClipList,
136                             ControlState nState, const ImplControlValue& aValue,
137 							const OUString& rCaption );
138 
139     sal_Bool NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
140 							const Rectangle& rControlRectangle,
141                             const clipList& rClipList,
142                             ControlState nState, const ImplControlValue& aValue,
143 							const OUString& rCaption );
144     sal_Bool NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
145 							const Rectangle& rControlRectangle,
146                             const clipList& rClipList,
147                             ControlState nState, const ImplControlValue& aValue,
148 							const OUString& rCaption );
149     sal_Bool NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
150                               const Rectangle& rControlRectangle,
151                               const clipList& rClipList,
152                               ControlState nState, const ImplControlValue& aValue,
153                               const OUString& rCaption );
154     sal_Bool NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
155                             const Rectangle& rControlRectangle,
156                             const clipList& rClipList,
157                             ControlState nState, const ImplControlValue& aValue,
158                             const OUString& rCaption );
159     sal_Bool NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
160                             const Rectangle& rControlRectangle,
161                             const clipList& rClipList,
162                             ControlState nState, const ImplControlValue& aValue,
163                             const OUString& rCaption );
164     sal_Bool NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
165                            const Rectangle& rControlRectangle,
166                            const clipList& rClipList,
167                            ControlState nState, const ImplControlValue& aValue,
168                            const OUString& rCaption );
169     sal_Bool NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
170                             const Rectangle& rControlRectangle,
171                             const clipList& rClipList,
172                             ControlState nState, const ImplControlValue& aValue,
173                             const OUString& rCaption );
174 };
175 
176 #endif // _VCL_GTKGDI_HXX
177