コード例 #1
0
            public TextDocument(uint objectID) : base(objectID)
            {
                // Set the window title via its Title property.
                Title = "CSharp Toolbox Window - Scale: " + Scale + "%";

                DocMenu = Toolbox.Object.CreateInstance <DocumentMenu> ("WindowMenu");
                // Attach the menu to the window.
                Menu = DocMenu;

                font = new Font.Instance(FontID,
                                         ((FontHeight * FontAspectRatio) / 100) << 4,
                                         FontHeight << 4);

                DocMenu.SaveAsDBox.FileType           = 0xfff;
                DocMenu.SaveAsDBox.SelectionAvailable = false;
                DocMenu.SaveAsDBox.SaveToFile        += save_data;
                DocMenu.SaveAsDBox.FillBuffer        += fill_buffer;

                DocMenu.FileInfoDBox.AboutToBeShown += fileinfo_Show;

                // The AboutToBeShown events for ColourMenu and ColourDialogue don't seem to
                // be reliable, so use the SubMenuShow events instead. This is a Toolbox issue,
                // not a Mono/C# issue.
                DocMenu.ColourDBoxEntry.SubMenu += colourdbox_SubMenuShow;
                DocMenu.ColourMenuEntry.SubMenu += colourmenu_SubMenuShow;

                Toolbox.ColourDialogue colour_dbox =
                    DocMenu.ColourDBoxEntry.GetSubMenuShow <Toolbox.ColourDialogue> ();
                colour_dbox.ColourSelected += colourdbox_Selected;

                Toolbox.ColourMenu colour_menu =
                    DocMenu.ColourMenuEntry.GetSubMenuShow <Toolbox.ColourMenu> ();
                colour_menu.Selection += colourmenu_Selected;

                DocMenu.FontDBox.AboutToBeShown += fontdbox_Show;
                DocMenu.FontDBox.ApplyFont      += fontdbox_ApplyFont;

                DocMenu.FontMenu.AboutToBeShown += fontmenu_Show;
                DocMenu.FontMenu.FontSelection  += fontmenu_Selection;

                DocMenu.ScaleDBox.AboutToBeShown += scaledbox_Shown;
                DocMenu.ScaleDBox.ApplyFactor    += scaledbox_ApplyFactor;

                DocMenu.PrintDBox.ClickSave  += printdbox_SavePrint;
                DocMenu.PrintDBox.ClickPrint += printdbox_SavePrint;
            }
コード例 #2
0
            void colourdbox_SubMenuShow(object sender, Toolbox.MenuEntry.SubMenuEventArgs args)
            {
                var menu_entry = (Toolbox.MenuEntry)sender;

                Toolbox.ColourDialogue colour_dbox = menu_entry.GetSubMenuShow <Toolbox.ColourDialogue> ();

                // The menu is a shared toolbox object, so check that this is the
                // intended target of the event.
                if (!this.Equals(colour_dbox.GetAncestor <TextDocument>()))
                {
                    return;
                }

                // Create the necessary colour block from the font colour
                int [] colour_block = Toolbox.ColourDialogue.AllocStandardColourBlock(font_palette_colour, Toolbox.ColourDialogue.ColourModel.RGB);
                // If the ColourMenu was the last to set the colour, then we set the current
                // colour to None.
                colour_dbox.SetColour(colour_block, ColourSetBy != ColourSetter.Dialogue);
            }