LCOV - code coverage report
Current view: top level - vcl/inc/unx/gtk - gtksalmenu.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 9 0.0 %
Date: 2014-11-03 Functions: 0 9 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             : 
      10             : #ifndef INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX
      11             : #define INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX
      12             : 
      13             : #include <vector>
      14             : #ifdef ENABLE_GIO
      15             : #include <gio/gio.h>
      16             : #endif
      17             : 
      18             : #include <unx/salmenu.h>
      19             : #include <unx/gtk/gtkframe.hxx>
      20             : 
      21             : #if defined(ENABLE_DBUS) && defined(ENABLE_GIO) && \
      22             :     (GLIB_MAJOR_VERSION > 2 || GLIB_MINOR_VERSION >= 36)
      23             : #  define ENABLE_GMENU_INTEGRATION
      24             : #  include <unx/gtk/glomenu.h>
      25             : #  include <unx/gtk/gloactiongroup.h>
      26             : #else
      27             : #  if !(GLIB_MAJOR_VERSION > 2 || GLIB_MINOR_VERSION >= 32)
      28             :      typedef void GMenuModel;
      29             : #  endif
      30             : #  if !(GLIB_MAJOR_VERSION > 2 || GLIB_MINOR_VERSION >= 28)
      31             :      typedef void GActionGroup;
      32             : #  endif
      33             : #endif
      34             : 
      35             : class MenuItemList;
      36             : class GtkSalMenuItem;
      37             : 
      38             : class GtkSalMenu : public SalMenu
      39             : {
      40             : private:
      41             :     std::vector< GtkSalMenuItem* >  maItems;
      42             : 
      43             :     bool                        mbMenuBar;
      44             :     Menu*                           mpVCLMenu;
      45             :     GtkSalMenu*                     mpOldSalMenu;
      46             :     GtkSalMenu*                     mpParentSalMenu;
      47             :     const GtkSalFrame*              mpFrame;
      48             : 
      49             :     // GMenuModel and GActionGroup attributes
      50             :     GMenuModel*                     mpMenuModel;
      51             :     GActionGroup*                   mpActionGroup;
      52             : 
      53             :     GtkSalMenu*                 GetMenuForItemCommand( gchar* aCommand, gboolean bGetSubmenu );
      54             :     void                        ImplUpdate( gboolean bRecurse );
      55             :     void                        ActivateAllSubmenus(MenuBar* pMenuBar);
      56             : 
      57             : public:
      58             :     GtkSalMenu( bool bMenuBar );
      59             :     virtual ~GtkSalMenu();
      60             : 
      61             :     virtual bool            VisibleMenuBar() SAL_OVERRIDE;   // must return TRUE to actually DISPLAY native menu bars
      62             :                                                     // otherwise only menu messages are processed (eg, OLE on Windows)
      63             : 
      64             :     virtual void                InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) SAL_OVERRIDE;
      65             :     virtual void                RemoveItem( unsigned nPos ) SAL_OVERRIDE;
      66             :     virtual void                SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) SAL_OVERRIDE;
      67             :     virtual void                SetFrame( const SalFrame* pFrame ) SAL_OVERRIDE;
      68             :     virtual const GtkSalFrame*  GetFrame() const;
      69             :     virtual void                CheckItem( unsigned nPos, bool bCheck ) SAL_OVERRIDE;
      70             :     virtual void                EnableItem( unsigned nPos, bool bEnable ) SAL_OVERRIDE;
      71             :     virtual void                ShowItem( unsigned nPos, bool bShow ) SAL_OVERRIDE;
      72             :     virtual void                SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) SAL_OVERRIDE;
      73             :     virtual void                SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) SAL_OVERRIDE;
      74             :     virtual void                SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) SAL_OVERRIDE;
      75             :     virtual void                GetSystemMenuData( SystemMenuData* pData ) SAL_OVERRIDE;
      76             : 
      77           0 :     virtual void                SetMenu( Menu* pMenu ) { mpVCLMenu = pMenu; }
      78           0 :     virtual Menu*               GetMenu() { return mpVCLMenu; }
      79           0 :     virtual GtkSalMenu*         GetParentSalMenu() { return mpParentSalMenu; }
      80           0 :     virtual void                SetMenuModel( GMenuModel* pMenuModel ) { mpMenuModel = pMenuModel; }
      81           0 :     virtual GMenuModel*         GetMenuModel() { return mpMenuModel; }
      82           0 :     virtual unsigned            GetItemCount() { return maItems.size(); }
      83           0 :     virtual GtkSalMenuItem*     GetItemAtPos( unsigned nPos ) { return maItems[ nPos ]; }
      84           0 :     virtual void                SetActionGroup( GActionGroup* pActionGroup ) { mpActionGroup = pActionGroup; }
      85           0 :     virtual GActionGroup*       GetActionGroup() { return mpActionGroup; }
      86             :     virtual bool            IsItemVisible( unsigned nPos );
      87             : 
      88             :     void                        NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString& rText );
      89             :     void                        NativeSetItemCommand( unsigned nSection,
      90             :                                                       unsigned nItemPos,
      91             :                                                       sal_uInt16 nId,
      92             :                                                       const gchar* aCommand,
      93             :                                                       MenuItemBits nBits,
      94             :                                                       gboolean bChecked,
      95             :                                                       gboolean bIsSubmenu );
      96             :     void                        NativeSetEnableItem( gchar* aCommand, gboolean bEnable );
      97             :     void                        NativeCheckItem( unsigned nSection, unsigned nItemPos, MenuItemBits bits, gboolean bCheck );
      98             :     void                        NativeSetAccelerator( unsigned nSection, unsigned nItemPos, const vcl::KeyCode& rKeyCode, const OUString& rKeyName );
      99             : 
     100             :     void                        DispatchCommand( gint itemId, const gchar* aCommand );
     101             :     void                        Activate();
     102             :     void                        Deactivate( const gchar* aMenuCommand );
     103             :     void                        Display( bool bVisible );
     104             :     bool                        PrepUpdate();
     105             :     void                        Update();           // Update this menu only.
     106             :     void                        UpdateFull();       // Update full menu hierarchy from this menu.
     107             : };
     108             : 
     109             : class GtkSalMenuItem : public SalMenuItem
     110             : {
     111             : public:
     112             :     GtkSalMenuItem( const SalItemParams* );
     113             :     virtual ~GtkSalMenuItem();
     114             : 
     115             :     sal_uInt16          mnId;               // Item ID
     116             :     MenuItemType        mnType;             // Item type
     117             :     bool            mbVisible;          // Item visibility.
     118             :     Menu*               mpVCLMenu;          // VCL Menu into which this menu item is inserted
     119             :     GtkSalMenu*         mpParentMenu;       // The menu into which this menu item is inserted
     120             :     GtkSalMenu*         mpSubMenu;          // Submenu of this item (if defined)
     121             : };
     122             : 
     123             : #endif // INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX
     124             : 
     125             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10