LCOV - code coverage report
Current view: top level - vcl/inc/unx/gtk - gtkgdi.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 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             :     Region               m_aClipRegion;
     121             : 
     122             : public:
     123             :                         GtkSalGraphics( GtkSalFrame *, GtkWidget *window );
     124             :     virtual             ~GtkSalGraphics();
     125             : 
     126             :     inline GtkWidget*  GetGtkWidget() const { return m_pWindow; }
     127           0 :     inline GdkWindow*  GetGdkWindow() const { return m_pWindow->window; }
     128           0 :     inline GtkSalFrame* GetGtkFrame() const { return static_cast<GtkSalFrame*>(m_pFrame); }
     129           0 :     void SetWindow( GtkWidget* window ) { m_pWindow = window; }
     130             : 
     131             :     // will be set when UI theme was changed
     132             :     static  bool        bThemeChanged;
     133             :     static  bool        bNeedPixmapPaint;
     134             : 
     135             :     // native widget methods
     136             :     virtual bool        IsNativeControlSupported( ControlType nType, ControlPart nPart ) SAL_OVERRIDE;
     137             :     virtual bool        hitTestNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
     138             :                                               const Point& aPos, bool& rIsInside ) SAL_OVERRIDE;
     139             :     virtual bool        drawNativeControl( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion,
     140             :                                            ControlState nState, const ImplControlValue& aValue,
     141             :                                            const OUString& rCaption ) SAL_OVERRIDE;
     142             :     virtual bool        getNativeControlRegion( ControlType nType, ControlPart nPart, const Rectangle& rControlRegion, ControlState nState,
     143             :                                                 const ImplControlValue& aValue, const OUString& rCaption,
     144             :                                                 Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion ) SAL_OVERRIDE;
     145             : 
     146             :     //helper methods for frame's UpdateSettings
     147             :     void updateSettings( AllSettings& rSettings );
     148             :     static void refreshFontconfig( GtkSettings *pSettings );
     149             :     static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
     150             : 
     151             :     virtual bool            setClipRegion( const Region& ) SAL_OVERRIDE;
     152             :     virtual void            ResetClipRegion() SAL_OVERRIDE;
     153             : 
     154             :     // some themes set the background pixmap of our window EVERY time
     155             :     // a control is painted; but presentation effects need
     156             :     // the background set to None; workaround: set the background
     157             :     // before copyBits
     158             :     virtual void            copyBits( const SalTwoRect& rPosAry,
     159             :                                       SalGraphics* pSrcGraphics ) SAL_OVERRIDE;
     160             : 
     161             : protected:
     162             :     typedef std::list< Rectangle > clipList;
     163             : 
     164             :     GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect );
     165             :     bool NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect );
     166             : 
     167             :     bool NWPaintGTKArrow( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     168             :                            const Rectangle& rControlRectangle,
     169             :                            const clipList& rClipList,
     170             :                            ControlState nState, const ImplControlValue& aValue,
     171             :                            const OUString& rCaption );
     172             :     bool NWPaintGTKListHeader( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     173             :                            const Rectangle& rControlRectangle,
     174             :                            const clipList& rClipList,
     175             :                            ControlState nState, const ImplControlValue& aValue,
     176             :                            const OUString& rCaption );
     177             :     bool NWPaintGTKFixedLine( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     178             :                            const Rectangle& rControlRectangle,
     179             :                            const clipList& rClipList,
     180             :                            ControlState nState, const ImplControlValue& aValue,
     181             :                            const OUString& rCaption );
     182             :     bool NWPaintGTKFrame( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     183             :                            const Rectangle& rControlRectangle,
     184             :                            const clipList& rClipList,
     185             :                            ControlState nState, const ImplControlValue& aValue,
     186             :                            const OUString& rCaption );
     187             :     bool NWPaintGTKWindowBackground( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     188             :                            const Rectangle& rControlRectangle,
     189             :                            const clipList& rClipList,
     190             :                            ControlState nState, const ImplControlValue& aValue,
     191             :                            const OUString& rCaption );
     192             :     bool NWPaintGTKButtonReal( GtkWidget* button, GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     193             :                            const Rectangle& rControlRectangle,
     194             :                            const clipList& rClipList,
     195             :                            ControlState nState, const ImplControlValue& aValue,
     196             :                            const OUString& rCaption );
     197             :     bool NWPaintGTKButton( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     198             :                            const Rectangle& rControlRectangle,
     199             :                            const clipList& rClipList,
     200             :                            ControlState nState, const ImplControlValue& aValue,
     201             :                            const OUString& rCaption );
     202             :     bool NWPaintGTKRadio( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     203             :                           const Rectangle& rControlRectangle,
     204             :                           const clipList& rClipList,
     205             :                           ControlState nState, const ImplControlValue& aValue,
     206             :                           const OUString& rCaption );
     207             :     bool NWPaintGTKCheck( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     208             :                           const Rectangle& rControlRectangle,
     209             :                           const clipList& rClipList,
     210             :                           ControlState nState, const ImplControlValue& aValue,
     211             :                           const OUString& rCaption );
     212             :     bool NWPaintGTKScrollbar( ControlType nType, ControlPart nPart,
     213             :                               const Rectangle& rControlRectangle,
     214             :                               const clipList& rClipList,
     215             :                               ControlState nState, const ImplControlValue& aValue,
     216             :                               const OUString& rCaption );
     217             :     bool NWPaintGTKEditBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     218             :                             const Rectangle& rControlRectangle,
     219             :                             const clipList& rClipList,
     220             :                             ControlState nState, const ImplControlValue& aValue,
     221             :                             const OUString& rCaption );
     222             :     bool NWPaintGTKSpinBox( ControlType nType, ControlPart nPart,
     223             :                             const Rectangle& rControlRectangle,
     224             :                             const clipList& rClipList,
     225             :                             ControlState nState, const ImplControlValue& aValue,
     226             :                             const OUString& rCaption );
     227             :     bool NWPaintGTKComboBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     228             :                              const Rectangle& rControlRectangle,
     229             :                              const clipList& rClipList,
     230             :                              ControlState nState, const ImplControlValue& aValue,
     231             :                              const OUString& rCaption );
     232             :     bool NWPaintGTKTabItem( ControlType nType, ControlPart nPart,
     233             :                             const Rectangle& rControlRectangle,
     234             :                             const clipList& rClipList,
     235             :                             ControlState nState, const ImplControlValue& aValue,
     236             :                             const OUString& rCaption );
     237             :     bool NWPaintGTKListBox( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     238             :                             const Rectangle& rControlRectangle,
     239             :                             const clipList& rClipList,
     240             :                             ControlState nState, const ImplControlValue& aValue,
     241             :                             const OUString& rCaption );
     242             : 
     243             :     bool NWPaintGTKToolbar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     244             :                             const Rectangle& rControlRectangle,
     245             :                             const clipList& rClipList,
     246             :                             ControlState nState, const ImplControlValue& aValue,
     247             :                             const OUString& rCaption );
     248             :     bool NWPaintGTKMenubar( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     249             :                             const Rectangle& rControlRectangle,
     250             :                             const clipList& rClipList,
     251             :                             ControlState nState, const ImplControlValue& aValue,
     252             :                             const OUString& rCaption );
     253             :     bool NWPaintGTKPopupMenu( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     254             :                               const Rectangle& rControlRectangle,
     255             :                               const clipList& rClipList,
     256             :                               ControlState nState, const ImplControlValue& aValue,
     257             :                               const OUString& rCaption );
     258             :     bool NWPaintGTKTooltip( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     259             :                             const Rectangle& rControlRectangle,
     260             :                             const clipList& rClipList,
     261             :                             ControlState nState, const ImplControlValue& aValue,
     262             :                             const OUString& rCaption );
     263             :     bool NWPaintGTKProgress( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     264             :                             const Rectangle& rControlRectangle,
     265             :                             const clipList& rClipList,
     266             :                             ControlState nState, const ImplControlValue& aValue,
     267             :                             const OUString& rCaption );
     268             :     bool NWPaintGTKSlider( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     269             :                            const Rectangle& rControlRectangle,
     270             :                            const clipList& rClipList,
     271             :                            ControlState nState, const ImplControlValue& aValue,
     272             :                            const OUString& rCaption );
     273             :     bool NWPaintGTKListNode( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
     274             :                             const Rectangle& rControlRectangle,
     275             :                             const clipList& rClipList,
     276             :                             ControlState nState, const ImplControlValue& aValue,
     277             :                             const OUString& rCaption );
     278             : };
     279             : 
     280             : #endif // !gtk3
     281             : 
     282             : #endif // INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
     283             : 
     284             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10