public XWindow createItemWindow(XWindow xWindow)
        {
            // xMSF is set by initialize(Object[])
            try
            {
                // get XWindowPeer
                XWindowPeer xWinPeer = (XWindowPeer)xWindow;
                Object      o        = _xMsf.createInstanceWithContext("com.sun.star.awt.Toolkit", OO.GetContext());
                XToolkit    xToolkit = (XToolkit)o;
                // create WindowDescriptor
                WindowDescriptor wd = new WindowDescriptor();
                wd.Type              = WindowClass.SIMPLE;
                wd.Parent            = xWinPeer;
                wd.Bounds            = new Rectangle(0, 0, 20, 23);
                wd.ParentIndex       = (short)-1;
                wd.WindowAttributes  = WindowAttribute.SHOW;
                wd.WindowServiceName = "pushbutton";
                // create Button
                XWindowPeer cBox_xWinPeer = xToolkit.createWindow(wd);// null here
                var         xButton       = (XButton)cBox_xWinPeer;
                xButton.setLabel("My Texte");
                XWindow cBox_xWindow = (XWindow)cBox_xWinPeer;
                cBox_xWindow.addKeyListener(this);

                return(cBox_xWindow);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("createItemWindow left not o.k.\n" + e);
                return(null);
            }
        }
Example #2
0
        public override void UpdateSelection(ICmObject currentObject)
        {
            CheckDisposed();

            XWindow  window = (XWindow)m_mediator.PropertyTable.GetValue("window");
            TreeView tree   = (TreeView)window.TreeStyleRecordList;

            if (currentObject == null)
            {
                tree.SelectedNode = null;
                m_clickNode       = null;           // otherwise we can try to promote a deleted one etc.
                return;
            }

            TreeNode node = null;

            if (m_hvoToTreeNodeTable.ContainsKey(currentObject.Hvo))
            {
                node = m_hvoToTreeNodeTable[currentObject.Hvo];
            }
            //Debug.Assert(node != null);
            // node.EnsureVisible() throws an exception if tree != node.TreeView, and this can
            // happen somehow.  (see LT-986)
            if (node != null && node.TreeView == tree && (tree.SelectedNode != node))
            {
                tree.SelectedNode = node;
                EnsureSelectedNodeVisible(tree);
            }
        }
Example #3
0
            // Determine if we want a particular widget in a map request.
            private bool WantThisWindow(IntPtr dpy, XWindow window)
            {
                // Bail out if the parent already has an embedded child.
                if (embedParent.child != XWindow.Zero)
                {
                    return(false);
                }

                // Ignore the window if it is a transient, because
                // we don't want dialog boxes that are displayed before
                // the main window to get accidentally reparented.
                XWindow transientFor;

                if (Xlib.XGetTransientForHint(dpy, window, out transientFor)
                    != XStatus.Zero)
                {
                    // KDE apps that act like a top-level dialog
                    // (kcalc, kfind, etc) specific the root window
                    // as their parent.  We assume that such windows
                    // are actually the main window of the app.
                    if (transientFor !=
                        Xlib.XRootWindowOfScreen(screen.screen))
                    {
                        return(false);
                    }
                }

                // We want this widget.
                return(true);
            }
Example #4
0
        /// <summary>
        /// <para>Process a color theme change for this widget.</para>
        /// </summary>
        public override void ThemeChange()
        {
            // Pass the theme change on to all of the child widgets.
            base.ThemeChange();

            // Change the background pixel to match the new theme
            // settings, and then force a repaint on the widget.
            try
            {
                IntPtr        display = dpy.Lock();
                XWindow       window  = GetWidgetHandle();
                StandardColor sc      = background.Index;
                if (sc != StandardColor.Inherit &&
                    sc != StandardColor.Pixmap &&
                    sc != StandardColor.RGB)
                {
                    Xlib.XSetWindowBackground
                        (display, window, ToPixel(background));
                }
                if (mapped && AncestorsMapped)
                {
                    Xlib.XClearArea(display, window,
                                    0, 0, (uint)0, (uint)0,
                                    XBool.True);
                }
            }
            finally
            {
                dpy.Unlock();
            }
        }
        public override void PopulateRecordBar(RecordList recList)
        {
            CheckDisposed();

            // The ListBar has a problem in that when it is populated for the first time the horizonal
            // scroll scrolls over a little ways over hiding the left most + or -. I (Rand) sent some
            // time searching this out and found that it is a bug in the ListView control.  It is not
            // our bug.  The scrolling happens when EnsureVisible() is called on the listview.  I found
            // a way around it. By calling this method twice the bug goes away, it looks like the list
            // must be populated, cleared, then repopulated before the bug is bypassed. There are also
            // other things that have an effect on it, such as ClearListBar() must be before
            // BeginUpdate().  Also selection must be made before ExpandAll() or CollapseAll() is called.

            // JohnT: no, the problem is when we EnsureVisible of a node that is wider than the window.
            // EnsureVisble tries to show as much as possible of the label; since it won't fit, it scrolls
            // horizontally and hides the plus/minus.
            // To avoid this if it is desired to EnsureVisible, use the EnsureSelectedNodeVisible routine
            // (which temporarily makes the label short while calling EnsureVisible).
            // (I'm not sure why Rand's comment is in this exact location, so I'm not deleting it.)

            if (this.IsShowing)
            {
                m_fOutOfDate = false;
            }
            else
            {
                m_fOutOfDate = true;
                return;
            }

            XWindow window = (XWindow)m_mediator.PropertyTable.GetValue("window");

            window.TreeBarControl.IsFlatList = true;
            window.Cursor = Cursors.WaitCursor;
            ListView list = (ListView)window.ListStyleRecordList;

            list.BeginUpdate();
            window.ClearRecordBarList();                //don't want to directly clear the nodes, because that causes an event to be fired as every single note is removed!
            m_hvoToListViewItemTable.Clear();

            AddListViewItems(recList.SortedObjects, list);
            try
            {
                list.Font = new System.Drawing.Font(recList.FontName, recList.TypeSize);
            }
            catch (Exception error)
            {
                ErrorReporter.ReportException(error, null, false);
            }


            UpdateSelection(recList.CurrentObject);
            list.EndUpdate();

            if (list.SelectedItems.Count > 0)
            {
            }             //list.s .EnsureVisible();

            window.Cursor = Cursors.Default;
        }
Example #6
0
        /// <summary>
        /// Handle a right mouse up, invoking an appropriate context menu.
        /// </summary>
        /// <param name="pt"></param>
        /// <param name="rcSrcRoot"></param>
        /// <param name="rcDstRoot"></param>
        /// <returns></returns>
        protected override bool DoContextMenu(IVwSelection sel, Point pt, Rectangle rcSrcRoot, Rectangle rcDstRoot)
        {
            // Allow base method to handle spell check problems, if any.
            if (base.DoContextMenu(sel, pt, rcSrcRoot, rcDstRoot))
            {
                return(true);
            }

            XWindow mainWind = this.ParentForm as XWindow;

            if (mainWind == null || sel == null)
            {
                return(false);
            }
            ITsString tssWord;

            sel.GrowToWord().GetSelectionString(out tssWord, " ");
            TemporaryColleagueParameter tempColleague = null;

            if (tssWord != null && !string.IsNullOrEmpty(tssWord.Text))
            {
                // We can have a WfiWordformUi as an additional colleague to handle more menu items.
                // The temporaray colleague handles adding and removing it.
                int form = WfiWordform.FindOrCreateWordform(Cache, tssWord, true);

                CmObjectUi ui = CmObjectUi.MakeUi(Cache, form);
                ui.Mediator   = m_mediator;
                tempColleague = new TemporaryColleagueParameter(m_mediator, ui, false);
            }

            mainWind.ShowContextMenu("mnuIText-RawText", new Point(Cursor.Position.X, Cursor.Position.Y),
                                     tempColleague, null);
            return(true);
        }
        public InputManager()
        {
            _inputs = new Dictionary <ConsoleKey, KeyStatus>();

            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                var display = new XDisplay(":0.0");
                _mainWin = new XWindow(display);
                _xevent  = new XEvent(display);
                bool a = false;
                _mainWin.SelectInput(XEventMask.KeyPressMask | XEventMask.KeyReleaseMask);
                XDisplay.XkbSetDetectableAutoRepeat(display.Handle, true, ref a);

                _xevent.KeyPressHandlerEvent += (ev, window, root, subwindow) =>
                {
                    //Console.WriteLine("Pressed:" + ev.keycode);
                    HandleGenericKeyStatus(X11ToConsoleKey(ev), new KeyState()
                    {
                        IsPressed = true
                    });
                };
                _xevent.KeyReleaseHandlerEvent += (ev, window, root, subwindow) =>
                {
                    //Console.WriteLine("Released:" + ev.keycode);
                    HandleGenericKeyStatus(X11ToConsoleKey(ev), new KeyState()
                    {
                        IsPressed = false
                    });
                };
            }
        }
 /// <summary>
 /// Launch the Respeller dlg.
 /// </summary>
 /// <param name="argument">The xCore Command object.</param>
 /// <returns>true</returns>
 public bool OnLaunchRespellerDlg(object argument)
 {
     CheckDisposed();
     if (!InFriendliestTool)                     // See LT-8641.
     {
         LaunchRespellerDlgOnWord(ActiveWord());
         return(true);
     }
     using (RecordClerk.ListUpdateHelper luh = new RecordClerk.ListUpdateHelper(m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk))
     {
         // Launch the Respeller Dlg.
         using (RespellerDlg dlg = new RespellerDlg())
         {
             XWindow xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
             if (dlg.SetDlgInfo(m_mediator, m_configurationParameters))
             {
                 dlg.ShowDialog(xwindow);
             }
             else
             {
                 MessageBox.Show(MEStrings.ksCannotRespellWordform);
             }
         }
         // We assume that RespellerDlg made all the necessary changes to relevant lists.
         // no need to reload due to a propchange (e.g. change in paragraph contents).
         luh.TriggerPendingReloadOnDispose = false;
     }
     return(true);
 }
        private void LaunchRespellerDlgOnWord(ITsString tss)
        {
            if (tss == null || string.IsNullOrEmpty(tss.Text))
            {
                return;
            }
            FdoCache cache       = m_mediator.PropertyTable.GetValue("cache") as FdoCache;
            int      hvoWordform = WfiWordform.FindOrCreateWordform(cache, tss);

            if (hvoWordform == 0)
            {
                return;                 // paranoia.
            }
            IWfiWordform wf = WfiWordform.CreateFromDBObject(cache, hvoWordform);

            using (RecordClerk.ListUpdateHelper luh = new RecordClerk.ListUpdateHelper(m_mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk))
            {
                // Launch the Respeller Dlg.
                using (RespellerDlg dlg = new RespellerDlg())
                {
                    XWindow xwindow = m_mediator.PropertyTable.GetValue("window") as XWindow;
                    if (dlg.SetDlgInfo2(wf, m_mediator, m_configurationParameters))
                    {
                        dlg.ShowDialog(xwindow);
                    }
                    else
                    {
                        MessageBox.Show(MEStrings.ksCannotRespellWordform);
                    }
                }
                // We assume that RespellerDlg made all the necessary changes to relevant lists.
                // no need to reload due to a propchange (e.g. change in paragraph contents).
                luh.TriggerPendingReloadOnDispose = false;
            }
        }
Example #10
0
        // Remove an element from this handle map.
        public void Remove(XWindow window)
        {
            // Look in the main part of the table.
            int hash = (((int)window) & (HashSize - 1));

            if (handles[hash].window == window)
            {
                handles[hash].window = XWindow.Zero;
                handles[hash].widget = null;
                return;
            }

            // Look in the overflow part of the table.
            HandleOverflowInfo info = handles[hash].overflow;

            while (info != null)
            {
                if (info.window == window)
                {
                    info.window = XWindow.Zero;
                    info.widget = null;
                    return;
                }
                info = info.overflow;
            }
        }
Example #11
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }

            base.Dispose(disposing);

            if (disposing)
            {
                // Do this after base class call,
                // as it will dispose the browse view,
                // which wants the mediator still kicking.
                // when it tires to get a RecordClerk out of it.
                if (m_myOwnPrivateMediator != null)
                {
                    m_myOwnPrivateMediator.Dispose();
                }
            }
            m_xwindow = null;
            m_cache   = null;
            m_myOwnPrivateMediator = null;
        }
Example #12
0
        // Set this cursor on a widget.
        internal void SetCursor(Widget widget)
        {
            Display dpy = widget.dpy;

            try
            {
                IntPtr  display = dpy.Lock();
                XWindow window  = widget.GetWidgetHandle();
                if (source != null)
                {
                    if (cursor == XCursor.Zero)
                    {
                        XColor foreground = new XColor();
                        foreground.red   = (ushort)0;
                        foreground.green = (ushort)0;
                        foreground.blue  = (ushort)0;
                        foreground.flags =
                            (XColor.DoRed | XColor.DoGreen | XColor.DoBlue);
                        XColor background = new XColor();
                        background.red   = (ushort)0xFFFF;
                        background.green = (ushort)0xFFFF;
                        background.blue  = (ushort)0xFFFF;
                        background.flags =
                            (XColor.DoRed | XColor.DoGreen | XColor.DoBlue);
                        if (reverse)
                        {
                            cursor = Xlib.XCreatePixmapCursor
                                         (display,
                                         source.GetPixmapHandle(),
                                         mask.GetPixmapHandle(),
                                         ref background, ref foreground,
                                         (uint)hotspotX, (uint)hotspotY);
                        }
                        else
                        {
                            cursor = Xlib.XCreatePixmapCursor
                                         (display,
                                         source.GetPixmapHandle(),
                                         mask.GetPixmapHandle(),
                                         ref foreground, ref background,
                                         (uint)hotspotX, (uint)hotspotY);
                        }
                    }
                    Xlib.XDefineCursor(display, window, cursor);
                }
                else if (type == CursorType.XC_inherit_parent)
                {
                    Xlib.XUndefineCursor(display, window);
                }
                else
                {
                    Xlib.XDefineCursor
                        (display, window, dpy.GetCursor(type));
                }
            }
            finally
            {
                dpy.Unlock();
            }
        }
Example #13
0
        public void HandleKeyPress(XKeyEvent e, XWindow window, XWindow root, XWindow subwindow)
        {
            if (Convert.ToBoolean(main_win.LookupKeysym(ref e) == XKeySym.XK_q))
            {
                Console.WriteLine("Cleaning up and exiting...");

                //pix.Free ();

                gc.Dispose();

                bg_color.Dispose();
                handle_color.Dispose();

                resize_top_left_win.Dispose();
                resize_top_right_win.Dispose();
                resize_bottom_left_win.Dispose();
                resize_bottom_right_win.Dispose();

                resize_main_win.Dispose();

                main_win.Dispose();
                ev.Dispose();
                s.Dispose();
                dpy.Dispose();

                Environment.Exit(0);
            }
        }
Example #14
0
        public override bool OnRecordNavigation(object argument)
        {
            CheckDisposed();

            if (!m_fullyInitialized)
            {
                return(false);
            }
            if (RecordNavigationInfo.GetSendingClerk(argument) != Clerk)
            {
                return(false);
            }

            // persist Clerk's CurrentIndex in a db specific way
            string propName = Clerk.PersistedIndexProperty;

            m_mediator.PropertyTable.SetProperty(propName, Clerk.CurrentIndex, PropertyTable.SettingsGroup.LocalSettings);
            m_mediator.PropertyTable.SetPropertyPersistence(propName, true, PropertyTable.SettingsGroup.LocalSettings);
            XWindow window = (XWindow)m_mediator.PropertyTable.GetValue("window");

            Clerk.SuppressSaveOnChangeRecord = (argument as RecordNavigationInfo).SuppressSaveOnChangeRecord;
            try
            {
                window.SuspendIdleProcessing();
                ShowRecord();
            }
            finally
            {
                window.ResumeIdleProcessing();
                Clerk.SuppressSaveOnChangeRecord = false;
            }
            return(true);               //we handled this.
        }
Example #15
0
 // Grab control of the mouse and keyboard to manage popups.
 private void Grab()
 {
     try
     {
         IntPtr  display = dpy.Lock();
         XWindow handle  = GetWidgetHandle();
         Xlib.XGrabKeyboard
             (display, handle, XBool.False,
             1 /* GrabModeAsync */, 1 /* GrabModeAsync */,
             dpy.knownEventTime);
         Xlib.XGrabPointer
             (display, handle, XBool.False,
             (uint)(EventMask.ButtonPressMask |
                    EventMask.ButtonReleaseMask |
                    EventMask.PointerMotionMask),
             1 /* GrabModeAsync */, 1 /* GrabModeAsync */,
             XWindow.Zero,
             dpy.GetCursor(CursorType.XC_left_ptr),
             dpy.knownEventTime);
         Xlib.XFlush(display);
     }
     finally
     {
         dpy.Unlock();
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="OoDrawPagesObserver"/> class.
        /// </summary>
        /// <param name="dp">The Draw document.</param>
        /// <param name="doc">The document related accessibility component.</param>
        /// <param name="docWnd">The related document accessible window component.</param>
        public OoDrawPagesObserver(XDrawPagesSupplier dp, OoAccComponent doc, OoAccessibleDocWnd docWnd = null)
        {
            this.PagesSupplier = dp;
            Document           = doc;
            DocWnd             = docWnd;

            // get Zoom and ViewOffset first time
            if (Controller != null)
            {
                if (Controller is XPropertySet)
                {
                    refreshDrawViewProperties((XPropertySet)(Controller));
                }
                // try to get dpi settings from openoffice
                XWindow componentWindow = Controller.ComponentWindow;
                if (componentWindow != null && componentWindow is XDevice)
                {
                    DeviceInfo deviceInfo = (DeviceInfo)((XDevice)componentWindow).getInfo();
                    if (deviceInfo != null)
                    {
                        PixelPerMeterX = deviceInfo.PixelPerMeterX;
                        PixelPerMeterY = deviceInfo.PixelPerMeterY;
                    }
                }
            }
            // register for Zoom and ViewOffset updates
            addVisibleAreaPropertyChangeListener();

            if (this.PagesSupplier != null)
            {
                List <XDrawPage> dpL = OoDrawUtils.DrawDocGetXDrawPageList(dp);

                if (PagesSupplier is unoidl.com.sun.star.frame.XTitle)
                {
                    Title = ((unoidl.com.sun.star.frame.XTitle)PagesSupplier).getTitle();
                }

                Logger.Instance.Log(LogPriority.DEBUG, this, "create DrawPagesObserver for supplier " + dp.GetHashCode() + " width title '" + Title + "' - having " + dpL.Count + " pages");

                //FIXME: Do this if the api enable parallel access
                //Parallel.ForEach(dpL, (drawPage) =>
                //{
                //    OoDrawPageObserver dpobs = new OoDrawPageObserver(drawPage, this);
                //    DrawPageobservers[drawPage] = dpobs;
                //    DrawPages.Add(dpobs);
                //});

                foreach (var drawPage in dpL)
                {
                    OoDrawPageObserver dpobs = new OoDrawPageObserver(drawPage, this);
                    RegisterDrawPage(dpobs);
                }

                XModifyBroadcaster mdfBc = PagesSupplier as XModifyBroadcaster;
                if (mdfBc != null)
                {
                    mdfBc.addModifyListener(eventForwarder);
                }
            }
        }
	// Constructor.  Called from the "Screen" class.
	internal RootWindow(Display dpy, Screen screen, XWindow handle)
			: base(dpy, screen, DrawableKind.Widget, null)
			{
				// Set this window's handle and add it to the handle map.
				this.handle = (XDrawable)handle;
				if(dpy.handleMap == null)
				{
					dpy.handleMap = new HandleMap();
				}
				dpy.handleMap[handle] = this;

				// Adjust the root window object to match the screen state.
				width = (int)(Xlib.XWidthOfScreen(screen.screen));
				height = (int)(Xlib.XHeightOfScreen(screen.screen));
				mapped = true;
				autoMapChildren = false;

				// Get the current state of the RESOURCE_MANAGER property.
				// We extract color theme information from it.
				resourceManager = Xlib.XInternAtom
					(dpy.dpy, "RESOURCE_MANAGER", XBool.False);
				IntPtr resptr = Xlib.XSharpGetResources(dpy.dpy, handle);
				if(resptr != IntPtr.Zero)
				{
					resources = Marshal.PtrToStringAnsi(resptr);
					Xlib.XSharpFreeResources(resptr);
				}

				// Select for property notifications so that we can
				// track changes to the RESOURCE_MANAGER property.
				SelectInput(EventMask.PropertyChangeMask);
			}
Example #18
0
        private Window ParseDeserialized(XWindow deserialized)
        {
            Window root = new Window(deserialized.Title ?? "")
            {
                Width  = Dim.Fill(),
                Height = Dim.Fill()
            };

            int row = 1;

            foreach (var child in deserialized.Children)
            {
                View?rendered = null;
                if (child is XSpacer spacer)
                {
                    row += spacer.Rows;
                }
                else if (child is XTextBlock textBlock)
                {
                    _elementFactory?.RenderTextBlock(textBlock, root, ref row);
                }
                else
                {
                    rendered = RenderSimple(child, root, row);
                    root.Add(rendered);
                    ++row;
                }
            }

            return(root);
        }
Example #19
0
    public static int AppSelectionNotifyHandler(object info)
    {
        EcoreEventSelectionNotify    e    = (EcoreEventSelectionNotify)info;
        EcoreEventSelectionDataFiles data = new EcoreEventSelectionDataFiles(e.data);
        XWindow win = (XWindow)window.DataGet("xwindow");

        System.Console.WriteLine("Selection Notify Handler!");
        System.Console.WriteLine("Selection length: " + data.num_files);

        for (int i = 0; i < data.num_files; i++)
        {
            System.Console.Write(data.files[i] + " ");
        }

        System.Console.WriteLine("");

        if (data.num_files == 1)
        {
            Regex imgExtention = new Regex("(jpg|jpeg|png)$");

            if (imgExtention.IsMatch(data.files[0].ToLower()))
            {
                Image image = (Image)window.DataGet("image");
                image.Set(data.files[0].Substring(5, data.files[0].Length - 5), null);
                image.Resize(320, 320);
                image.Fill = new ImageFill(0, 0, 320, 320);
                image.Move(0, 0);
            }
        }

        System.Console.WriteLine("Target: " + e.target);
        Enlightenment.Ecore.X.XDnd.SendFinished();

        return(1);
    }
Example #20
0
 void grabKeys(XWindow w)
 {
     foreach (XKeySym key in alt_keys)
     {
         w.GrabKey(key, (XModMask.Mod1Mask | XModMask.ControlMask), true, XGrabMode.GrabModeAsync, XGrabMode.GrabModeAsync);
     }
 }
Example #21
0
 void ungrabKeys(XWindow w)
 {
     foreach (XKeySym key in alt_keys)
     {
         w.UngrabKey(key, (XModMask.Mod1Mask | XModMask.ControlMask));
     }
 }
Example #22
0
        // Constructor.  Called from the "Screen" class.
        internal RootWindow(Display dpy, Screen screen, XWindow handle)
            : base(dpy, screen, DrawableKind.Widget, null)
        {
            // Set this window's handle and add it to the handle map.
            this.handle = (XDrawable)handle;
            if (dpy.handleMap == null)
            {
                dpy.handleMap = new HandleMap();
            }
            dpy.handleMap[handle] = this;

            // Adjust the root window object to match the screen state.
            width           = (int)(Xlib.XWidthOfScreen(screen.screen));
            height          = (int)(Xlib.XHeightOfScreen(screen.screen));
            mapped          = true;
            autoMapChildren = false;

            // Get the current state of the RESOURCE_MANAGER property.
            // We extract color theme information from it.
            resourceManager = Xlib.XInternAtom
                                  (dpy.dpy, "RESOURCE_MANAGER", XBool.False);
            IntPtr resptr = Xlib.XSharpGetResources(dpy.dpy, handle);

            if (resptr != IntPtr.Zero)
            {
                resources = Marshal.PtrToStringAnsi(resptr);
                Xlib.XSharpFreeResources(resptr);
            }

            // Select for property notifications so that we can
            // track changes to the RESOURCE_MANAGER property.
            SelectInput(EventMask.PropertyChangeMask);
        }
Example #23
0
    public static int AppDndPositionHandler(object info)
    {
        System.Console.WriteLine("Dnd Position Handler!");
        XWindow win = (XWindow)window.DataGet("xwindow");

        win.Dnd.SendStatus(1, 1, new Enlightenment.Ecore.X.Rectangle(500, 20, (uint)640, (uint)480), XDnd.ActionPrivate);
        return(1);
    }
Example #24
0
    public static int AppDndDropHandler(object info)
    {
        System.Console.WriteLine("Dnd Drop Handler!");
        XWindow win = (XWindow)window.DataGet("xwindow");

        win.Selection.DndRequest("text/uri-list");
        return(1);
    }
Example #25
0
 public void HandleExpose(XExposeEvent e, XWindow window)
 {
     if (e.window == main_win.ID)
     {
         DrawClock();
         main_win.DrawString(gc, new Point(10, 20), "Resize / Move test / Clock / Color test... Press 'Q' to quit...");
     }
 }
Example #26
0
        private void btnMenu_Click(object sender, EventArgs e)
        {
            XWindow window = (XWindow)m_sandbox.Mediator.PropertyTable.GetValue("window");

            window.ShowContextMenu("mnuFocusBox",
                                   btnMenu.PointToScreen(new Point(btnMenu.Width / 2, btnMenu.Height / 2)),
                                   null,
                                   null);
        }
        public virtual XFixedText CreateFixedLabel(String text, int _nPosX, int _nPosY, int _nWidth, int _nHeight, int _nStep, XMouseListener _xMouseListener, String sName = "")
        {
            if (MXMcf == null)
            {
                return(null);
            }
            XFixedText xFixedText = null;

            try
            {
                // create a unique id by means of an own implementation...
                if (String.IsNullOrWhiteSpace(sName))
                {
                    sName = createUniqueName(MXDlgModelNameContainer, "TEXT_FIXED");
                }
                else
                {
                    sName = createUniqueName(MXDlgModelNameContainer, sName);
                }


                // create a controlmodel at the multiservicefactory of the dialog model...
                Object oFTModel   = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_TEXT_FIXED_MODEL, MXContext);
                Object xFTControl = MXMcf.createInstanceWithContext(OO.Services.AWT_CONTROL_TEXT_FIXED, MXContext);

                XMultiPropertySet xFTModelMPSet = (XMultiPropertySet)oFTModel;
                // Set the properties at the model - keep in mind to pass the property names in alphabetical order!

                xFTModelMPSet.setPropertyValues(
                    new String[] { "Height", "Name", "PositionX", "PositionY", "Step", "Width", "Label" },
                    Any.Get(new Object[] { _nHeight, sName, _nPosX, _nPosY, _nStep, _nWidth, text }));

                if (oFTModel != null && xFTControl != null && xFTControl is XControl)
                {
                    ((XControl)xFTControl).setModel(oFTModel as XControlModel);
                }

                xFixedText = xFTControl as XFixedText;
                if (_xMouseListener != null && xFTControl is XWindow)
                {
                    XWindow xWindow = (XWindow)xFTControl;
                    xWindow.addMouseListener(_xMouseListener);
                }
            }
            catch (unoidl.com.sun.star.uno.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("uno.Exception:");
                System.Diagnostics.Debug.WriteLine(ex);
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("System.Exception:");
                System.Diagnostics.Debug.WriteLine(ex);
            }
            return(xFixedText);
        }
Example #28
0
        public EcoreEventDndEnter(IntPtr EventInfo)
        {
            _EcoreEventDndEnter e = new _EcoreEventDndEnter();

            e         = (_EcoreEventDndEnter)Marshal.PtrToStructure(EventInfo, typeof(_EcoreEventDndEnter));
            win       = new XWindow(e.win);
            src       = new XWindow(e.src);
            types     = Common.PtrToStringArray(e.num_types, e.types);
            num_types = e.num_types;
        }
Example #29
0
        public void HandleButtonPress(XButtonEvent e, XWindow window, XWindow root, XWindow subwindow)
        {
            pointer.Grab(e.window, XEventMask.PointerMotionMask | XEventMask.ButtonReleaseMask);

            attr = resize_main_win.GetAttributes();

            start = e;

            old_resize_x = resize_win_x;
            old_resize_y = resize_win_y;
        }
Example #30
0
        public void Run(Stream view, ViewModelBase model)
        {
            Application.UseSystemConsole = false;
            _binder         = new Binder(model);
            _elementFactory = new UiElementFactory(_binder);
            XWindow deserialized = DeserializeXmlView(view);

            _window = ParseDeserialized(deserialized);
            model.InjectView(this);
            ResumeUi();
        }
Example #31
0
        private void ReloadPaneBar(IPaneBar paneBar)
        {
            string groupId = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "PaneBarGroupId", null);

            if (groupId != null)
            {
                XWindow     window = (XWindow)m_mediator.PropertyTable.GetValue("window");
                ChoiceGroup group  = window.GetChoiceGroupForMenu(groupId);
                group.PopulateNow();
                paneBar.AddGroup(group);
            }
        }
 public void calculateDialogPosition(XWindow _xWindow)
 {
     Rectangle aFramePosSize = ((unoidl.com.sun.star.frame.XModel)MXModel).getCurrentController().getFrame().getComponentWindow().getPosSize();
     Rectangle CurPosSize = _xWindow.getPosSize();
     int WindowHeight = aFramePosSize.Height;
     int WindowWidth = aFramePosSize.Width;
     int DialogWidth = CurPosSize.Width;
     int DialogHeight = CurPosSize.Height;
     int iXPos = ((WindowWidth / 2) - (DialogWidth / 2));
     int iYPos = ((WindowHeight / 2) - (DialogHeight / 2));
     _xWindow.setPosSize(iXPos, iYPos, DialogWidth, DialogHeight, PosSize.POS);
 }
Example #33
0
	// Set the handle for this drawable, assuming it is a widget.
	internal void SetWidgetHandle(XWindow handle)
			{
				try
				{
					dpy.Lock();
					this.handle = (XDrawable)handle;
					dpy.handleMap[handle] = (Widget)this;
				}
				finally
				{
					dpy.Unlock();
				}
			}
Example #34
0
	extern public static XStatus XSendEvent
			(IntPtr display, XWindow w, XBool propagate,
			 int event_mask, ref XEvent event_send);
Example #35
0
	extern public static int XSelectInput(IntPtr display, XWindow w,
											  int mode);
Example #36
0
	extern public static XStatus XSetWMProtocols
			(IntPtr display, XWindow w, XAtom[] protocols, int count);
Example #37
0
	extern public static int XSetIconName
			(IntPtr display, XWindow w, String window_name);
Example #38
0
	extern public static int XSetSelectionOwner
			(IntPtr display, XAtom selection, XWindow owner, XTime time);
Example #39
0
	extern public static IntPtr XSharpGetResources(IntPtr dpy, XWindow w);
		// Determine if we want a particular widget in a map request.
		private bool WantThisWindow(IntPtr dpy, XWindow window)
				{
					// Bail out if the parent already has an embedded child.
					if(embedParent.child != XWindow.Zero)
					{
						return false;
					}

					// Ignore the window if it is a transient, because
					// we don't want dialog boxes that are displayed before
					// the main window to get accidentally reparented.
					XWindow transientFor;
					if(Xlib.XGetTransientForHint(dpy, window, out transientFor)
							!= XStatus.Zero)
					{
						// KDE apps that act like a top-level dialog
						// (kcalc, kfind, etc) specific the root window
						// as their parent.  We assume that such windows
						// are actually the main window of the app.
						if(transientFor !=
								Xlib.XRootWindowOfScreen(screen.screen))
						{
							return false;
						}
					}

					// We want this widget.
					return true;
				}
Example #41
0
	extern public static int XGrabButton
			(IntPtr display, uint button, uint modifiers,
			 XWindow grab_window, XBool owner_events,
			 uint event_mask, int pointer_mode, int keyboard_mode,
			 XWindow confine_to, XCursor cursor);
Example #42
0
	extern public static XStatus XGetTransientForHint
			(IntPtr display, XWindow w, out XWindow prop_window);
	// Called when the child window is destroyed.
	private void ChildDestroyed()
			{
				// Clear the child window and destroy the application group.
				child = XWindow.Zero;
				try
				{
					IntPtr d = dpy.Lock();
					if(group != XAppGroup.Zero)
					{
						Xlib.XagDestroyApplicationGroup(d, group);
						group = XAppGroup.Zero;
					}
				}
				finally
				{
					dpy.Unlock();
				}

				// Wait for the child process to exit properly.
				if(process != null && !(process.HasExited))
				{
					if(!process.WaitForExit(5000))
					{
						// Process is still alive!  Kill it the hard way.
						process.Kill();
						process = null;
					}
				}

				// Delete the authority file, which we no longer require.
				if(authorityFile != null)
				{
					File.Delete(authorityFile);
					authorityFile = null;
				}

				// Notify subclasses that the child was destroyed.
				if(!closeNotifySent)
				{
					closeNotifySent = true;
					OnClose();
				}
			}
Example #44
0
	extern public static XDrawable XdbeAllocateBackBufferName
			(IntPtr display, XWindow window, XdbeSwapAction swap_action);
Example #45
0
	extern public static void XSharpSendWakeup
			(IntPtr display, XWindow window);
Example #46
0
	extern public static void XSharpSendClose
			(IntPtr display, XWindow window);
Example #47
0
	extern public static int XUngrabButton
			(IntPtr display, uint button, uint modifiers,
			 XWindow grab_window);
Example #48
0
	extern public static void XSetWMNormalHints
			(IntPtr display, XWindow w, ref XSizeHints hints);
Example #49
0
	extern public static int XConvertSelection
			(IntPtr display, XAtom selection, XAtom target,
			 XAtom property, XWindow requestor, XTime time);
Example #50
0
	extern public static XStatus XGetGeometry
			(IntPtr display, XDrawable d, out XWindow root_return,
			 out Xint x_return, out Xint y_return,
			 out Xuint width_return, out Xuint height_return,
			 out Xuint border_width_return, out Xuint depth_return);
Example #51
0
	extern public static int XGrabPointer
			(IntPtr display, XWindow grab_window, XBool owner_events,
			 uint event_mask, int pointer_mode, int keyboard_mode,
			 XWindow confine_to, XCursor cursor, XTime time);
Example #52
0
	extern public static XStatus XGetWindowProperty
			(IntPtr display, XWindow w, XAtom property,
			 int long_offset, int long_length,
			 XBool deleteProp, XAtom req_type,
			 out XAtom actual_type_return,
			 out Xlib.Xint actual_format_return,
			 out Xlib.Xulong nitems_return,
			 out Xlib.Xulong bytes_after_return,
			 out IntPtr prop_return);
Example #53
0
	extern public static int XGrabKeyboard
			(IntPtr display, XWindow grab_window, XBool owner_events,
			 int pointer_mode, int keyboard_mode, XTime time);
Example #54
0
	extern public static void XSetTextProperty
			(IntPtr display, XWindow w, ref XTextProperty textProp,
			 XAtom property);
Example #55
0
	extern public static void XSetClassHint
			(IntPtr display, XWindow w, ref XClassHint class_hints);
Example #56
0
	extern public static int XDeleteProperty
			(IntPtr display, XWindow w, XAtom property);
Example #57
0
	extern public static int XSetTransientForHint
			(IntPtr display, XWindow w, XWindow prop_window);
Example #58
0
	extern public static int XReconfigureWMWindow
			(IntPtr display, XWindow w, int screen_number,
			 uint value_mask, ref XWindowChanges changes);
Example #59
0
	extern public static int XChangeProperty
			(IntPtr display, XWindow w, XAtom property,
			 XAtom type, int format, int mode,
			 Xlong[] data, int nelements);
Example #60
0
	extern public static void XSetWMHints
			(IntPtr display, XWindow w, ref XWMHints hints);