Ejemplo n.º 1
0
 public wnd1(EndianBinaryReader er)
     : base(er)
 {
     long basepos = er.BaseStream.Position - 0x4C;
     InflationLeft = er.ReadUInt16() / 16f;
     InflationRight = er.ReadUInt16() / 16f;
     InflationTop = er.ReadUInt16() / 16f;
     InflationBottom = er.ReadUInt16() / 16f;
     FrameSizeLeft = er.ReadUInt16();
     FrameSizeRight = er.ReadUInt16();
     FrameSizeTop = er.ReadUInt16();
     FrameSizeBottom = er.ReadUInt16();
     NrFrames = er.ReadByte();
     byte tmp = er.ReadByte();
     UseLTMaterial = (tmp & 1) == 1;
     UseVtxColorForAllWindow = (tmp & 2) == 2;
     Kind = (WindowKind)((tmp >> 2) & 3);
     DontDrawContent = (tmp & 8) == 16;
     Padding = er.ReadUInt16();
     ContentOffset = er.ReadUInt32();
     FrameOffsetTableOffset = er.ReadUInt32();
     er.BaseStream.Position = basepos + ContentOffset;
     Content = new WindowContent(er);
     er.BaseStream.Position = basepos + FrameOffsetTableOffset;
     WindowFrameOffsets = er.ReadUInt32s(NrFrames);
     WindowFrames = new WindowFrame[NrFrames];
     for (int i = 0; i < NrFrames; i++)
     {
         er.BaseStream.Position = basepos + WindowFrameOffsets[i];
         WindowFrames[i] = new WindowFrame(er);
     }
     er.BaseStream.Position = basepos + SectionSize;
 }
Ejemplo n.º 2
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            GtkAlertDialog alertDialog = new GtkAlertDialog(message);

            alertDialog.FocusButton(message.DefaultButton);
            var wb  = (IGtkWidgetBackend)WidgetRegistry.GetBackend(transientFor);
            var win = wb != null ? (Gtk.Window)wb.Widget : null;

            MessageService.ShowCustomDialog(alertDialog, win);
            if (alertDialog.ApplyToAll)
            {
                ApplyToAll = true;
            }
            var res = alertDialog.ResultButton;

            if (res == null)
            {
                // If the dialog is closed clicking the close window button we may have no result.
                // In that case, try to find a cancelling button
                if (message.Buttons.Contains(Command.Cancel))
                {
                    return(Command.Cancel);
                }
                else if (message.Buttons.Contains(Command.No))
                {
                    return(Command.No);
                }
                else if (message.Buttons.Contains(Command.Close))
                {
                    return(Command.Close);
                }
            }
            return(res);
        }
Ejemplo n.º 3
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            GtkAlertDialog alertDialog = new GtkAlertDialog(context, message);

            alertDialog.FocusButton(message.DefaultButton);
            var win = context.Toolkit.GetNativeWindow(transientFor) as Gtk.Window;

            MessageService.ShowCustomDialog(alertDialog, win);
            if (alertDialog.ApplyToAll)
            {
                ApplyToAll = true;
            }
            var res = alertDialog.ResultButton;

            if (res == null)
            {
                // If the dialog is closed clicking the close window button we may have no result.
                // In that case, try to find a cancelling button
                if (message.Buttons.Contains(Command.Cancel))
                {
                    return(Command.Cancel);
                }
                else if (message.Buttons.Contains(Command.No))
                {
                    return(Command.No);
                }
                else if (message.Buttons.Contains(Command.Close))
                {
                    return(Command.Close);
                }
            }
            return(res);
        }
        private IEnumerable <DocumentView> GetDocumentViewsToRight(WindowFrame activeWindowFrame, DocumentGroup docGroup)
        {
            var docViewsToRight = new List <DocumentView>();
            var viewMoniker     = activeWindowFrame.FrameMoniker.ViewMoniker;
            var documentViews   = docGroup.Children.Where(c => c != null && c.GetType() == typeof(DocumentView)).Select(c => c as DocumentView);
            var foundActive     = false;

            foreach (var documentView in documentViews)
            {
                var name = CleanDocumentViewName(documentView.Name);
                if (!foundActive)
                {
                    if (name == viewMoniker)
                    {
                        foundActive = true;
                    }

                    // Skip over documents until we have found the first one after the active
                    continue;
                }

                docViewsToRight.Add(documentView);
            }

            return(docViewsToRight);
        }
Ejemplo n.º 5
0
        protected override void OnHidden()
        {
            base.OnHidden();
            var temp = Owner;

            Owner = null;

            moveButton = 0;

            if (temp != null)
            {
                if (temp is ToolWindow)
                {
                    if (!byDeactivate)
                    {
                        ((ToolWindow)temp).byDeactivate = true;
                    }
                }
                // temp.Visible = true;
            }

            if (timerHide.Enabled)
            {
                timerHide.Stop();
            }
            byDeactivate = false;
        }
Ejemplo n.º 6
0
            //     [DllImport("libgdk-win32-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
            //    internal static extern IntPtr gdk_win32_drawable_get_handle(IntPtr raw);

            private IntPtr GetHwnd(WindowFrame r)
            {
                var wh = Activator.CreateInstance(Extensions.GetType("System.Windows.Interop.WindowInteropHelper"),
                                                  new object[] { (Xwt.Toolkit.CurrentEngine.GetSafeBackend(r) as Xwt.Backends.IWindowFrameBackend).Window });

                return((IntPtr)wh.GetType().GetPropertyValue(wh, "Handle"));
            }
Ejemplo n.º 7
0
            public Window(BinaryReaderX br) : base(br)
            {
                inflatLeft       = (ushort)(br.ReadUInt16() / 16);
                inflatRight      = (ushort)(br.ReadUInt16() / 16);
                inflatTop        = (ushort)(br.ReadUInt16() / 16);
                inflatBottom     = (ushort)(br.ReadUInt16() / 16);
                frameSizeLeft    = br.ReadUInt16();
                frameSizeRight   = br.ReadUInt16();
                frameSizeTop     = br.ReadUInt16();
                frameSizeBottom  = br.ReadUInt16();
                nrFrames         = br.ReadByte();
                flag             = br.ReadByte();
                padding          = br.ReadUInt16();
                contOffset       = br.ReadUInt32();
                frameTableOffset = br.ReadUInt32();

                br.BaseStream.Position = contOffset - 0x8;
                content = new WindowContent(br);

                br.BaseStream.Position = frameTableOffset - 0x8;
                frames = new WindowFrame[nrFrames];
                for (int i = 0; i < nrFrames; i++)
                {
                    frames[i] = new WindowFrame(br);
                }
            }
Ejemplo n.º 8
0
        public wnd1(EndianBinaryReader er)
            : base(er)
        {
            long basepos = er.BaseStream.Position - 0x4C;

            InflationLeft   = er.ReadUInt16() / 16f;
            InflationRight  = er.ReadUInt16() / 16f;
            InflationTop    = er.ReadUInt16() / 16f;
            InflationBottom = er.ReadUInt16() / 16f;
            FrameSizeLeft   = er.ReadUInt16();
            FrameSizeRight  = er.ReadUInt16();
            FrameSizeTop    = er.ReadUInt16();
            FrameSizeBottom = er.ReadUInt16();
            NrFrames        = er.ReadByte();
            byte tmp = er.ReadByte();

            UseLTMaterial           = (tmp & 1) == 1;
            UseVtxColorForAllWindow = (tmp & 2) == 2;
            Kind                   = (WindowKind)((tmp >> 2) & 3);
            DontDrawContent        = (tmp & 8) == 16;
            Padding                = er.ReadUInt16();
            ContentOffset          = er.ReadUInt32();
            FrameOffsetTableOffset = er.ReadUInt32();
            er.BaseStream.Position = basepos + ContentOffset;
            Content                = new WindowContent(er);
            er.BaseStream.Position = basepos + FrameOffsetTableOffset;
            WindowFrameOffsets     = er.ReadUInt32s(NrFrames);
            WindowFrames           = new WindowFrame[NrFrames];
            for (int i = 0; i < NrFrames; i++)
            {
                er.BaseStream.Position = basepos + WindowFrameOffsets[i];
                WindowFrames[i]        = new WindowFrame(er);
            }
            er.BaseStream.Position = basepos + SectionSize;
        }
Ejemplo n.º 9
0
            public override void  SetParent(WindowFrame r, WindowFrame parentWindow)
            {
                var gtkwin       = r.GetBackend().Window;
                var gtkwinparent = parentWindow.GetBackend().Window;

                gtkwin.GetType().SetPropertyValue(gtkwin, "TransientFor", gtkwinparent);
            }
Ejemplo n.º 10
0
        public (Repository, Commit) GetSelectedCommit()
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            EnvDTE80.DTE2 dte = ServiceProvider.GetService(typeof(DTE)) as EnvDTE80.DTE2;
            // GUID found via dte.ActiveWindow.ObjectKind
            Guid           gitHistoryWindowGuid = new Guid("116D2292-E37D-41CD-A077-EBACAC4C8CC4");
            IVsUIShell     vsUIShell            = (IVsUIShell)Package.GetGlobalService(typeof(SVsUIShell));
            int            toolWindowReturn     = vsUIShell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fFrameOnly, ref gitHistoryWindowGuid, out IVsWindowFrame vsWindowFrame);
            WindowFrame    windowFrame          = (WindowFrame)vsWindowFrame;
            ToolWindowView toolWindowView       = (ToolWindowView)windowFrame.FrameView;
            // panel is of innaccessible type Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ContentHostingPanel
            // so use base System.Windows.Controls.Grid
            Grid contentHostingPanel = (Grid)toolWindowView.Content;
            // Type Microsoft.VisualStudio.Platform.WindowManagement.Controls.GenericPaneContentPresenter is internal
            // so use base ContentPresenter
            ContentPresenter genericPaneContentPresenter = contentHostingPanel.Children[1] as ContentPresenter;
            // Microsoft.VisualStudio.TeamFoundation.ToolWindowBase.ToolWindowBaseProxy is innaccessible
            // so use base ContentPresenter
            ContentPresenter toolWindowBaseProxy = (ContentPresenter)genericPaneContentPresenter.Content;
            // Is of type Microsoft.TeamFoundation.Git.Controls.History.HistoryView,
            // but this class is defined as internal so using base UserControl.
            UserControl historyView = (UserControl)toolWindowBaseProxy.Content;
            // Is of type Microsoft.TeamFoundation.Git.Controls.History.HistoryViewModel,
            // but this class is defined as internal so using base Microsoft.TeamFoundation.MVVM.ViewModelBase.
            ViewModelBase historyViewModel = (ViewModelBase)historyView.DataContext;
            // Use reflection to get at properties of internal type HistoryViewModel and ObservableCollection<GitHistoryItem>
            object     gitHistoryItem = ((IList)historyViewModel.GetType().GetProperty("SelectedItems").GetValue(historyViewModel, null))[0];
            IGitCommit selectedCommit = (IGitCommit)gitHistoryItem.GetType().GetProperty("Commit").GetValue(gitHistoryItem, null);
            IGitExt    gitExt         = ServiceProvider.GetService(typeof(IGitExt)) as IGitExt;
            Repository repository     = new Repository(gitExt.ActiveRepositories.First().RepositoryPath);
            Commit     commit         = repository.Lookup <Commit>(selectedCommit.Id.Sha);

            return(repository, commit);
        }
Ejemplo n.º 11
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            this.icon    = GetIcon(message.Icon);
            this.buttons = ConvertButtons(message.Buttons);
            if (message.SecondaryText == null)
            {
                message.SecondaryText = String.Empty;
            }
            else
            {
                message.Text          = message.Text + "\r\n\r\n" + message.SecondaryText;
                message.SecondaryText = String.Empty;
            }

            var wb = (WindowFrameBackend)WidgetRegistry.GetBackend(transientFor);

            if (wb != null)
            {
                this.dialogResult = MessageBox.Show(wb.Window, message.Text, message.SecondaryText,
                                                    this.buttons, this.icon, this.defaultResult, this.options);
            }
            else
            {
                this.dialogResult = MessageBox.Show(message.Text, message.SecondaryText, this.buttons,
                                                    this.icon, this.defaultResult, this.options);
            }

            return(ConvertResultToCommand(this.dialogResult));
        }
Ejemplo n.º 12
0
        //调整价钱
        protected void btnAdjustPrice_Click(object sender, EventArgs e)
        {
            if (gvList.Rows.Count <= 0 || gvList.SelectedRowIndexArray.Length <= 0)
            {
                return;
            }
            System.Web.UI.WebControls.Label lab = (System.Web.UI.WebControls.Label)gvList.Rows[gvList.SelectedRowIndexArray[0]].FindControl("Label1");
            if (lab.Text == "预出账")
            {
                List <Billdetail> billdetailList = (List <Billdetail>)ViewState["billdetailList"];
                string            ordernum       = gvList.Rows[gvList.SelectedRowIndexArray[0]].Values[3].ToString();
                string            billheadid     = gvList.Rows[gvList.SelectedRowIndexArray[0]].Values[0].ToString();
                //string ids = gvList.Rows[gvList.SelectedRowIndexArray[0]].Values[12].ToString();

                string url = "BillAccurately.aspx?ordernum=" + ordernum + "&billheadid=" + billheadid;
                PageContext.RegisterStartupScript(WindowFrame.GetShowReference(url, "调整价钱"));
            }
            else
            {
                if (lab.Text == "已退款")
                {
                    MessageBoxShow("已退款账单,不能再修改价格!");
                }
                else if (lab.Text == "已接收")
                {
                    MessageBoxShow("已接收账单,不能再修改价格!");
                }
                else if (lab.Text == "已作废")
                {
                    MessageBoxShow("已作废账单,不能再修改价格!");
                }
            }
        }
Ejemplo n.º 13
0
        public static Command ShowDialog(this Widget widget, WindowFrame owner)
        {
            if (widget is ILocalizable)
            {
                ((ILocalizable)widget).Localize();
            }
            var window = new Dialog
            {
                BackgroundColor = GuiEnvironment.Theme["Window"].BaseColor,
                Content         = widget,
                Title           = widget.Name,
                Padding         = new WidgetSpacing(5, 5, 5, 5),
                Size            = new Size(800, 600),
                TransientFor    = owner
            };

            if (widget is IText)
            {
                window.Title = ((IText)widget).Text;
                ((IText)widget).TextChanged += WindowContentTextChanged;
            }
            window.CloseRequested += (s, e) =>
            {
                //((Dialog)s).TransientFor = null;
                if (widget is IText)
                {
                    ((IText)widget).TextChanged -= WindowContentTextChanged;
                }
            };
            return(window.Run(owner));
        }
Ejemplo n.º 14
0
		public Command Run (WindowFrame transientFor, MessageDescription message)
		{
			this.icon = GetIcon (message.Icon);
			if (ConvertButtons (message.Buttons, out buttons)) {
				// Use a system message box
				if (message.SecondaryText == null)
					message.SecondaryText = String.Empty;
				else {
					message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
					message.SecondaryText = String.Empty;
				}
				var wb = (WindowFrameBackend)Toolkit.GetBackend (transientFor);
				if (wb != null) {
					this.dialogResult = MessageBox.Show (wb.Window, message.Text, message.SecondaryText,
														this.buttons, this.icon, this.defaultResult, this.options);
				}
				else {
					this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
														this.icon, this.defaultResult, this.options);
				}
				return ConvertResultToCommand (this.dialogResult);
			}
			else {
				// Custom message box required
				Dialog dlg = new Dialog ();
				dlg.Resizable = false;
				dlg.Padding = 0;
				HBox mainBox = new HBox { Margin = 25 };

				if (message.Icon != null) {
					var image = new ImageView (message.Icon.WithSize (32,32));
					mainBox.PackStart (image, vpos: WidgetPlacement.Start);
				}
				VBox box = new VBox () { Margin = 3, MarginLeft = 8, Spacing = 15 };
				mainBox.PackStart (box, true);
				var text = new Label {
					Text = message.Text ?? ""
				};
				Label stext = null;
				box.PackStart (text);
				if (!string.IsNullOrEmpty (message.SecondaryText)) {
					stext = new Label {
						Text = message.SecondaryText
					};
					box.PackStart (stext);
				}
				dlg.Buttons.Add (message.Buttons.ToArray ());
				if (mainBox.Surface.GetPreferredSize (true).Width > 480) {
					text.Wrap = WrapMode.Word;
					if (stext != null)
						stext.Wrap = WrapMode.Word;
					mainBox.WidthRequest = 480;
				}
				var s = mainBox.Surface.GetPreferredSize (true);

				dlg.Content = mainBox;
				return dlg.Run ();
			}
		}
Ejemplo n.º 15
0
 /// <summary>
 /// Gets a native window reference from an Xwt window.
 /// </summary>
 /// <returns> The native window object. </returns>
 /// <param name='window'> The Xwt window. </param>
 public virtual object GetNativeWindow(WindowFrame window)
 {
     if (window == null)
     {
         return(null);
     }
     return(GetNativeWindow(window.GetBackend() as IWindowFrameBackend));
 }
Ejemplo n.º 16
0
            public override void GetMouseInfo(WindowFrame window, out int mx, out int my, out uint buttons)
            {
                Win32.POINT mp = new Win32.POINT();
                Win32.GetCursorPos(ref mp);

                mx      = mp.X; my = mp.Y;
                buttons = (uint)((((Win32.GetKeyState(1) & 1) != 0) ? 1 : 0) | (((Win32.GetKeyState(2) & 1) != 0) ? 2 : 0));
            }
Ejemplo n.º 17
0
            public override void SetParent(WindowFrame r, WindowFrame parentWindow)
            {
                Type et    = Platform.GetType("AppKit.NSWindowLevel");
                var  level = Enum.ToObject(et, 3L /*floating*/);
                var  w     = r.GetBackend().Window;

                w.GetType().SetPropertyValue(w, "Level", level);
            }
Ejemplo n.º 18
0
 private void Navigate(int index)
 {
     switch (index)
     {
     default:
         WindowFrame.Navigate(typeof(TextGeneratorPage));
         break;
     }
 }
Ejemplo n.º 19
0
            public override IntPtr GetDisplay(WindowFrame window)
            {
                var gtkkwin = window.GetBackend().Window;
                var gdkdisp = gtkkwin.GetType().GetPropertyValue(gtkkwin, "Display");
                var display = (IntPtr)gdkdisp.GetType().GetPropertyValue(gdkdisp, "Handle");
                var xdisp   = getxdisplay(display);

                return(xdisp);
            }
 protected override void Run()
 {
     try {
         var         dialog = new UserAddinManagerDialog();
         WindowFrame parent = Toolkit.CurrentEngine.WrapWindow(IdeApp.Workbench.RootWindow);
         dialog.Run(parent);
     } catch (Exception ex) {
         LoggingService.LogError("OpenUserAddinManagerHandler.Run error", ex);
     }
 }
Ejemplo n.º 21
0
        public void OpenFile(Scene hackerScene, IRedTeamContext ctx, string filePath)
        {
            _scene    = hackerScene ?? throw new ArgumentNullException(nameof(hackerScene));
            _ctx      = ctx ?? throw new ArgumentNullException(nameof(ctx));
            _filePath = filePath;

            // Create the app window pane.
            _window = _scene.GetSystem <WindowManager>().CreateFloatingPane(Name);

            Main();
        }
Ejemplo n.º 22
0
            private static WindowFrame WindowBottom()
            {
                WindowFrame w = new WindowFrame()
                {
                    Top   = Screen.PrimaryScreen.Bounds.Bottom,
                    Left  = Screen.PrimaryScreen.Bounds.Left,
                    Right = Screen.PrimaryScreen.Bounds.Right
                };

                return(w);
            }
Ejemplo n.º 23
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     GlobalColor = new Color
     {
         R = 255,
         G = 0,
         B = 100,
         A = 255
     };
     HarmonyOption = HarmoniesType.Monochromatic;
     WindowFrame.Navigate(typeof(ColorHSBPage));
 }
Ejemplo n.º 24
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            this.MessageText = (message.Text != null) ? message.Text : String.Empty;
            this.InformativeText = (message.SecondaryText != null) ? message.SecondaryText : String.Empty;
            //TODO Set Icon
            //TODO Sort Buttons to have the default button first
            foreach (Command cmd in message.Buttons) {
                this.AddButton (cmd.Label);
            }

            return message.Buttons [this.RunModal () - 1000];
        }
Ejemplo n.º 25
0
        public void Init()
        {
            winFrame          = new WindowFrame(2000, 2000);
            hitInfo           = new HitInfo();
            hitInfo.hitObject = new Sphere(new Point3D(-50, 0, 60), 30, new Metal(new ColorRGB(1, 0, 0)));
            hitInfo.hitPoint  = new Point3D(1);
            Vector3D rayDirection = new Vector3D(-0.6, -0.8, -0.99);
            Point3D  rayOrigin    = new Point3D(0, 30, 300);
            Ray      testRay      = new Ray(rayOrigin, rayDirection);

            hitInfo.ray = testRay;
        }
        // 档案
        protected void btnArchive_Click(object sender, EventArgs e)
        {
            int[] strSelect = GridOrders.SelectedRowIndexArray;
            if (strSelect.Length <= 0)
            {
                MessageBoxShow("您还没有勾选记录!");
                return;
            }
            object[] obj = GridOrders.DataKeys[strSelect[0]];
            string   URL = "ProMemberFile.aspx?Mid=" + obj[5].ToString();

            PageContext.RegisterStartupScript(WindowFrame.GetShowReference(URL));
        }
Ejemplo n.º 27
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            this.MessageText     = (message.Text != null) ? message.Text : String.Empty;
            this.InformativeText = (message.SecondaryText != null) ? message.SecondaryText : String.Empty;
            //TODO Set Icon
            //TODO Sort Buttons to have the default button first
            foreach (Command cmd in message.Buttons)
            {
                this.AddButton(cmd.Label);
            }

            return(message.Buttons [this.RunModal() - 1000]);
        }
Ejemplo n.º 28
0
        public void SetCaption(string s)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            Log("setting to {0}", s);

            // the visible caption is made of a combination of the
            // EditorCaption and OwnerCaption; setting the EditorCaption to
            // null makes sure the caption can be controlled uniquely by
            //OwnerCaption
            WindowFrame.SetProperty((int)VsFramePropID.EditorCaption, null);
            WindowFrame.SetProperty((int)VsFramePropID.OwnerCaption, s);
        }
Ejemplo n.º 29
0
 public EnvironmentJSON(string fileName, WindowFrame winFrame, ColorRGB background, List <Light> lights, Perspective camera, double wallPosition)
 {
     this.fileName     = fileName;
     this.winFrame     = winFrame;
     this.background   = background;
     this.lights       = lights;
     this.camera       = new Perspective(camera);
     this.wallPosition = wallPosition;
     if (wallPosition.Equals(0.0))
     {
         wallPosition = Config.DEFAULT_WALL_POSITION;
     }
     this.wallPosition = wallPosition;
 }
Ejemplo n.º 30
0
        public IWindowFrame CreateDocumentWindow(string documentType, object docItem, string documentTitle, IWindowPane pane)
        {
            var tabPage = new TabPage
            {
                Text       = documentTitle,
                ImageIndex = 7,
            };
            WindowFrame frame = new WindowFrame(this, documentType, docItem, tabPage, pane);

            framesByTab.Add(tabPage, frame);
            this.form.DocumentTabs.TabPages.Add(tabPage);
            this.form.DocumentTabs.SelectedTab = tabPage;
            pane.SetSite(services);
            return(frame);
        }
Ejemplo n.º 31
0
        public static WindowFrame GetWindowFrame(IntPtr hWnd)
        {
            GetWindowRect(hWnd, out var lpWindowRect);
            var lpWindowRectangle = lpWindowRect.ToRectangle();
            var baseWindowFrame   = new WindowFrame(lpWindowRectangle, lpWindowRectangle);

            if (Environment.OSVersion.Version.Major < 6)
            {
                return(baseWindowFrame);
            }

            var result = DwmGetWindowAttribute(hWnd, (int)Dwmwindowattribute.DwmwaExtendedFrameBounds, out var dwmRect, Marshal.SizeOf(typeof(RECT)));

            return(result >= 0 ? new WindowFrame(lpWindowRectangle, dwmRect.ToRectangle()) : baseWindowFrame);
        }
Ejemplo n.º 32
0
 internal bool HitAWall(WindowFrame critter, List <WindowFrame> openWindows)
 {
     try
     {
         var walkingCritter = openWindows.FirstOrDefault(openWindow =>
                                                         openWindow.Left > critter.Right &&
                                                         openWindow.Left < (critter.Right + movementDistance) &&
                                                         openWindow.Top <critter.Bottom &&
                                                                         openWindow.Bottom> critter.Bottom);
         return(walkingCritter != null);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 33
0
        public IWindowFrame CreateWindow(string windowType, string windowTitle, IWindowPane pane)
        {
            var tabPage = new TabPage
            {
                Text       = windowTitle,
                ImageIndex = 7,
            };
            WindowFrame frame = new WindowFrame(this, windowType, tabPage, pane);

            framesByName.Add(windowType, frame);
            framesByTab.Add(tabPage, frame);
            this.form.DocumentTabs.TabPages.Add(tabPage);
            this.form.DocumentTabs.SelectedTab = tabPage;
            pane.SetSite(services);
            return(frame);
        }
Ejemplo n.º 34
0
		public Command Run (WindowFrame transientFor, MessageDescription message)
		{
			this.MessageText = (message.Text != null) ? message.Text : String.Empty;
			this.InformativeText = (message.SecondaryText != null) ? message.SecondaryText : String.Empty;
			//TODO Set Icon

			var sortedButtons = new Command [message.Buttons.Count];
			sortedButtons [0] = message.Buttons [message.DefaultButton];
			this.AddButton (message.Buttons [message.DefaultButton].Label);
			var j = 1;
			for (var i = 0; i < message.Buttons.Count; i++) {
				if (i == message.DefaultButton)
					continue;
				sortedButtons [j++] = message.Buttons [i];
				this.AddButton (message.Buttons [i].Label);
			}

			return sortedButtons [this.RunModal () - 1000];
		}
Ejemplo n.º 35
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            this.icon = GetIcon (message.Icon);
            this.buttons = ConvertButtons (message.Buttons);
            if (message.SecondaryText == null)
                message.SecondaryText = String.Empty;
            else {
                message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
                message.SecondaryText = String.Empty;
            }

            var wb = (WindowFrameBackend)Toolkit.GetBackend (transientFor);
            if (wb != null) {
                this.dialogResult = MessageBox.Show (wb.Window, message.Text,message.SecondaryText,
                                                    this.buttons, this.icon, this.defaultResult, this.options);
            } else {
                this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
                                                    this.icon, this.defaultResult, this.options);
            }

            return ConvertResultToCommand (this.dialogResult);
        }
Ejemplo n.º 36
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            GtkAlertDialog alertDialog = new GtkAlertDialog (message);
            alertDialog.FocusButton (message.DefaultButton);
            var wb = (WindowFrameBackend)Toolkit.GetBackend (transientFor);
            var win = wb != null ? wb.Window : null;
            MessageService.ShowCustomDialog (alertDialog, win);
            if (alertDialog.ApplyToAll)
                ApplyToAll = true;
            var res = alertDialog.ResultButton;

            if (res == null) {
                // If the dialog is closed clicking the close window button we may have no result.
                // In that case, try to find a cancelling button
                if (message.Buttons.Contains (Command.Cancel))
                    return Command.Cancel;
                else if (message.Buttons.Contains (Command.No))
                    return Command.No;
                else if (message.Buttons.Contains (Command.Close))
                    return Command.Close;
            }
            return res;
        }
Ejemplo n.º 37
0
 void IBackend.Initialize(object frontend)
 {
     this.frontend = (WindowFrame) frontend;
 }
Ejemplo n.º 38
0
		void IBackend.InitializeBackend (object frontend, ApplicationContext context)
		{
			this.frontend = (WindowFrame) frontend;
			ApplicationContext = context;
		}
Ejemplo n.º 39
0
 public IWindowFrame CreateWindow(string windowType, string windowTitle, IWindowPane pane)
 {
     var tabPage = new TabPage
     {
         Text = windowTitle,
         ImageIndex = 7,
     };
     WindowFrame frame = new WindowFrame(this, windowType, tabPage, pane);
     framesByName.Add(windowType, frame);
     framesByTab.Add(tabPage, frame);
     this.form.DocumentTabs.TabPages.Add(tabPage);
     this.form.DocumentTabs.SelectedTab = tabPage;
     pane.SetSite(services);
     return frame;
 }
Ejemplo n.º 40
0
 private void RemoveFrame(WindowFrame windowFrame)
 {
     var name = framesByName
         .Where(de => de.Value == windowFrame)
         .Select(de => de.Key)
         .SingleOrDefault();
     if (name != null)
         framesByName.Remove(name);
     var page = framesByTab
         .Where(de => de.Value == windowFrame)
         .Select(de => de.Key)
         .SingleOrDefault();
     framesByTab.Remove(page);
 }
Ejemplo n.º 41
0
 public IWindowFrame CreateDocumentWindow(string documentType, object docItem, string documentTitle, IWindowPane pane)
 {
     var tabPage = new TabPage
     {
         Text = documentTitle,
         ImageIndex = 7,
     };
     WindowFrame frame = new WindowFrame(this, documentType, docItem, tabPage, pane);
     framesByTab.Add(tabPage, frame);
     this.form.DocumentTabs.TabPages.Add(tabPage);
     this.form.DocumentTabs.SelectedTab = tabPage;
     pane.SetSite(services);
     return frame;   
 }
Ejemplo n.º 42
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            this.MessageText = message.Text ?? String.Empty;
            this.InformativeText = message.SecondaryText ?? String.Empty;

            if (message.Icon != null)
                Icon = message.Icon.ToImageDescription (Context).ToNSImage ();

            var sortedButtons = new Command [message.Buttons.Count];
            var j = 0;
            if (message.DefaultButton >= 0) {
                sortedButtons [0] = message.Buttons [message.DefaultButton];
                this.AddButton (message.Buttons [message.DefaultButton].Label);
                j = 1;
            }
            for (var i = 0; i < message.Buttons.Count; i++) {
                if (i == message.DefaultButton)
                    continue;
                sortedButtons [j++] = message.Buttons [i];
                this.AddButton (message.Buttons [i].Label);
            }
            for (var i = 0; i < sortedButtons.Length; i++) {
                if (sortedButtons [i].Icon != null) {
                    Buttons [i].Image = sortedButtons [i].Icon.WithSize (IconSize.Small).ToImageDescription (Context).ToNSImage ();
                    Buttons [i].ImagePosition = NSCellImagePosition.ImageLeft;
                }
            }

            if (message.AllowApplyToAll) {
                ShowsSuppressionButton = true;
                SuppressionButton.State = NSCellStateValue.Off;
                SuppressionButton.Activated += (sender, e) => ApplyToAll = SuppressionButton.State == NSCellStateValue.On;
            }

            if (message.Options.Count > 0) {
                AccessoryView = new NSView ();
                var optionsSize = new CGSize (0, 3);

                foreach (var op in message.Options) {
                    var chk = new NSButton ();
                    chk.SetButtonType (NSButtonType.Switch);
                    chk.Title = op.Text;
                    chk.State = op.Value ? NSCellStateValue.On : NSCellStateValue.Off;
                    chk.Activated += (sender, e) => message.SetOptionValue (op.Id, chk.State == NSCellStateValue.On);

                    chk.SizeToFit ();
                    chk.Frame = new CGRect (new CGPoint (0, optionsSize.Height), chk.FittingSize);

                    optionsSize.Height += chk.FittingSize.Height + 6;
                    optionsSize.Width = (float) Math.Max (optionsSize.Width, chk.FittingSize.Width);

                    AccessoryView.AddSubview (chk);
                    chk.NeedsDisplay = true;
                }

                AccessoryView.SetFrameSize (optionsSize);
            }

            var win = Toolkit.CurrentEngine.GetNativeWindow (transientFor) as NSWindow;
            if (win != null)
                return sortedButtons [(int)this.RunSheetModal (win) - 1000];
            return sortedButtons [(int)this.RunModal () - 1000];
        }
Ejemplo n.º 43
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            this.icon = GetIcon (message.Icon);
            if (ConvertButtons (message.Buttons, out buttons) && message.Options.Count == 0) {
                // Use a system message box
                if (message.SecondaryText == null)
                    message.SecondaryText = String.Empty;
                else {
                    message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
                    message.SecondaryText = String.Empty;
                }
                var parent =  Toolkit.CurrentEngine.GetNativeWindow(transientFor) as System.Windows.Window;
                if (parent != null) {
                    this.dialogResult = MessageBox.Show (parent, message.Text, message.SecondaryText,
                                                        this.buttons, this.icon, this.defaultResult, this.options);
                }
                else {
                    this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
                                                        this.icon, this.defaultResult, this.options);
                }
                return ConvertResultToCommand (this.dialogResult);
            }
            else {
                // Custom message box required
                Dialog dlg = new Dialog ();
                dlg.Resizable = false;
                dlg.Padding = 0;
                HBox mainBox = new HBox { Margin = 25 };

                if (message.Icon != null) {
                    var image = new ImageView (message.Icon.WithSize (32,32));
                    mainBox.PackStart (image, vpos: WidgetPlacement.Start);
                }
                VBox box = new VBox () { Margin = 3, MarginLeft = 8, Spacing = 15 };
                mainBox.PackStart (box, true);
                var text = new Label {
                    Text = message.Text ?? ""
                };
                Label stext = null;
                box.PackStart (text);
                if (!string.IsNullOrEmpty (message.SecondaryText)) {
                    stext = new Label {
                        Text = message.SecondaryText
                    };
                    box.PackStart (stext);
                }
                foreach (var option in message.Options) {
                    var check = new CheckBox (option.Text);
                    check.Active = option.Value;
                    box.PackStart(check);
                    check.Toggled += (sender, e) => message.SetOptionValue(option.Id, check.Active);
                }
                dlg.Buttons.Add (message.Buttons.ToArray ());
                if (message.DefaultButton >= 0 && message.DefaultButton < message.Buttons.Count)
                    dlg.DefaultCommand = message.Buttons[message.DefaultButton];
                if (mainBox.Surface.GetPreferredSize (true).Width > 480) {
                    text.Wrap = WrapMode.Word;
                    if (stext != null)
                        stext.Wrap = WrapMode.Word;
                    mainBox.WidthRequest = 480;
                }
                var s = mainBox.Surface.GetPreferredSize (true);

                dlg.Content = mainBox;
                return dlg.Run ();
            }
        }
Ejemplo n.º 44
0
 /// <summary>
 /// Converts the image to a bitmap
 /// </summary>
 /// <returns>The bitmap.</returns>
 /// <param name="renderTarget">Window to be used as reference for determining the resolution of the bitmap</param>
 /// <param name="format">Bitmap format</param>
 public BitmapImage ToBitmap(WindowFrame renderTarget, ImageFormat format = ImageFormat.ARGB32)
 {
     return ToBitmap (renderTarget.Screen.ScaleFactor, format);
 }