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