Exemplo n.º 1
0
        public static void addWindows(Container parent = null)
        {
            if (parent == null)
            {
                addWindows(MainWindow.Instance);
            }
            else
            {
                DockableWidget wnd = parent as DockableWidget;
                if (wnd != null)
                {
                    if (!MainWindow.Instance.WindowList.ContainsKey(wnd.ID))
                    {
                        MainWindow.Instance.WindowList.Add(wnd.ID, wnd);
                        //wnd.hookDelegates(); //not needed because the hookDelegates call in hookDelegates() above ??
                    }
                }

                if (parent.Children != null)
                {
                    foreach (Widget w in parent.Children)
                    {
                        Container c = w as Container;
                        if (c != null)
                        {
                            addWindows(c);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// creates a dockable widget by classname
        ///
        /// uses parameters and delegates from the windows.config file
        /// </summary>
        /// <returns>
        /// The dockable widget.
        /// </returns>
        /// <param name='classname'>
        /// Classname.
        /// </param>
        public DockableWidget createDockableWidget(String classname)
        {
            XmlNode nd = Configuration.ConfigurationManager.getValue("windows.config", "//window[@class = '" + classname + "']");

            if (nd != null)
            {
                return(DockableWidget.CreateInstance(nd));
            }
            return(null);
        }
Exemplo n.º 3
0
        /// <summary>
        /// called when a popup window is destoryed ... then we have to remove it from the windowlist
        /// </summary>
        /// <param name='sender'>
        /// Sender.
        /// </param>
        /// <param name='e'>
        /// E.
        /// </param>
        void HandlePwDestroyed(object sender, EventArgs e)
        {
            PopupWindow pw = (sender as PopupWindow);

            if (pw != null)
            {
                DockableWidget dw = (pw.CurrentWidget as DockableWidget);
                if (dw != null)
                {
                    windowlist.Remove(dw.ID);
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// add a new dockable widegt to the mainwindow
 /// </summary>
 /// <param name='widget'>
 /// Widget.
 /// </param>
 protected void addWidget(DockableWidget widget)
 {
     if (!windowlist.ContainsKey(widget.ID))
     {
         windowlist.Add(widget.ID, widget);
         widget.Visible = true;
         frame.addItem(new DockItemContainer(frame, widget), ItemAlignment.Top, true);
     }
     else
     {
         Console.WriteLine("Window is already in list: " + widget.ID);                 //TODO logging
     }
 }
Exemplo n.º 5
0
        void HandleOnClose(object o, EventArgs e)
        {
            Console.WriteLine("HandleOnClose" + o);
            PopupWindow pw = (o as PopupWindow);

            if (pw != null)
            {
                Console.WriteLine("HandleOnClose CW" + pw.CurrentWidget);
                DockableWidget dw = (pw.CurrentWidget as DockableWidget);
                if (dw != null)
                {
                    windowlist.Remove(dw.ID);
                }
            }
        }
Exemplo n.º 6
0
        void HandleDeleteEvent(object o, DeleteEventArgs args)
        {
            Console.WriteLine("HandleDeleteEvent: " + o);
            PopupWindow pw = (o as PopupWindow);

            if (pw != null)
            {
                Console.WriteLine("HandleDeleteEvent: " + pw.CurrentWidget);
                DockableWidget dw = (pw.CurrentWidget as DockableWidget);
                if (dw != null)
                {
                    windowlist.Remove(dw.ID);
                }
            }
        }
Exemplo n.º 7
0
        public static DockableWidget createWindow(ParameterSet param, DelegateSet delegates)
        {
            ConstructorInfo ci = param.BaseType.GetConstructor(param.Types);
            object          o  = ci.Invoke(param.Data);

            if (o != null)
            {
                DockableWidget wnd = (DockableWidget)o;
                wnd.Params    = param;
                wnd.Delegates = delegates;
                wnd.hookDelegates();
                wnd.afterInit();
                return(wnd);
            }
            return(null);
        }
Exemplo n.º 8
0
        /// <summary>
        /// show a dockable widget as popup window
        /// </summary>
        /// <param name='widget'>
        /// Widget.
        /// </param>
        public void showAsPopupWindow(DockableWidget widget)
        {
            if (!windowlist.ContainsKey(widget.ID))
            {
                PopupWindow pw = new PopupWindow(widget);

                windowlist.Add(widget.ID, widget);
                pw.SetSizeRequest(640, 480);
                pw.WindowPosition = WindowPosition.CenterOnParent;
                //pw.Destroyed += HandlePwDestroyed;
                pw.DeleteEvent += HandleDeleteEvent;
                pw.OnClose     += HandleOnClose;
                //pw.Destroyed += HandleDestroyed;
                pw.ShowAll();
            }
        }
Exemplo n.º 9
0
        public void createPopupWindow(ParameterSet param)
        {
            Console.WriteLine("createPopupWindow");
            DockableWidget wnd = DockableWidget.createWindow(param, null);
            //addWidget(wnd);
            PopupWindow pw = new PopupWindow(wnd);

            windowlist.Add(wnd.ID, wnd);
            pw.SetSizeRequest(640, 480);
            pw.WindowPosition = WindowPosition.CenterAlways;
            //pw.Destroyed += HandlePwDestroyed;
            pw.DeleteEvent += HandleDeleteEvent;
            pw.OnClose     += HandleOnClose;
            //pw.DestroyEvent += HandleDestroyEvent;
            pw.Shown += HandlePwShown;
            pw.ShowAll();
        }
Exemplo n.º 10
0
        //TODO nameing ... functionnames upper or lowercase ?
        public void createPopupWindow(String classname)
        {
            //String configfile = Configuration.ConfigurationManager.AppSettings["windows_config"];
            XmlNode nd = Configuration.ConfigurationManager.getValue("windows.config", "//window[@class = '" + classname + "']");

            if (nd != null)
            {
                DockableWidget wnd = DockableWidget.CreateInstance(nd);
                //addWidget(wnd);
                showAsPopupWindow(wnd);
            }
            else
            {
                //TODO exception or logging ??
                Console.WriteLine("Window " + classname + " has no entry in windows.config");
            }
        }
Exemplo n.º 11
0
        private void CreateWindow(XmlNode node)
        {
            DockableWidget wnd = DockableWidget.CreateInstance(node);

            addWidget(wnd);
        }
Exemplo n.º 12
0
 public void removeWidget(DockableWidget widget)
 {
     widget.unHookDelegates();
     windowlist.Remove(widget.ID);
 }