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 <utility>
24#include <vcl/menu.hxx>
25#include <vcl/image.hxx>
26
27struct SystemMenuData;
28class FloatingWindow;
29class SalFrame;
30
32{
33 Image aImage; // Image
34 VclPtr<Menu> pMenu; // Pointer to Menu
35 OUString aText; // Menu-Text
36 MenuItemType eType; // MenuItem-Type
37 sal_uInt16 nId; // item Id
38 MenuItemBits nBits; // MenuItem-Bits
39};
40
42{
43 sal_uInt16 mnId;
45 OUString maToolTipText;
46
48 SalMenuButtonItem( sal_uInt16 i_nId, Image aImg, OUString i_TTText )
49 : mnId( i_nId ), maImage(std::move( aImg )), maToolTipText(std::move( i_TTText )) {}
50};
51
53{
54public:
55 virtual ~SalMenuItem();
56};
57
59{
60public:
61 virtual ~SalMenu();
62
69 virtual bool HasNativeMenuBar() = 0;
71 virtual int GetMenuBarHeight() const;
73 virtual void ShowMenuBar(bool);
74
75 virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) = 0;
76 virtual void RemoveItem( unsigned nPos ) = 0;
77 virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) = 0;
78 virtual void SetFrame( const SalFrame* pFrame ) = 0;
79 virtual void SetItemBits( unsigned /*nPos*/, MenuItemBits /*nBits*/ ) {}
80 virtual void CheckItem( unsigned nPos, bool bCheck ) = 0;
81 virtual void EnableItem( unsigned nPos, bool bEnable ) = 0;
82 virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText )= 0;
83 virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0;
84 virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) = 0;
85 virtual void GetSystemMenuData( SystemMenuData* pData ) = 0;
86 virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags);
87 virtual void ShowCloseButton(bool bShow);
88 virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure
89 virtual void RemoveMenuBarButton( sal_uInt16 nId );
90 virtual void Update() {}
91
92 virtual bool CanGetFocus() const { return false; }
93 virtual bool TakeFocus() { return false; }
94
95 // TODO: implement show/hide for the Win/Mac VCL native backends
96 virtual void ShowItem( unsigned nPos, bool bShow ) { EnableItem( nPos, bShow ); }
97
98 // return an empty rectangle if not implemented
99 // return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) if menu bar buttons implemented
100 // but rectangle cannot be determined
101 virtual tools::Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame );
102
103 virtual void ApplyPersona();
104};
105
106#endif // INCLUDED_VCL_INC_SALMENU_HXX
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: image.hxx:40
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
virtual void SetAccelerator(unsigned nPos, SalMenuItem *pSalMenuItem, const vcl::KeyCode &rKeyCode, const OUString &rKeyName)=0
virtual void GetSystemMenuData(SystemMenuData *pData)=0
virtual void SetSubMenu(SalMenuItem *pSalMenuItem, SalMenu *pSubMenu, unsigned nPos)=0
virtual void SetItemBits(unsigned, MenuItemBits)
Definition: salmenu.hxx:79
virtual bool CanGetFocus() const
Definition: salmenu.hxx:92
virtual bool TakeFocus()
Definition: salmenu.hxx:93
virtual void EnableItem(unsigned nPos, bool bEnable)=0
virtual void RemoveItem(unsigned nPos)=0
virtual void ShowItem(unsigned nPos, bool bShow)
Definition: salmenu.hxx:96
virtual void InsertItem(SalMenuItem *pSalMenuItem, unsigned nPos)=0
virtual void Update()
Definition: salmenu.hxx:90
virtual void SetItemText(unsigned nPos, SalMenuItem *pSalMenuItem, const OUString &rText)=0
virtual void SetFrame(const SalFrame *pFrame)=0
virtual void SetItemImage(unsigned nPos, SalMenuItem *pSalMenuItem, const Image &rImage)=0
virtual void CheckItem(unsigned nPos, bool bCheck)=0
virtual bool HasNativeMenuBar()=0
Return true, if the implementation supports a native menu bar (or wants to suppress LO's menu bar,...
#define VCL_PLUGIN_PUBLIC
Definition: dllapi.h:40
sal_uInt16 nPos
VclPtr< Menu > pMenu
Definition: salmenu.hxx:34
MenuItemBits nBits
Definition: salmenu.hxx:38
MenuItemType eType
Definition: salmenu.hxx:36
sal_uInt16 nId
Definition: salmenu.hxx:37
OUString aText
Definition: salmenu.hxx:35
Image aImage
Definition: salmenu.hxx:33
SalMenuButtonItem(sal_uInt16 i_nId, Image aImg, OUString i_TTText)
Definition: salmenu.hxx:48
OUString maToolTipText
Definition: salmenu.hxx:45
sal_uInt16 mnId
Definition: salmenu.hxx:43
MenuItemType
Definition: vclenum.hxx:30
MenuItemBits
Definition: vclenum.hxx:33
FloatWinPopupFlags
Definition: vclenum.hxx:330