public ViewDrawRibbonGroupNumericUpDown(KryptonRibbon ribbon,
KryptonRibbonGroupNumericUpDown ribbonNumericUpDown,
NeedPaintHandler needPaint)
{
Debug.Assert(ribbon != null);
Debug.Assert(ribbonNumericUpDown != null);
Debug.Assert(needPaint != null);
// Remember incoming references
_ribbon = ribbon;
_ribbonNumericUpDown = ribbonNumericUpDown;
_needPaint = needPaint;
_currentSize = _ribbonNumericUpDown.ItemSizeCurrent;
// Hook into the numeric up-down events
_ribbonNumericUpDown.MouseEnterControl += new EventHandler(OnMouseEnterControl);
_ribbonNumericUpDown.MouseLeaveControl += new EventHandler(OnMouseLeaveControl);
// Associate this view with the source component (required for design time selection)
Component = _ribbonNumericUpDown;
if (_ribbon.InDesignMode)
{
// At design time we need to know when the user right clicks the numeric up-down
ContextClickController controller = new ContextClickController();
controller.ContextClick += new MouseEventHandler(OnContextClick);
MouseController = controller;
}
// Create controller needed for handling focus and key tip actions
_controller = new NumericUpDownController(_ribbon, _ribbonNumericUpDown, this);
SourceController = _controller;
KeyController = _controller;
// We need to rest visibility of the numeric up-down for each layout cycle
_ribbon.ViewRibbonManager.LayoutBefore += new EventHandler(OnLayoutAction);
_ribbon.ViewRibbonManager.LayoutAfter += new EventHandler(OnLayoutAction);
// Define back reference to view for the numeric up-down definition
_ribbonNumericUpDown.NumericUpDownView = this;
// Give paint delegate to numeric up-down so its palette changes are redrawn
_ribbonNumericUpDown.ViewPaintDelegate = needPaint;
// Hook into changes in the ribbon custom definition
_ribbonNumericUpDown.PropertyChanged += new PropertyChangedEventHandler(OnNumericUpDownPropertyChanged);
}