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