xref: /aoo41x/main/vcl/inc/unx/gtk/gtkgdi.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _VCL_GTKGDI_HXX
29 #define _VCL_GTKGDI_HXX
30 
31 #include <tools/prex.h>
32 #include <gtk/gtk.h>
33 #include <gdk/gdkx.h>
34 #include <gdk/gdkkeysyms.h>
35 #include <tools/postx.h>
36 
37 #include <unx/salgdi.h>
38 
39 class GtkSalGraphics : public X11SalGraphics
40 {
41     GtkWidget           *m_pWindow;
42     Region               m_aClipRegion;
43 
44 public:
45                         GtkSalGraphics( GtkWidget *window )
46                             : m_pWindow( window ),
47                               m_aClipRegion( REGION_NULL )
48                               {}
49     virtual             ~GtkSalGraphics();
50 
51     inline GtkWidget*  GetGtkWidget() const { return m_pWindow; }
52     inline GdkWindow*  GetGdkWindow() const { return m_pWindow->window; }
53     inline GtkSalFrame* GetGtkFrame() const { return static_cast<GtkSalFrame*>(m_pFrame); }
54     void SetWindow( GtkWidget* window ) { m_pWindow = window; }
55 
56 
57     // will be set when UI theme was changed
58     static  sal_Bool        bThemeChanged;
59     static  sal_Bool        bNeedPixmapPaint;
60     static  sal_Bool        bGlobalNeedPixmapPaint;
61     static  sal_Bool        bToolbarGripWorkaround;
62     static  sal_Bool        bNeedButtonStyleAsEditBackgroundWorkaround;
63 
64     // native widget methods
65     virtual sal_Bool        IsNativeControlSupported( ControlType nType, ControlPart nPart );
66     virtual sal_Bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
67                                               const Point& aPos, sal_Bool& rIsInside );
68     virtual sal_Bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
69                                            ControlState nState, const ImplControlValue& aValue,
70                                            const rtl::OUString& rCaption );
71     virtual sal_Bool        drawNativeControlText( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
72                                                ControlState nState, const ImplControlValue& aValue,
73                                                const rtl::OUString& rCaption );
74     virtual sal_Bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
75                                                 const ImplControlValue& aValue, const rtl::OUString& rCaption,
76                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
77 
78     //helper methods for frame's UpdateSettings
79     void updateSettings( AllSettings& rSettings );
80 
81     virtual bool            setClipRegion( const Region& );
82     virtual void			ResetClipRegion();
83 
84     // some themes set the background pixmap of our window EVERY time
85     // a control is painted; but presentation effects need
86     // the background set to None; workaround: set the background
87     // before copyBits
88     virtual void			copyBits( const SalTwoRect* pPosAry,
89                                       SalGraphics* pSrcGraphics );
90 
91 protected:
92     typedef std::list< Rectangle > clipList;
93 
94     GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect );
95     sal_Bool NWRenderPixmapToScreen( GdkPixmap*	pPixmap, Rectangle dstRect );
96 
97     sal_Bool NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
98                            const Rectangle& rControlRectangle,
99                            const clipList& rClipList,
100                            ControlState nState, const ImplControlValue& aValue,
101                            const OUString& rCaption );
102     sal_Bool NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
103 						  const Rectangle& rControlRectangle,
104                           const clipList& rClipList,
105                           ControlState nState, const ImplControlValue& aValue,
106 						  const OUString& rCaption );
107     sal_Bool NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
108 						  const Rectangle& rControlRectangle,
109                           const clipList& rClipList,
110                           ControlState nState, const ImplControlValue& aValue,
111                           const OUString& rCaption );
112     sal_Bool NWPaintGTKScrollbar( ControlType nType, ControlPart nPart,
113 							  const Rectangle& rControlRectangle,
114                               const clipList& rClipList,
115                               ControlState nState, const ImplControlValue& aValue,
116                               const OUString& rCaption );
117     sal_Bool NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
118 							const Rectangle& rControlRectangle,
119                             const clipList& rClipList,
120                             ControlState nState, const ImplControlValue& aValue,
121 							const OUString& rCaption );
122     sal_Bool NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
123 							const Rectangle& rControlRectangle,
124                             const clipList& rClipList,
125                             ControlState nState, const ImplControlValue& aValue,
126 							const OUString& rCaption );
127     sal_Bool NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
128 							 const Rectangle& rControlRectangle,
129                              const clipList& rClipList,
130                              ControlState nState, const ImplControlValue& aValue,
131                              const OUString& rCaption );
132     sal_Bool NWPaintGTKTabItem( ControlType nType, ControlPart nPart,
133 							const Rectangle& rControlRectangle,
134                             const clipList& rClipList,
135                             ControlState nState, const ImplControlValue& aValue,
136 							const OUString& rCaption );
137     sal_Bool NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
138 							const Rectangle& rControlRectangle,
139                             const clipList& rClipList,
140                             ControlState nState, const ImplControlValue& aValue,
141 							const OUString& rCaption );
142 
143     sal_Bool NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
144 							const Rectangle& rControlRectangle,
145                             const clipList& rClipList,
146                             ControlState nState, const ImplControlValue& aValue,
147 							const OUString& rCaption );
148     sal_Bool NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
149 							const Rectangle& rControlRectangle,
150                             const clipList& rClipList,
151                             ControlState nState, const ImplControlValue& aValue,
152 							const OUString& rCaption );
153     sal_Bool NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
154                               const Rectangle& rControlRectangle,
155                               const clipList& rClipList,
156                               ControlState nState, const ImplControlValue& aValue,
157                               const OUString& rCaption );
158     sal_Bool NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
159                             const Rectangle& rControlRectangle,
160                             const clipList& rClipList,
161                             ControlState nState, const ImplControlValue& aValue,
162                             const OUString& rCaption );
163     sal_Bool NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
164                             const Rectangle& rControlRectangle,
165                             const clipList& rClipList,
166                             ControlState nState, const ImplControlValue& aValue,
167                             const OUString& rCaption );
168     sal_Bool NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
169                            const Rectangle& rControlRectangle,
170                            const clipList& rClipList,
171                            ControlState nState, const ImplControlValue& aValue,
172                            const OUString& rCaption );
173     sal_Bool NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
174                             const Rectangle& rControlRectangle,
175                             const clipList& rClipList,
176                             ControlState nState, const ImplControlValue& aValue,
177                             const OUString& rCaption );
178 };
179 
180 #endif // _VCL_GTKGDI_HXX
181