Exemple #1
0
        public DataViewControl(DataView dv)
        {
            dataView = dv;

            selStartPos = new Position();
            selEndPos   = new Position();

            imContext = new IMContextSimple();
        }
		public EntryCanvasElement ()
		{
			currentEntry = "";
			CaretOffset = 0;
			CaretHighlightOffset = -1;

			imContext = new IMMulticontext ();
			imContext.PreeditChanged += HandlePreeditChanged;
			imContext.PreeditStart += HandlePreeditStart;
			imContext.PreeditEnd += HandlePreeditEnd;
			imContext.RetrieveSurrounding += HandleRetrieveSurrounding;
			imContext.SurroundingDeleted += HandleSurroundingDeleted;
			imContext.Commit += HandleCommit;

			SetPreferedSize (200, 30);

			preEditLabel = new LabelCanvasElement ("");
			preEditLabel.YAlign = 0.5;
			preEditLabel.Opacity = 0.5;
			preEditLabel.InputTransparent = true;
			Add (preEditLabel);
		}
 public static void SetImCursorLocation(Gtk.IMContext ctx, Gdk.Window clientWindow, Gdk.Rectangle cursor)
 {
     // work around GTK+ Bug 663096 - Windows IME position is wrong when Aero glass is enabled
     // https://bugzilla.gnome.org/show_bug.cgi?id=663096
     if (Platform.IsWindows && System.Environment.OSVersion.Version.Major >= 6)
     {
         bool enabled;
         if (DwmIsCompositionEnabled(out enabled) == 0 && enabled)
         {
             var       hwnd = gdk_win32_drawable_get_handle(clientWindow.Toplevel.Handle);
             Win32Rect rect;
             // this module gets the WINVER=6 version of GetWindowRect, which returns the correct value
             if (GetWindowRect(hwnd, out rect))
             {
                 int x, y;
                 clientWindow.Toplevel.GetPosition(out x, out y);
                 cursor.X = cursor.X - x + rect.Left;
                 cursor.Y = cursor.Y - y + rect.Top - cursor.Height;
             }
         }
     }
     ctx.CursorLocation = cursor;
 }