예제 #1
0
        void CreateNativeWindow(WindowClass @class, WindowAttributes attrib, Rect r)
        {
            Debug.Print("Creating window...");

            OSStatus err = API.CreateNewWindow(@class, attrib, ref r, out WinHandle);

            API.CheckReturn(err);
            Debug.Print("Created window " + WinHandle.ToString());

            IntPtr titleCF = CF.CFSTR(title);

            Debug.Print("Setting window title: {0},   CFstring : {1},  Text : {2}", WinHandle, titleCF, title);
            API.SetWindowTitleWithCFString(WinHandle, titleCF);

            SetLocation(r.X, r.Y);
            SetSize(r.Width, r.Height);
            LoadSize();

            Rect titleSize = API.GetWindowBounds(WinHandle, WindowRegionCode.TitleBarRegion);

            mTitlebarHeight = titleSize.Height;
            Debug.Print("Titlebar size: {0}", titleSize);
            ConnectEvents();
            Debug.Print("Attached window events.");
        }
예제 #2
0
        IntPtr GetPasteboard()
        {
            if (pbStr == IntPtr.Zero)
            {
                pbStr = CF.CFSTR("com.apple.pasteboard.clipboard");
                utf16 = CF.CFSTR("public.utf16-plain-text");
                utf8  = CF.CFSTR("public.utf8-plain-text");
            }

            IntPtr   pbRef;
            OSStatus err = API.PasteboardCreate(pbStr, out pbRef);

            if (err != OSStatus.NoError)
            {
                throw new MacOSException(err, "Creating Pasteboard reference.");
            }
            API.PasteboardSynchronize(pbRef);
            return(pbRef);
        }