/// <summary> /// Initialize a new instance of the ViewLayoutRibbonGalleryItems class. /// </summary> /// <param name="palette">Reference to palette for display values.</param> /// <param name="gallery">Reference to owning gallery.</param> /// <param name="needPaint">Delegate for requesting paints.</param> /// <param name="buttonUp">Reference to the up button.</param> /// <param name="buttonDown">Reference to the down button.</param> /// <param name="buttonContext">Reference to the context button.</param> public ViewLayoutRibbonGalleryItems(IPalette palette, KryptonGallery gallery, NeedPaintHandler needPaint, ViewDrawRibbonGalleryButton buttonUp, ViewDrawRibbonGalleryButton buttonDown, ViewDrawRibbonGalleryButton buttonContext) { Debug.Assert(palette != null); Debug.Assert(gallery != null); Debug.Assert(needPaint != null); Debug.Assert(buttonUp != null); Debug.Assert(buttonDown != null); Debug.Assert(buttonContext != null); _gallery = gallery; _needPaint = needPaint; _buttonUp = buttonUp; _buttonDown = buttonDown; _buttonContext = buttonContext; _bringIntoView = -1; _scrollIntoView = true; // Need to know when any button is clicked _buttonUp.Click += new MouseEventHandler(OnButtonUp); _buttonDown.Click += new MouseEventHandler(OnButtonDown); _buttonContext.Click += new MouseEventHandler(OnButtonContext); // Create triple that can be used by the draw button _style = ButtonStyle.LowProfile; _triple = new PaletteTripleToPalette(palette, PaletteBackStyle.ButtonLowProfile, PaletteBorderStyle.ButtonLowProfile, PaletteContentStyle.ButtonLowProfile); // Setup timer to use for scrolling lines _scrollTimer = new Timer(); _scrollTimer.Interval = 40; _scrollTimer.Tick += new EventHandler(OnScrollTick); }