示例#1
0
 public Canvas3D(MainWindow window)
 {
     this.owner         = window;
     this.RenderFactory = window.RenderFactory;
     this.XwtRender     = window.XwtRender;
     this.Xwt           = window.Xwt;
 }
示例#2
0
            public DragWindowWpf(IXwt xwt, Point position, Size size)
                : base(xwt, position, size, false)
            {
                var wpfwin = (this.GetBackend() as IWindowFrameBackend).Window;

                wpfwin.GetType().SetPropertyValue(wpfwin, "AllowsTransparency", true);

                SetMaxWidth(32);
            }
示例#3
0
        public opentkdoc(IRendererFactory factory, IXwtRender xwtrender, IXwt xwt)
        {
            this.xwtrender = xwtrender;
            this.xwt       = xwt;
            this.factory   = factory;

            base.BackgroundColor = Colors.Black;
            base.MinWidth        = base.MinHeight = 100;
        }
示例#4
0
            public Canvas3D(MainWindow window)
            {
                this.RenderFactory = window.Renderfactory;
                this.XwtRender     = window.XwtRender;
                this.Xwt           = window.Xwt;

                base.BackgroundColor = global::Xwt.Drawing.Colors.DarkGreen;
                base.MinWidth        = base.MinHeight = 100;
            }
示例#5
0
        public mainwindow(IXwt xwt)
        {
            this.Title   = $"Xwt Demo Application {Xwt.Toolkit.CurrentEngine.Type}";
            this.Width   = 150; this.Height = 150;
            this.Padding = 0;

            this.CloseRequested += (s, e) => { if (!closing)
                                               {
                                                   e.AllowClose = this.close();
                                               }
            };

            var menu = new Menu();
            var file = new MenuItem("_File");

            file.SubMenu = new Menu();
            file.SubMenu.Items.Add(UIHelpers.NewMenuItem("New window", new_mainwindow));
            file.SubMenu.Items.Add(UIHelpers.NewMenuItem("New testdoc", new_testdoc));
            file.SubMenu.Items.Add(UIHelpers.NewMenuItem("New toolbar", new_toolbar));
            file.SubMenu.Items.Add(UIHelpers.NewMenuItem("New google", new_webview));
            file.SubMenu.Items.Add(UIHelpers.NewMenuItem("New properties", new_properties));
            file.SubMenu.Items.Add(UIHelpers.NewMenuItem("New winlist", (s, a) => dock.Dock(new winlisttoolitem(), DockPosition.Left)));
            //   file.SubMenu.Items.Add(new MenuItem("_Open"));
            //    file.SubMenu.Items.Add(new MenuItem("_New"));
            var mi = new MenuItem("_Close");

            mi.Clicked += (s, e) => { if (this.close())
                                      {
                                          base.Close();
                                      }
                                      ; };
            file.SubMenu.Items.Add(mi);
            menu.Items.Add(file);

            var dockmenu = new MenuItem("Dock")
            {
                SubMenu = new Menu()
            };

            dockmenu.SubMenu.Items.Add(UIHelpers.NewMenuItem("save layout to disk", save_layout));
            dockmenu.SubMenu.Items.Add(UIHelpers.NewMenuItem("load layout from disk", load_layout));
            menu.Items.Add(dockmenu);

            this.MainMenu = menu;
            this.Content  = dock = new DockPanel(this, xwt);

            try
            {
                dock.LoadXml(settingsfile, true, Deserialize);
            }
            catch
            {
                dock.Dock(new testdockitem());
                dock.Dock(new testtoolitem(this), DockPosition.Top);
                dock.Dock(new IDockContent[] { new testtoolitem(this), new testtoolitem(this), new testtoolitem(this), new testtoolitem(this), new testtoolitem(this) }, DockPosition.Top);
            }
        }
示例#6
0
        private static DragWindow CreateDragWin(IXwt xwt, Point position, Size size)
        {
            switch (Toolkit.CurrentEngine.Type)
            {
            case ToolkitType.Wpf: return(new DragWindowWpf(xwt, position, size));

            case ToolkitType.XamMac: return(new DragWindowXamMac(xwt, position, size));

            case ToolkitType.Gtk: return(new DragWindowGTK2(xwt, position, size));

            case ToolkitType.Gtk3: return(new DragWindowGTK3(xwt, position, size));

            default: throw new NotImplementedException();
            }
        }
示例#7
0
        public MainWindow(IRendererFactory renderfactory, IXwtRender xwtrender, IXwt xwt)
        {
            this.Renderfactory = renderfactory;
            this.XwtRender     = xwtrender;
            this.Xwt           = xwt;

            this.Content = new Canvas3D(this)
            {
                MinWidth            = 100,
                MinHeight           = 100,
                HorizontalPlacement = WidgetPlacement.Fill,
                VerticalPlacement   = WidgetPlacement.Fill,
                ExpandHorizontal    = true,
                ExpandVertical      = true
            };
        }
示例#8
0
        static void Main(string[] args)
        {
            try
            {
#if (__MACOS__)
                if (args.Contains("gtk"))
                {
                    try { BaseLib.Xwt.Platform.Initialize(ToolkitType.Gtk); }
                    catch { Application.Initialize(ToolkitType.XamMac); }
                }
                else
                {
                    Application.Initialize(ToolkitType.XamMac);
                }
#else
                if (BaseLib.Xwt.Platform.OSPlatform == PlatformID.MacOSX)
                {
                    BaseLib.Xwt.Platform.Initialize(args.Contains("-gtk") ? ToolkitType.Gtk : ToolkitType.XamMac);
                }
                else if (System.Environment.OSVersion.Platform == PlatformID.Unix)
                {
                    BaseLib.Xwt.Platform.Initialize(args.Contains("-gtk3") ? ToolkitType.Gtk3 : ToolkitType.Gtk);
                }
                else
                {
                    if (args.Contains("-gtk"))
                    {
                        try { Application.Initialize(ToolkitType.Gtk); }
                        catch { Application.Initialize(ToolkitType.Wpf); }
                    }
                    else
                    {
                        Application.Initialize(ToolkitType.Wpf);
                    }
                }
#endif
                Program.Xwt = (IXwt)XwtImpl.Create();

                UIHelpers.NewWindow();
                Application.Run();
            }
            catch (Exception e)
            {
            }
        }
示例#9
0
            protected DragWindow(IXwt wxt, Point position, Size size, bool checkmouse)
            {
                this.xwt        = wxt;
                this.checkmouse = checkmouse;

                this.result = this.doexit = false;

                //  this.Resizable = false;
                this.Decorated = false;
                this.Location  = position.Offset(-5, -5);
                this.Size      = new Size(32, 32);
                this.Width     = this.Height = 32;
                this.Opacity   = 0.8;
                this.Padding   = 0;
                this.Title     = "dragform";

                this.floatsize = size;

                this.Content = new MyCanvas(this);

                this.GetBackend().ShowInTaskbar = false;
            }
示例#10
0
 public DragWindowGTK3(IXwt xwt, Point position, Size size)
     : base(xwt, position, size, true)
 {
 }
示例#11
0
 public DragWindowXamMac(IXwt wxt, Point position, Size size)
     : base(wxt, position, size, false)
 {
 }