protected override void InitCommandBars() { base.InitCommandBars(); NCommand comm, comm1, comm2; NMenuBar bar = nCommandBarsManager1.Toolbars.GetMenu(); comm = new NCommand(); comm.Properties.Text = "Per&sistency"; bar.Commands.Insert(0, comm); comm1 = new NCommand(); comm1.Properties.Text = "&Save..."; comm1.Properties.ID = 0; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.Text = "&Load..."; comm1.Properties.ID = 1; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.BeginGroup = true; comm1.Properties.Text = "Format"; comm.Commands.Add(comm1); foreach (PersistencyFormat format in Enum.GetValues(typeof(PersistencyFormat))) { comm2 = new NCommand(); comm2.Properties.Tag = format; comm2.Properties.ID = 2; comm2.Properties.Text = format.ToString(); comm1.Commands.Add(comm2); } }
/// <summary> /// Default constructor. /// </summary> public NExampleHost() { // Create the main menu NMenuBar mainMenu = CreateMainMenu(); Add(mainMenu, ENDockArea.Top); // Create the example toolbar m_Toolbar = CreateToolbar(); Add(m_Toolbar, ENDockArea.Top); // Create the status bar NStatusBar statusBar = new NStatusBar(); m_StatusLabel = new NLabel(); statusBar.Items.Add(m_StatusLabel); Add(statusBar, ENDockArea.Bottom); // Create the example splitter and tree view m_Splitter = new NSplitter(); m_Splitter.SplitMode = ENSplitterSplitMode.OffsetFromNearSide; m_Splitter.SplitOffset = TreeViewPaneWidth; Add(m_Splitter, ENDockArea.Center); m_TreeView = new NTreeView(); m_TreeView.SelectedPathChanged += OnTreeViewSelectedPathChanged; m_Splitter.Pane1.Content = m_TreeView; }
protected override void InitCommandBars() { base.InitCommandBars(); NCommand comm, comm1; NMenuBar bar = nCommandBarsManager1.Toolbars.GetMenu(); comm = new NCommand(); comm.Properties.Text = "Document"; bar.Commands.Add(comm); comm1 = new NCommand(); comm1.Properties.Text = "&New Document"; comm1.Properties.ID = 0; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.Text = "&Close Document"; comm1.Properties.ID = 1; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.Text = "Close &All Documents"; comm1.Properties.ID = 2; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.Text = "Close All &But Active"; comm1.Properties.ID = 8; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.BeginGroup = true; comm1.Properties.Text = "Tile &Horizontally"; comm1.Properties.ID = 3; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.Text = "Tile &Vertically"; comm1.Properties.ID = 4; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.Text = "Ca&scade"; comm1.Properties.ID = 5; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.Text = "Arrange &Icons"; comm1.Properties.ID = 6; comm.Commands.Add(comm1); comm1 = new NCommand(); comm1.Properties.BeginGroup = true; comm1.Properties.Text = "&Documents..."; comm1.Properties.ID = 7; comm.Commands.Add(comm1); }
protected virtual void InitCommandBars() { NMenuBar menu = nCommandBarsManager1.Toolbars.GetMenu(); menu.AllowHide = false; menu.AllowDelete = false; menu.AllowReset = false; nCommandBarsManager1.CommandClicked += new CommandEventHandler(nCommandBarsManager1_CommandClicked); nCommandBarsManager1.QueryCommandUIState += new QueryCommandUIStateEventHandler(nCommandBarsManager1_QueryCommandUIState); }
internal void InitMainMenu() { NMenuBar menu = new NMenuBar(); menu.Text = "Menu Bar"; menu.AllowRename = false; menu.AllowHide = false; menu.DefaultRangeID = (int)NIDELoadUC.RangeID.MenuBar; m_CommandBarsManager.Toolbars.Add(menu); menu.Reset(false); }
/// <summary> /// /// </summary> /// <returns></returns> protected NMenuBar CreateMainMenu() { NMenuBar menuBar = new NMenuBar(); // collapse the gripper and the pendant for the main menu menuBar.Pendant.Visibility = ENVisibility.Collapsed; menuBar.Items.Add(CreateThemesMenuDropDown()); menuBar.Items.Add(CreateOptionsMenuDropDown()); return(menuBar); }
protected override NWidget CreateExampleContent() { m_MenuBar = new NMenuBar(); m_MenuBar.Text = "My Menu"; m_MenuBar.HorizontalPlacement = ENHorizontalPlacement.Left; m_MenuBar.VerticalPlacement = ENVerticalPlacement.Top; m_MenuBar.Items.Add(CreateFileMenuDropDown()); m_MenuBar.Items.Add(CreateEditMenuDropDown()); m_MenuBar.Items.Add(CreateViewMenuDropDown()); m_MenuBar.AddEventHandler(NMenuPopupHost.ClickEvent, new NEventHandler <NEventArgs>(new Function <NEventArgs>(OnMenuItemClicked))); NStackPanel stack = new NStackPanel(); stack.Direction = ENHVDirection.TopToBottom; stack.Add(m_MenuBar); return(stack); }
protected override NWidget CreateExampleContent() { NCommandBarManager manager = new NCommandBarManager(); // create two lanes NCommandBarLane lane0 = new NCommandBarLane(); manager.TopDock.Add(lane0); NCommandBarLane lane1 = new NCommandBarLane(); manager.TopDock.Add(lane1); NCommandBarLane lane2 = new NCommandBarLane(); manager.TopDock.Add(lane2); NCommandBarLane lane3 = new NCommandBarLane(); manager.TopDock.Add(lane3); // create a menu bar in the first lane NMenuBar menuBar = new NMenuBar(); lane0.Add(menuBar); menuBar.Items.Add(CreateFileMenu()); menuBar.Items.Add(CreateEditMenu()); menuBar.Items.Add(CreateViewMenu()); menuBar.Text = "Main Menu"; //Create File toolbar. NToolBar fileToolBar = new NToolBar(); lane1.Add(fileToolBar); fileToolBar.Text = "File"; AddToolBarItem(fileToolBar, Nevron.Nov.Presentation.NResources.Image_File_New_png, null, "New"); AddToolBarItem(fileToolBar, Nevron.Nov.Presentation.NResources.Image_File_Open_png, null, "Open"); fileToolBar.Items.Add(new NCommandBarSeparator()); AddToolBarItem(fileToolBar, Nevron.Nov.Presentation.NResources.Image_File_Save_png, null, "Save..."); AddToolBarItem(fileToolBar, Nevron.Nov.Presentation.NResources.Image_File_SaveAs_png, null, "Save As..."); //Create Edit toolbar. NToolBar editToolBar = new NToolBar(); lane1.Add(editToolBar); editToolBar.Text = "Edit"; AddToolBarItem(editToolBar, Nevron.Nov.Presentation.NResources.Image_Edit_Undo_png, "Undo"); AddToolBarItem(editToolBar, Nevron.Nov.Presentation.NResources.Image_Edit_Redo_png, "Redo"); editToolBar.Items.Add(new NCommandBarSeparator()); AddToolBarItem(editToolBar, Nevron.Nov.Presentation.NResources.Image_Edit_Copy_png, "Copy"); AddToolBarItem(editToolBar, Nevron.Nov.Presentation.NResources.Image_Edit_Cut_png, "Cut"); AddToolBarItem(editToolBar, Nevron.Nov.Presentation.NResources.Image_Edit_Paste_png, "Paste"); //Create View toolbar. NToolBar viewToolBar = new NToolBar(); lane1.Add(viewToolBar); viewToolBar.Text = "View"; //Add toggle buttons in a toggle button group which acts like radio buttons. AddToggleToolBarItem(viewToolBar, Nevron.Nov.Text.NResources.Image_Layout_Normal_png, "Normal Layout"); AddToggleToolBarItem(viewToolBar, Nevron.Nov.Text.NResources.Image_Layout_Web_png, "Web Layout"); AddToggleToolBarItem(viewToolBar, Nevron.Nov.Text.NResources.Image_Layout_Print_png, "Print Layout"); viewToolBar.Items.Add(new NCommandBarSeparator()); AddToolBarItem(viewToolBar, null, "Task Pane"); AddToolBarItem(viewToolBar, null, "Toolbars"); AddToolBarItem(viewToolBar, null, "Ruller"); NToolBar toolbar = new NToolBar(); lane2.Add(toolbar); toolbar.Text = "Toolbar"; toolbar.Wrappable = true; NColorBox colorBoxItem = new NColorBox(); colorBoxItem.Tooltip = new NTooltip("Select Color"); NCommandBar.SetText(colorBoxItem, "Select Color"); toolbar.Items.Add(colorBoxItem); NMenuSplitButton splitButton = new NMenuSplitButton(); splitButton.ActionButton.Content = NWidget.FromObject("Send/Receive"); splitButton.Menu.Items.Add(new NMenuItem("Send Receive All")); splitButton.SelectedIndexChanged += OnSplitButtonSelectedIndexChanged; splitButton.Menu.Items.Add(new NMenuItem("Send All")); splitButton.Menu.Items.Add(new NMenuItem("Receive All")); toolbar.Items.Add(splitButton); //Add toggle button which enable/disables the next fill split button. NToggleButton toggleButton = new NToggleButton("Enable"); toggleButton.CheckedChanged += OnToggleButtonCheckedChanged; toolbar.Items.Add(toggleButton); // Add fill split button NFillSplitButton fillButton = new NFillSplitButton(); fillButton.Tooltip = new NTooltip("Select Fill"); fillButton.Enabled = false; toolbar.Items.Add(fillButton); // Add shadow split button NShadowSplitButton shadowButton = new NShadowSplitButton(); shadowButton.Tooltip = new NTooltip("Select Shadow"); toolbar.Items.Add(shadowButton); // Add stroke split button NStrokeSplitButton strokeButton = new NStrokeSplitButton(); strokeButton.Tooltip = new NTooltip("Select Stroke"); toolbar.Items.Add(strokeButton); manager.Content = new NLabel("Content Goes Here"); manager.Content.AllowFocus = true; manager.Content.MouseDown += new Function <NMouseButtonEventArgs>(OnContentMouseDown); manager.Content.Border = NBorder.CreateFilledBorder(NColor.Black); manager.Content.BackgroundFill = new NColorFill(NColor.White); manager.Content.BorderThickness = new NMargins(1); manager.Content.GotFocus += new Function <NFocusChangeEventArgs>(OnContentGotFocus); manager.Content.LostFocus += new Function <NFocusChangeEventArgs>(OnContentLostFocus); return(manager); }
protected override NWidget CreateExampleControls() { NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.Last; stack.FitMode = ENStackFitMode.Last; // create the buttons group NGroupBox buttonsGroup = new NGroupBox("Open Dialogs from Buttons"); stack.Add(buttonsGroup); NStackPanel buttonsStack = new NStackPanel(); buttonsStack.Direction = ENHVDirection.LeftToRight; buttonsGroup.Content = buttonsStack; NButton openButton = new NButton("Open File..."); openButton.Content.HorizontalPlacement = ENHorizontalPlacement.Center; openButton.Click += new Function <NEventArgs>(OnOpenButtonClick); buttonsStack.Add(openButton); NButton openMultiselectButton = new NButton("Choose Multiple Files..."); openMultiselectButton.Content.HorizontalPlacement = ENHorizontalPlacement.Center; openMultiselectButton.Click += new Function <NEventArgs>(OnMultiselectOpenButtonClick); buttonsStack.Add(openMultiselectButton); NButton saveButton = new NButton("Save to File..."); saveButton.Content.HorizontalPlacement = ENHorizontalPlacement.Center; saveButton.Click += new Function <NEventArgs>(OnSaveButtonClick); buttonsStack.Add(saveButton); // create the menu group NGroupBox menuGroup = new NGroupBox("Open Dialogs from Menu Items"); stack.Add(menuGroup); NMenuBar menuBar = new NMenuBar(); menuGroup.Content = menuBar; NMenuDropDown fileMenu = new NMenuDropDown("File"); menuBar.Items.Add(fileMenu); NMenuItem openFileMenuItem = new NMenuItem("Open File..."); openFileMenuItem.Click += new Function <NEventArgs>(OnOpenFileMenuItemClick); fileMenu.Items.Add(openFileMenuItem); NMenuItem saveFileMenuItem = new NMenuItem("Save File..."); saveFileMenuItem.Click += new Function <NEventArgs>(OnSaveFileMenuItemClick); fileMenu.Items.Add(saveFileMenuItem); // create the dialog group NGroupBox dialogGroup = new NGroupBox("Open Dialogs from Dialog"); stack.Add(dialogGroup); NButton showDialogButton = new NButton("Show Dialog..."); showDialogButton.Click += new Function <NEventArgs>(OnShowDialogButtonClick); dialogGroup.Content = showDialogButton; // add the events log m_EventsLog = new NExampleEventsLog(); stack.Add(m_EventsLog); return(stack); }
private void CreateMenuBar() { NMenuBar menu = new NMenuBar(); menu.Text = "Examples Main Menu"; //forbide toolbar permisiions menu.AllowReset = false; menu.AllowRename = false; menu.AllowHide = false; NCommand comm, comm1; //create the "File" command comm = new NCommand(); comm.Properties.Text = "&File"; menu.Commands.Add(comm); //create the "Exit" command comm1 = new NCommand(); comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.Exit; comm1.Properties.Text = "E&xit"; comm.Commands.Add(comm1); //create the "View" command comm = new NCommand(); comm.Properties.Text = "&View"; //add the "View Navigation" command comm1 = new NCommand(); comm1.Properties.Text = "Navigation Tree"; comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.View_NavigationTree; comm.Commands.Add(comm1); //add the "View Example TabControl" command comm1 = new NCommand(); comm1.Properties.Text = "Example TabControl"; comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.View_ExampleTabControl; comm.Commands.Add(comm1); //add the "View Example CommandBars" command comm1 = new NCommand(); comm1.Properties.Text = "Example Command Bars"; comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.View_ExampleCommandBars; comm.Commands.Add(comm1); menu.Commands.Add(comm); //create the "Palette" command comm = new NCommand(); comm.Properties.Text = "&Palette"; //add the color scheme context comm.Commands.Add(NCommand.FromContext(Contexts.ContextFromID((int)NDiagramExamplesCommandIDs.ColorScheme))); //add the style3d context comm.Commands.Add(NCommand.FromContext(Contexts.ContextFromID((int)NDiagramExamplesCommandIDs.Style3D))); //add the "Edit Palette" command comm1 = new NCommand(); comm1.Properties.BeginGroup = true; comm1.Properties.Text = "&Edit"; comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.Palette_Edit; comm.Commands.Add(comm1); menu.Commands.Add(comm); //create the "File" command comm = new NCommand(); comm.Properties.Text = "&Help"; comm1 = new NCommand(); comm1.Properties.Text = "&About..."; comm.Commands.Add(comm1); menu.Commands.Add(comm); //add the menu to the toolbars collection base.Toolbars.Add(menu); }