/// <summary> /// Occurs when a page drag is about to begin and allows it to be cancelled. /// </summary> /// <param name="sender">Source of the page drag; can be null.</param> /// <param name="navigator">Navigator instance associated with source; can be null.</param> /// <param name="e">Event arguments indicating list of pages being dragged.</param> public virtual void PageDragStart(object sender, KryptonNavigator navigator, PageDragCancelEventArgs e) { e.Cancel = !DragStart(e.ScreenPoint, new PageDragEndData(sender, navigator, e.Pages)); }
/// <summary> /// Initialize a new instance of the ViewDrawNavRibbonTab class. /// </summary> /// <param name="navigator">Owning navigator instance.</param> /// <param name="page">Page this ribbon tab represents.</param> public ViewDrawNavRibbonTab(KryptonNavigator navigator, KryptonPage page) { Debug.Assert(navigator != null); Debug.Assert(page != null); Navigator = navigator; Page = page; _lastClick = DateTime.Now.AddDays(-1); // Associate the page component with this view element Component = page; // Create a controller for managing button behavior _buttonController = new PageButtonController(this, OnNeedPaint) { ClickOnDown = true }; _buttonController.Click += OnClick; _buttonController.RightClick += OnRightClick; // Allow the page to be dragged and hook into drag events _buttonController.AllowDragging = true; _buttonController.DragStart += OnDragStart; _buttonController.DragMove += OnDragMove; _buttonController.DragEnd += OnDragEnd; _buttonController.DragQuit += OnDragQuit; _buttonController.ButtonDragRectangle += OnButtonDragRectangle; _buttonController.ButtonDragOffset += OnButtonDragOffset; // A tab is selected on being pressed and not on the mouse up _buttonController.ClickOnDown = true; // We need to be notified of got/lost focus and keyboard events SourceController = _buttonController; KeyController = _buttonController; // Create a decorator to interface with the tooltip manager ToolTipController toolTipController = new ToolTipController(Navigator.ToolTipManager, this, _buttonController); ToolTipController hoverController = new ToolTipController(Navigator.HoverManager, this, toolTipController); // Assign controller for handing mouse input MouseController = hoverController; // Create overrides for handling a focus state _paletteGeneral = Navigator.StateCommon.RibbonGeneral; _overrideStateNormal = new PaletteRibbonTabContentInheritOverride(Page.OverrideFocus.RibbonTab.TabDraw, Page.OverrideFocus.RibbonTab.TabDraw, Page.OverrideFocus.RibbonTab.Content, Page.StateNormal.RibbonTab.TabDraw, Page.StateNormal.RibbonTab.TabDraw, Page.StateNormal.RibbonTab.Content, PaletteState.FocusOverride); _overrideStateTracking = new PaletteRibbonTabContentInheritOverride(Page.OverrideFocus.RibbonTab.TabDraw, Page.OverrideFocus.RibbonTab.TabDraw, Page.OverrideFocus.RibbonTab.Content, Page.StateTracking.RibbonTab.TabDraw, Page.StateTracking.RibbonTab.TabDraw, Page.StateTracking.RibbonTab.Content, PaletteState.FocusOverride); _overrideStatePressed = new PaletteRibbonTabContentInheritOverride(Page.OverrideFocus.RibbonTab.TabDraw, Page.OverrideFocus.RibbonTab.TabDraw, Page.OverrideFocus.RibbonTab.Content, Page.StatePressed.RibbonTab.TabDraw, Page.StatePressed.RibbonTab.TabDraw, Page.StatePressed.RibbonTab.Content, PaletteState.FocusOverride); _overrideStateSelected = new PaletteRibbonTabContentInheritOverride(Page.OverrideFocus.RibbonTab.TabDraw, Page.OverrideFocus.RibbonTab.TabDraw, Page.OverrideFocus.RibbonTab.Content, Page.StateSelected.RibbonTab.TabDraw, Page.StateSelected.RibbonTab.TabDraw, Page.StateSelected.RibbonTab.Content, PaletteState.FocusOverride); // Use a class to convert from ribbon tab to content interface _contentProvider = new RibbonTabToContent(_paletteGeneral, _overrideStateNormal, _overrideStateNormal); // Create the content view element and use the content provider as a way to // convert from the ribbon palette entries to the content palette entries _viewContent = new ViewDrawContent(_contentProvider, this, VisualOrientation.Top); // Add content to the view _layoutDocker = new ViewLayoutDocker { { _viewContent, ViewDockStyle.Fill } }; Add(_layoutDocker); // Create button specification collection manager ButtonSpecManager = new ButtonSpecNavManagerLayoutBar(Navigator, Navigator.InternalRedirector, Page.ButtonSpecs, null, new ViewLayoutDocker[] { _layoutDocker }, new IPaletteMetric[] { Navigator.StateCommon }, new PaletteMetricInt[] { PaletteMetricInt.PageButtonInset }, new PaletteMetricInt[] { PaletteMetricInt.PageButtonInset }, new PaletteMetricPadding[] { PaletteMetricPadding.PageButtonPadding }, Navigator.CreateToolStripRenderer, OnNeedPaint) { // Hook up the tooltip manager so that tooltips can be generated ToolTipManager = Navigator.ToolTipManager, RemapTarget = ButtonSpecNavRemap.ButtonSpecRemapTarget.ButtonStandalone }; // Ensure current button specs are created ButtonSpecManager.RecreateButtons(); // Create the state specific memento array _mementos = new IDisposable[Enum.GetValues(typeof(PaletteState)).Length]; // Cache the last shape encountered _lastRibbonShape = PaletteRibbonShape.Office2010; }
/// <summary> /// Initialize a new instance of the ButtonSpecNavNext class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> public ButtonSpecNavNext(KryptonNavigator navigator) : base(navigator, PaletteButtonSpecStyle.Next) { }
/// <summary> /// Initialize a new instance of the HeaderGroupMappingSecondary class. /// </summary> /// <param name="navigator">Reference to owning navogator instance.</param> /// <param name="needPaint">Delegate for notifying paint requests.</param> public HeaderGroupMappingSecondary(KryptonNavigator navigator, NeedPaintHandler needPaint) : base(navigator, needPaint) { }
/// <summary> /// Initialize a new instance of the ViewDrawNavCheckButtonOutlook class. /// </summary> /// <param name="navigator">Owning navigator instance.</param> /// <param name="page">Page this check button represents.</param> /// <param name="orientation">Orientation for the check button.</param> public ViewDrawNavOutlookOverflow(KryptonNavigator navigator, KryptonPage page, VisualOrientation orientation) : base(navigator, page, orientation, true) { }
/// <summary> /// Initialize a new instance of the ViewDrawNavCheckButtonBase class. /// </summary> /// <param name="navigator">Owning navigator instance.</param> /// <param name="page">Page this check button represents.</param> /// <param name="orientation">Orientation for the check button.</param> /// <param name="stateDisabled">Source for disabled state values.</param> /// <param name="stateNormal">Source for normal state values.</param> /// <param name="stateTracking">Source for tracking state values.</param> /// <param name="statePressed">Source for pressed state values.</param> /// <param name="stateSelected">Source for selected state values.</param> /// <param name="stateFocused">Source for focused state values.</param> public ViewDrawNavCheckButtonBase(KryptonNavigator navigator, KryptonPage page, VisualOrientation orientation, IPaletteTriple stateDisabled, IPaletteTriple stateNormal, IPaletteTriple stateTracking, IPaletteTriple statePressed, IPaletteTriple stateSelected, IPaletteTriple stateFocused) : base(stateDisabled, stateNormal, stateTracking, statePressed, null, null, orientation, true) { Debug.Assert(navigator != null); _navigator = navigator; _page = page; _lastClick = DateTime.Now.AddDays(-1); // Associate the page component with this view element Component = page; // Prevent user from unchecking the selected check button AllowUncheck = false; // Set the source for values to ourself ButtonValues = this; // Create a controller for managing button behavior IMouseController controller = CreateMouseController(); MouseController = controller; // Create overrides for getting the focus values _overrideDisabled = new PaletteTripleOverride(stateFocused, stateDisabled, PaletteState.FocusOverride); _overrideNormal = new PaletteTripleOverride(stateFocused, stateNormal, PaletteState.FocusOverride); _overrideTracking = new PaletteTripleOverride(stateFocused, stateTracking, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(stateFocused, statePressed, PaletteState.FocusOverride); _overrideSelected = new PaletteTripleOverride(stateFocused, stateSelected, PaletteState.FocusOverride); // Push values into the base class SetPalettes(_overrideDisabled, _overrideNormal, _overrideTracking, _overridePressed); SetCheckedPalettes(_overrideSelected, _overrideSelected, _overrideSelected); // Are we allowed to add button specs to the button? if (AllowButtonSpecs) { // Create button specification collection manager _buttonManager = new ButtonSpecNavManagerLayoutBar(Navigator, Navigator.InternalRedirector, Page.ButtonSpecs, null, new ViewLayoutDocker[] { LayoutDocker }, new IPaletteMetric[] { Navigator.StateCommon }, new PaletteMetricInt[] { PaletteMetricInt.PageButtonInset }, new PaletteMetricInt[] { PaletteMetricInt.PageButtonInset }, new PaletteMetricPadding[] { PaletteMetricPadding.PageButtonPadding }, new GetToolStripRenderer(Navigator.CreateToolStripRenderer), null) { // Hook up the tooltip manager so that tooltips can be generated ToolTipManager = Navigator.ToolTipManager }; // Allow derived classes to update the remapping with different values UpdateButtonSpecMapping(); } }
/// <summary> /// Initialize a new instance of the ViewDrawNavCheckButtonStack class. /// </summary> /// <param name="navigator">Owning navigator instance.</param> /// <param name="page">Page this check button represents.</param> /// <param name="orientation">Orientation for the check button.</param> public ViewDrawNavCheckButtonStack(KryptonNavigator navigator, KryptonPage page, VisualOrientation orientation) : base(navigator, page, orientation) { }
/// <summary> /// Initialize a new instance of the NavFixedButtonSpecCollection class. /// </summary> /// <param name="owner">Reference to owning object.</param> public NavFixedButtonSpecCollection(KryptonNavigator owner) : base(owner) { }
/// <summary> /// Occurs when a page drag is about to begin and allows it to be cancelled. /// </summary> /// <param name="sender">Source of the page drag; should never be null.</param> /// <param name="navigator">Navigator instance associated with source; can be null.</param> /// <param name="e">Event arguments indicating list of pages being dragged.</param> public void PageDragStart(object sender, KryptonNavigator navigator, PageDragCancelEventArgs e) { _workspace.InternalPageDragStart(sender, navigator, e); }
/// <summary> /// Initialize a new instance of the ButtonSpecNavPrevious class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> public ButtonSpecNavPrevious(KryptonNavigator navigator) : base(navigator, PaletteButtonSpecStyle.Previous) { }
public KryptonNavigatorProxy(KryptonNavigator navigator) { _navigator = navigator; }
/// <summary> /// Initialize a new instance of the ButtonSpecNavClose class. /// </summary> /// <param name="navigator">Reference to owning navigator instance.</param> public ButtonSpecNavClose(KryptonNavigator navigator) : base(navigator, PaletteButtonSpecStyle.Close) { }
/// <summary> /// Perform licence checking actions. /// </summary> /// <param name="navigator">Navigator control reference.</param> protected override void PerformLicenceChecking(KryptonNavigator navigator) { // Define the encryted licence information EncryptedLicenseProvider.SetParameters(_licenseParameters); // If an error has already been shown, then no need to test license again bool validated = _usageShown; if (!validated) { // Is there a valid license registered? License license = null; validated = LicenseManager.IsValid(typeof(KryptonNavigator), navigator, out license); // Valid license is not enough! if (validated) { validated = false; EncryptedLicense encryptedLicense = license as EncryptedLicense; string[] productInfo = encryptedLicense.ProductInfo.Split(','); // Must contain two fields separated by a comma if (productInfo.Length == 2) { // Both fields must not be empty if (!string.IsNullOrEmpty(productInfo[0]) && !string.IsNullOrEmpty(productInfo[1])) { // Product code must be ... // 'S' = Krypton Suite // And version number... // '400' validated = (productInfo[1].Equals("400")) && (productInfo[0][0] == 'S'); } } } // Remember to release resources no longer needed if (license != null) { license.Dispose(); } } // If we need to indicate the invalid licensing state... if (!validated) { // Get hold of the assembly version number Version thisVersion = Assembly.GetExecutingAssembly().GetName().Version; // We want a unique 30 day evaluation period for each major/minor version EvaluationMonitor monitor = new EvaluationMonitor(_monitorId + thisVersion.Major.ToString() + thisVersion.Minor.ToString()); // If the first time we have failed to get the licence or // the 30 days evaluation period has expired or the component // has been created over a 3000 times then... if ((monitor.UsageCount == 0) || (monitor.UsageCount > 3000) || (monitor.DaysInUse > 30)) { // At runtime show a NAG screen to prevent unauthorized use of the control if (LicenseManager.CurrentContext.UsageMode == LicenseUsageMode.Runtime) { MessageBox.Show("This application was created using an unlicensed version of\n" + "the Krypton Suite control from Component Factory Pty Ltd.\n\n" + "You must contact your software supplier in order to resolve\n" + "the licencing issue.", "Unlicensed Application", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { LicenseInstallForm form = new LicenseInstallForm(); form.ShowDialog(typeof(KryptonNavigator)); } } } // No need to perform check check more than once _usageShown = true; }