Beispiel #1
0
        protected void LaunchMenuInternal(HtmlElement elmHadFocus)
        {
            LaunchMenu(elmHadFocus);

            DisplayedComponent.RaiseCommandEvent(Properties.CommandMenuOpen,
                                                 CommandType.MenuCreation,
                                                 null);
        }
Beispiel #2
0
 protected override void OnLaunchedMenuClosed()
 {
     CloseToolTip();
     RemoveHighlight();
     DisplayedComponent.RaiseCommandEvent(Properties.CommandMenuClose,
                                          CommandType.MenuClose,
                                          null);
     base.OnLaunchedMenuClosed();
 }
Beispiel #3
0
        /// <summary>
        /// Invoked when the Menu is opened
        /// </summary>
        protected void OnMenuButtonClick(HtmlEvent evt)
        {
            if (!Enabled)
            {
                return;
            }

            LaunchContextMenu(null, evt);
            DisplayedComponent.RaiseCommandEvent(Properties.CommandMenuOpen,
                                                 CommandType.MenuCreation,
                                                 null);
        }
Beispiel #4
0
        private void EnsureClickPreviewReverted()
        {
            if (previewClickCommandSent && !string.IsNullOrEmpty(Properties.CommandRevert))
            {
                Dictionary <string, string> dict = new Dictionary <string, string>();
                dict[ColorPickerCommandProperties.Color] = previewPickerResult.Color;
                dict[ColorPickerCommandProperties.Style] = previewPickerResult.Style;

                DisplayedComponent.RaiseCommandEvent(Properties.CommandRevert,
                                                     CommandType.PreviewRevert,
                                                     dict);
            }
        }
Beispiel #5
0
 private void EnsureClickPreviewReverted()
 {
     if (previewClickCommandSent)
     {
         string revClkCmd = Properties.CommandRevert;
         if (!string.IsNullOrEmpty(revClkCmd))
         {
             CommandProperties[InsertTableCommandProperties.Rows]    = (prevRow + 1).ToString();
             CommandProperties[InsertTableCommandProperties.Columns] = (prevCol + 1).ToString();
             DisplayedComponent.RaiseCommandEvent(revClkCmd,
                                                  CommandType.PreviewRevert,
                                                  CommandProperties);
         }
         CancelClickPreviewRevert();
     }
 }
Beispiel #6
0
        protected void ValidateAndSave()
        {
            Dictionary <string, string> commandDict = new Dictionary <string, string>();

            // If value is not a valid menu item
            if (!SelectMenuItemById(_pendingMenuItemId))
            {
                ControlComponent comp = DisplayedComponent;
                if (!Utility.IsTrue(CBProperties.AutoComplete))
                {
                    string menuitemid = GetMenuItem(_elmMediumInput.Value);
                    if (!string.IsNullOrEmpty(menuitemid) &&
                        SelectMenuItemById(menuitemid))
                    {
                        IsFreeForm = false;
                        commandDict["IsFreeForm"]     = "false";
                        commandDict["CommandValueId"] = _selectedControl.GetCommandValueId();
                        comp.RaiseCommandEvent(CBProperties.Command, CommandType.OptionSelection, commandDict);
                        return;
                    }
                }
                // If autocomplete was off, but we haven't returned yet, then the value was not a valid item in the menu
                // If free-form entry is allowed, send the value to the PageManager
                if (_allowFreeForm)
                {
                    IsFreeForm = true;
                    commandDict["IsFreeForm"] = "true";
                    commandDict["Value"]      = _elmMediumInput.Value;
                    StateProperties[ComboBoxCommandProperties.Value] = _elmMediumInput.Value;
                    comp.RaiseCommandEvent(CBProperties.Command, CommandType.OptionSelection, commandDict);
                }
                // If free-form entry is not allowed, reset to the last valid value and stop
                else
                {
                    ResetToPreviousValue();
                    return;
                }
            }
            // If the value is a valid menu item, send it as a CommandValueId to the PageManager
            else
            {
                IsFreeForm = false;
                commandDict["IsFreeForm"]     = "false";
                commandDict["CommandValueId"] = _selectedControl.GetCommandValueId();
                DisplayedComponent.RaiseCommandEvent(CBProperties.Command, CommandType.OptionSelection, commandDict);
            }
        }
Beispiel #7
0
        protected override void OnClick(HtmlEvent evt)
        {
            if (!CUIUtility.IsNullOrUndefined(typeof(PMetrics)))
            {
                PMetrics.PerfMark(PMarker.perfCUIRibbonToggleButtonOnClickStart);
            }

            CloseToolTip();
            Utility.CancelEventUtility(evt, false, true);

            if (!Enabled)
            {
                return;
            }

            Root.LastCommittedControl = this;

            CommandType ct     = CommandType.General;
            string      cmdtpe = Properties.CommandType;

            if (!string.IsNullOrEmpty(cmdtpe) && cmdtpe == "OptionSelection")
            {
                ct = CommandType.OptionSelection;
                StateProperties[ToggleButtonCommandProperties.CommandValueId] = _commandValueId;
            }

            // Send out the command
            StateProperties[ToggleButtonCommandProperties.On] =
                (!Utility.IsTrue(StateProperties[ToggleButtonCommandProperties.On])).ToString();
            DisplayedComponent.RaiseCommandEvent(Properties.Command,
                                                 ct,
                                                 StateProperties);
            if (Root.PollForState)
            {
                PollForStateAndUpdate();
            }
            else
            {
                SetState(Utility.IsTrue(StateProperties[ToggleButtonCommandProperties.On]));
            }

            if (!CUIUtility.IsNullOrUndefined(typeof(PMetrics)))
            {
                PMetrics.PerfMark(PMarker.perfCUIRibbonToggleButtonOnClickEnd);
            }
        }
Beispiel #8
0
        private void OnMouseout(HtmlEvent args)
        {
            OnEndFocus();
            if (!Enabled)
            {
                return;
            }

            if (string.IsNullOrEmpty(Properties.CommandRevert))
            {
                return;
            }

            DisplayedComponent.RaiseCommandEvent(Properties.CommandRevert,
                                                 CommandType.PreviewRevert,
                                                 StateProperties);
        }
Beispiel #9
0
        private void OnFocus(HtmlEvent args)
        {
            OnBeginFocus();
            if (!Enabled)
            {
                return;
            }

            Root.LastFocusedControl = this;
            if (string.IsNullOrEmpty(Properties.CommandPreview))
            {
                return;
            }

            DisplayedComponent.RaiseCommandEvent(Properties.CommandPreview,
                                                 CommandType.Preview,
                                                 StateProperties);
        }
Beispiel #10
0
        private void OnSelectedItemMouseout(HtmlEvent args)
        {
            OnEndFocus();
            if (!Enabled)
            {
                return;
            }

            switch (DisplayedComponent.Title)
            {
            case "Large":
                Utility.RemoveCSSClassFromElement(_elmLargeSelectedItem,
                                                  "ms-cui-ctl-light-hoveredOver");
                Utility.RemoveCSSClassFromElement(_elmLargeBtn,
                                                  "ms-cui-ctl-split-hover");
                break;

            case "Medium":
                Utility.RemoveCSSClassFromElement(_elmMediumSelectedItem,
                                                  "ms-cui-ctl-light-hoveredOver");
                Utility.RemoveCSSClassFromElement(_elmMediumBtn,
                                                  "ms-cui-ctl-split-hover");
                break;

            case "Small":
                Utility.RemoveCSSClassFromElement(_elmSmallSelectedItem,
                                                  "ms-cui-ctl-light-hoveredOver");
                Utility.RemoveCSSClassFromElement(_elmSmallBtn,
                                                  "ms-cui-ctl-split-hover");
                break;
            }

            if (string.IsNullOrEmpty(Properties.CommandRevert))
            {
                return;
            }

            Dictionary <string, string> commandTemp = new Dictionary <string, string>();

            commandTemp["CommandValueId"] = _selectedControl.GetCommandValueId();
            DisplayedComponent.RaiseCommandEvent(Properties.CommandRevert,
                                                 CommandType.PreviewRevert,
                                                 commandTemp);
        }
Beispiel #11
0
        private void SendClickPreviewCommand(int idx)
        {
            // Store the fact that we sent out a live preview command
            // and its coordinates
            prevCol = GetColFromIndex(idx);
            prevRow = GetRowFromIndex(idx);
            previewClickCommandSent = true;

            string prevClkCmd = Properties.CommandPreview;

            if (!string.IsNullOrEmpty(prevClkCmd))
            {
                CommandProperties[InsertTableCommandProperties.Rows]    = (prevRow + 1).ToString();
                CommandProperties[InsertTableCommandProperties.Columns] = (prevCol + 1).ToString();
                DisplayedComponent.RaiseCommandEvent(prevClkCmd,
                                                     CommandType.Preview,
                                                     CommandProperties);
            }
        }
Beispiel #12
0
        protected void OnMouseOut(HtmlEvent args)
        {
            OnEndFocus();
            if (!Enabled)
            {
                return;
            }

            if (string.IsNullOrEmpty(Properties.CommandRevert))
            {
                return;
            }

            Dictionary <string, string> dict = this.StateProperties;

            dict["CommandValueId"] = Properties.CommandValueId;
            DisplayedComponent.RaiseCommandEvent(Properties.CommandRevert,
                                                 CommandType.PreviewRevert,
                                                 dict);
        }
Beispiel #13
0
        protected void OnButtonClick(HtmlEvent evt)
        {
            Utility.CancelEventUtility(evt, false, true);

            CloseToolTip();
            if (!Enabled || !_buttonEnabled)
            {
                return;
            }

            Root.LastCommittedControl = this;
            focusOnArrow = false;

            Dictionary <string, string> dict = this.StateProperties;

            dict["CommandValueId"] = Properties.CommandValueId;
            DisplayedComponent.RaiseCommandEvent(Properties.Command,
                                                 CommandType.General,
                                                 dict);
        }
Beispiel #14
0
        private void SendClickPreviewCommand(HtmlElement cell)
        {
            if (!string.IsNullOrEmpty(Properties.CommandPreview))
            {
                // Store the fact that we sent out a live preview command
                // and its coordinates
                previewClickCommandSent = true;

                ColorPickerResult           result = GetColorPickerResultFromSelectedCell(cell);
                Dictionary <string, string> dict   = new Dictionary <string, string>();
                dict[ColorPickerCommandProperties.Color] = result.Color;
                dict[ColorPickerCommandProperties.Style] = result.Style;

                previewPickerResult = result;

                DisplayedComponent.RaiseCommandEvent(Properties.CommandPreview,
                                                     CommandType.Preview,
                                                     dict);
            }
        }
Beispiel #15
0
        private void OnSelectedItemClick(HtmlEvent evt)
        {
#if PERF_METRICS
            PMetrics.PerfMark(PMarker.perfCUIRibbonEditWikiPageStart);
#endif
            CloseToolTip();
            Utility.CancelEventUtility(evt, false, true);

            if (!Enabled)
            {
                return;
            }

            CommandType ct = CommandType.OptionSelection;

            Dictionary <string, string> commandTemp = new Dictionary <string, string>();
            commandTemp["CommandValueId"] = _selectedControl.GetCommandValueId();
            DisplayedComponent.RaiseCommandEvent(Properties.Command,
                                                 ct,
                                                 commandTemp);
        }
Beispiel #16
0
        private void OnChange(HtmlEvent args)
        {
            CloseToolTip();
            if (!Enabled)
            {
                return;
            }

            // Send out the command
            StateProperties[TextBoxCommandProperties.Value] = this.Value;
            DisplayedComponent.RaiseCommandEvent(Properties.Command,
                                                 CommandType.General,
                                                 StateProperties);
            if (Root.PollForState)
            {
                PollForStateAndUpdate();
            }
            else
            {
                SetState(null);
            }
        }
Beispiel #17
0
        private void OnChanged(HtmlEvent args)
        {
            CloseToolTip();

            if (!Enabled)
            {
                return;
            }

            if (!ValidateInput())
            {
                ResetToPreviousValue();
                return;
            }

            CommandType ct = CommandType.General;

            StateProperties[SpinnerCommandProperties.ChangeType]     = "manual";
            StateProperties[SpinnerCommandProperties.ChangedByMouse] = false.ToString();
            DisplayedComponent.RaiseCommandEvent(_cmdChanged,
                                                 ct,
                                                 StateProperties);
        }
Beispiel #18
0
        protected void OnMenuButtonClick(HtmlEvent args)
        {
            if (CUIUtility.IsNullOrUndefined(args))
            {
                return;
            }

            Utility.CancelEventUtility(args, false, true);
            CloseToolTip();
            if (!Enabled || !_menuButtonEnabled)
            {
                return;
            }

            Root.FixedPositioningEnabled = false;
            Root.LastCommittedControl    = this;
            focusOnArrow = true;

            HtmlElement prev = args.TargetElement;

            LaunchMenu(prev);
            DisplayedComponent.RaiseCommandEvent(Properties.CommandMenuOpen, CommandType.MenuCreation, null);
        }
Beispiel #19
0
        protected override void OnClick(HtmlEvent evt)
        {
            CloseToolTip();
            Utility.CancelEventUtility(evt, false, true);

            if (!Enabled)
            {
                return;
            }

            Toggle();

            CommandType ct     = CommandType.General;
            string      cmdtpe = Properties.CommandType;
            Dictionary <string, string> dict = StateProperties;

            dict[GalleryButtonCommandProperties.CommandValueId] = Properties.CommandValueId;
            dict["MenuItemId"]      = Properties.MenuItemId;
            dict["SourceControlId"] = Properties.Id;
            if (!CUIUtility.IsNullOrUndefined(cmdtpe) && cmdtpe == "OptionSelection")
            {
                ct = CommandType.OptionSelection;
            }

            DisplayedComponent.RaiseCommandEvent(Properties.Command,
                                                 ct,
                                                 dict);

            if (Root.PollForState)
            {
                PollForStateAndUpdate();
            }
            else
            {
                SetState(Utility.IsTrue(StateProperties[GalleryButtonCommandProperties.On]));
            }
        }
Beispiel #20
0
        protected override void OnClick(HtmlEvent args)
        {
            if (!CUIUtility.IsNullOrUndefined(typeof(PMetrics)))
            {
                PMetrics.PerfMark(PMarker.perfCUIRibbonButtonOnClickStart);
            }

            Utility.CancelEventUtility(args, true, true);
            CloseToolTip();
            if (!Enabled)
            {
                return;
            }

            Root.LastCommittedControl = this;

            CommandType ct = CommandType.General;
            Dictionary <string, string> dict = this.StateProperties;
            string cmdtpe = Properties.CommandType;

            if (!string.IsNullOrEmpty(cmdtpe) && cmdtpe == "OptionSelection")
            {
                ct = CommandType.OptionSelection;
            }
            dict["CommandValueId"]  = this._commandValueId;
            dict["MenuItemId"]      = this._menuItemId;
            dict["SourceControlId"] = this.Id;
            DisplayedComponent.RaiseCommandEvent(Properties.Command,
                                                 ct,
                                                 dict);

            if (!CUIUtility.IsNullOrUndefined(typeof(PMetrics)))
            {
                PMetrics.PerfMark(PMarker.perfCUIRibbonButtonOnClickEnd);
            }
        }
Beispiel #21
0
 /// <summary>
 /// Invoked when the Menu is closed
 /// </summary>
 protected override void OnLaunchedMenuClosed()
 {
     DisplayedComponent.RaiseCommandEvent(Properties.CommandMenuClose,
                                          CommandType.MenuClose,
                                          null);
 }
Beispiel #22
0
 protected void SendMenuCreationCommandEvent()
 {
     DisplayedComponent.RaiseCommandEvent(Properties.CommandMenuOpen,
                                          CommandType.MenuCreation,
                                          null);
 }