Example #1
0
        public static void nukeOverlayElement(OverlayElement element)
        {
            Mogre.OverlayContainer container = element as Mogre.OverlayContainer;
            if (container != null)
            {
                List <Mogre.OverlayElement> toDelete = new List <Mogre.OverlayElement>();

                Mogre.OverlayContainer.ChildIterator children = container.GetChildIterator();
                while (children.MoveNext())
                {
                    toDelete.Add(children.Current);
                }

                for (int i = 0; i < toDelete.Count; i++)
                {
                    nukeOverlayElement(toDelete[i]);
                }
            }
            if (element != null)
            {
                Mogre.OverlayContainer parent = element.Parent;
                if (parent != null)
                {
                    parent.RemoveChild(element.Name);
                }
                Mogre.OverlayManager.Singleton.DestroyOverlayElement(element);
            }
        }
Example #2
0
 public ProgressBarWidget(string name, string caption, float width, float commentBoxWidth)
 {
     progress      = 0.0f;
     element       = Mogre.OverlayManager.Singleton.CreateOverlayElementFromTemplate("SdkTrays/ProgressBar", "BorderPanel", name);
     element.Width = (width);
     Mogre.OverlayContainer c = (Mogre.OverlayContainer)element;
     textAreaElement = (Mogre.TextAreaOverlayElement)c.GetChild(Name + "/ProgressCaption");
     Mogre.OverlayContainer commentBox = (Mogre.OverlayContainer)c.GetChild(Name + "/ProgressCommentBox");
     commentBox.Width       = (commentBoxWidth);
     commentBox.Left        = (-(commentBoxWidth + 5f));
     commentTextAreaElement = (Mogre.TextAreaOverlayElement)commentBox.GetChild(commentBox.Name + "/ProgressCommentText");
     meterElement           = c.GetChild(Name + "/ProgressMeter");
     meterElement.Width     = (width - 10f);
     fillElement            = ((Mogre.OverlayContainer)meterElement).GetChild(meterElement.Name + "/ProgressFill");
     setCaption(caption);
 }
Example #3
0
        public Slider(string name, string caption, float width, float trackWidth, float valueBoxWidth, float minValue, float maxValue, uint snaps)
        {
            mDragOffset    = 0.0f;
            mValue         = 0.0f;
            mMinValue      = 0.0f;
            mMaxValue      = 0.0f;
            mInterval      = 0.0f;
            mDragging      = false;
            mFitToContents = false;
            element        = Mogre.OverlayManager.Singleton.CreateOverlayElementFromTemplate("SdkTrays/Slider", "BorderPanel", name);
            element.Width  = (width);
            Mogre.OverlayContainer c = (Mogre.OverlayContainer)element;
            mTextArea = (Mogre.TextAreaOverlayElement)c.GetChild(Name + "/SliderCaption");
            Mogre.OverlayContainer valueBox = (Mogre.OverlayContainer)c.GetChild(Name + "/SliderValueBox");
            valueBox.Width = (valueBoxWidth);
            valueBox.Left  = (-(valueBoxWidth + 5));
            mValueTextArea = (Mogre.TextAreaOverlayElement)valueBox.GetChild(valueBox.Name + "/SliderValueText");
            mTrack         = (Mogre.BorderPanelOverlayElement)c.GetChild(Name + "/SliderTrack");
            mHandle        = (Mogre.PanelOverlayElement)mTrack.GetChild(mTrack.Name + "/SliderHandle");

            if (trackWidth <= 0f)             // tall style
            {
                mTrack.Width = (width - 16f);
            }
            else             // long style
            {
                if (width <= 0f)
                {
                    mFitToContents = true;
                }
                element.Height             = (34f);
                mTextArea.Top              = (10f);
                valueBox.Top               = (2f);
                mTrack.Top                 = (-23f);
                mTrack.Width               = (trackWidth);
                mTrack.HorizontalAlignment = (GuiHorizontalAlignment.GHA_RIGHT);
                mTrack.Left                = (-(trackWidth + valueBoxWidth + 5f));
            }

            setCaption(caption);
            setRange(minValue, maxValue, snaps, false);
        }