Пример #1
0
 internal Cursor(ToolkitCursorType cursorType, Type type, String resource)
 {
     this.type = cursorType;
     this.icon = new Icon(type, resource);
 }
Пример #2
0
 public Cursor(String fileName)
 {
     this.type = ToolkitCursorType.UserDefined;
     this.icon = new Icon(fileName);
 }
Пример #3
0
 public Cursor(Type type, String resource)
 {
     this.type = ToolkitCursorType.UserDefined;
     this.icon = new Icon(type, resource);
 }
Пример #4
0
 // Constructors.
 internal Cursor(ToolkitCursorType type)
 {
     this.type = type;
     this.icon = null;
 }
Пример #5
0
 public Cursor(Stream stream)
 {
     this.type = ToolkitCursorType.UserDefined;
     this.icon = new Icon(stream);
 }
Пример #6
0
 // Set the cursor.  The toolkit may ignore "frame" if it already
 // has a system-defined association for "cursorType".  Setting
 // "cursorType" to "ToolkitCursorType.InheritParent" will reset
 // the cursor to be the same as the parent window's.
 void IToolkitWindow.SetCursor(ToolkitCursorType cursorType, Frame frame)
 {
     // TODO
 }
	// Set the cursor.  The toolkit may ignore "frame" if it already
	// has a system-defined association for "cursorType".  Setting
	// "cursorType" to "ToolkitCursorType.InheritParent" will reset
	// the cursor to be the same as the parent window's.
	void IToolkitWindow.SetCursor(ToolkitCursorType cursorType, Frame frame)
			{
				DrawingWindow.ModifyCursor(this, cursorType, frame);
			}
Пример #8
0
 // Set the cursor.  The toolkit may ignore "frame" if it already
 // has a system-defined association for "cursorType".  Setting
 // "cursorType" to "ToolkitCursorType.InheritParent" will reset
 // the cursor to be the same as the parent window's.
 void IToolkitWindow.SetCursor(ToolkitCursorType cursorType, Frame frame)
 {
     DrawingWindow.ModifyCursor(this, cursorType, frame);
 }
	// Set the cursor.  The toolkit may ignore "frame" if it already
	// has a system-defined association for "cursorType".  Setting
	// "cursorType" to "ToolkitCursorType.InheritParent" will reset
	// the cursor to be the same as the parent window's.
	void IToolkitWindow.SetCursor(ToolkitCursorType cursorType, Frame frame)
	{
		// TODO
	}
Пример #10
0
	internal Cursor(ToolkitCursorType cursorType, Type type, String resource)
			{
				this.type = cursorType;
				this.icon = new Icon(type, resource);
			}
Пример #11
0
        // Modify the cursor on a widget.
        internal static void ModifyCursor
            (Widget widget, ToolkitCursorType cursorType, Frame frame)
        {
            if (cursorType == ToolkitCursorType.InheritParent)
            {
                // Change the cursor back to the same value as the parent.
                widget.Cursor = null;
            }
            else if (cursorType == ToolkitCursorType.Default)
            {
                // Set the default cursor to something matching X.
                widget.Cursor = new Cursor(CursorType.XC_left_ptr);
            }
            else
            {
                // Create a cursor based on the supplied image.
                if (frame != null &&

                    /* irgnore pixel format !
                     * frame.PixelFormat == DotGNU.Images.PixelFormat.Format1bppIndexed
                     * &&
                     */
                    frame.Mask != null)
                {
                    if (cursorType != ToolkitCursorType.UserDefined)
                    {
                        lock (typeof(DrawingWindow))
                        {
                            if (cursors == null)
                            {
                                cursors = new Xsharp.Cursor [32];
                            }
                            Xsharp.Cursor curs = cursors[(int)cursorType];
                            if (curs == null)
                            {
                                cursors[(int)cursorType] = curs =
                                    new Xsharp.Cursor
                                        (widget.Screen, frame);
                            }
                            widget.Cursor = curs;
                        }
                    }
                    else
                    {
                        widget.Cursor = new Xsharp.Cursor
                                            (widget.Screen, frame);
                    }
                    return;
                }

                // Last ditch attempt - use the nearest X11 cursor.
                CursorType type;
                switch (cursorType)
                {
                case ToolkitCursorType.AppStarting:
                    type = CursorType.XC_watch;
                    break;

                case ToolkitCursorType.Arrow:
                case ToolkitCursorType.Default:
                    type = CursorType.XC_left_ptr;
                    break;

                case ToolkitCursorType.Cross:
                    type = CursorType.XC_crosshair;
                    break;

                case ToolkitCursorType.IBeam:
                    type = CursorType.XC_xterm;
                    break;

                case ToolkitCursorType.No:
                    type = CursorType.XC_X_cursor;
                    break;

                case ToolkitCursorType.SizeAll:
                    type = CursorType.XC_fleur;
                    break;

                case ToolkitCursorType.SizeNS:
                case ToolkitCursorType.VSplit:
                    type = CursorType.XC_sb_v_double_arrow;
                    break;

                case ToolkitCursorType.SizeWE:
                case ToolkitCursorType.HSplit:
                    type = CursorType.XC_sb_h_double_arrow;
                    break;

                case ToolkitCursorType.UpArrow:
                    type = CursorType.XC_sb_up_arrow;
                    break;

                case ToolkitCursorType.WaitCursor:
                    type = CursorType.XC_watch;
                    break;

                case ToolkitCursorType.Help:
                    type = CursorType.XC_question_arrow;
                    break;

                case ToolkitCursorType.Hand:
                    type = CursorType.XC_hand2;
                    break;

                case ToolkitCursorType.SizeNWSE:
                case ToolkitCursorType.SizeNESW:
                case ToolkitCursorType.NoMove2D:
                case ToolkitCursorType.NoMoveHoriz:
                case ToolkitCursorType.NoMoveVert:
                case ToolkitCursorType.PanEast:
                case ToolkitCursorType.PanNE:
                case ToolkitCursorType.PanNorth:
                case ToolkitCursorType.PanNW:
                case ToolkitCursorType.PanSE:
                case ToolkitCursorType.PanSouth:
                case ToolkitCursorType.PanSW:
                case ToolkitCursorType.PanWest:
                case ToolkitCursorType.UserDefined:
                default:
                    type = CursorType.XC_circle;
                    break;
                }
                widget.Cursor = new Cursor(type);
            }
        }
Пример #12
0
	public Cursor(Type type, String resource)
			{
				this.type = ToolkitCursorType.UserDefined;
				this.icon = new Icon(type, resource);
			}
Пример #13
0
	public Cursor(String fileName)
			{
				this.type = ToolkitCursorType.UserDefined;
				this.icon = new Icon(fileName);
			}
Пример #14
0
	public Cursor(Stream stream)
			{
				this.type = ToolkitCursorType.UserDefined;
				this.icon = new Icon(stream);
			}
Пример #15
0
	// Constructors.
	internal Cursor(ToolkitCursorType type) 
			{
				this.type = type;
				this.icon = null;
			}
Пример #16
0
	// Modify the cursor on a widget.
	internal static void ModifyCursor
				(Widget widget, ToolkitCursorType cursorType, Frame frame)
			{
				if(cursorType == ToolkitCursorType.InheritParent)
				{
					// Change the cursor back to the same value as the parent.
					widget.Cursor = null;
				}
				else if(cursorType == ToolkitCursorType.Default)
				{
					// Set the default cursor to something matching X.
					widget.Cursor = new Cursor(CursorType.XC_left_ptr);
				}
				else
				{
					// Create a cursor based on the supplied image.
					if(frame != null &&
									 /* irgnore pixel format !
									 frame.PixelFormat == DotGNU.Images.PixelFormat.Format1bppIndexed 
									 &&
									 */
					   frame.Mask != null)
					{
						if(cursorType != ToolkitCursorType.UserDefined)
						{
							lock(typeof(DrawingWindow))
							{
								if(cursors == null)
								{
									cursors = new Xsharp.Cursor [32];
								}
								Xsharp.Cursor curs = cursors[(int)cursorType];
								if(curs == null)
								{
									cursors[(int)cursorType] = curs =
										new Xsharp.Cursor
											(widget.Screen, frame);
								}
								widget.Cursor = curs;
							}
						}
						else
						{
							widget.Cursor = new Xsharp.Cursor
								(widget.Screen, frame);
						}
						return;
					}

					// Last ditch attempt - use the nearest X11 cursor.
					CursorType type;
					switch(cursorType)
					{
						case ToolkitCursorType.AppStarting:
							type = CursorType.XC_watch;
							break;
						case ToolkitCursorType.Arrow:
						case ToolkitCursorType.Default:
							type = CursorType.XC_left_ptr;
							break;
						case ToolkitCursorType.Cross:
							type = CursorType.XC_crosshair;
							break;
						case ToolkitCursorType.IBeam:
							type = CursorType.XC_xterm;
							break;
						case ToolkitCursorType.No:
							type = CursorType.XC_X_cursor;
							break;
						case ToolkitCursorType.SizeAll:
							type = CursorType.XC_fleur;
							break;
						case ToolkitCursorType.SizeNS:
						case ToolkitCursorType.VSplit:
							type = CursorType.XC_sb_v_double_arrow;
							break;
						case ToolkitCursorType.SizeWE:
						case ToolkitCursorType.HSplit:
							type = CursorType.XC_sb_h_double_arrow;
							break;
						case ToolkitCursorType.UpArrow:
							type = CursorType.XC_sb_up_arrow;
							break;
						case ToolkitCursorType.WaitCursor:
							type = CursorType.XC_watch;
							break;
						case ToolkitCursorType.Help:
							type = CursorType.XC_question_arrow;
							break;
						case ToolkitCursorType.Hand:
							type = CursorType.XC_hand2;
							break;
						case ToolkitCursorType.SizeNWSE:
						case ToolkitCursorType.SizeNESW:
						case ToolkitCursorType.NoMove2D:
						case ToolkitCursorType.NoMoveHoriz:
						case ToolkitCursorType.NoMoveVert:
						case ToolkitCursorType.PanEast:
						case ToolkitCursorType.PanNE:
						case ToolkitCursorType.PanNorth:
						case ToolkitCursorType.PanNW:
						case ToolkitCursorType.PanSE:
						case ToolkitCursorType.PanSouth:
						case ToolkitCursorType.PanSW:
						case ToolkitCursorType.PanWest:
						case ToolkitCursorType.UserDefined:
						default:
							type = CursorType.XC_circle;
							break;
					}
					widget.Cursor = new Cursor(type);
				}
			}