示例#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 colourmenu_SubMenuShow(object sender, Toolbox.MenuEntry.SubMenuEventArgs args)
            {
                var menu_entry = (Toolbox.MenuEntry)sender;

                Toolbox.ColourMenu colour_menu = menu_entry.GetSubMenuShow <Toolbox.ColourMenu> ();

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

                // If the ColourDialogue was the last to set the colour then we leave the
                // menu unselected.
                colour_menu.Colour = (ColourSetBy != ColourSetter.Menu) ?
                                     Toolbox.ColourMenu.WimpColour.Unselected :
                                     font_wimp_colour;
            }