update emoji autocorrect entries from po-files
[LibreOffice.git] / vcl / inc / unx / gtk / gtksalmenu.hxx
blobe74de22f3de32bf6e34917e6fec193ff2b66b2d3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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 */
10 #ifndef INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX
11 #define INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX
13 #include <vector>
14 #ifdef ENABLE_GIO
15 #include <gio/gio.h>
16 #endif
18 #include <unx/salmenu.h>
19 #include <unx/gtk/gtkframe.hxx>
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
35 class MenuItemList;
36 class GtkSalMenuItem;
38 class GtkSalMenu : public SalMenu
40 private:
41 std::vector< GtkSalMenuItem* > maItems;
43 bool mbMenuBar;
44 Menu* mpVCLMenu;
45 GtkSalMenu* mpParentSalMenu;
46 const GtkSalFrame* mpFrame;
48 // GMenuModel and GActionGroup attributes
49 GMenuModel* mpMenuModel;
50 GActionGroup* mpActionGroup;
52 GtkSalMenu* GetMenuForItemCommand( gchar* aCommand, gboolean bGetSubmenu );
53 void ImplUpdate( gboolean bRecurse );
54 void ActivateAllSubmenus(MenuBar* pMenuBar);
56 public:
57 GtkSalMenu( bool bMenuBar );
58 virtual ~GtkSalMenu();
60 virtual bool VisibleMenuBar() SAL_OVERRIDE; // must return TRUE to actually DISPLAY native menu bars
61 // otherwise only menu messages are processed (eg, OLE on Windows)
63 virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) SAL_OVERRIDE;
64 virtual void RemoveItem( unsigned nPos ) SAL_OVERRIDE;
65 virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) SAL_OVERRIDE;
66 virtual void SetFrame( const SalFrame* pFrame ) SAL_OVERRIDE;
67 const GtkSalFrame* GetFrame() const;
68 virtual void CheckItem( unsigned nPos, bool bCheck ) SAL_OVERRIDE;
69 virtual void EnableItem( unsigned nPos, bool bEnable ) SAL_OVERRIDE;
70 virtual void ShowItem( unsigned nPos, bool bShow ) SAL_OVERRIDE;
71 virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) SAL_OVERRIDE;
72 virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) SAL_OVERRIDE;
73 virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) SAL_OVERRIDE;
74 virtual void GetSystemMenuData( SystemMenuData* pData ) SAL_OVERRIDE;
76 void SetMenu( Menu* pMenu ) { mpVCLMenu = pMenu; }
77 Menu* GetMenu() { return mpVCLMenu; }
78 GtkSalMenu* GetParentSalMenu() { return mpParentSalMenu; }
79 void SetMenuModel( GMenuModel* pMenuModel ) { mpMenuModel = pMenuModel; }
80 GMenuModel* GetMenuModel() { return mpMenuModel; }
81 unsigned GetItemCount() { return maItems.size(); }
82 GtkSalMenuItem* GetItemAtPos( unsigned nPos ) { return maItems[ nPos ]; }
83 void SetActionGroup( GActionGroup* pActionGroup ) { mpActionGroup = pActionGroup; }
84 GActionGroup* GetActionGroup() { return mpActionGroup; }
85 bool IsItemVisible( unsigned nPos );
87 void NativeSetItemText( unsigned nSection, unsigned nItemPos, const OUString& rText );
88 void NativeSetItemCommand( unsigned nSection,
89 unsigned nItemPos,
90 sal_uInt16 nId,
91 const gchar* aCommand,
92 MenuItemBits nBits,
93 gboolean bChecked,
94 gboolean bIsSubmenu );
95 void NativeSetEnableItem( gchar* aCommand, gboolean bEnable );
96 void NativeCheckItem( unsigned nSection, unsigned nItemPos, MenuItemBits bits, gboolean bCheck );
97 void NativeSetAccelerator( unsigned nSection, unsigned nItemPos, const vcl::KeyCode& rKeyCode, const OUString& rKeyName );
99 void DispatchCommand( gint itemId, const gchar* aCommand );
100 void Activate();
101 void Deactivate( const gchar* aMenuCommand );
102 void Display( bool bVisible );
103 bool PrepUpdate();
104 void Update(); // Update this menu only.
105 void UpdateFull(); // Update full menu hierarchy from this menu.
108 class GtkSalMenuItem : public SalMenuItem
110 public:
111 GtkSalMenuItem( const SalItemParams* );
112 virtual ~GtkSalMenuItem();
114 sal_uInt16 mnId; // Item ID
115 MenuItemType mnType; // Item type
116 bool mbVisible; // Item visibility.
117 Menu* mpVCLMenu; // VCL Menu into which this menu item is inserted
118 GtkSalMenu* mpParentMenu; // The menu into which this menu item is inserted
119 GtkSalMenu* mpSubMenu; // Submenu of this item (if defined)
122 #endif // INCLUDED_VCL_INC_UNX_GTK_GTKSALMENU_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */