menuBar.h
Engine/source/platform/menus/menuBar.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "console/simBase.h" 25 26#ifndef _MENUBAR_H_ 27#define _MENUBAR_H_ 28 29// Forward Refs 30class PlatformMenuBarData; 31class PopupMenu; 32class GuiCanvas; 33 34class MenuBar : public SimSet 35{ 36 typedef SimSet Parent; 37 38protected: 39 PlatformMenuBarData *mData; 40 GuiCanvas *mCanvas; 41 42 /// Update the native menu bar to ensure consistency with the set 43 void updateMenuBar(PopupMenu *menu = NULL); 44 45 void createPlatformPopupMenuData(); 46 void deletePlatformPopupMenuData(); 47 48public: 49 MenuBar(); 50 virtual ~MenuBar(); 51 DECLARE_CONOBJECT(MenuBar); 52 53 /// Attach this menu bar to the native menu bar 54 void attachToCanvas(GuiCanvas *owner, S32 pos); 55 /// Remove this menu bar from the native menu bar 56 void removeFromCanvas(); 57 58 /// Returns true if this menu is attached to the menu bar 59 bool isAttachedToCanvas() { return mCanvas != NULL; } 60 61 virtual void insertObject(SimObject *obj, S32 pos); 62 63 // Overridden SimSet methods to ensure menu bar consistency when attached 64 virtual void addObject(SimObject *obj); 65 virtual void removeObject(SimObject *obj); 66 virtual void pushObject(SimObject *obj); 67 virtual void popObject(); 68 69 virtual bool reOrder(SimObject *obj, SimObject *target = 0); 70}; 71 72#endif // _MENUBAR_H_ 73
