xref: /trunk/main/vcl/inc/salmenu.hxx (revision 161f4cd1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_SALMENU_HXX
25 #define _SV_SALMENU_HXX
26 
27 #include <vcl/sv.h>
28 #include "vcl/dllapi.h"
29 #include <vcl/menu.hxx>
30 #include <vcl/keycod.hxx>
31 #include <vcl/image.hxx>
32 
33 struct SystemMenuData;
34 class FloatingWindow;
35 class SalFrame;
36 
37 struct SalItemParams
38 {
39     sal_uInt16          nId;					// item Id
40     MenuItemType    eType;					// MenuItem-Type
41     MenuItemBits    nBits;					// MenuItem-Bits
42     Menu*           pMenu;				    // Pointer to Menu
43     XubString       aText;					// Menu-Text
44     Image           aImage;					// Image
45 };
46 
47 
48 struct SalMenuButtonItem
49 {
50     sal_uInt16              mnId;
51     Image               maImage;
52     rtl::OUString       maToolTipText;
53 
SalMenuButtonItemSalMenuButtonItem54     SalMenuButtonItem() : mnId( 0 ) {}
SalMenuButtonItemSalMenuButtonItem55     SalMenuButtonItem( sal_uInt16 i_nId, const Image& rImg, const rtl::OUString& i_rTTText = rtl::OUString() )
56     : mnId( i_nId ), maImage( rImg ), maToolTipText( i_rTTText ) {}
57 };
58 
59 class VCL_PLUGIN_PUBLIC SalMenuItem
60 {
61 public:
SalMenuItem()62     SalMenuItem() {}
63     virtual ~SalMenuItem();
64 };
65 
66 class VCL_PLUGIN_PUBLIC SalMenu
67 {
68 public:
SalMenu()69     SalMenu() {}
70     virtual ~SalMenu();
71 
72     virtual sal_Bool VisibleMenuBar() = 0;  // must return sal_True to actually DISPLAY native menu bars
73                             // otherwise only menu messages are processed (eg, OLE on Windows)
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 CheckItem( unsigned nPos, sal_Bool bCheck ) = 0;
80     virtual void EnableItem( unsigned nPos, sal_Bool bEnable ) = 0;
81     virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const XubString& rText )= 0;
82     virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0;
83     virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const KeyCode& rKeyCode, const XubString& rKeyName ) = 0;
84     virtual void GetSystemMenuData( SystemMenuData* pData ) = 0;
85 	virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const Rectangle& rRect, sal_uLong nFlags);
86     virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure
87     virtual void RemoveMenuBarButton( sal_uInt16 nId );
88 
89     // return an empty rectangle if not implemented
90     // return Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) if menu bar buttons implemented
91     // but rectangle cannot be determined
92     virtual Rectangle GetMenuBarButtonRectPixel( sal_uInt16 i_nItemId, SalFrame* i_pReferenceFrame );
93 };
94 
95 
96 #endif // _SV_SALMENU_HXX
97 
98