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