public void alignListItemText(GuiHorizontalAlignment ha, GuiVerticalAlignment va) { mListItemHorizontalAlignment = ha; mListItemVerticalAlignment = va; mList.alignListItemText(mListItemHorizontalAlignment, mListItemVerticalAlignment); }
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()); }
public virtual void setHorizontalAlignment(GuiHorizontalAlignment gha) { OgreOverlayPINVOKE.OverlayElement_setHorizontalAlignment(swigCPtr, (int)gha); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual GuiHorizontalAlignment getHorizontalAlignment() { GuiHorizontalAlignment ret = (GuiHorizontalAlignment)OgreOverlayPINVOKE.OverlayElement_getHorizontalAlignment(swigCPtr); if (OgreOverlayPINVOKE.SWIGPendingException.Pending) { throw OgreOverlayPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
// 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); }
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); } }
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); } }
void alignListItemText(GuiHorizontalAlignment ha, GuiVerticalAlignment va) { mList.alignListItemText(ha, va); }