コード例 #1
0
ファイル: LgLinkLabel.cs プロジェクト: rinavin/RCJS
        /// <summary>
        ///
        /// </summary>
        /// <param name="control"></param>
        internal override void setSpecificControlProperties(Control control)
        {
            MgControlType type = GuiMgControl.Type;

            ControlUtils.SetContentAlignment(control, ContentAlignment);
            if (Text != null)
            {
                GuiUtilsBase.setText(control, Text);
            }
            if (GuiMgControl.IsHyperTextButton())
            {
                MgLinkLabel mgLinkLabel = ((MgLinkLabel)control);

                mgLinkLabel.SetHoveringColor(HoveringFGColor, HoveringBGColor);
                mgLinkLabel.SetVisitedColor(VisitedFGColor, VisitedBGColor);
                mgLinkLabel.LinkVisited = Visited;
                mgLinkLabel.RefreshLinkColor();
            }
        }
コード例 #2
0
        /// <summary></summary>
        /// <param name="type"></param>
        /// <param name="sender"></param>
        /// <param name="evtArgs"></param>
        internal override void handleEvent(EventType type, Object sender, EventArgs evtArgs)
        {
            ControlsMap controlsMap = ControlsMap.getInstance();
            Control     ctrl        = (Control)sender;
            MapData     mapData     = controlsMap.getMapData(ctrl);

            if (mapData == null)
            {
                return;
            }

            GuiMgControl mgControl = mapData.getControl();
            MgLinkLabel  linkLabel = ctrl as MgLinkLabel;

            var contextIDGuard = new Manager.ContextIDGuard(Manager.GetContextID(mgControl));

            try
            {
                if (linkLabel != null)
                {
                    switch (type)
                    {
                    case EventType.LINK_CLICKED:
                        LinkLabelLinkClickedEventArgs args = (LinkLabelLinkClickedEventArgs)evtArgs;
#if !PocketPC
                        if (args.Button == MouseButtons.Left)
#endif
                        // Mobile: we get here only with a left button click
                        OnLinkClicked(linkLabel, controlsMap, mapData, mgControl, true);
                        return;

                    case EventType.GOT_FOCUS:
                    case EventType.MOUSE_UP:
                        break;

                    case EventType.MOUSE_DOWN:
                        if (!linkLabel.Focused)
                        {
                            GuiUtils.saveFocusingControl(GuiUtils.FindForm(linkLabel), mapData);
                        }

                        break;

                    case EventType.MOUSE_ENTER:
                        linkLabel.OnHovering = true;
                        break;

                    case EventType.MOUSE_LEAVE:
                        linkLabel.OnHovering = false;
                        break;

                    case EventType.KEY_DOWN:
                        KeyEventArgs keyEventArgs = (KeyEventArgs)evtArgs;

                        if (KbdConvertor.isModifier(keyEventArgs.KeyCode))
                        {
                            return;
                        }

                        if (keyEventArgs.Modifiers == Keys.None && keyEventArgs.KeyCode == Keys.Space)
                        {
                            OnLinkClicked(linkLabel, controlsMap, mapData, mgControl, false);
                            return;
                        }
                        break;

                    case EventType.PRESS:
                        if (!linkLabel.Focused)
                        {
                            GuiUtils.saveFocusingControl(GuiUtils.FindForm(linkLabel), mapData);
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            finally
            {
                contextIDGuard.Dispose();
            }


            DefaultHandler.getInstance().handleEvent(type, sender, evtArgs);
        }
コード例 #3
0
 /// <summary>on click</summary>
 /// <param name="controlsMap"></param>
 /// <param name="ctrl"></param>
 /// <param name="mapData"></param>
 /// <param name="mgControl"></param>
 /// <param name="linkLabel"></param>
 private static void OnLinkClicked(MgLinkLabel linkLabel, ControlsMap controlsMap, MapData mapData, GuiMgControl mgControl, bool produceClick)
 {
     Events.OnSelection(GuiUtils.getValue(linkLabel), mgControl, mapData.getIdx(), produceClick);
 }