LCOV - code coverage report
Current view: top level - vcl/inc/unx/gtk - gtkgdi.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 3 0.0 %
Date: 2014-11-03 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
      21             : #define INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
      22             : 
      23             : #include <prex.h>
      24             : #include <gtk/gtk.h>
      25             : #include <gdk/gdkx.h>
      26             : #include <gdk/gdkkeysyms.h>
      27             : #include <postx.h>
      28             : 
      29             : #include <unx/salgdi.h>
      30             : 
      31             : #if GTK_CHECK_VERSION(3,0,0)
      32             : 
      33             : #include <headless/svpgdi.hxx>
      34             : 
      35             : class GtkSalFrame;
      36             : class GtkSalGraphics : public SvpSalGraphics
      37             : {
      38             :     GtkSalFrame *mpFrame;
      39             : public:
      40             :     GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow );
      41             :     virtual void copyArea( long nDestX, long nDestY,
      42             :                            long nSrcX, long nSrcY,
      43             :                            long nSrcWidth, long nSrcHeight,
      44             :                            sal_uInt16 /*nFlags*/ ) SAL_OVERRIDE;
      45             :     virtual bool        drawNativeControl( ControlType nType, ControlPart nPart,
      46             :                                                const Rectangle& rControlRegion,
      47             :                                                ControlState nState, const ImplControlValue& aValue,
      48             :                                                const OUString& rCaption ) SAL_OVERRIDE;
      49             :     virtual bool        IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE;
      50             :     virtual bool        getNativeControlRegion( ControlType nType, ControlPart nPart,
      51             :                                                     const Rectangle& rControlRegion,
      52             :                                                     ControlState nState,
      53             :                                                     const ImplControlValue& aValue,
      54             :                                                     const OUString& rCaption,
      55             :                                                     Rectangle &rNativeBoundingRegion,
      56             :                                                     Rectangle &rNativeContentRegion ) SAL_OVERRIDE;
      57             :     void updateSettings( AllSettings& rSettings );
      58             :     static void refreshFontconfig( GtkSettings *pSettings );
      59             :     static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
      60             : private:
      61             :     GtkWidget       *mpWindow;
      62             :     static GtkStyleContext *mpButtonStyle;
      63             :     static GtkStyleContext *mpEntryStyle;
      64             :     static GtkStyleContext *mpVScrollbarStyle;
      65             :     static GtkStyleContext *mpHScrollbarStyle;
      66             :     static GtkStyleContext *mpToolbarStyle;
      67             :     static GtkStyleContext *mpToolButtonStyle;
      68             :     static GtkStyleContext *mpCheckButtonStyle;
      69             :     static GtkStyleContext *mpMenuBarStyle;
      70             :     static GtkStyleContext *mpMenuBarItemStyle;
      71             :     static GtkStyleContext *mpMenuStyle;
      72             :     static GtkStyleContext *mpMenuItemStyle;
      73             :     static GtkStyleContext *mpSpinStyle;
      74             :     static GtkStyleContext *mpComboboxStyle;
      75             :     static GtkStyleContext *mpListboxStyle;
      76             : 
      77             :     void renderAreaToPix( cairo_t* cr, cairo_rectangle_int_t *region );
      78             :     void getStyleContext( GtkStyleContext** style, GtkWidget* widget );
      79             :     Rectangle NWGetScrollButtonRect( ControlPart nPart, Rectangle aAreaRect );
      80             :     Rectangle NWGetSpinButtonRect( ControlPart nPart, Rectangle aAreaRect);
      81             :     Rectangle NWGetComboBoxButtonRect( ControlType nType, ControlPart nPart, Rectangle aAreaRect );
      82             : 
      83             :     void PaintScrollbar(GtkStyleContext *context,
      84             :                         cairo_t *cr,
      85             :                         const Rectangle& rControlRectangle,
      86             :                         ControlType nType,
      87             :                         ControlPart nPart,
      88             :                         const ImplControlValue& aValue );
      89             :     void PaintOneSpinButton( GtkStyleContext *context,
      90             :                              cairo_t *cr,
      91             :                              ControlType nType,
      92             :                              ControlPart nPart,
      93             :                              Rectangle aAreaRect,
      94             :                              ControlState nState );
      95             :     void PaintSpinButton(GtkStyleContext *context,
      96             :                          cairo_t *cr,
      97             :                          const Rectangle& rControlRectangle,
      98             :                          ControlType nType,
      99             :                          ControlPart nPart,
     100             :                          const ImplControlValue& aValue );
     101             :     void PaintCombobox( GtkStyleContext *context,
     102             :                         cairo_t *cr,
     103             :                         const Rectangle& rControlRectangle,
     104             :                         ControlType nType,
     105             :                         ControlPart nPart,
     106             :                         const ImplControlValue& aValue );
     107             :     void PaintCheckOrRadio(GtkStyleContext *context,
     108             :                            cairo_t *cr,
     109             :                            const Rectangle& rControlRectangle,
     110             :                            ControlType nType);
     111             : 
     112             :     static bool style_loaded;
     113             : };
     114             : 
     115             : #else
     116             : 
     117             : class GtkSalGraphics : public X11SalGraphics
     118             : {
     119             :     GtkWidget           *m_pWindow;
     120             :     vcl::Region               m_aClipRegion;
     121             : 
     122             : public:
     123             :                         GtkSalGraphics( GtkSalFrame *, GtkWidget *window );
     124             :                         GtkSalGraphics( GtkSalFrame *, GtkWidget *window, SalX11Screen nXScreen );
     125             :     virtual             ~GtkSalGraphics();
     126             : 
     127             :     inline GtkWidget*  GetGtkWidget() const { return m_pWindow; }
     128           0 :     inline GdkWindow*  GetGdkWindow() const { return m_pWindow->window; }
     129           0 :     inline GtkSalFrame* GetGtkFrame() const { return static_cast<GtkSalFrame*>(m_pFrame); }
     130           0 :     void SetWindow( GtkWidget* window ) { m_pWindow = window; }
     131             : 
     132             :     // will be set when UI theme was changed
     133             :     static  bool        bThemeChanged;
     134             :     static  bool        bNeedPixmapPaint;
     135             : 
     136             :     // native widget methods
     137             :     virtual bool        IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE;
     138             :     virtual bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
     139             :                                               const Point& aPos, bool& rIsInside ) SAL_OVERRIDE;
     140             :     virtual bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
     141             :                                            ControlState nState, const ImplControlValue& aValue,
     142             :                                            const OUString& rCaption ) SAL_OVERRIDE;
     143             :     virtual bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
     144             :                                                 const ImplControlValue& aValue, const OUString& rCaption,
     145             :                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) SAL_OVERRIDE;
     146             : 
     147             :     //helper methods for frame's UpdateSettings
     148             :     void updateSettings( AllSettings& rSettings );
     149             :     static void refreshFontconfig( GtkSettings *pSettings );
     150             :     static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
     151             : 
     152             :     virtual bool            setClipRegion( const vcl::Region& ) SAL_OVERRIDE;
     153             :     virtual void            ResetClipRegion() SAL_OVERRIDE;
     154             : 
     155             :     // some themes set the background pixmap of our window EVERY time
     156             :     // a control is painted; but presentation effects need
     157             :     // the background set to None; workaround: set the background
     158             :     // before copyBits
     159             :     virtual void            copyBits( const SalTwoRect& rPosAry,
     160             :                                       SalGraphics* pSrcGraphics ) SAL_OVERRIDE;
     161             : 
     162             : protected:
     163             :     typedef std::list< Rectangle > clipList;
     164             : 
     165             :     GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect );
     166             :     bool NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect );
     167             : 
     168             :     bool NWPaintGTKArrow( 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             :     bool NWPaintGTKListHeader( 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             :     bool NWPaintGTKFixedLine( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     179             :                            const Rectangle& rControlRectangle,
     180             :                            const clipList& rClipList,
     181             :                            ControlState nState, const ImplControlValue& aValue,
     182             :                            const OUString& rCaption );
     183             :     bool NWPaintGTKFrame( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     184             :                            const Rectangle& rControlRectangle,
     185             :                            const clipList& rClipList,
     186             :                            ControlState nState, const ImplControlValue& aValue,
     187             :                            const OUString& rCaption );
     188             :     bool NWPaintGTKWindowBackground( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     189             :                            const Rectangle& rControlRectangle,
     190             :                            const clipList& rClipList,
     191             :                            ControlState nState, const ImplControlValue& aValue,
     192             :                            const OUString& rCaption );
     193             :     bool NWPaintGTKButtonReal( GtkWidget* button, GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     194             :                            const Rectangle& rControlRectangle,
     195             :                            const clipList& rClipList,
     196             :                            ControlState nState, const ImplControlValue& aValue,
     197             :                            const OUString& rCaption );
     198             :     bool NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     199             :                            const Rectangle& rControlRectangle,
     200             :                            const clipList& rClipList,
     201             :                            ControlState nState, const ImplControlValue& aValue,
     202             :                            const OUString& rCaption );
     203             :     bool NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     204             :                           const Rectangle& rControlRectangle,
     205             :                           const clipList& rClipList,
     206             :                           ControlState nState, const ImplControlValue& aValue,
     207             :                           const OUString& rCaption );
     208             :     bool NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     209             :                           const Rectangle& rControlRectangle,
     210             :                           const clipList& rClipList,
     211             :                           ControlState nState, const ImplControlValue& aValue,
     212             :                           const OUString& rCaption );
     213             :     bool NWPaintGTKScrollbar( ControlType nType, ControlPart nPart,
     214             :                               const Rectangle& rControlRectangle,
     215             :                               const clipList& rClipList,
     216             :                               ControlState nState, const ImplControlValue& aValue,
     217             :                               const OUString& rCaption );
     218             :     bool NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     219             :                             const Rectangle& rControlRectangle,
     220             :                             const clipList& rClipList,
     221             :                             ControlState nState, const ImplControlValue& aValue,
     222             :                             const OUString& rCaption );
     223             :     bool NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
     224             :                             const Rectangle& rControlRectangle,
     225             :                             const clipList& rClipList,
     226             :                             ControlState nState, const ImplControlValue& aValue,
     227             :                             const OUString& rCaption );
     228             :     bool NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     229             :                              const Rectangle& rControlRectangle,
     230             :                              const clipList& rClipList,
     231             :                              ControlState nState, const ImplControlValue& aValue,
     232             :                              const OUString& rCaption );
     233             :     bool NWPaintGTKTabItem( ControlType nType, ControlPart nPart,
     234             :                             const Rectangle& rControlRectangle,
     235             :                             const clipList& rClipList,
     236             :                             ControlState nState, const ImplControlValue& aValue,
     237             :                             const OUString& rCaption );
     238             :     bool NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     239             :                             const Rectangle& rControlRectangle,
     240             :                             const clipList& rClipList,
     241             :                             ControlState nState, const ImplControlValue& aValue,
     242             :                             const OUString& rCaption );
     243             : 
     244             :     bool NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     245             :                             const Rectangle& rControlRectangle,
     246             :                             const clipList& rClipList,
     247             :                             ControlState nState, const ImplControlValue& aValue,
     248             :                             const OUString& rCaption );
     249             :     bool NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     250             :                             const Rectangle& rControlRectangle,
     251             :                             const clipList& rClipList,
     252             :                             ControlState nState, const ImplControlValue& aValue,
     253             :                             const OUString& rCaption );
     254             :     bool NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     255             :                               const Rectangle& rControlRectangle,
     256             :                               const clipList& rClipList,
     257             :                               ControlState nState, const ImplControlValue& aValue,
     258             :                               const OUString& rCaption );
     259             :     bool NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     260             :                             const Rectangle& rControlRectangle,
     261             :                             const clipList& rClipList,
     262             :                             ControlState nState, const ImplControlValue& aValue,
     263             :                             const OUString& rCaption );
     264             :     bool NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     265             :                             const Rectangle& rControlRectangle,
     266             :                             const clipList& rClipList,
     267             :                             ControlState nState, const ImplControlValue& aValue,
     268             :                             const OUString& rCaption );
     269             :     bool NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     270             :                            const Rectangle& rControlRectangle,
     271             :                            const clipList& rClipList,
     272             :                            ControlState nState, const ImplControlValue& aValue,
     273             :                            const OUString& rCaption );
     274             :     bool NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     275             :                             const Rectangle& rControlRectangle,
     276             :                             const clipList& rClipList,
     277             :                             ControlState nState, const ImplControlValue& aValue,
     278             :                             const OUString& rCaption );
     279             : };
     280             : 
     281             : #endif // !gtk3
     282             : 
     283             : #endif // INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
     284             : 
     285             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10