public ModifiedUTF8StringData(string value)
     : base(IntPtr.Zero)
 {
     byte[] data = ModifiedUTF8Encoding.GetBytes(value);
     _data = Marshal.AllocHGlobal(data.Length);
     Marshal.Copy(data, 0, _data, data.Length);
 }
    /// <summary>
    /// Retrieve the X11 Display* to pass to VTK's vtkRenderWindow::SetDisplayId
    /// </summary>
    private System.IntPtr GetXDisplay()
    {
      System.Type xplatui = System.Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
      if (xplatui != null)
      {
        System.IntPtr DisplayHandle = (System.IntPtr)xplatui.
          GetField("DisplayHandle", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).
          GetValue(null);
        XDisplay = DisplayHandle;

        // Also, may need possibly:
        // Setup correct X visual and colormap so that VTK OpenGL stuff
        // works properly on mono/X11. Cache the display value so that we
        // can use it to set the RenderWindowId in OnCreated.

        //System.IntPtr RootWindow = (System.IntPtr)xplatui.GetField("RootWindow", System.Reflection.BindingFlags.Static |
        //System.Reflection.BindingFlags.NonPublic).GetValue(null);
        //int ScreenNo = (int)xplatui.GetField("ScreenNo", System.Reflection.BindingFlags.Static | 
        //System.Reflection.BindingFlags.NonPublic).GetValue(null);
        //int[] dblBuf = new int[] { 5, (int)GLXFlags.GLX_RGBA, (int)GLXFlags.GLX_RED_SIZE, 1, (int)GLXFlags.GLX_GREEN_SIZE, 
        //1, (int)GLXFlags.GLX_BLUE_SIZE, 1, (int)GLXFlags.GLX_DEPTH_SIZE, 1, 0 };
        //GLXVisualInfo = glXChooseVisual(DisplayHandle, ScreenNo, dblBuf);
        //XVisualInfo xVisualInfo = (XVisualInfo)Marshal.PtrToStructure(GLXVisualInfo, typeof(XVisualInfo));
        //System.IntPtr visual = System.IntPtr.Zero; // xVisualInfo.visual;
        //System.IntPtr colormap = XCreateColormap(DisplayHandle, RootWindow, visual, 0/*AllocNone*/);
        //xplatui.GetField("CustomVisual", System.Reflection.BindingFlags.Static | 
        //System.Reflection.BindingFlags.NonPublic).SetValue(null, visual);
        //xplatui.GetField("CustomColormap", System.Reflection.BindingFlags.Static | 
        //System.Reflection.BindingFlags.NonPublic).SetValue(null, colormap);
      }

      return XDisplay;
    }
        public void STPActionT4()
        {
            IntPtr p = new IntPtr(int.MaxValue);
            Guid guid = Guid.NewGuid();

            IPAddress ip = IPAddress.Parse("1.2.3.4");
            IWorkItemResult wir = _stp.QueueWorkItem(Action4, long.MinValue, p, ip, guid);
            Assert.IsNull(wir.State);
        }
Exemplo n.º 4
0
        public void ObjectIsolation()
        {
            numRows = image.Height;
            numCols = image.Width;
            data = image.LockBits(new Rectangle(0,0,numCols,numRows), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            stride=data.Stride;
            ptr=data.Scan0;
            nOffset=stride - image.Width*3;
            unsafe
            {
                byte* p;

                p = (byte*)(void*)ptr;
                //p+=stride;
                for (int y = 1; y < numRows - 1; y++)
                {
                    //p+=3;
                    for (int x = 1; x < numCols - 3; x++)
                    {
                        if ((p + x * 3 + stride * y)[0] == 0)
                        {
                            label++;
                            try
                            {
                                startY = 10000;
                                finalY = 0;
                                startX = int.MaxValue;
                                finalX = 0;
                                search(label, y, x);
                                Object singleObject = new Object();
                                singleObject.StartX = startX;
                                singleObject.StartY = startY;
                                singleObject.FinalX = finalX;
                                singleObject.FinalY = finalY;
                                singleObject.Label = label;
                                objects.Add(singleObject);
                            }
                            catch (System.StackOverflowException)
                            {
                                return;
                            }
                        }
                        //p+=3;
                    }
                    //p+=stride;
                }
                int t = 0;
                t++;
            }
            image.UnlockBits(data);
        }
        public void ActionT4()
        {
            IntPtr p = new IntPtr(int.MaxValue);
            Guid guid = Guid.NewGuid();

            IPAddress ip = IPAddress.Parse("1.2.3.4");
            IWorkItemResult wir = _wig.QueueWorkItem(Action4, long.MinValue, p, ip, guid);
            object[] args = wir.State as object[];

            Assert.IsNotNull(args);
            Assert.AreEqual(args.Length, 4);
            Assert.AreEqual(args[0], long.MinValue);
            Assert.AreEqual(args[1], p);
            Assert.AreEqual(args[2], ip);
            Assert.AreEqual(args[3], guid);
        }
        /// <summary>
        /// Allows a windows form to be used as the UI for an anchor window
        /// </summary>
        public static void AttachWindowsForm(
            IVisio.Window anchor_window,
            System.Windows.Forms.Form the_form)
        {
            if (anchor_window == null)
            {
                throw new System.ArgumentNullException(nameof(anchor_window));
            }

            if (the_form == null)
            {
                throw new System.ArgumentNullException(nameof(the_form));
            }

            // Show the form as a modeless dialog.
            the_form.Show();

            // Get the window handle of the form.
            int hwnd = the_form.Handle.ToInt32();
            var hwnd_as_intptr = new System.IntPtr(hwnd);

            // Set the window properties to make it a visible child window.
            const int window_prop_index = Internal.Interop.NativeMethods.GWL_STYLE;
            const int window_prop_value = Internal.Interop.NativeMethods.WS_CHILD | Internal.Interop.NativeMethods.WS_VISIBLE;
            Internal.Interop.NativeMethods.SetWindowLong(hwnd_as_intptr, window_prop_index, window_prop_value);

            // Set the anchor bar window as the parent of the form.
            Internal.Interop.NativeMethods.SetParent(hwnd, anchor_window.WindowHandle32);

            // Force a resize of the anchor bar so it will refresh.
            int left, top, width, height;
            anchor_window.GetWindowRect(out left, out top, out width, out height);
            anchor_window.SetWindowRect(left, top, width - 1, height - 1);
            anchor_window.SetWindowRect(left, top, width, height);

            // Set the dock property of the form to fill, so that the form
            // automatically resizes to the size of the anchor bar.
            the_form.Dock = System.Windows.Forms.DockStyle.Fill;

            // had to set to false to prevent a resizing problem (it was originally set to true)
            the_form.AutoSize = true;
        }
    public bool Open(string FileName)
    {
        // open the existing file for reading
        handle = CreateFile
        (
            FileName,
            GENERIC_READ,
            0,
            0,
            OPEN_EXISTING,
            0,
            0
        );

        if (handle != System.IntPtr.Zero)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
Exemplo n.º 8
0
		static extern void gtk_paint_flat_box (
			GtkStylePointer style,
			GdkWindowPointer window,
			GtkStateType state_type,
			GtkShadowType shadow_type,
			ref GdkRectangle area,
			GtkWidgetPointer widget,
			string detail,
			gint x,
			gint y,
			gint width,
			gint height);
Exemplo n.º 9
0
 private static extern int DrawText(HDC hdc, string lpString, int nCount, ref RECT lpRect, StringFormat uFormat);
 private IPAddress Func4(long p1, IntPtr p2, IPAddress p3, Guid p4)
 {
     return IPAddress.None;
 }
Exemplo n.º 11
0
			public override void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus)
			{
				PaintFunction (
					style,
					window,
					(GtkStateType)state,
					(GtkShadowType)value,
					ref area,
					widget,
					Detail,
					x, y, width,height);
			}
Exemplo n.º 12
0
			public abstract void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus);
Exemplo n.º 13
0
		void Paint (GdkDrawablePointer drawable, GdkGCPointer gc, Rectangle rectangle, WidgetType widgetType, out GdkPixbufPointer pixbuf, out IntPtr pixelData, out int rowstride, Rectangle clippingArea, Painter painter, Rectangle excludedArea)
		{
			gdk_draw_rectangle (drawable, gc, true, clippingArea.X, clippingArea.Y, clippingArea.Width, clippingArea.Height);
			painter.Paint (styles [(int)widgetType], drawable, new GdkRectangle(clippingArea), widgets [(int)widgetType], 0, 0, rectangle.Width, rectangle.Height, this);
			if (excludedArea.Width != 0)
				gdk_draw_rectangle (drawable, gc, true, excludedArea.X, excludedArea.Y, excludedArea.Width, excludedArea.Height);
			if (
				(pixbuf = gdk_pixbuf_new (GdkColorspace.GDK_COLORSPACE_RGB, true, 8, clippingArea.Width, clippingArea.Height)) == IntPtr.Zero ||
				gdk_pixbuf_get_from_drawable (pixbuf, drawable, IntPtr.Zero, clippingArea.X, clippingArea.Y, 0, 0, clippingArea.Width, clippingArea.Height) == IntPtr.Zero)
				throw new OutOfMemoryException ();
			pixelData = gdk_pixbuf_get_pixels (pixbuf);
			rowstride = gdk_pixbuf_get_rowstride (pixbuf);
		}
Exemplo n.º 14
0
 private static extern ColorRef SetBkColor(HDC hdc, ColorRef color);
Exemplo n.º 15
0
		static extern void g_object_unref (gpointer @object);
Exemplo n.º 16
0
		static void GTK_WIDGET_SET_FLAGS (GtkWidgetPointer wid, GtkWidgetFlags flag)
		{
			GtkObject @object = (GtkObject)Marshal.PtrToStructure (wid, typeof (GtkObject));
			@object.flags |= (guint32)flag;
			Marshal.StructureToPtr (@object, wid, false);
		}
Exemplo n.º 17
0
 private static extern bool TextOut(HDC hdc, int nXStart, int nYStart, string lpString, int cbString);
Exemplo n.º 18
0
 private static extern System.IntPtr SelectObject(HDC hdc, System.IntPtr hgdiobj);
Exemplo n.º 19
0
		static extern void gtk_paint_resize_grip (
			GtkStylePointer style,
			GdkWindowPointer window,
			GtkStateType state_type,
			ref GdkRectangle area,
			GtkWidgetPointer widget,
			string detail,
			GdkWindowEdge edge,
			gint x,
			gint y,
			gint width,
			gint height);
Exemplo n.º 20
0
		static extern void g_object_get (gpointer @object, string property_name, out gboolean value, IntPtr nullTerminator);
Exemplo n.º 21
0
		static extern void gtk_paint_slider (
			GtkStylePointer style,
			GdkWindowPointer window,
			GtkStateType state_type,
			GtkShadowType shadow_type,
			ref GdkRectangle area,
			GtkWidgetPointer widget,
			string detail,
			gint x,
			gint y,
			gint width,
			gint height,
			GtkOrientation orientation);
Exemplo n.º 22
0
 private static extern ColorRef GetBkColor(HDC hdc);
Exemplo n.º 23
0
		static extern gpointer g_object_ref (gpointer @object);
Exemplo n.º 24
0
		static extern GtkWidgetPointer gtk_bin_get_child (GtkBinPointer bin);
Exemplo n.º 25
0
		static extern gboolean g_type_check_instance_is_a (GTypeInstancePointer type_instance, GType iface_type);
Exemplo n.º 26
0
		static extern GtkWidgetPointer gtk_radio_button_new (GSListPointer group);
Exemplo n.º 27
0
		protected GtkPlus ()
		{
			widgets = new GtkWidgetPointer [WidgetTypeCount];
			styles = new GtkStylePointer [WidgetTypeCount];
			window = gtk_window_new (GtkWindowType.GTK_WINDOW_TOPLEVEL);
			@fixed = gtk_fixed_new ();
			gtk_container_add (window, @fixed);
			#region Widget types
			#region Button
			gtk_container_add (@fixed, widgets [(int)WidgetType.Button] = gtk_button_new ());
			GTK_WIDGET_SET_FLAGS (widgets [(int)WidgetType.Button], GtkWidgetFlags.GTK_CAN_DEFAULT);
			#endregion
			#region CheckBox
			gtk_container_add (@fixed, widgets [(int)WidgetType.CheckBox] = gtk_check_button_new ());
			#endregion
			#region ComboBox
			gtk_container_add (@fixed, widgets [(int)WidgetType.ComboBox] = gtk_combo_box_entry_new ());
			gtk_widget_realize (widgets [(int)WidgetType.ComboBox]);
			combo_box_drop_down_toggle_button = GetFirstChildWidgetOfType.Get (widgets [(int)WidgetType.ComboBox], gtk_toggle_button_get_type ());
			gtk_widget_realize (combo_box_drop_down_toggle_button);
			combo_box_drop_down_arrow = GetFirstChildWidgetOfType.Get (combo_box_drop_down_toggle_button, gtk_arrow_get_type ());
			g_object_ref (combo_box_drop_down_toggle_button_style = GetWidgetStyle (combo_box_drop_down_toggle_button));
			g_object_ref (combo_box_drop_down_arrow_style = GetWidgetStyle (combo_box_drop_down_arrow));
			#endregion
			#region GroupBox
			gtk_container_add (@fixed, widgets [(int)WidgetType.GroupBox] = gtk_frame_new (null));
			#endregion
			#region ProgressBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.ProgressBar] = gtk_progress_bar_new ());
			#endregion
			#region RadioButton
			gtk_container_add (@fixed, widgets [(int)WidgetType.RadioButton] = gtk_radio_button_new (IntPtr.Zero));
			#endregion
			#region ScrollBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.HScrollBar] = gtk_hscrollbar_new (IntPtr.Zero));
			gtk_container_add (@fixed, widgets [(int)WidgetType.VScrollBar] = gtk_vscrollbar_new (IntPtr.Zero));
			#endregion
			#region StatusBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.StatusBar] = gtk_statusbar_new ());
			#endregion
			#region TabControl
			gtk_container_add (@fixed, widgets [(int)WidgetType.TabControl] = gtk_notebook_new ());
			#endregion
			#region TextBox
			gtk_container_add (@fixed, widgets [(int)WidgetType.TextBox] = gtk_entry_new ());
			#endregion
			#region ToolBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.ToolBar] = gtk_toolbar_new ());

			GtkToolItemPointer tool_button = gtk_tool_button_new (IntPtr.Zero, null);
			gtk_toolbar_insert (widgets [(int)WidgetType.ToolBar], tool_button, -1);
			tool_bar_button = gtk_bin_get_child (tool_button);
			g_object_ref (tool_bar_button_style = GetWidgetStyle (tool_bar_button));

			GtkToolItemPointer toggle_tool_button = gtk_toggle_tool_button_new ();
			gtk_toolbar_insert (widgets [(int)WidgetType.ToolBar], toggle_tool_button, -1);
			tool_bar_toggle_button = gtk_bin_get_child (toggle_tool_button);
			g_object_ref (tool_bar_toggle_button_style = GetWidgetStyle (tool_bar_toggle_button));
			#endregion
			#region TrackBar
			gtk_container_add (@fixed, widgets [(int)WidgetType.HorizontalTrackBar] = gtk_hscale_new_with_range (0, 1, 1));
			gtk_container_add (@fixed, widgets [(int)WidgetType.VerticalTrackBar] = gtk_vscale_new_with_range (0, 1, 1));
			#endregion
			#region TreeView
			gtk_container_add (@fixed, widgets [(int)WidgetType.TreeView] = gtk_tree_view_new ());
			tree_view_column = gtk_tree_view_column_new ();
			gtk_tree_view_insert_column (widgets [(int)WidgetType.TreeView], tree_view_column, -1);
			GtkTreeViewColumn column_structure = (GtkTreeViewColumn)Marshal.PtrToStructure (tree_view_column, typeof (GtkTreeViewColumn));
			tree_view_column_button = column_structure.button;
			g_object_ref (tree_view_column_button_style = GetWidgetStyle (tree_view_column_button));
			#endregion
			#region UpDown
			GtkAdjustmentPointer adjustment = gtk_adjustment_new (0, 0, 0, 0, 0, 0);
			gtk_container_add (@fixed, widgets [(int)WidgetType.UpDown] = gtk_spin_button_new (adjustment, 0, 0));
			#endregion
			#endregion
			for (int widget_index = 0; widget_index < WidgetTypeCount; widget_index++)
				g_object_ref (styles [widget_index] = GetWidgetStyle (widgets [widget_index]));
		}
Exemplo n.º 28
0
		static extern GtkWidgetPointer gtk_spin_button_new (GtkAdjustmentPointer adjustment, gdouble climb_rate, guint digits);
Exemplo n.º 29
0
			public virtual void AttachStyle (WidgetType widgetType, GdkDrawablePointer drawable, GtkPlus gtkPlus)
			{
				gtkPlus.styles [(int)widgetType] = gtk_style_attach (gtkPlus.styles [(int)widgetType], drawable);
			}
Exemplo n.º 30
0
		static extern GtkToolItemPointer gtk_tool_button_new (
			GtkWidgetPointer icon_widget,
			string label);
Exemplo n.º 31
0
			public override void Paint (GtkStylePointer style, GdkWindowPointer window, GdkRectangle area, GtkWidgetPointer widget, gint x, gint y, gint width, gint height, GtkPlus gtkPlus)
			{
				if (@default) {
					gtk_window_set_default (gtkPlus.window, widget);
					gtk_paint_box (
						style,
						window,
						GtkStateType.GTK_STATE_NORMAL,
						GtkShadowType.GTK_SHADOW_IN,
						ref area,
						widget,
						"buttondefault",
						x, y, width, height);
					gtk_window_set_default (gtkPlus.window, IntPtr.Zero);
				} else
					gtk_paint_box (
						style,
						window,
						(GtkStateType)state,
						state == GtkPlusState.Pressed ? GtkShadowType.GTK_SHADOW_IN : GtkShadowType.GTK_SHADOW_OUT,
						ref area,
						widget,
						"button",
						x, y, width, height);
			}
Exemplo n.º 32
0
		static extern GtkWidgetPointer gtk_vscrollbar_new (GtkAdjustmentPointer adjustment);
 private void Action4(long p1, IntPtr p2, IPAddress p3, Guid p4)
 {
 }
Exemplo n.º 34
0
		static extern void gtk_paint_expander (
			GtkStylePointer style,
			GdkWindowPointer window,
			GtkStateType state_type,
			ref GdkRectangle area,
			GtkWidgetPointer widget,
			string detail,
			gint x,
			gint y,
			GtkExpanderStyle expander_style);
Exemplo n.º 35
0
		static extern void gtk_paint_extension (
			GtkStylePointer style,
			GdkWindowPointer window,
			GtkStateType state_type,
			GtkShadowType shadow_type,
			ref GdkRectangle area,
			GtkWidgetPointer widget,
			string detail,
			gint x,
			gint y,
			gint width,
			gint height,
			GtkPositionType gap_side);
Exemplo n.º 36
0
 private static extern bool internalLineDDA(int nXStart, int nYStart, int nXEnd, int nYEnd, internalLineDDAProc lpLineFunc, System.IntPtr lpData);