/// <summary> /// Initialize a new instance of the DirectionActionEventArgs class. /// </summary> /// <param name="page">Page effected by event.</param> /// <param name="index">Index of page in the owning collection.</param> /// <param name="action">Previous/Next action to take.</param> public DirectionActionEventArgs(KryptonPage page, int index, DirectionButtonAction action) : base(page, index) { _action = action; }
/// <summary> /// Calculate the enabled state of the next button based on the required action. /// </summary> /// <param name="action">Requested action.</param> /// <returns>Enabled state of the button.</returns> public override ButtonEnabled NextActionEnabled(DirectionButtonAction action) { // Ask the header group to update the action action = _headerGroup.NextActionEnabled(action); // Let base class perform basic action calculations return base.NextActionEnabled(action); }
/// <summary> /// Peform the previous button action requested. /// </summary> /// <param name="action">Requested action.</param> /// <param name="page">Selected page at time of action request.</param> public override void PerformPreviousAction(DirectionButtonAction action, KryptonPage page) { // Ask the header group to update the action action = _headerGroup.PreviousActionEnabled(action); // Let base class perform basic actions base.PerformPreviousAction(action, page); }
/// <summary> /// Calculate the enabled state of the previous button based on the required action. /// </summary> /// <param name="action">Requested action.</param> /// <returns>Enabled state of the button.</returns> public override ButtonEnabled PreviousActionEnabled(DirectionButtonAction action) { // Ask the header group to update the action action = _headerGroup.PreviousActionEnabled(action); // Let base class perform basic action calculations return(base.PreviousActionEnabled(action)); }
/// <summary> /// Get the appropriate action for the header group previous action. /// </summary> /// <param name="action">Requested action.</param> /// <returns>Updated requested action.</returns> public DirectionButtonAction PreviousActionEnabled(DirectionButtonAction action) { // Our mode appropriate action is always to select a page if (action == DirectionButtonAction.ModeAppropriateAction) { action = DirectionButtonAction.SelectPage; } return(action); }
/// <summary> /// Calculate the enabled state of the previous button based on the required action. /// </summary> /// <param name="action">Requested action.</param> /// <returns>Enabled state of the button.</returns> public override ButtonEnabled PreviousActionEnabled(DirectionButtonAction action) { // Our mode appropriate action is always to select a page if (action == DirectionButtonAction.ModeAppropriateAction) { action = DirectionButtonAction.SelectPage; } // Let base class perform basic action calculations return(base.PreviousActionEnabled(action)); }
/// <summary> /// Peform the previous button action requested. /// </summary> /// <param name="action">Requested action.</param> /// <param name="page">Selected page at time of action request.</param> public override void PerformPreviousAction(DirectionButtonAction action, KryptonPage page) { // Our mode appropriate action is always to select a page if (action == DirectionButtonAction.ModeAppropriateAction) { action = DirectionButtonAction.SelectPage; } // Let base class perform basic actions base.PerformPreviousAction(action, page); }
/// <summary> /// Peform the previous button action requested. /// </summary> /// <param name="action">Requested action.</param> /// <param name="page">Selected page at time of action request.</param> public virtual void PerformPreviousAction(DirectionButtonAction action, KryptonPage page) { // Process the requested action switch (action) { case DirectionButtonAction.None: // Do nothing break; case DirectionButtonAction.SelectPage: // Select the page before the provided one Navigator.SelectPreviousPage(page, false); break; } }
/// <summary> /// Calculate the enabled state of the previous button based on the required action. /// </summary> /// <param name="action">Requested action.</param> /// <returns>Enabled state of the button.</returns> public virtual ButtonEnabled PreviousActionEnabled(DirectionButtonAction action) { // Process the requested action switch (action) { case DirectionButtonAction.None: case DirectionButtonAction.SelectPage: // Only enabled if the count of visible pages to the left of current page is positive return(Navigator.PreviousActionValid ? ButtonEnabled.True : ButtonEnabled.False); default: // Action not supported so disable button return(ButtonEnabled.False); } }
/// <summary> /// Initialize a new instance of the NavigatorButton class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public NavigatorButton(KryptonNavigator navigator, NeedPaintHandler needPaint) { Debug.Assert(navigator != null); // Remember back reference _navigator = navigator; // Store the provided paint notification delegate NeedPaint = needPaint; // Create collection for use defined and fixed buttons _buttonSpecs = new NavigatorButtonSpecCollection(navigator); _fixedSpecs = new NavFixedButtonSpecCollection(navigator); // Create the fixed buttons _fixedPrevious = new ButtonSpecNavPrevious(_navigator); _fixedNext = new ButtonSpecNavNext(_navigator); _fixedContext = new ButtonSpecNavContext(_navigator); _fixedClose = new ButtonSpecNavClose(_navigator); // Hook into the click events for the buttons _fixedPrevious.Click += new EventHandler(OnPreviousClick); _fixedNext.Click += new EventHandler(OnNextClick); _fixedContext.Click += new EventHandler(OnContextClick); _fixedClose.Click += new EventHandler(OnCloseClick); // Add fixed buttons into the display collection _fixedSpecs.AddRange(new ButtonSpecNavFixed[] { _fixedPrevious, _fixedNext, _fixedContext, _fixedClose }); // Default fields _displayLogic = ButtonDisplayLogic.Context; _mapTextContext = MapKryptonPageText.TextTitle; _mapImageContext = MapKryptonPageImage.Small; _actionClosed = CloseButtonAction.RemovePageAndDispose; _actionContext = ContextButtonAction.SelectPage; _actionPrevious = _actionNext = DirectionButtonAction.ModeAppropriateAction; _displayPrevious = _displayNext = _displayContext = _displayClosed = ButtonDisplay.Logic; _shortcutClose = DEFAULT_SHORTCUT_CLOSE; _shortcutContext = DEFAULT_SHORTCUT_CONTEXT; _shortcutNext = DEFAULT_SHORTCUT_NEXT; _shortcutPrevious = DEFAULT_SHORTCUT_PREVIOUS; }
/// <summary> /// Initialize a new instance of the NavigatorButton class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public NavigatorButton(KryptonNavigator navigator, NeedPaintHandler needPaint) { Debug.Assert(navigator != null); // Remember back reference _navigator = navigator; // Store the provided paint notification delegate NeedPaint = needPaint; // Create collection for use defined and fixed buttons _buttonSpecs = new NavigatorButtonSpecCollection(navigator); _fixedSpecs = new NavFixedButtonSpecCollection(navigator); // Create the fixed buttons _fixedPrevious = new ButtonSpecNavPrevious(_navigator); _fixedNext = new ButtonSpecNavNext(_navigator); _fixedContext = new ButtonSpecNavContext(_navigator); _fixedClose = new ButtonSpecNavClose(_navigator); // Hook into the click events for the buttons _fixedPrevious.Click += new EventHandler(OnPreviousClick); _fixedNext.Click += new EventHandler(OnNextClick); _fixedContext.Click += new EventHandler(OnContextClick); _fixedClose.Click += new EventHandler(OnCloseClick); // Add fixed buttons into the display collection _fixedSpecs.AddRange(new ButtonSpecNavFixed[] { _fixedPrevious, _fixedNext, _fixedContext, _fixedClose }); // Default fields _displayLogic = ButtonDisplayLogic.Context; _mapTextContext = MapKryptonPageText.TextTitle; _mapImageContext = MapKryptonPageImage.Small; _actionClosed = CloseButtonAction.RemovePageAndDispose; _actionContext = ContextButtonAction.SelectPage; _actionPrevious = _actionNext = DirectionButtonAction.ModeAppropriateAction; _displayPrevious = _displayNext = _displayContext = _displayClosed = ButtonDisplay.Logic; _shortcutClose = _defaultShortcutClose; _shortcutContext = _defaultShortcutContext; _shortcutNext = _defaultShortcutNext; _shortcutPrevious = _defaultShortcutPrevious; }
/// <summary> /// Get the appropriate action for the header group previous action. /// </summary> /// <param name="action">Requested action.</param> /// <returns>Updated requested action.</returns> public DirectionButtonAction PreviousActionEnabled(DirectionButtonAction action) { // Our mode appropriate action is always to select a page if (action == DirectionButtonAction.ModeAppropriateAction) action = DirectionButtonAction.SelectPage; return action; }
/// <summary> /// Initialize a new instance of the DirectionActionEventArgs class. /// </summary> /// <param name="page">Page effected by event.</param> /// <param name="index">Index of page in the owning collection.</param> /// <param name="action">Previous/Next action to take.</param> public DirectionActionEventArgs(KryptonPage page, int index, DirectionButtonAction action) : base(page, index) =>
/// <summary> /// Peform the previous button action requested. /// </summary> /// <param name="action">Requested action.</param> /// <param name="page">Selected page at time of action request.</param> public override void PerformPreviousAction(DirectionButtonAction action, KryptonPage page) { // Our mode appropriate action is always to select a page if (action == DirectionButtonAction.ModeAppropriateAction) action = DirectionButtonAction.SelectPage; // Let base class perform basic actions base.PerformPreviousAction(action, page); }
/// <summary> /// Calculate the enabled state of the previous button based on the required action. /// </summary> /// <param name="action">Requested action.</param> /// <returns>Enabled state of the button.</returns> public override ButtonEnabled PreviousActionEnabled(DirectionButtonAction action) { // Our mode appropriate action is always to select a page if (action == DirectionButtonAction.ModeAppropriateAction) action = DirectionButtonAction.SelectPage; // Let base class perform basic action calculations return base.PreviousActionEnabled(action); }
/// <summary> /// Peform the previous button action requested. /// </summary> /// <param name="action">Requested action.</param> /// <param name="page">Selected page at time of action request.</param> public override void PerformPreviousAction(DirectionButtonAction action, KryptonPage page) { // Our mode appropriate action is always to move the bar positoin if (action == DirectionButtonAction.ModeAppropriateAction) action = DirectionButtonAction.MoveBar; // Only we know how to actually move the bar if (action == DirectionButtonAction.MoveBar) { // Tell the viewport to shift to previous area _layoutBarViewport.MovePrevious(); if (_buttonManager != null) _buttonManager.RecreateButtons(); // Need to layout and paint to effect change Navigator.PerformNeedPaint(true); } else base.PerformPreviousAction(action, page); }
/// <summary> /// Calculate the enabled state of the previous button based on the required action. /// </summary> /// <param name="action">Requested action.</param> /// <returns>Enabled state of the button.</returns> public override ButtonEnabled PreviousActionEnabled(DirectionButtonAction action) { // Our mode appropriate action is always to move the bar positoin if (action == DirectionButtonAction.ModeAppropriateAction) action = DirectionButtonAction.MoveBar; // Only we know how to calculate the moving bar action if (action == DirectionButtonAction.MoveBar) return (_layoutBarViewport.CanScrollPrevious ? ButtonEnabled.True : ButtonEnabled.False); else return base.PreviousActionEnabled(action); }