当前位置: 首页>>代码示例>>C#>>正文


C# VBox.AddEvents方法代码示例

本文整理汇总了C#中Gtk.VBox.AddEvents方法的典型用法代码示例。如果您正苦于以下问题:C# VBox.AddEvents方法的具体用法?C# VBox.AddEvents怎么用?C# VBox.AddEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.VBox的用法示例。


在下文中一共展示了VBox.AddEvents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainWindow

        public MainWindow()
            : base(WindowType.Toplevel)
        {
            AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));

            VBox master = new VBox ();
            master.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));

            Title = "Ribbons Sample";
            AppPaintable = true;

            VariantsCombinaisonSwitcher page0 = new VariantsCombinaisonSwitcher ();

            RibbonGroup group0 = CreateGroup0 ();
            RibbonGroup group1 = CreateGroup1 ();
            RibbonGroup group2 = CreateGroup2 ();
            DropdownRibbonGroup dgroup0 = CreateDropdownGroup0 ();
            dgroup0.Group = group0;
            DropdownRibbonGroup dgroup1 = CreateDropdownGroup1 ();
            dgroup1.Group = group1;
            DropdownRibbonGroup dgroup2 = CreateDropdownGroup2 ();
            dgroup2.Group = group2;

            VariantsCombinaison combi0 = new VariantsCombinaison ();
            combi0.Append (group0);
            combi0.Append (group1);
            combi0.Append (group2);
            page0.AddCombinaison (combi0);

            VariantsCombinaison combi1 = new VariantsCombinaison ();
            combi1.Append (group0);
            combi1.Append (group1);
            combi1.Append (dgroup2);
            page0.AddCombinaison (combi1);

            VariantsCombinaison combi2 = new VariantsCombinaison ();
            combi2.Append (dgroup0);
            combi2.Append (dgroup1);
            combi2.Append (dgroup2);
            page0.AddCombinaison (combi2);

            HBox page1 = new HBox (false, 2);
            RibbonGroup group10 = new RibbonGroup ();
            group10.Label = "Welcome on the second page";
            page1.PackStart (group10, false, false, 0);

            HBox page2 = new HBox (false, 2);

            Label pageLabel0 = new Label ("Page 1");
            pageLabel1 = new Label ("Page 2");
            Label pageLabel2 = new Label ("Page 3");

            Ribbons.Button shortcuts = new Ribbons.Button ("Menu");
            shortcuts.Child.ModifyFg (Gtk.StateType.Normal, new Gdk.Color(255, 255, 255));

            Menu mainMenu = new Menu ();
            MenuItem mainMenu_quit = new MenuItem ("Quit");
            mainMenu_quit.Activated += delegate (object Sender, EventArgs e)
            {
                Application.Quit ();
            };
            mainMenu.Append (mainMenu_quit);

            shortcuts.Clicked += delegate (object Sender, EventArgs e)
            {
                mainMenu.Popup ();
                mainMenu.ShowAll ();
            };

            QuickAccessToolbar qat = new QuickAccessToolbar ();
            Ribbons.Button qatNew, qatSave;
            qat.Append (qatNew = Ribbons.Button.FromStockIcon (Gtk.Stock.New, false));
            qat.Append (qatSave = Ribbons.Button.FromStockIcon (Gtk.Stock.Save, false));

            ribbon = new Ribbon ();
            ribbon.ApplicationButton = new ApplicationButton ();
            ribbon.QuickAccessToolbar = qat;
            //ribbon.Shortcuts = shortcuts;
            ribbon.AppendPage (page0, pageLabel0);
            ribbon.AppendPage (page1, pageLabel1);
            ribbon.AppendPage (page2, pageLabel2);
            pageLabel1.AddEvents ((int)(Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask));
            pageLabel1.ButtonPressEvent += delegate (object sender, ButtonPressEventArgs e)
            {
                Console.WriteLine("label1 press");
            };
            pageLabel1.EnterNotifyEvent += delegate (object sender, EnterNotifyEventArgs e)
            {
                Console.WriteLine("label1 enter");
            };
            pageLabel1.LeaveNotifyEvent += delegate (object sender, LeaveNotifyEventArgs e)
            {
                Console.WriteLine("label1 leave");
            };

            ApplicationMenu appMenu = ribbon.ApplicationButton.Menu;
            TextView mnu = new TextView ();
            appMenu.DefaultMenu = mnu;
            mnu.Buffer.InsertAtCursor ("Default");
            ApplicationMenuItem mi = new ApplicationMenuItem ("Test 1");
//.........这里部分代码省略.........
开发者ID:MASGAU,项目名称:gtk-sharp-ribbon,代码行数:101,代码来源:MainWindow.cs


注:本文中的Gtk.VBox.AddEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。