LibreOffice Module vcl (master)  1
salmenu.hxx
Go to the documentation of this file.
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_SALMENU_HXX
21 #define INCLUDED_VCL_INC_SALMENU_HXX
22 
23 #include <vcl/menu.hxx>
24 #include <vcl/image.hxx>
25 
26 struct SystemMenuData;
27 class FloatingWindow;
28 class SalFrame;
29 
31 {
32  Image aImage; // Image
33  VclPtr<Menu> pMenu; // Pointer to Menu
34  OUString aText; // Menu-Text
35  MenuItemType eType; // MenuItem-Type
36  sal_uInt16 nId; // item Id
37  MenuItemBits nBits; // MenuItem-Bits
38 };
39 
41 {
42  sal_uInt16 mnId;
44  OUString maToolTipText;
45 
46  SalMenuButtonItem() : mnId( 0 ) {}
47  SalMenuButtonItem( sal_uInt16 i_nId, const Image& rImg, const OUString& i_rTTText )
48  : mnId( i_nId ), maImage( rImg ), maToolTipText( i_rTTText ) {}
49 };
50 
52 {
53 public:
55  virtual ~SalMenuItem();
56 };
57 
59 {
60 public:
61  SalMenu() {}
62  virtual ~SalMenu();
63 
64  virtual bool VisibleMenuBar() = 0; // must return true to actually DISPLAY native menu bars
65  // otherwise only menu messages are processed (eg, OLE on Windows)
66  virtual void ShowMenuBar( bool ) {}
67  virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) = 0;
68  virtual void RemoveItem( unsigned nPos ) = 0;
69  virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) = 0;
70  virtual void SetFrame( const SalFrame* pFrame ) = 0;
71  virtual void SetItemBits( unsigned /*nPos*/, MenuItemBits /*nBits*/ ) {}
72  virtual void CheckItem( unsigned nPos, bool bCheck ) = 0;
73  virtual void EnableItem( unsigned nPos, bool bEnable ) = 0;
74  virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText )= 0;
75  virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0;
76  virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) = 0;
77  virtual void GetSystemMenuData( SystemMenuData* pData ) = 0;
78  virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags);
79  virtual void ShowCloseButton(bool bShow);
80  virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure
81  virtual void RemoveMenuBarButton( sal_uInt16 nId );
82  virtual void Update() {}
83 
84  virtual bool CanGetFocus() const { return false; }
85  virtual bool TakeFocus() { return false; }
86 
87  // TODO: implement show/hide for the Win/Mac VCL native backends
88  virtual void ShowItem( unsigned nPos, bool bShow ) { EnableItem( nPos, bShow ); }
89 
90  // return an empty rectangle if not implemented
91  // return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) if menu bar buttons implemented
92  // but rectangle cannot be determined
93  virtual tools::Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame );
94 
95  virtual int GetMenuBarHeight() const;
96 
97  virtual void ApplyPersona();
98 };
99 
100 #endif // INCLUDED_VCL_INC_SALMENU_HXX
101 
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString aText
Definition: salmenu.hxx:34
MenuItemType
Definition: vclenum.hxx:30
virtual void ShowItem(unsigned nPos, bool bShow)
Definition: salmenu.hxx:88
MenuItemBits nBits
Definition: salmenu.hxx:37
MenuItemBits
Definition: vclenum.hxx:32
sal_uInt16 nId
Definition: salmenu.hxx:36
virtual bool TakeFocus()
Definition: salmenu.hxx:85
virtual void Update()
Definition: salmenu.hxx:82
MenuItemType eType
Definition: salmenu.hxx:35
virtual bool CanGetFocus() const
Definition: salmenu.hxx:84
SalMenu()
Definition: salmenu.hxx:61
OUString maToolTipText
Definition: salmenu.hxx:44
virtual void ShowMenuBar(bool)
Definition: salmenu.hxx:66
SalMenuButtonItem(sal_uInt16 i_nId, const Image &rImg, const OUString &i_rTTText)
Definition: salmenu.hxx:47
FloatWinPopupFlags
Definition: floatwin.hxx:31
virtual void SetItemBits(unsigned, MenuItemBits)
Definition: salmenu.hxx:71
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
VclPtr< Menu > pMenu
Definition: salmenu.hxx:33
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:112
Image aImage
Definition: salmenu.hxx:32
Definition: image.hxx:40
sal_uInt16 mnId
Definition: salmenu.hxx:42