Exemplo n.º 1
0
        private void AddToolBarItem(NToolBar toolBar, NImage image, string text, string tooltip)
        {
            NWidget item;

            if (text == null)
            {
                text = string.Empty;
            }

            if (image == null)
            {
                item = new NButton(text);
            }
            else
            {
                item = new NButton(NPairBox.Create(image, text));
            }

            if (!string.IsNullOrEmpty(tooltip))
            {
                item.Tooltip = new NTooltip(tooltip);
            }

            toolBar.Items.Add(item);

            NCommandBar.SetText(item, text);

            if (image != null)
            {
                NCommandBar.SetImage(item, (NImage)image.DeepClone());
            }
        }
Exemplo n.º 2
0
        private static NMenuDropDown CreateMenuDropDown(string text)
        {
            NMenuDropDown menuDropDown = new NMenuDropDown(text);

            NCommandBar.SetText(menuDropDown, text);
            NCommandBar.SetImage(menuDropDown, null);
            return(menuDropDown);
        }
Exemplo n.º 3
0
        private void AddToggleToolBarItem(NToolBar toolBar, NImage image, string tooltip)
        {
            NToggleButton item = new NToggleButton(image);

            item.Tooltip = new NTooltip(tooltip);
            NCommandBar.SetText(item, tooltip);
            NCommandBar.SetImage(item, image);
            toolBar.Items.Add(item);
        }
Exemplo n.º 4
0
        private NButton CreateButton(ENToolBarButtonType buttonType, string text)
        {
            NButton button = null;
            NImage  image  = null;

            switch (buttonType)
            {
            case ENToolBarButtonType.Text:
                button = new NButton(text);
                break;

            case ENToolBarButtonType.SmallIcon:
                image  = GetSmallImage(text);
                button = new NButton(image);
                break;

            case ENToolBarButtonType.SmallIconAndText:
                image  = GetSmallImage(text);
                button = new NButton(CreatePairBox(image, text));
                break;

            case ENToolBarButtonType.LargeIcon:
                image  = GetLargeImage(text);
                button = new NButton(image);
                break;

            case ENToolBarButtonType.LargeIconAndText:
                image  = GetLargeImage(text);
                button = new NButton(CreatePairBox(image, text));
                break;

            default:
                throw new Exception("New ENToolBarButtonType?");
            }

            NCommandBar.SetText(button, text);
            NCommandBar.SetImage(button, image);

            button.Click += new Function <NEventArgs>(OnToolBarButtonClick);
            return(button);
        }
        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);
        }
Exemplo n.º 6
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);
        }