Esempio n. 1
0
        public void alignListItemText(GuiHorizontalAlignment ha, GuiVerticalAlignment va)
        {
            mListItemHorizontalAlignment = ha;
            mListItemVerticalAlignment   = va;

            mList.alignListItemText(mListItemHorizontalAlignment, mListItemVerticalAlignment);
        }
Esempio n. 2
0
        public List(string name, Vector3 dimensions, Label itemTemplate, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget ParentWidget) : base(name, new Vector4(dimensions.x, dimensions.y, dimensions.z, 0), positionMode, sizeMode, material, overlayContainer, ParentWidget)
        {
            mAutoNameListItemCount       = 0;
            mAutoNameListCount           = 0;
            mListItemHorizontalAlignment = GuiHorizontalAlignment.GHA_CENTER;
            mListItemVerticalAlignment   = GuiVerticalAlignment.GVA_CENTER;

            mWidgetType = Widget.WidgetType.QGUI_TYPE_LIST;

            mDefaultListItemHeight = itemTemplate.getDimensions(QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE).w;

            mHighlightMaterial = getSheet().getDefaultSkin() + ".list.highlight";

            // create highlight container for the list
            mHighlightContainer = createOverlayContainer(mInstanceName + ".HighlightContainer", "");
            mChildrenContainer.AddChildImpl(mHighlightContainer);

            mHighlightPanel = createPanelOverlayElement(mInstanceName + ".HighlightPanel", mPixelDimensions, mHighlightMaterial);
            mHighlightContainer.AddChild(mHighlightPanel);
            mHighlightPanel.Show();

            mItems        = new List <ListItem>();
            mChildLists   = new List <List>();
            OnDeactivate += new DeactivateEventHandler(List_OnDeactivate);


            setCharacterHeight(itemTemplate.getCharacterHeight());
            setFont(itemTemplate.getFont());
            setTextColor(itemTemplate.getTextColorTop());
        }
Esempio n. 3
0
 public virtual void setVerticalAlignment(GuiVerticalAlignment gva)
 {
     OgreOverlayPINVOKE.OverlayElement_setVerticalAlignment(swigCPtr, (int)gva);
     if (OgreOverlayPINVOKE.SWIGPendingException.Pending)
     {
         throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 4
0
        public virtual GuiVerticalAlignment getVerticalAlignment()
        {
            GuiVerticalAlignment ret = (GuiVerticalAlignment)OgreOverlayPINVOKE.OverlayElement_getVerticalAlignment(swigCPtr);

            if (OgreOverlayPINVOKE.SWIGPendingException.Pending)
            {
                throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Esempio n. 5
0
        // User defined event handlers that are called when a Selection is made.
        // Reemplazado por Manejo de Eventos // GDZ
        //List<MemberFunctionSlot> mOnSelectUserEventHandlers = new List<MemberFunctionSlot>();


        internal ComboBox(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget ParentWidget) : base(name, dimensions, positionMode, sizeMode, material, overlayContainer, ParentWidget)
        {
            mListItemHorizontalAlignment = GuiHorizontalAlignment.GHA_CENTER;
            mListItemVerticalAlignment   = GuiVerticalAlignment.GVA_CENTER;
            mWidgetType = Widget.WidgetType.QGUI_TYPE_COMBOBOX;

            // Create CloseButton - remember to position it relative to it's parent (TitleBar)
            // Height of the Title Bar
            float height = (mAbsoluteDimensions.w / mAbsoluteDimensions.z);
            // Button has same height as width - Make the button slightly smaller that the titlebar height
            float buttonHeight = 0.8f;
            float buttonWidth  = (height * buttonHeight);
            // Make a 5 pixel buffer
            float   buffer      = 5.0f / mPixelDimensions.z;
            Vector4 bDimensions = new Vector4((1 - (buttonWidth + buffer)), 0.1f, buttonWidth, buttonHeight);

            mButton = new Button(mInstanceName + ".button", bDimensions, QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, mWidgetMaterial + ".button", mChildrenContainer, this);
            mButton.setZOrderOffset(1);
            _addChildWidget(mButton);

            // Make a 15 pixel buffer for the Label
            float bigBuffer = 15.0f / mPixelDimensions.z;

            mLabel = new Label(mInstanceName + ".Label", new Vector4(bigBuffer, 0, (1 - (buttonWidth + bigBuffer)), 1), QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, "", mChildrenContainer, this);
            mLabel.OnDeactivate += new DeactivateEventHandler(ComboBox_OnDeactivate);
            //Reemplazado por Manejo de Eventos //GDZ
            //mLabel.addEventHandler((int)Widget.Event.QGUI_EVENT_DEACTIVATED, this);
            mLabel.setZOrderOffset(1);
            _addChildWidget(mLabel);

            mList = new List(mInstanceName + ".List", new Mogre.Vector3(0, 1.0f, 1.0f), QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, mWidgetMaterial + ".list", getSheet().getMenuContainer(), this);
            mList.setCharacterHeight(mCharacterHeight);
            mList.setFont(mFont);
            mList.setTextColor(mTextTopColor, mTextBotColor);
            mList.hide();
            int    derivedZOrder = getSheet().getMenuOverlayZOrder() + 1;
            Window w             = getWindow();

            if (w != null)
            {
                mList.setZOrderOffset(derivedZOrder - getWindow().getZOrder(), false);
            }
            else
            {
                mList.setZOrderOffset(derivedZOrder, false);
            }
            _addChildWidget(mList);

            OnDeactivate      += new DeactivateEventHandler(ComboBox_OnDeactivate);
            OnMouseEnter      += new MouseEnterEventHandler(ComboBox_OnMouseEnter);
            OnMouseLeaves     += new MouseLeavesEventHandler(ComboBox_OnMouseLeaves);
            OnMouseButtonDown += new MouseButtonDownEventHandler(ComboBox_OnMouseButtonDown);
            OnMouseButtonUp   += new MouseButtonUpEventHandler(ComboBox_OnMouseButtonUp);
        }
Esempio n. 6
0
        public void alignListItemText(GuiHorizontalAlignment ha, GuiVerticalAlignment va)
        {
            mListItemHorizontalAlignment = ha;
            mListItemVerticalAlignment   = va;

            //std::vector<ListItem*>::iterator it;
            //for( it = mItems.begin(); it != mItems.end(); ++it )
            foreach (ListItem i in mItems)
            {
                i.alignText(mListItemHorizontalAlignment, mListItemVerticalAlignment);
            }
        }
Esempio n. 7
0
        public void alignText(GuiHorizontalAlignment ha, GuiVerticalAlignment va)
        {
            mHorizontalAlignment = ha;
            mVerticalAlignment   = va;

            Vector2 relativeLabelPos = mTextWidget.getPosition(QGuiMetricsMode.QGUI_GMM_RELATIVE);
            Vector2 labelPos         = mTextWidget.getPosition(QGuiMetricsMode.QGUI_GMM_ABSOLUTE);
            Vector2 labelSize        = mTextWidget.getSize(QGuiMetricsMode.QGUI_GMM_ABSOLUTE);

            if (mHorizontalAlignment == GuiHorizontalAlignment.GHA_LEFT)
            {
                // We should add a 5 pixel buffer
                float buffer = 5.0f / mPixelDimensions.z;
                mTextWidget.setPosition(buffer, relativeLabelPos.y);
            }
            else if (mHorizontalAlignment == GuiHorizontalAlignment.GHA_CENTER)
            {
                mTextWidget.setPosition(((mAbsoluteDimensions.z / 2) - (labelSize.x / 2)) / mAbsoluteDimensions.z, relativeLabelPos.y);
            }
            else if (mHorizontalAlignment == GuiHorizontalAlignment.GHA_RIGHT)
            {
                // We should add a 5 pixel buffer
                float buffer = 5.0f / mPixelDimensions.z;
                mTextWidget.setPosition(((mAbsoluteDimensions.z) - (labelSize.x) - buffer) / mAbsoluteDimensions.z, relativeLabelPos.y);
            }

            // Make sure to update the position, in case alignment has moved it
            relativeLabelPos = mTextWidget.getPosition(QGuiMetricsMode.QGUI_GMM_RELATIVE);

            if (mVerticalAlignment == GuiVerticalAlignment.GVA_TOP)
            {
                mTextWidget.setPosition(relativeLabelPos.x, 0.0f);
            }
            else if (mVerticalAlignment == GuiVerticalAlignment.GVA_CENTER)
            {
                mTextWidget.setPosition(relativeLabelPos.x, ((mAbsoluteDimensions.w / 2) - (labelSize.y / 2)) / mAbsoluteDimensions.w);
            }
            else if (mVerticalAlignment == GuiVerticalAlignment.GVA_BOTTOM)
            {
                mTextWidget.setPosition(relativeLabelPos.x, ((mAbsoluteDimensions.w) - (labelSize.y)) / mAbsoluteDimensions.w);
            }
        }
Esempio n. 8
0
 void alignListItemText(GuiHorizontalAlignment ha, GuiVerticalAlignment va)
 {
     mList.alignListItemText(ha, va);
 }