Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / inc / win / salmenu.h
blob7058d9c82b8a4ed4f429a684b1e50f148efe3615
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INC_WIN_SALMENU_H
21 #define INCLUDED_VCL_INC_WIN_SALMENU_H
23 #include <vcl/bitmap.hxx>
24 #include <salmenu.hxx>
26 class WinSalMenu : public SalMenu
28 public:
29 WinSalMenu();
30 virtual ~WinSalMenu() override;
31 virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars
32 // otherwise only menu messages are processed (eg, OLE on Windows)
34 virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) override;
35 virtual void RemoveItem( unsigned nPos ) override;
36 virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) override;
37 virtual void SetFrame( const SalFrame* pFrame ) override;
38 virtual void CheckItem( unsigned nPos, bool bCheck ) override;
39 virtual void EnableItem( unsigned nPos, bool bEnable ) override;
40 virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override;
41 virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) override;
42 virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override;
43 virtual void GetSystemMenuData( SystemMenuData* pData ) override;
45 HMENU mhMenu; // the menu handle
46 bool mbMenuBar; // true for menu bars
47 HWND mhWnd; // the window handle where the menubar is attached, may be NULL
48 WinSalMenu *mpParentMenu; // the parent menu
51 class WinSalMenuItem : public SalMenuItem
53 public:
54 WinSalMenuItem();
55 virtual ~WinSalMenuItem() override;
57 MENUITEMINFOW mInfo;
58 void* mpMenu; // pointer to corresponding VCL menu
59 OUString mText; // the item text
60 OUString mAccelText; // the accelerator string
61 Bitmap maBitmap; // item image
62 int mnId; // item id
63 WinSalMenu* mpSalMenu; // the menu where this item is inserted
66 #endif // INCLUDED_VCL_INC_WIN_SALMENU_H
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */