예제 #1
0
        //private bool dragging;
        public ListView(string name, float left, float top, float height, float width, List <string> columnNames)
        {
            listview        = OverlayManager.Singleton.CreateOverlayElementFromTemplate("AMGE/UI/ListView", "BorderPanel", name) as OverlayContainer;
            scroll          = listview.GetChild(name + "/ListViewScroll") as BorderPanelOverlayElement;
            drag            = scroll.GetChild(name + "/ListViewScroll" + "/ListViewDrag") as OverlayElement;
            this.name       = name;
            this.top        = top;
            this.height     = height;
            this.width      = width;
            this.left       = left;
            listview.Top    = top;
            listview.Left   = left;
            listview.Height = height;
            listview.Width  = width;
            scroll.Height   = height - 0.016f;
            drag.Hide();

            //remove column's height
            maxShowItem     = System.Math.Floor(Convert.ToDouble(float.Parse((height - 0.04f).ToString("0.00")) / 0.045f));
            columns         = new List <ListViewColumn>();
            items           = new List <ListViewItem>();
            visibleItems    = new List <ListViewItem>();
            allUsedElements = new List <OverlayElement>();

            mElement = listview;

            LoadColumns(columnNames);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
0
        public SimplePanelScrollableWidget(string name, float width = 0, float height = 0, float left = 0, float top = 0, float eachRowHeight = 0.03f, int col = 1, bool hasBorder = true) : base(name, width, height, left, top, (int)(height / eachRowHeight), col, hasBorder)
        {
            visualWidgets = new List <Widget>();
            string scrollName = name + "_Scroll";

            scroll = OverlayManager.Singleton.CreateOverlayElementFromTemplate("ScrollComponet", "BorderPanel", scrollName) as BorderPanelOverlayElement;
            drag   = scroll.GetChild(scrollName + "/Drag") as OverlayElement;

            for (int i = 0; i < Rows.Count; i++)
            {
                Rows[i].Type = ValueType.Auto;
            }

            scroll.Left = -0.01f;
            scroll.Top  = 0;
            AddChildOverlayElement(scroll);
            initDragTop = drag.Top;

            scroll.Hide();
            drag.Hide();
        }
예제 #5
0
        public StaticMultiLineTextBoxWidget(string name, string caption, float width, float height)
        {
            element        = OverlayManager.Singleton.CreateOverlayElementFromTemplate("SdkTrays/TextBox", "BorderPanel", name);
            element.Width  = (width);
            element.Height = (height);
            OverlayContainer container = (OverlayContainer)element;

            textArea         = (TextAreaOverlayElement)container.GetChild(Name + "/TextBoxText");
            captionBar       = (BorderPanelOverlayElement)container.GetChild(Name + "/TextBoxCaptionBar");
            captionBar.Width = (width - 4f);
            captionTextArea  = (TextAreaOverlayElement)captionBar.GetChild(captionBar.Name + "/TextBoxCaption");
            setCaption(caption);
            scrollTrack  = (BorderPanelOverlayElement)container.GetChild(Name + "/TextBoxScrollTrack");
            scrollHandle = (PanelOverlayElement)scrollTrack.GetChild(scrollTrack.Name + "/TextBoxScrollHandle");
            scrollHandle.Hide();
            dragging         = false;
            scrollPercentage = 0f;
            startingLine     = 0;
            contentPadding   = 15f;
            originalText     = "";

            refitContents();
        }