A clickable item in a MenuStrip or item in a sub-menu.
Наследование: TextDisplay
Пример #1
0
        public MenuItem AddItem(string displayText)
        {
            MenuItem menuItem = new MenuItem();
            this.AddWindow(menuItem);
            menuItem.Text = displayText;
            mMenus.Add(menuItem);

            // Make sure to update AFTER it's added
            UpdateMenuItemPositions();

            return menuItem;
        }
Пример #2
0
 public MenuItem Insert(int index, string displayText)
 {
     MenuItem menuItem = new MenuItem(displayText);
     mMenuItems.Insert(index, menuItem);
     return menuItem;
 }
Пример #3
0
 public MenuItem AddItem(string displayText)
 {
     MenuItem menuItem = new MenuItem(displayText);
     mMenuItems.Add(menuItem);
     return menuItem;
 }
Пример #4
0
        public Menu()
            : base(GuiManager.Cursor)
        {
            GuiManager.AddWindow(this);

            #region File

            MenuItem item = AddItem("File");

            item.AddItem("New").Click += PromptNew;
            item.AddItem("---------------");
            item.AddItem("Load Polygon List").Click += OpenFileWindowLoadPolygonList;
            item.AddItem("Load Shape Collection").Click += OpenFileWindowLoadShapeList;
            item.AddItem("Load Scene").Click += OpenFileWindowLoadScene;
            item.AddItem("---------------");
            item.AddItem("Save Polygon List").Click += OpenFileWindowSavePolygonList;
            item.AddItem("Save Shape Collection").Click += OpenFileWindowSaveShapeList;
            item.AddItem("Save Scene").Click += SaveSceneClick;
            #endregion

            #region Add
            item = AddItem("Add");

            item.AddItem("AxisAlignedRectangle").Click += AddAxisAlignedRectangle;
            item.AddItem("AxisAlignedCube").Click += AddAxisAlignedCube;
            item.AddItem("Capsule2D").Click += AddCapsule2D;
            item.AddItem("Circle").Click += AddCircle;
            item.AddItem("Polygon (Rectangle)").Click += AddRectanglePolygon;
            item.AddItem("Sphere").Click += AddSphere;
            #endregion

            #region Action
            item = AddItem("Action");
            item.AddItem("Scale All Polygons").Click += ScaleAllPolygons;

            mFlipHorizontally = item.AddItem("Flip Polygon Horizontally");
            mFlipHorizontally.Click += FlipHorizontallyClick;

            mFlipVertically = item.AddItem("Flip Polygon Vertically");
            mFlipVertically.Click += FlipVerticallyClick;

            item.AddItem("Unload Scene").Click += UnloadScene;
            #endregion

            #region Window
            item = AddItem("Window");
            item.AddItem("Editor Properties").Click += ShowEditorPropertiesWindow;
            item.AddItem("Line Grid Properties").Click += ShowLineGridProperties;
            item.AddItem("Bounds Properties").Click += ShowSceneCameraProperties;
            item.AddItem("Camera Properties").Click += ShowEditorCameraProperties;
            item.AddItem("Show Scene Properties").Click += ShowSceneProperties;
            item.AddItem("Show ShapeCollection Properties").Click += ShowShapeCollectionProperties;

            #endregion
        }