Exemple #1
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());
        }
Exemple #2
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);
        }
        /** Constructor
         *  @param
         *      name The name to be given to the widget (must be unique).
         *  @param
         *      dimensions The x Position, y Position, width, and height of the widget.
         *  @param
         *      positionMode The GuiMetricsMode for the values given for the position. (absolute/relative/pixel)
         *  @param
         *      sizeMode The GuiMetricsMode for the values given for the size. (absolute/relative/pixel)
         *  @param
         *      material Ogre material defining the widget image.
         *  @param
         *      overlayContainer associates the internal OverlayElement with a specified zOrder.
         *  @param
         *      ParentWidget parent widget which created this widget.
         */
        public Menu(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget ParentWidget)
            : base(name, dimensions, positionMode, sizeMode, material, overlayContainer, ParentWidget)
        {
            mMenuListCounter = 0;
            mShowMenus       = false;
            mWidgetType      = Widget.WidgetType.QGUI_TYPE_MENU;
            mMenuLists       = new List <MenuList>();

            OnDeactivate    += new DeactivateEventHandler(Menu_OnDeactivate);
            OnMouseButtonUp += new MouseButtonUpEventHandler(Menu_OnMouseButtonUp);
            OnMouseMoved    += new MouseMovedEventHandler(Menu_OnMouseMoved);
        }
        public ListItem(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, OverlayContainer overlayContainer, Widget ParentWidget) : base(name, dimensions, positionMode, sizeMode, "", overlayContainer, ParentWidget)
        {
            mImage      = null;
            mButton     = null;
            mWidgetType = Widget.WidgetType.QGUI_TYPE_LISTITEM;
            setCharacterHeight(1.0f);

            OnDeactivate    += new DeactivateEventHandler(ListItem_OnDeactivate);
            OnMouseEnter    += new MouseEnterEventHandler(ListItem_OnMouseEnter);
            OnMouseButtonUp += new MouseButtonUpEventHandler(ListItem_OnMouseButtonUp);
            OnMouseLeaves   += new MouseLeavesEventHandler(ListItem_OnMouseLeaves);
        }
Exemple #5
0
        public MenuList(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget ParentWidget) : base(name, dimensions, positionMode, sizeMode, material + ".button", overlayContainer, ParentWidget)
        {
            mWidgetType = Widget.WidgetType.QGUI_TYPE_MENULIST;
            setCharacterHeight(0.8f);

            // create list
            mList = new List(mInstanceName + ".List", new Vector3(0f, 1.0f, 1.0f), QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, material + ".list", getSheet().getMenuContainer(), this);
            mList.setCharacterHeight(mCharacterHeight);
            mList.setFont(mFont);
            mList.setTextColor(mTextTopColor, mTextBotColor);
            mList.hide();
            // give the list the same zOrder as the button representing this menulist.
            mList.setZOrderOffset(mZOrderOffset, false);
            _addChildWidget(mList);

            OnDeactivate += new DeactivateEventHandler(MenuList_OnDeactivate);
        }
        /** Constructor
         *  @param
         *      name The name to be given to the widget (must be unique).
         *  @param
         *      dimensions The x Position, y Position, width, and height of the widget.
         *              @param
         *                      positionMode The GuiMetricsMode for the values given for the position. (absolute/relative/pixel)
         *              @param
         *                      sizeMode The GuiMetricsMode for the values given for the size. (absolute/relative/pixel)
         *              @param
         *                      material Ogre material defining the widget image.
         *              @param
         *                      overlayContainer associates the internal OverlayElement with a specified zOrder.
         *              @param
         *                      ParentWidget parent widget which created this widget.
         */
        public TextBox(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget ParentWidget)
            : base(name, dimensions, positionMode, sizeMode, material, overlayContainer, ParentWidget)
        {
            mWidgetType = Widget.WidgetType.QGUI_TYPE_TEXTBOX;

            mMaskUserInput         = false;
            mBackSpaceDown         = false;
            mBackSpaceTimer        = 0.0f;
            mDeleteDown            = false;
            mDeleteTimer           = 0.0f;
            mLeftArrowDown         = false;
            mRightArrowDown        = false;
            mMoveCursorTimer       = 0.0f;
            mCursorVisibilityTimer = 0.0f;
            mReadOnly  = false;
            mInputMode = false;


            // Border Overlay gives us ability to assign material to TextBox border and Panel separately.
            mOverlayElement = createPanelOverlayElement(mInstanceName + ".Background", mPixelDimensions, "");
            mOverlayContainer.AddChild(mOverlayElement);
            mOverlayElement.Show();
            setMaterial(mWidgetMaterial);

            mCharacterHeight = 0.75f;
            Mogre.Vector3 textDimensions = new Mogre.Vector3(0, 0, mCharacterHeight);
            // Label has no material, since it directly overlaps the textbox overlay element
            mTextWidget = new Text(mInstanceName + ".Text", textDimensions, QGuiMetricsMode.QGUI_GMM_RELATIVE, QGuiMetricsMode.QGUI_GMM_RELATIVE, mChildrenContainer, this);
            mTextWidget.setTruncateMode(Text.TruncateMode.LEFT);
            mTextWidget.setTruncationFeedback("");
            mTextWidget.setZOrderOffset(1);
            _addChildWidget(mTextWidget);

            mHorizontalAlignment = GuiHorizontalAlignment.GHA_LEFT;
            mVerticalAlignment   = GuiVerticalAlignment.GVA_CENTER;

            alignText(mHorizontalAlignment, mVerticalAlignment);

            OnDeactivate      += new DeactivateEventHandler(TextBox_OnDeactivate);
            OnCharacter       += new CharacterEventHandler(TextBox_OnCharacter);
            OnKeyDown         += new KeyDownEventHandler(TextBox_OnKeyDown);
            OnKeyUp           += new KeyUpEventHandler(TextBox_OnKeyUp);
            OnMouseButtonDown += new MouseButtonDownEventHandler(TextBox_OnMouseButtonDown);
            OnTimeElapsed     += new TimeElapsedHandler(TextBox_OnTimeElapsed);
        }
Exemple #7
0
        /** Constructor
         *  @param
         *      name The name to be given to the widget (must be unique).
         *  @param
         *      dimensions The x Position, y Position, width, and height of the widget.
         *  @param
         *      positionMode The GuiMetricsMode for the values given for the position. (absolute/relative/pixel)
         *  @param
         *      sizeMode The GuiMetricsMode for the values given for the size. (absolute/relative/pixel)
         *  @param
         *      material Ogre material defining the widget image.
         *  @param
         *      overlayContainer associates the internal OverlayElement with a specified zOrder.
         *  @param
         *      parentWidget parent widget which created this widget.
         */
        public Panel(string name, Vector4 dimensions, QGuiMetricsMode positionMode, QGuiMetricsMode sizeMode, string material, OverlayContainer overlayContainer, Widget parentWidget)
            : base(name, dimensions, positionMode, sizeMode, material, overlayContainer, parentWidget)
        {
            mAutoNameWidgetCounter = 0;
            mNumButtons            = 0;
            mNumComboBoxes         = 0;
            mNumImages             = 0;
            mNumLabels             = 0;
            mNumLists         = 0;
            mNumMenus         = 0;
            mNumNStateButtons = 0;
            mNumPanels        = 0;
            mNumProgressBars  = 0;
            mNumTextBoxes     = 0;
            mNumTrackBars     = 0;

            mWidgetType = WidgetType.QGUI_TYPE_PANEL;
            mZOrderValues.Clear();

            if (overlayContainer == null)
            {
                mOverlayContainer = createOverlayContainer(mInstanceName + ".OverlayContainer", "");
                mOverlayContainer.AddChildImpl(mChildrenContainer);

                mOverlayContainer.Show();
                mChildrenContainer.Show();
            }

            mOverlayElement = createPanelOverlayElement(mInstanceName + ".Background", mPixelDimensions, "");
            mOverlayContainer.AddChild(mOverlayElement);
            mOverlayElement.Show();
            setMaterial(mWidgetMaterial);

            OnActivate   += new ActivateEventHandler(Panel_OnActivate);
            OnDeactivate += new DeactivateEventHandler(Panel_OnDeactivate);
        }