A 2D element which contains other OverlayElement instances.
This is a specialization of OverlayElement for 2D elements that contain other elements. These are also the smallest elements that can be attached directly to an Overlay.

OverlayElementContainers should be managed using OverlayElementManager. This class is responsible for instantiating elements, and also for accepting new types of element from plugins etc.

상속: OverlayElement
예제 #1
0
        /// <summary>
        ///    Internal method to put the overlay contents onto the render queue.
        /// </summary>
        /// <param name="camera">Current camera being used in the render loop.</param>
        /// <param name="queue">Current render queue.</param>
        public void FindVisibleObjects(Camera camera, RenderQueue queue)
        {
            if (!isVisible)
            {
                return;
            }

            // add 3d elements
            rootNode.Position    = camera.DerivedPosition;
            rootNode.Orientation = camera.DerivedOrientation;
            rootNode.Update(true, false);

            // set up the default queue group for the objects about to be added
            RenderQueueGroupID oldGroupID = queue.DefaultRenderGroup;

            queue.DefaultRenderGroup = RenderQueueGroupID.Overlay;
            rootNode.FindVisibleObjects(camera, queue, null, true, false);
            // reset the group
            queue.DefaultRenderGroup = oldGroupID;

            // add 2d elements
            for (int i = 0; i < elementList.Count; i++)
            {
                OverlayElementContainer container = (OverlayElementContainer)elementList[i];
                container.Update();
                container.UpdateRenderQueue(queue);
            }
        }
예제 #2
0
 public Dialogue(string name, int width, int height)
 {
     _name = name;
     _dialogueWidth = width;
     _dialogueHeight = height;
     _dialogueElement = CreateDialogueElement();
 }
예제 #3
0
		public void CreateScene()
		{
			TextureUtil.CreateDynamicTextureAndMaterial(
				"OBDynamicTexture",
				"OBDynamicMaterial",
				_browserWidth,
				_browserHeight,
				out _texture,
				out _material);



			
			_panel = (OverlayElementContainer)OverlayManager.Instance.Elements.CreateElement("Panel", "Panels");
			_panel.SetPosition(1, 1);
			_panel.SetDimensions(_browserWidth, _browserHeight);
			_panel.MaterialName = "OBDynamicMaterial";


			_overlay = OverlayManager.Instance.Create("OverlayBrowser");
			_overlay.AddElement(_panel);
			_overlay.Show();

			Core.BrowserManager.BrowserRenderEvent += BrowserManager_BrowserRenderEvent;
			_browserId = Core.BrowserManager.CreateBrowser("http://www.google.com.au", _browserWidth, _browserHeight);
		}
예제 #4
0
파일: TopBar.cs 프로젝트: vvnurmi/MOOLGOSS
 public TopBar(string name, string defaultLocation)
 {
     _name = name;
     _defaultLocation = defaultLocation;
     _topBar = OverlayManager.Instance.Create("Overlays/TopBar/" + _name);
     _topBarElement = CreateTopBarElement();
     SetLocationText(_defaultLocation);
     _topBar.AddElement(_topBarElement);
 }
예제 #5
0
 public MessageDialog(string name, int width)
 {
     _name = name;
     _dialogWidth = width;
     _dialog = OverlayManager.Instance.Create("Overlays/MessageDialog/" + _name);
     _dialogElement = CreateDialogElement();
     _dialog.AddElement(_dialogElement);
     ResizeElement();
 }
예제 #6
0
        public override void NotifyParent(OverlayElementContainer parent, Overlay overlay)
        {
            // call the base class method
            base.NotifyParent(parent, overlay);

            foreach (var child in this.children.Values)
            {
                child.NotifyParent(this, overlay);
            }
        }
        public override void NotifyParent(OverlayElementContainer parent, Overlay overlay)
        {
            // call the base class method
            base.NotifyParent(parent, overlay);

            for (int i = 0; i < childList.Count; i++)
            {
                ((OverlayElement)childList[i]).NotifyParent(this, overlay);
            }
        }
예제 #8
0
        /// <summary>
        ///    Add a nested container to this container.
        /// </summary>
        /// <param name="container"></param>
        public virtual void AddChildContainer(OverlayElementContainer container)
        {
            // add this container to the main child list first
            OverlayElement element = container;

            AddChildElement(element);

            // now add the container to the container collection
            this.childContainers.Add(container.Name, container);
        }
예제 #9
0
        /// <summary>
        ///    Adds a 2d element to this overlay.
        /// </summary>
        /// <remarks>
        ///    Containers are created and managed using the GuiManager. A container
        ///    could be as simple as a square panel, or something more complex like
        ///    a grid or tree view. Containers group collections of other elements,
        ///    giving them a relative coordinate space and a common z-order.
        ///    If you want to attach a gui widget to an overlay, you have to do it via
        ///    a container.
        /// </remarks>
        /// <param name="element"></param>
        public void AddElement(OverlayElementContainer element)
        {
            elementList.Add(element);
            elementLookup.Add(element.Name, element);

            // notify the parent
            element.NotifyParent(null, this);

            // Set Z order, scaled to separate overlays
            // max 100 container levels per overlay, should be plenty
            element.NotifyZOrder(zOrder * 100);
        }
예제 #10
0
        /// <summary>
        /// Removes a 2D container from the overlay.
        /// </summary>
        /// <remarks>
        /// Consider using <see>Hide</see>.
        /// </remarks>
        /// <param name="element"></param>
        public void RemoveElement(OverlayElementContainer element)
        {
            if (this.elementList.Contains(element))
            {
                this.elementList.Remove(element);
            }
            if (this.elementLookup.ContainsKey(element.Name))
            {
                this.elementLookup.Remove(element.Name);
            }

            AssignZOrders();
            element.NotifyParent(null, null);
        }
예제 #11
0
        /// <summary>
        ///    Adds a 2d element to this overlay.
        /// </summary>
        /// <remarks>
        ///    Containers are created and managed using the OverlayManager. A container
        ///    could be as simple as a square panel, or something more complex like
        ///    a grid or tree view. Containers group collections of other elements,
        ///    giving them a relative coordinate space and a common z-order.
        ///    If you want to attach a gui widget to an overlay, you have to do it via
        ///    a container.
        /// </remarks>
        /// <param name="element"></param>
        public void AddElement(OverlayElementContainer element)
        {
            this.elementList.Add(element);
            this.elementLookup.Add(element.Name, element);

            // notify the parent
            element.NotifyParent(null, this);

            AssignZOrders();

            GetWorldTransforms(this.xform);

            element.NotifyWorldTransforms(this.xform);
            element.NotifyViewport();
        }
예제 #12
0
        /// <summary>
        ///    Parses a new element
        /// </summary>
        /// <param name="script"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <param name="isContainer"></param>
        /// <param name="overlay"></param>
        /// <param name="isTemplate"></param>
        /// <param name="templateName"></param>
        /// <param name="parent"></param>
        private void ParseNewElement(TextReader script, string type, string name, bool isContainer, Overlay overlay,
                                     bool isTemplate, string templateName, OverlayElementContainer parent)
        {
            string line;
            var    element = OverlayElementManager.Instance.CreateElementFromTemplate(templateName, type, name, isTemplate);

            if (parent != null)
            {
                // add this element to the parent container
                parent.AddChild(element);
            }
            else if (overlay != null)
            {
                overlay.AddElement((OverlayElementContainer)element);
            }

            while ((line = ParseHelper.ReadLine(script)) != null)
            {
                // inore blank lines and comments
                if (line.Length > 0 && (!line.StartsWith("//") && !line.StartsWith("# ")))
                {
                    if (line == "}")
                    {
                        // finished element
                        break;
                    }
                    else
                    {
                        OverlayElementContainer container = null;
                        if (element is OverlayElementContainer)
                        {
                            container = (OverlayElementContainer)element;
                        }
                        if (isContainer && ParseChildren(script, line, overlay, isTemplate, container))
                        {
                            // nested children, so don't reparse it
                        }
                        else
                        {
                            // element attribute
                            ParseElementAttrib(line, overlay, element);
                        }
                    }
                }
            }
        }
        /// <summary>
        ///    Add a nested container to this container.
        /// </summary>
        /// <param name="container"></param>
        public virtual void AddChildImpl(OverlayElementContainer container)
        {
            // add this container to the main child list first
            OverlayElement element = container;

            AddChildImpl(element);
            element.NotifyParent(this, overlay);
            element.NotifyZOrder(zOrder + 1);

            // inform container children of the current overlay
            // *gasp* it's a foreach!  this isn't a time critical method anyway
            foreach (OverlayElement child in container.children)
            {
                child.NotifyParent(container, overlay);
                child.NotifyZOrder(container.ZOrder + 1);
            }

            // now add the container to the container collection
            childContainers.Add(container.Name, container);
        }
 /// <summary>
 ///    Internal method for notifying the gui element of it's parent and ultimate overlay.
 /// </summary>
 /// <param name="parent">Parent of this element.</param>
 /// <param name="overlay">Overlay this element belongs to.</param>
 public virtual void NotifyParent(OverlayElementContainer parent, Overlay overlay)
 {
     this.parent        = parent;
     this.overlay       = overlay;
     isDerivedOutOfDate = true;
 }
        /// <summary>
        ///    Add a nested container to this container.
        /// </summary>
        /// <param name="container"></param>
        public virtual void AddChildImpl(OverlayElementContainer container)
        {
            // add this container to the main child list first
            OverlayElement element = container;
            AddChildImpl(element);
            element.NotifyParent(this, overlay);
            element.NotifyZOrder(zOrder + 1);

            // inform container children of the current overlay
            // *gasp* it's a foreach!  this isn't a time critical method anyway
            foreach(OverlayElement child in container.children) {
                child.NotifyParent(container, overlay);
                child.NotifyZOrder(container.ZOrder + 1);
            }

            // now add the container to the container collection
            childContainers.Add(container.Name, container);
        }
예제 #16
0
파일: Trade.cs 프로젝트: vvnurmi/MOOLGOSS
 private void AddConfirmButton()
 {
     _confirmButton = CreateConfirmButton();
     _confirmButton.VerticalAlignment = VerticalAlignment.Bottom;
     _confirmButton.HorizontalAlignment = HorizontalAlignment.Right;
     _confirmButton.Left = -(_confirmButton.Width + 6);
     _confirmButton.Top = -(_confirmButton.Height + 6);
     TradeContent.AddChildElement(_confirmButton);
 }
예제 #17
0
        /// <summary>
        ///    Adds a 2d element to this overlay.
        /// </summary>
        /// <remarks>
        ///    Containers are created and managed using the GuiManager. A container
        ///    could be as simple as a square panel, or something more complex like
        ///    a grid or tree view. Containers group collections of other elements,
        ///    giving them a relative coordinate space and a common z-order.
        ///    If you want to attach a gui widget to an overlay, you have to do it via
        ///    a container.
        /// </remarks>
        /// <param name="element"></param>
        public void AddElement(OverlayElementContainer element)
        {
            elementList.Add(element);
            elementLookup.Add(element.Name, element);

            // notify the parent
            element.NotifyParent(null, this);

            // Set Z order, scaled to separate overlays
            // max 100 container levels per overlay, should be plenty
            element.NotifyZOrder(zOrder * 100);
        }
예제 #18
0
 public void ShowConfirmButton(string label, Action action)
 {
     _confirmButton = CreateConfirmButton(label);
     ShowButton(_confirmButton, action);
 }
예제 #19
0
		public override void NotifyParent( OverlayElementContainer parent, Overlay overlay )
		{
			// call the base class method
			base.NotifyParent( parent, overlay );

			foreach ( var child in this.children.Values )
			{
				child.NotifyParent( this, overlay );
			}
		}
예제 #20
0
 public void Destroy()
 {
     OverlayManager.Instance.Elements.DestroyElement(InstanceName + "/DialogueImage");
     OverlayManager.Instance.Elements.DestroyElement(InstanceName + "/DialogueContent/BorderBL");
     OverlayManager.Instance.Elements.DestroyElement(InstanceName + "/DialogueContent/BorderBR");
     OverlayManager.Instance.Elements.DestroyElement(InstanceName + "/DialogueContent");
     OverlayManager.Instance.Elements.DestroyElement(InstanceName + "/TechTL");
     OverlayManager.Instance.Elements.DestroyElement(InstanceName + "/TechBL");
     OverlayManager.Instance.Elements.DestroyElement(InstanceName);
     RemovePortrait();
     _dialogueElement = null;
 }
예제 #21
0
		/// <summary>
		/// Removes a 2D container from the overlay.
		/// </summary>
		/// <remarks>
		/// Consider using <see>Hide</see>.
		/// </remarks>
		/// <param name="element"></param>
		public void RemoveElement( OverlayElementContainer element )
		{
			if ( this.elementList.Contains( element ) )
			{
				this.elementList.Remove( element );
			}
			if ( this.elementLookup.ContainsKey( element.Name ) )
			{
				this.elementLookup.Remove( element.Name );
			}

			AssignZOrders();
			element.NotifyParent( null, null );
		}
예제 #22
0
		/// <summary>
		///
		/// </summary>
		/// <param name="name"></param>
		protected internal OverlayElement( string name )
            : base()
		{
			this.name = name;
			isVisible = true;
			isCloneable = true;
			left = 0.0f;
			top = 0.0f;
			width = 1.0f;
			height = 1.0f;
			metricsMode = MetricsMode.Relative;
			horzAlign = HorizontalAlignment.Left;
			vertAlign = VerticalAlignment.Top;
			pixelTop = 0.0f;
			pixelLeft = 0.0f;
			pixelWidth = 1.0f;
			pixelHeight = 1.0f;
			pixelScaleX = 1.0f;
			pixelScaleY = 1.0f;
			parent = null;
			overlay = null;
			isDerivedOutOfDate = true;
			isGeomPositionsOutOfDate = true;
			isGeomUVsOutOfDate = true;
			zOrder = 0;
			isEnabled = true;
			isInitialized = false;
			sourceTemplate = null;
		}
예제 #23
0
 public void ShowCancelButton(string label, Action action)
 {
     _cancelButton = CreateCancelButton(label);
     ShowButton(_cancelButton, action);
 }
예제 #24
0
		public ObjectTextDisplay( MovableObject p, Camera c, string shapeName )
		{
			this.parent = p;
			this.camera = c;
			this.enabled = false;
			this.text = "";

			// create an overlay that we can use for later

			// = Ogre.OverlayManager.getSingleton().create("shapeName");
			this.parentOverlay = (Overlay)OverlayManager.Instance.Create( "shapeName" );

			// (Ogre.OverlayContainer)(Ogre.OverlayManager.getSingleton().createOverlayElement("Panel", "container1"));
			this.parentContainer =
				(OverlayElementContainer)( OverlayElementManager.Instance.CreateElement( "Panel", "container1", false ) );

			//parentOverlay.add2D(parentContainer);
			this.parentOverlay.AddElement( this.parentContainer );

			//parentText = Ogre.OverlayManager.getSingleton().createOverlayElement("TextArea", "shapeNameText");
			this.parentText = OverlayElementManager.Instance.CreateElement( "TextArea", shapeName, false );

			this.parentText.SetDimensions( 1.0f, 1.0f );

			//parentText.setMetricsMode(Ogre.GMM_PIXELS);
			this.parentText.MetricsMode = MetricsMode.Pixels;


			this.parentText.SetPosition( 1.0f, 1.0f );


			this.parentText.SetParam( "font_name", "Arial" );
			this.parentText.SetParam( "char_height", "25" );
			this.parentText.SetParam( "horz_align", "center" );
			this.parentText.Color = new ColorEx( 1.0f, 1.0f, 1.0f );
			//parentText.setColour(Ogre.ColourValue(1.0, 1.0, 1.0));


			this.parentContainer.AddChild( this.parentText );

			this.parentOverlay.Show();
		}
예제 #25
0
파일: Docked.cs 프로젝트: vvnurmi/MOOLGOSS
        private void EnterHandler()
        {
            Globals.UI.ShowMouse();

            if (_topBarView == null)
            {
                _topBarView = new TopBarView("Docked", _baseName);
            }

            if (_interactionView == null)
            {
                _interactionView = new InteractionView("Docked", 320, 500);
            }

            _interactionView.AddHeader("creatures", "CREATURES");
            _interactionView.AddItem("TestInstance", "Portrait", "[RK] Gom", "Guild Master", "Small", "Default", "", () => { InteractionListElementClicked("Creature"); });
            _interactionView.AddItem("TestInstance2", "Portrait", "[RK] Chapelier", "Lord of The Code", "Small", "Default", "", () => { InteractionListElementClicked("Creature"); });
            _interactionView.AddHeader("ships", "SHIPS");
            _interactionView.AddItem("TestShip", "Portrait", "Nautilus", "Small Fighter", "Small", "DefaultShip", "", () => { InteractionListElementClicked("Ship"); });

            if (_leftVerticalBar == null)
            {
                _leftVerticalBar = OverlayManager.Instance.Create("Overlays/LeftVerticalBar/Docked");
                _leftVerticalBarElement = CreateLeftVerticalBarElement();
                _leftVerticalBarElement.AddChildElement(_interactionView.ListElement);
                _interactionView.ListElement.VerticalAlignment = VerticalAlignment.Center;
                _interactionView.ListElement.Top = -(_interactionView.AbsoluteContentHeight / 2);
                _leftVerticalBar.AddElement(_leftVerticalBarElement);
            }

            _topBarView.AddButton("bar", "BAR (F1)", MoveToBar);
            _topBarView.AddButton("shopping", "SHOPS (F2)", MoveToShopping);
            _topBarView.AddButton("hangar", "HANGAR (F3)", MoveToHangar);
            _topBarView.AddButton("leave", "LEAVE (F4)", Leave);

            MoveToHangar();
        }
예제 #26
0
파일: Trade.cs 프로젝트: vvnurmi/MOOLGOSS
 private void AddCloseButton()
 {
     _closeButton = CreateCloseButton();
     _closeButton.VerticalAlignment = VerticalAlignment.Bottom;
     _closeButton.HorizontalAlignment = HorizontalAlignment.Left;
     _closeButton.Left = 6;
     _closeButton.Top = -(_closeButton.Height + 6);
     TradeContent.AddChildElement(_closeButton);
 }
예제 #27
0
 private void ShowButton(OverlayElementContainer button, Action action)
 {
     DialogContent.AddChildElement(button);
     button.UserData = action + Destroy;
     Globals.UI.AddButton(button);
     ResizeElement();
 }
        public override void NotifyParent(OverlayElementContainer parent, Overlay overlay)
        {
            // call the base class method
            base.NotifyParent (parent, overlay);

            for(int i = 0; i < childList.Count; i++) {
                ((OverlayElement)childList[i]).NotifyParent(this, overlay);
            }
        }
예제 #29
0
		/// <summary>
		///    Adds a 2d element to this overlay.
		/// </summary>
		/// <remarks>
		///    Containers are created and managed using the OverlayManager. A container
		///    could be as simple as a square panel, or something more complex like
		///    a grid or tree view. Containers group collections of other elements,
		///    giving them a relative coordinate space and a common z-order.
		///    If you want to attach a gui widget to an overlay, you have to do it via
		///    a container.
		/// </remarks>
		/// <param name="element"></param>
		public void AddElement( OverlayElementContainer element )
		{
			this.elementList.Add( element );
			this.elementLookup.Add( element.Name, element );

			// notify the parent
			element.NotifyParent( null, this );

			AssignZOrders();

			GetWorldTransforms( this.xform );

			element.NotifyWorldTransforms( this.xform );
			element.NotifyViewport();
		}
 /// <summary>
 ///    Internal method for notifying the gui element of it's parent and ultimate overlay.
 /// </summary>
 /// <param name="parent">Parent of this element.</param>
 /// <param name="overlay">Overlay this element belongs to.</param>
 public virtual void NotifyParent(OverlayElementContainer parent, Overlay overlay)
 {
     this.parent = parent;
     this.overlay = overlay;
     isDerivedOutOfDate = true;
 }
예제 #31
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="script"></param>
        /// <param name="line"></param>
        /// <param name="overlay"></param>
        /// <param name="isTemplate"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        private bool ParseChildren(TextReader script, string line, Overlay overlay, bool isTemplate, OverlayElementContainer parent)
        {
            var ret       = false;
            var skipParam = 0;

            var parms = line.Split(' ', '(', ')');

            // split on lines with a ) will have an extra blank array element, so lets get rid of it
            if (parms[parms.Length - 1].Length == 0)
            {
                Array.Resize(ref parms, parms.Length - 1);
            }

            if (isTemplate)
            {
                // the first param = 'template' on a new child element
                if (parms[0] == "template")
                {
                    skipParam++;
                }
            }

            // top level component cannot be an element, it must be a container unless it is a template
            if (parms[0 + skipParam] == "container" ||
                (parms[0 + skipParam] == "element" && (isTemplate || parent != null)))
            {
                var templateName = "";
                ret = true;

                // nested container/element
                if (parms.Length > 3 + skipParam)
                {
                    if (parms.Length != 5 + skipParam)
                    {
                        LogManager.Instance.Write("Bad element/container line: {0} in {1} - {2}, expecting ':' templateName", line, parent.GetType().Name, parent.Name);
                        ParseHelper.SkipToNextCloseBrace(script);
                        return(ret);
                    }
                    if (parms[3 + skipParam] != ":")
                    {
                        LogManager.Instance.Write("Bad element/container line: {0} in {1} - {2}, expecting ':' for element inheritance.", line, parent.GetType().Name, parent.Name);
                        ParseHelper.SkipToNextCloseBrace(script);
                        return(ret);
                    }

                    // get the template name
                    templateName = parms[4 + skipParam];
                }
                else if (parms.Length != 3 + skipParam)
                {
                    LogManager.Instance.Write("Bad element/container line: {0} in {1} - {2}, expecting 'element type(name)'.", line, parent.GetType().Name, parent.Name);
                    ParseHelper.SkipToNextCloseBrace(script);
                    return(ret);
                }

                ParseHelper.SkipToNextOpenBrace(script);
                var isContainer = (parms[0 + skipParam] == "container");
                ParseNewElement(script, parms[1 + skipParam], parms[2 + skipParam], isContainer, overlay, isTemplate, templateName, parent);
            }


            return(ret);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="script"></param>
        /// <param name="line"></param>
        /// <param name="overlay"></param>
        /// <param name="isTemplate"></param>
        /// <param name="parent"></param>
        /// <returns></returns>
        private bool ParseChildren(TextReader script, string line, Overlay overlay, bool isTemplate, OverlayElementContainer parent)
        {
            bool ret = false;
            int skipParam = 0;

            string[] parms = line.Split(' ', '(', ')');

            // split on lines with a ) will have an extra blank array element, so lets get rid of it
            if(parms[parms.Length - 1].Length == 0) {
                string[] tmp = new string[parms.Length - 1];
                Array.Copy(parms, 0, tmp, 0, parms.Length - 1);
                parms = tmp;
            }

            if(isTemplate) {
                // the first param = 'template' on a new child element
                if(parms[0] == "template") {
                    skipParam++;
                }
            }

            // top level component cannot be an element, it must be a container unless it is a template
            if(parms[0 + skipParam] == "container" || (parms[0 + skipParam] == "element" && (isTemplate || parent != null))) {
                string templateName = "";
                ret = true;

                // nested container/element
                if(parms.Length > 3 + skipParam) {
                    if(parms.Length != 5 + skipParam) {
                        log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting ':' templateName", line, parent.Type, parent.Name);
                        ParseHelper.SkipToNextCloseBrace(script);
                        return ret;
                    }
                    if(parms[3 + skipParam] != ":") {
                        log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting ':' for element inheritance.", line, parent.Type, parent.Name);
                        ParseHelper.SkipToNextCloseBrace(script);
                        return ret;
                    }

                    // get the template name
                    templateName = parms[4 + skipParam];
                }
                else if(parms.Length != 3 + skipParam) {
                    log.WarnFormat("Bad element/container line: {0} in {1} - {2}, expecting 'element type(name)'.", line, parent.Type, parent.Name);
                    ParseHelper.SkipToNextCloseBrace(script);
                    return ret;
                }

                ParseHelper.SkipToNextOpenBrace(script);
                bool isContainer = (parms[0 + skipParam] == "container");
                ParseNewElement(script, parms[1 + skipParam], parms[2 + skipParam], isContainer, overlay, isTemplate, templateName, parent);
            }

            return ret;
        }
예제 #33
0
		/// <summary>
		///    Add a nested container to this container.
		/// </summary>
		/// <param name="container"></param>
		public virtual void AddChildContainer( OverlayElementContainer container )
		{
			// add this container to the main child list first
			OverlayElement element = container;
			AddChildElement( element );

			// now add the container to the container collection
			this.childContainers.Add( container.Name, container );
		}
        /// <summary>
        ///    Parses a new element
        /// </summary>
        /// <param name="script"></param>
        /// <param name="type"></param>
        /// <param name="name"></param>
        /// <param name="isContainer"></param>
        /// <param name="overlay"></param>
        /// <param name="isTemplate"></param>
        /// <param name="templateName"></param>
        /// <param name="parent"></param>
        private void ParseNewElement(TextReader script, string type, string name, bool isContainer, Overlay overlay, bool isTemplate,
            string templateName, OverlayElementContainer parent)
        {
            string line;
            OverlayElement element = OverlayElementManager.Instance.CreateElementFromTemplate(templateName, type, name, isTemplate);

            if(parent != null) {
                // add this element to the parent container
                parent.AddChild(element);
            }
            else if(overlay != null) {
                overlay.AddElement((OverlayElementContainer)element);
            }

            while((line = ParseHelper.ReadLine(script)) != null) {
                // inore blank lines and comments
                if(line.Length > 0 && !line.StartsWith("//")) {
                    if(line == "}") {
                        // finished element
                        break;
                    }
                    else {
                        if(isContainer && ParseChildren(script, line, overlay, isTemplate, (OverlayElementContainer)element)) {
                            // nested children, so don't reparse it
                        }
                        else {
                            // element attribute
                            ParseElementAttrib(line, overlay, element);
                        }
                    }
                }
            }
        }
예제 #35
0
		/// <summary>
		/// Creates backdrop, cursor, and trays.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="window"></param>
		/// <param name="mouse"></param>
		/// <param name="listener"></param>
		public SdkTrayManager( String name, RenderWindow window, SIS.Mouse mouse, ISdkTrayListener listener )
		{
			this.mName = name;
			this.mWindow = window;
			this.Mouse = mouse;
			Listener = listener;

			this.mWidgetPadding = 8;
			this.mWidgetSpacing = 2;

			OverlayManager om = OverlayManager.Instance;

			String nameBase = this.mName + "/";
			nameBase.Replace( ' ', '_' );

			// create overlay layers for everything

			BackdropLayer = om.Create( nameBase + "BackdropLayer" );
			this.mTraysLayer = om.Create( nameBase + "WidgetsLayer" );
			this.mPriorityLayer = om.Create( nameBase + "PriorityLayer" );
			this.cursorLayer = om.Create( nameBase + "CursorLayer" );
			BackdropLayer.ZOrder = 100;
			this.mTraysLayer.ZOrder = 200;
			this.mPriorityLayer.ZOrder = 300;
			this.cursorLayer.ZOrder = 400;

			// make backdrop and cursor overlay containers

			this.cursor =
				(OverlayElementContainer)om.Elements.CreateElementFromTemplate( "SdkTrays/Cursor", "Panel", nameBase + "Cursor" );
			this.cursorLayer.AddElement( this.cursor );
			this.backdrop = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "Backdrop" );
			BackdropLayer.AddElement( this.backdrop );
			this.mDialogShade = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "DialogShade" );
			this.mDialogShade.MaterialName = "SdkTrays/Shade";
			this.mDialogShade.Hide();
			this.mPriorityLayer.AddElement( this.mDialogShade );

			String[] trayNames = {
			                     	"TopLeft", "Top", "TopRight", "Left", "Center", "Right", "BottomLeft", "Bottom", "BottomRight"
			                     };

			for ( int i = 0; i < 9; i++ ) // make the real trays
			{
				this.mTrays[ i ] =
					(OverlayElementContainer)
					om.Elements.CreateElementFromTemplate( "SdkTrays/Tray", "BorderPanel", nameBase + trayNames[ i ] + "Tray" );

				this.mTraysLayer.AddElement( this.mTrays[ i ] );

				this.trayWidgetAlign[ i ] = HorizontalAlignment.Center;

				// align trays based on location
				if ( i == (int)TrayLocation.Top || i == (int)TrayLocation.Center || i == (int)TrayLocation.Bottom )
				{
					this.mTrays[ i ].HorizontalAlignment = HorizontalAlignment.Center;
				}
				if ( i == (int)TrayLocation.Left || i == (int)TrayLocation.Center || i == (int)TrayLocation.Right )
				{
					this.mTrays[ i ].VerticalAlignment = VerticalAlignment.Center;
				}
				if ( i == (int)TrayLocation.TopRight || i == (int)TrayLocation.Right || i == (int)TrayLocation.BottomRight )
				{
					this.mTrays[ i ].HorizontalAlignment = HorizontalAlignment.Right;
				}
				if ( i == (int)TrayLocation.BottomLeft || i == (int)TrayLocation.Bottom || i == (int)TrayLocation.BottomRight )
				{
					this.mTrays[ i ].VerticalAlignment = VerticalAlignment.Bottom;
				}
			}

			// create the null tray for free-floating widgets
			this.mTrays[ 9 ] = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "NullTray" );
			this.trayWidgetAlign[ 9 ] = HorizontalAlignment.Left;
			this.mTraysLayer.AddElement( this.mTrays[ 9 ] );

			for ( int i = 0; i < this.mWidgets.Length; i++ )
			{
				this.mWidgets[ i ] = new WidgetList();
			}

			AdjustTrays();

			ShowTrays();
			ShowCursor();
		}
예제 #36
0
파일: Trade.cs 프로젝트: vvnurmi/MOOLGOSS
 private void AddTradeElement()
 {
     _tradeElement = CreateTradeElement();
     ListElement.Left = 6;
     ListElement.Top = 6;
     TradeContent.AddChildElement(ListElement);
 }
예제 #37
0
		/// <summary>
		///    Internal method for notifying the gui element of it's parent and ultimate overlay.
		/// </summary>
		/// <param name="parent">Parent of this element.</param>
		/// <param name="overlay">Overlay this element belongs to.</param>
		public virtual void NotifyParent( OverlayElementContainer parent, Overlay overlay )
		{
			this.parent = parent;
			this.overlay = overlay;

			if ( overlay != null && overlay.IsInitialized && !this.isInitialized )
			{
				Initialize();
			}

			isDerivedOutOfDate = true;
		}
예제 #38
0
파일: List.cs 프로젝트: vvnurmi/MOOLGOSS
 public List(string name, int width, int height)
 {
     _name = name;
     _listWidth = width;
     _listElement = CreateListElement(_listWidth, 50);
 }