public SimpleStaticTextWidget(string name, string caption, float width, bool specificColor, ColourValue color, float fontSize = 100)
        {
            OverlayManager overlayMgr = OverlayManager.Singleton;

            element             = overlayMgr.CreateOverlayElement("BorderPanel", name);
            element.MetricsMode = GuiMetricsMode.GMM_RELATIVE;
            //element.HorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT;
            element.Height = 0.32f;
            element.Left   = -0.01f;
            if (width == 0)
            {
                element.Width = 1;
            }
            mTextArea                     = overlayMgr.CreateOverlayElement("TextArea", name + "/StaticTextCaption") as TextAreaOverlayElement;
            mTextArea.MetricsMode         = GuiMetricsMode.GMM_RELATIVE;
            mTextArea.HorizontalAlignment = GuiHorizontalAlignment.GHA_CENTER;
            mTextArea.SetAlignment(TextAreaOverlayElement.Alignment.Center);
            mTextArea.Top        = 0f;
            mTextArea.FontName   = "EngineFont";
            mTextArea.CharHeight = 0.025f * (fontSize / (float)100);
            mTextArea.SpaceWidth = 0.02f;
            if (!specificColor)
            {
                mTextArea.Colour = new ColourValue(0.9f, 1f, 0.7f);
            }
            else
            {
                mTextArea.Colour = color;
            }
            ((OverlayContainer)element).AddChild(mTextArea);
            Text = caption;
        }
Beispiel #2
0
        public StaticText(string name, string caption, float width, bool specificColor, ColourValue color)
        {
            OverlayManager overlayMgr = OverlayManager.Singleton;

            mElement                      = overlayMgr.CreateOverlayElement("BorderPanel", name);
            mElement.MetricsMode          = GuiMetricsMode.GMM_PIXELS;
            mElement.HorizontalAlignment  = GuiHorizontalAlignment.GHA_CENTER;
            mElement.Height               = 32;
            mTextArea                     = overlayMgr.CreateOverlayElement("TextArea", name + "/StaticTextCaption") as TextAreaOverlayElement;
            mTextArea.MetricsMode         = GuiMetricsMode.GMM_PIXELS;
            mTextArea.HorizontalAlignment = GuiHorizontalAlignment.GHA_CENTER;
            mTextArea.SetAlignment(TextAreaOverlayElement.Alignment.Center);
            mTextArea.Top        = 10;
            mTextArea.FontName   = "EngineFont";
            mTextArea.CharHeight = 18;
            mTextArea.SpaceWidth = 9;
            if (!specificColor)
            {
                mTextArea.Colour = new ColourValue(0.9f, 1f, 0.7f);
            }
            else
            {
                mTextArea.Colour = color;
            }
            ((OverlayContainer)mElement).AddChild(mTextArea);
            SetText(caption);
        }
        public SimpleStaticTextButton(string name, string caption, ColourValue normalStateColor, ColourValue activeStateColor, bool specificColor = false)
        {
            OverlayManager overlayMgr = OverlayManager.Singleton;

            element                       = overlayMgr.CreateOverlayElement("BorderPanel", name);
            element.MetricsMode           = GuiMetricsMode.GMM_RELATIVE;
            element.HorizontalAlignment   = GuiHorizontalAlignment.GHA_LEFT;
            element.Height                = 0.32f;
            mTextArea                     = overlayMgr.CreateOverlayElement("TextArea", name + "/StaticTextCaption") as TextAreaOverlayElement;
            mTextArea.MetricsMode         = GuiMetricsMode.GMM_RELATIVE;
            mTextArea.HorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT;
            mTextArea.SetAlignment(TextAreaOverlayElement.Alignment.Left);
            mTextArea.Top        = 0.01f;
            mTextArea.FontName   = "EngineFont";
            mTextArea.CharHeight = 0.025f;
            mTextArea.SpaceWidth = 0.02f;
            if (!specificColor)
            {
                normalStateColor = new ColourValue(0.9f, 1f, 0.7f);
            }
            mTextArea.Colour = normalStateColor;
            ((OverlayContainer)element).AddChild(mTextArea);
            Text = caption;
            AssignListener(UILayer.Instance.Listener);
            this.normalStateColor = normalStateColor;
            this.activeStateColor = activeStateColor;
            mState = ButtonState.BS_UP;
        }
Beispiel #4
0
        public InputBoxWidget(string name, string caption, float width, float boxWidth, string text = null)
        {
            isTextMode      = false;
            element         = OverlayManager.Singleton.CreateOverlayElementFromTemplate("AMGE/UI/InputBox", "BorderPanel", name);
            isFitToContents = false;

            inputBoxElement       = (BorderPanelOverlayElement)((OverlayContainer)element).GetChild(name + "/InputBoxText");
            inputBoxElement.Width = width - 10;

            captionTextAreaElement       = (TextAreaOverlayElement)((OverlayContainer)element).GetChild(name + "/InputBoxCaption");
            captionTextAreaElement.Width = width - inputBoxElement.Width;

            contentTextAreaElement       = (TextAreaOverlayElement)inputBoxElement.GetChild(name + "/InputBoxText/InputBoxContentText");
            contentTextAreaElement.Width = inputBoxElement.Width;

            inputCursorElement       = (BorderPanelOverlayElement)inputBoxElement.GetChild(name + "/InputBoxText/InputBoxCursor");
            inputCursorElement.Width = 2;
            inputCursorElement.Hide();

            element.Width = width;
            originalText  = string.Empty;

            if (boxWidth > 0)
            {
                if (width <= 0)
                {
                    isFitToContents = true;
                }
                inputBoxElement.Width = boxWidth;
                inputBoxElement.Top   = 2;
                inputBoxElement.Left  = width - boxWidth - 5;
                element.Height        = inputBoxElement.Height + 4;
                captionTextAreaElement.HorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT;
                captionTextAreaElement.SetAlignment(TextAreaOverlayElement.Alignment.Left);
                captionTextAreaElement.Left = 12;
                captionTextAreaElement.Top  = 9;
            }

            if (!string.IsNullOrEmpty(text))
            {
                contentTextAreaElement.Caption = text;
                originalText = text;
            }

            setCaption(caption);
        }
 public override void AddedToAnotherWidgetFinished(
     AlignMode alignMode,
     float parentWidgetLeft,
     float parentWidgetWidth,
     float parentWidgetTop,
     float parentWidgetHeight
     )
 {
     switch (alignMode)
     {
     case AlignMode.Center:
         //mElement.Left = (parentWidgetWidth - TextWidth) / 2;
         mTextArea.HorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT;
         mTextArea.SetAlignment(TextAreaOverlayElement.Alignment.Center);
         element.Left += element.Left + TextWidth - parentWidgetWidth / 2;
         break;
     }
 }
Beispiel #6
0
        public SelectMenuWidget(string name, string caption, float width, float boxWidth, uint maxItemsShown)
        {
            Items                 = new List <string>();
            highlightIndex        = 0;
            displayIndex          = 0;
            dragOffset            = 0.0f;
            selectionIndex        = -1;
            isFitToContents       = false;
            isCursorOver          = false;
            isExpanded            = false;
            isDragging            = false;
            this.maxItemsShown    = maxItemsShown;
            itemsShown            = 0;
            element               = (Mogre.BorderPanelOverlayElement)Mogre.OverlayManager.Singleton.CreateOverlayElementFromTemplate("SdkTrays/SelectMenu", "BorderPanel", name);
            textAreaElement       = (Mogre.TextAreaOverlayElement)((Mogre.OverlayContainer)element).GetChild(name + "/MenuCaption");
            smallBoxElement       = (Mogre.BorderPanelOverlayElement)((Mogre.OverlayContainer)element).GetChild(name + "/MenuSmallBox");
            smallBoxElement.Width = (width - 10);
            smallTextAreaElement  = (Mogre.TextAreaOverlayElement)smallBoxElement.GetChild(name + "/MenuSmallBox/MenuSmallText");
            element.Width         = (width);

            if (boxWidth > 0f)             // long style
            {
                if (width <= 0f)
                {
                    isFitToContents = true;
                }
                smallBoxElement.Width = (boxWidth);
                smallBoxElement.Top   = (2f);
                smallBoxElement.Left  = (width - boxWidth - 5f);
                element.Height        = (smallBoxElement.Height + 4f);
                textAreaElement.HorizontalAlignment = (GuiHorizontalAlignment.GHA_LEFT);
                textAreaElement.SetAlignment(Mogre.TextAreaOverlayElement.Alignment.Left);
                textAreaElement.Left = (12f);
                textAreaElement.Top  = (10f);
            }

            expandedBoxElement       = (Mogre.BorderPanelOverlayElement)((Mogre.OverlayContainer)element).GetChild(name + "/MenuExpandedBox");
            expandedBoxElement.Width = (smallBoxElement.Width + 10);
            expandedBoxElement.Hide();
            scrollTrackElement  = (Mogre.BorderPanelOverlayElement)expandedBoxElement.GetChild(expandedBoxElement.Name + "/MenuScrollTrack");
            scrollHandleElement = (Mogre.PanelOverlayElement)scrollTrackElement.GetChild(scrollTrackElement.Name + "/MenuScrollHandle");

            setCaption(caption);
        }
Beispiel #7
0
        public SimpleButtonWidget(string name, string caption, float width, float height, float left = 0, float top = 0)
        {
            OverlayManager overlayMgr = OverlayManager.Singleton;

            element                             = OverlayManager.Singleton.CreateOverlayElementFromTemplate("SimpleButton", "BorderPanel", name);
            element.MetricsMode                 = GuiMetricsMode.GMM_RELATIVE;
            element.Top                         = top;
            element.Left                        = left;
            element.Height                      = height;
            element.Width                       = width;
            borderPanelElement                  = (BorderPanelOverlayElement)element;
            textAreaElement                     = overlayMgr.CreateOverlayElement("TextArea", name + "/StaticTextCaption") as TextAreaOverlayElement;
            textAreaElement.MetricsMode         = GuiMetricsMode.GMM_RELATIVE;
            textAreaElement.HorizontalAlignment = GuiHorizontalAlignment.GHA_CENTER;
            textAreaElement.SetAlignment(TextAreaOverlayElement.Alignment.Center);
            textAreaElement.FontName   = "EngineFont";
            textAreaElement.CharHeight = 0.025f;
            textAreaElement.SpaceWidth = 0.02f;
            textAreaElement.Colour     = ColourValue.Black;
            textAreaElement.Top        = height / 45f;
            ((OverlayContainer)element).AddChild(textAreaElement);
            textAreaElement.Caption = caption;
        }
Beispiel #8
0
        public Notification(Dimension resolution)
        {
            this.Resolution = resolution;
            Panel = (PanelOverlayElement)OverlayManager.Singleton.CreateOverlayElement("Panel", Guid.NewGuid().ToString());
            TextArea = (TextAreaOverlayElement)OverlayManager.Singleton.CreateOverlayElement("TextArea", Guid.NewGuid().ToString());
            TextArea.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            TextArea.CharHeight = 36;
            TextArea.FontName = "BlueHighway";
            TextArea.Colour = ColourValue.Black;

            Panel.MetricsMode = GuiMetricsMode.GMM_PIXELS;
            Panel.Top = Resolution.Height / 6;
            Panel.Left = 0;
            Panel.Width = Resolution.Width;
            Panel.Height = 50;

            TextArea.Top = 0;
            TextArea.Left = Resolution.Width / 2;
            TextArea.Width = Resolution.Width;
            TextArea.Height = 50;
            TextArea.SetAlignment(TextAreaOverlayElement.Alignment.Center);

            Panel.AddChild(TextArea);
        }