示例#1
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static void XFillArc(IntPtr x11display, IntPtr x11drawable, IntPtr x11gc, TInt x, TInt y, TUint width, TUint height, TInt angle1, TInt angle2);
        /// <summary> Draw the frame ( 3D effect). </summary>
        /// <param name="display"> The display pointer, that specifies the connection to the X server. <see cref="IntPtr"/> </param>
        /// <param name="window"> The window to draw on. <see cref="IntPtr"/> </param>
        /// <param name="gc"> The graphics context to use for drawing. <see cref="IntPtr"/> </param>
        /// <param name="clientArea"> The area to draw the shadow on. <see cref="TRectangle"/> </param>
        /// <param name="frameType"> The frame type to draw. <see cref="TFrameTypeExt"/> </param>
        /// <param name="darkShadow"> The X11 border pixel do use for dark shadow drawing. <see cref="TPixel"/> </param>
        /// <param name="lightShadow"> The X11 border pixel do use for light shadow drawing.<see cref="TPixel"/> </param>
        internal virtual void DrawFrame(IntPtr display, IntPtr window, IntPtr gc, TRectangle clientArea, TFrameTypeExt frameType, TPixel darkShadow, TPixel lightShadow)
        {
            if (display == IntPtr.Zero)
            {
                Console.WriteLine(CLASS_NAME + "::DrawFrame () ERROR: Argument null: display");
                return;
            }
            if (window == IntPtr.Zero)
            {
                Console.WriteLine(CLASS_NAME + "::DrawFrame () ERROR: Argument null: window");
                return;
            }
            if (gc == IntPtr.Zero)
            {
                Console.WriteLine(CLASS_NAME + "::DrawFrame () ERROR: Argument null: gc");
                return;
            }

            if (frameType == TFrameTypeExt.None)
            {
                return;
            }

            X11lib.XGCValues xgcValues = new X11lib.XGCValues();
            xgcValues.line_width = (X11.TInt) 1;
            TUint xgcMask = (TUint)(X11lib.GCattributemask.GCLineWidth);

            X11lib.XChangeGC(display, gc, xgcMask, ref xgcValues);

            if (frameType == TFrameTypeExt.Raised || frameType == TFrameTypeExt.Sunken ||
                frameType == TFrameTypeExt.RaisedTopTab || frameType == TFrameTypeExt.RaisedLeftTab ||
                frameType == TFrameTypeExt.RaisedRightTab || frameType == TFrameTypeExt.RaisedBottomTab ||
                frameType == TFrameTypeExt.RaisedTopTabTail || frameType == TFrameTypeExt.SunkenTopTabTail ||
                frameType == TFrameTypeExt.UnraisedTopTab || frameType == TFrameTypeExt.UnraisedLeftTab ||
                frameType == TFrameTypeExt.UnraisedRightTab || frameType == TFrameTypeExt.UnraisedBottomTab ||
                frameType == TFrameTypeExt.UnraisedTopTabTail || frameType == TFrameTypeExt.UnsunkenTopTabTail ||
                frameType == TFrameTypeExt.SunkenTopTab || frameType == TFrameTypeExt.SunkenLeftTab ||
                frameType == TFrameTypeExt.SunkenRightTab || frameType == TFrameTypeExt.SunkenBottomTab ||
                frameType == TFrameTypeExt.UnsunkenTopTab || frameType == TFrameTypeExt.UnsunkenLeftTab ||
                frameType == TFrameTypeExt.UnsunkenRightTab || frameType == TFrameTypeExt.UnsunkenBottomTab)
            {
                bool raised = true;

                if (frameType == TFrameTypeExt.Sunken ||
                    frameType == TFrameTypeExt.SunkenTopTab || frameType == TFrameTypeExt.SunkenTopTabTail ||
                    frameType == TFrameTypeExt.SunkenLeftTab || frameType == TFrameTypeExt.SunkenRightTab ||
                    frameType == TFrameTypeExt.SunkenBottomTab ||
                    frameType == TFrameTypeExt.UnsunkenTopTab || frameType == TFrameTypeExt.UnsunkenTopTabTail ||
                    frameType == TFrameTypeExt.UnsunkenLeftTab || frameType == TFrameTypeExt.UnsunkenRightTab ||
                    frameType == TFrameTypeExt.UnsunkenBottomTab)
                {
                    raised = false;
                }

                // Right and bottom edge.
                X11lib.XSetForeground(display, gc, (raised ? darkShadow : lightShadow));
                for (int width = 0; width < _frameWidth; width++)
                {
                    // Right.
                    if (frameType != TFrameTypeExt.RaisedLeftTab && frameType != TFrameTypeExt.SunkenLeftTab &&
                        frameType != TFrameTypeExt.UnraisedRightTab && frameType != TFrameTypeExt.UnraisedTopTab &&
                        frameType != TFrameTypeExt.UnraisedTopTabTail && frameType != TFrameTypeExt.UnraisedBottomTab &&
                        frameType != TFrameTypeExt.UnsunkenRightTab && frameType != TFrameTypeExt.UnsunkenTopTab &&
                        frameType != TFrameTypeExt.UnsunkenTopTabTail && frameType != TFrameTypeExt.UnsunkenBottomTab)
                    {
                        if (frameType == TFrameTypeExt.UnraisedLeftTab || frameType == TFrameTypeExt.UnsunkenLeftTab)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Top - 1,
                                             (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom + 1);
                        }
                        else if (frameType == TFrameTypeExt.RaisedTopTab || frameType == TFrameTypeExt.SunkenTopTab ||
                                 frameType == TFrameTypeExt.RaisedTopTabTail || frameType == TFrameTypeExt.SunkenTopTabTail)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Top,
                                             (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom);
                        }
                        else if (frameType == TFrameTypeExt.RaisedBottomTab || frameType == TFrameTypeExt.SunkenBottomTab)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Top - 1,
                                             (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom);
                        }
                        else
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Top + width,
                                             (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom - width);
                        }
                    }
                    // Bottom.
                    if (frameType != TFrameTypeExt.RaisedTopTab && frameType != TFrameTypeExt.RaisedTopTabTail &&
                        frameType != TFrameTypeExt.SunkenTopTab && frameType != TFrameTypeExt.SunkenTopTabTail &&
                        frameType != TFrameTypeExt.UnraisedBottomTab && frameType != TFrameTypeExt.UnraisedLeftTab && frameType != TFrameTypeExt.UnraisedRightTab &&
                        frameType != TFrameTypeExt.UnsunkenBottomTab && frameType != TFrameTypeExt.UnsunkenLeftTab && frameType != TFrameTypeExt.UnsunkenRightTab)
                    {
                        if (frameType == TFrameTypeExt.UnraisedTopTab || frameType == TFrameTypeExt.UnraisedTopTabTail ||
                            frameType == TFrameTypeExt.UnsunkenTopTab || frameType == TFrameTypeExt.UnsunkenTopTabTail)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left - 1, (TInt)clientArea.Bottom - 1 - width,
                                             (TInt)clientArea.Right - 1 + 1, (TInt)clientArea.Bottom - 1 - width);
                        }
                        else
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Bottom - 1 - width,
                                             (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom - 1 - width);
                        }
                    }
                }

                // Top and Left edge.
                X11lib.XSetForeground(display, gc, (raised ? lightShadow : darkShadow));
                for (int width = 0; width < _frameWidth; width++)
                {
                    // Top.
                    if (frameType != TFrameTypeExt.RaisedBottomTab && frameType != TFrameTypeExt.SunkenBottomTab &&
                        frameType != TFrameTypeExt.UnraisedTopTab && frameType != TFrameTypeExt.UnraisedTopTabTail &&
                        frameType != TFrameTypeExt.UnraisedLeftTab && frameType != TFrameTypeExt.UnraisedRightTab &&
                        frameType != TFrameTypeExt.UnsunkenTopTab && frameType != TFrameTypeExt.UnsunkenTopTabTail &&
                        frameType != TFrameTypeExt.UnsunkenLeftTab && frameType != TFrameTypeExt.UnsunkenRightTab)
                    {
                        if (frameType == TFrameTypeExt.UnraisedBottomTab || frameType == TFrameTypeExt.UnsunkenBottomTab)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left - 1, (TInt)clientArea.Top + width,
                                             (TInt)clientArea.Right + 1, (TInt)clientArea.Top + width);
                        }
                        else
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top + width,
                                             (TInt)clientArea.Right - width, (TInt)clientArea.Top + width);
                        }
                    }
                    // Left.
                    if (frameType != TFrameTypeExt.RaisedRightTab && frameType != TFrameTypeExt.SunkenRightTab &&
                        frameType != TFrameTypeExt.UnraisedLeftTab && frameType != TFrameTypeExt.UnraisedTopTab &&
                        frameType != TFrameTypeExt.UnraisedTopTabTail && frameType != TFrameTypeExt.UnraisedBottomTab &&
                        frameType != TFrameTypeExt.UnsunkenLeftTab && frameType != TFrameTypeExt.UnsunkenTopTab &&
                        frameType != TFrameTypeExt.UnsunkenTopTabTail && frameType != TFrameTypeExt.UnsunkenBottomTab)
                    {
                        if (frameType == TFrameTypeExt.UnraisedRightTab || frameType == TFrameTypeExt.UnsunkenRightTab)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top - 1,
                                             (TInt)clientArea.Left + width, (TInt)clientArea.Bottom + 1);
                        }
                        else if (frameType == TFrameTypeExt.RaisedTopTab || frameType == TFrameTypeExt.SunkenTopTab ||
                                 frameType == TFrameTypeExt.RaisedTopTabTail || frameType == TFrameTypeExt.SunkenTopTabTail)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top,
                                             (TInt)clientArea.Left + width, (TInt)clientArea.Bottom + 1);
                        }
                        else if (frameType == TFrameTypeExt.RaisedBottomTab || frameType == TFrameTypeExt.SunkenBottomTab)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top - 1,
                                             (TInt)clientArea.Left + width, (TInt)clientArea.Bottom - width);
                        }
                        else
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top + width,
                                             (TInt)clientArea.Left + width, (TInt)clientArea.Bottom - width);
                        }
                    }
                }
                // Finish right bottom edge.
                if (frameType == TFrameTypeExt.RaisedTopTab || frameType == TFrameTypeExt.SunkenTopTab)
                {
                    X11lib.XSetForeground(display, gc, (raised ? lightShadow : darkShadow));
                    for (int width = 0; width < _frameWidth; width++)
                    {
                        if (width >= 1)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Right - _frameWidth + width, (TInt)clientArea.Bottom - width,
                                             (TInt)clientArea.Right - _frameWidth + width, (TInt)clientArea.Bottom);
                        }
                    }
                }
                if (frameType == TFrameTypeExt.UnraisedTopTabTail || frameType == TFrameTypeExt.UnsunkenTopTabTail)
                {
                    X11lib.XSetForeground(display, gc, (raised ? lightShadow : darkShadow));
                    for (int width = 0; width < _frameWidth; width++)
                    {
                        if (width >= 1)
                        {
                            X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Right - _frameWidth + width, (TInt)clientArea.Bottom - width,
                                             (TInt)clientArea.Right - _frameWidth + width, (TInt)clientArea.Bottom);
                        }
                    }
                }
                // Finish top left edge.
                // else if (frameType == TFrameTypeExt.RaisedBottomTab     || frameType == TFrameTypeExt.SunkenBottomTab)
            }
            else if (frameType == TFrameTypeExt.Chiseled || frameType == TFrameTypeExt.Ledged)
            {
                int halfWidth = _frameWidth / 2;

                // Bottom and right edge.
                X11lib.XSetForeground(display, gc, (frameType == TFrameTypeExt.Chiseled ? lightShadow : darkShadow));
                for (int width = 0; width < halfWidth; width++)
                {
                    X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Top + width,
                                     (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom - width);
                    X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Bottom - 1 - width,
                                     (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom - 1 - width);
                }
                X11lib.XSetForeground(display, gc, (frameType == TFrameTypeExt.Chiseled ? darkShadow : lightShadow));
                for (int width = halfWidth; width < _frameWidth; width++)
                {
                    X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Top + width,
                                     (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom - width);
                    X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Bottom - 1 - width,
                                     (TInt)clientArea.Right - 1 - width, (TInt)clientArea.Bottom - 1 - width);
                }

                // Top and left edge.
                X11lib.XSetForeground(display, gc, (frameType == TFrameTypeExt.Chiseled ? darkShadow : lightShadow));
                for (int width = 0; width < halfWidth; width++)
                {
                    X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top + width,
                                     (TInt)clientArea.X + width, (TInt)clientArea.Bottom - width);
                    X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top + width,
                                     (TInt)clientArea.Right - width, (TInt)clientArea.Top + width);
                }
                X11lib.XSetForeground(display, gc, (frameType == TFrameTypeExt.Chiseled ? lightShadow : darkShadow));
                for (int width = halfWidth; width < _frameWidth; width++)
                {
                    X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top + width,
                                     (TInt)clientArea.X + width, (TInt)clientArea.Bottom - width);
                    X11lib.XDrawLine(display, window, gc, (TInt)clientArea.Left + width, (TInt)clientArea.Top + width,
                                     (TInt)clientArea.Right - width, (TInt)clientArea.Top + width);
                }
            }
        }
示例#3
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static void XChangeGC(IntPtr x11display, IntPtr x11gc, TUint valuemask, ref XGCValues values);
示例#4
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static void XFillRectangle(IntPtr x11display, IntPtr x11drawable, IntPtr x11gc, TInt x, TInt y, TUint width, TUint height);
示例#5
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static TPixmap XReadBitmapFile(IntPtr x11display, IntPtr X11drawableSrc, TChar[] filepath,
                                              ref TUint widthReturn, ref TUint heightReturn, ref IntPtr pixmapReturn,
                                              ref TInt xHotReturn, ref TInt yHotReturn);
示例#6
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static int XGetGCValues(IntPtr x11display, IntPtr x11gc, TUint valuemask, ref XGCValues values);
示例#7
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static void XCopyPlane(IntPtr x11display, IntPtr X11drawableSrc, IntPtr X11drawableDest, IntPtr X11gc, TInt srcOffsetX, TInt srcOffsetY, TUint width, TUint height, TInt dstOffsetX, TInt dstOffsetY, TUlong plane);
示例#8
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static IntPtr XCreateSimpleWindow(IntPtr x11display, IntPtr x11window, TInt x, TInt y, TUint width, TUint height,
                                                 TUint outsideBorderWidth, TPixel border, TPixel background);
示例#9
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static void XPutImage(IntPtr x11display, IntPtr x11drawable, IntPtr X11gc, IntPtr image, TInt srcOffsetX, TInt srcOffsetY, TInt destX, TInt destY, TUint width, TUint height);
示例#10
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static IntPtr XCreatePixmap(IntPtr x11display, IntPtr x11drawable, TUint width, TUint height, TUint depth);
示例#11
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static IntPtr XCreateImage(IntPtr x11display, IntPtr x11visual, TUint depth, TImageFormat imageFormat, TInt offset, IntPtr data, TUint width, TUint height, TInt bitmapPad, TInt bytesPerLine);
示例#12
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static IntPtr XCreateImage(IntPtr x11display, IntPtr x11visual, TUint depth, TImageFormat imageFormat, TInt offset, [MarshalAs(UnmanagedType.U1)] byte[] data, TUint width, TUint height, TInt bitmapPad, TInt bytesPerLine);
示例#13
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static IntPtr XCreateWindow(IntPtr x11display, IntPtr x11window, TInt x, TInt y, TUint width, TUint height, TUint outsideBorderWidth,
                                           TInt depth, TUint cls, IntPtr x11visual, WindowAttributeMask valueMask, ref XSetWindowAttributes attributes);
示例#14
0
 public static extern TBoolean     XIWarpPointer(IntPtr display, TInt deviceid, IntPtr src_win,
                                                 IntPtr dst_win, double src_x, double src_y, TUint src_width, TUint src_height, double dst_x, double dst_y);
示例#15
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static TPixmap XCreateBitmapFromData(IntPtr x11display, IntPtr X11drawableSrc, TUchar[] data, TUint width, TUint height);
示例#16
0
 extern public static void XRenderFillRectangle(IntPtr x11display, TInt xRenderPictureOp, IntPtr pictureDestination,
                                                ref XRenderColor color, TInt x, TInt y, TUint width, TUint height);
示例#17
0
文件: lib.cs 项目: RoseLeBlood/libral
 extern public static void XMoveResizeWindow(IntPtr x11display, IntPtr x11window, TInt x, TInt y, TUint width, TUint height);