コード例 #1
0
        protected override NWidget CreateExampleContent()
        {
            NCommandBarManager manager = new NCommandBarManager();

            // create two lanes
            NCommandBarLane lane0 = new NCommandBarLane();

            manager.TopDock.Add(lane0);

            // create some toolbars in the second lane
            for (int i = 0; i < 10; i++)
            {
                NToolBar toolBar = new NToolBar();
                lane0.Add(toolBar);
                toolBar.Text = "Bar" + i.ToString();

                for (int j = 0; j < 8; j++)
                {
                    string name = "BTN " + i.ToString() + "." + j.ToString();

                    NWidget item;
                    if (j == 2)
                    {
                        item = new NColorBox();
                    }
                    else if (j == 3)
                    {
                        NMenuSplitButton msb = new NMenuSplitButton();
                        msb.ActionButton.Content = NWidget.FromObject("Send/Receive");
                        msb.Menu.Items.Add(new NMenuItem("Send Receive All"));
                        msb.Menu.Items.Add(new NMenuItem("Send All"));
                        msb.Menu.Items.Add(new NMenuItem("Receive All"));
                        item = msb;
                    }
                    else if (j == 4)
                    {
                        NComboBox comboBox = new NComboBox();
                        comboBox.Items.Add(new NComboBoxItem("Item 1"));
                        comboBox.Items.Add(new NComboBoxItem("Item 2"));
                        comboBox.Items.Add(new NComboBoxItem("Item 3"));
                        comboBox.Items.Add(new NComboBoxItem("Item 4"));
                        item = comboBox;
                    }
                    else
                    {
                        item = new NButton(name);
                    }

                    NCommandBar.SetText(item, name);
                    toolBar.Items.Add(item);

                    if (j == 2 || j == 6)
                    {
                        toolBar.Items.Add(new NCommandBarSeparator());
                    }
                }

                if (i == 2)
                {
                    toolBar.Wrappable = true;
                }
            }

            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);
        }
コード例 #2
0
        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);
        }