WPFCustomControls::WpfSpinner Class Reference


Detailed Description

Interaction logic for WpfSpinner.xaml.

This class contains the logic and internal state for the spinner aspect of the MaxSpinnnerUserControl.

List of all members.

Classes

class   RedBorderAdorner
  Takes care of bracketing the spinner, regardless of its current size.

Public Types

enum   SpinnerType { Integer, Float }
enum   RightClickOnSpinnerBehaviorEnum { Minimizes, Maximizes, Zeroes, MinAndMax }

Public Member Functions

  WpfSpinner ()
void  EnterSpinMode ()
  Places the spinner in Spin Mode, where the mouse cursor is captured, the cursor is modified to reflect the spin mode, and scrubbing North-South causes the Value property to be appropriately modified according to the current Scale value.
void  ExitSpinMode ()
  Exits the Spin mode.
void  Increment ()
  Increments the spinner value.
void  Decrement ()
  Decrements the spinner value.

Static Public Attributes

static readonly DependencyProperty  ValueProperty
static readonly DependencyProperty  IsSpinningProperty
static readonly DependencyProperty  IsCapturingProperty
static readonly DependencyProperty  MinProperty
static readonly DependencyProperty  MaxProperty
static readonly DependencyProperty  ScaleProperty
static readonly DependencyProperty  CanSpinProperty
static readonly DependencyProperty  RightClickOnSpinnerBehaviorProperty
static readonly DependencyProperty  PrecisionProperty
static readonly DependencyProperty  IsShowingEditBoxProperty
static readonly DependencyProperty  ShouldRefreshProperty
static readonly decimal  ControlScaleModifier = 3
static readonly decimal  AltScaleModifier = 0.5M

Protected Member Functions

virtual void  OnScaleChanged (EventArgs args)
override void  OnMouseMove (MouseEventArgs e)
virtual decimal  CalculateSpinMoveModifier ()
virtual void  AttachSpinModeHandlers ()
virtual void  DetachSpinModeHandlers ()
void  OnValueChanged (ValueChangedEventArgs< decimal > args)
void  OnIsSpinningChanged (ValueChangedEventArgs< bool > args)
virtual void  OnRequestHighlight (EventArgs args)
void  OnIsShowingEditBoxChanged (EventArgs args)
virtual void  OnPrecisionChanged (EventArgs args)
virtual void  RevertToPreviousValue ()

Properties

decimal  Min [get, set]
  The minimum value of the spinner.
decimal  Max [get, set]
  The maximum value of the spinner.
decimal  Scale [get, set]
  The scale determines the increment (per pixel) and precision of the spinner.
bool  CanSpin [get, set]
  If this value is false, the spinner cannot enter Spin mode, but can increment and decrement its value by clicking or holding the Up and Down arrows of the spinner or changing the text value.
RightClickOnSpinnerBehaviorEnum  RightClickOnSpinnerBehavior [get, set]
  Determines the behaviour of the spinner when the user right-clicks on it.
decimal  Value [get, set]
  The currently commited spinner value.
int  Precision [get, set]
bool  IsCapturing [get, set]
  Used to determine if the spinner is in a Spinning state.
bool  IsSpinning [get, set]
  Used to determine if the spinner is in a Spinning state.
Point  ReportedMousePosition [get, set]
bool  IsShowingEditBox [get, set]
  If this property is false, then edit text box is not shown.
bool  ShouldRefresh [get, set]

Events

EventHandler< EventArgs >  ScaleChanged
EventHandler
< ValueChangedEventArgs
< decimal > > 
ValueChanged
EventHandler
< ValueChangedEventArgs< bool > > 
IsSpinningChanged
EventHandler  RequestHighlight
EventHandler< EventArgs >  IsShowingEditBoxChanged
EventHandler< EventArgs >  PrecisionChanged

Member Enumeration Documentation

Enumerator:
Integer 
Float 
Enumerator:
Minimizes 
Maximizes 
Zeroes 
MinAndMax 

Constructor & Destructor Documentation

WPFCustomControls::WpfSpinner::WpfSpinner ( ) [inline]

Member Function Documentation

virtual void WPFCustomControls::WpfSpinner::OnScaleChanged ( EventArgs  args ) [inline, protected, virtual]
override void WPFCustomControls::WpfSpinner::OnMouseMove ( MouseEventArgs  e ) [inline, protected]
virtual decimal WPFCustomControls::WpfSpinner::CalculateSpinMoveModifier ( ) [inline, protected, virtual]
void WPFCustomControls::WpfSpinner::EnterSpinMode ( ) [inline]

Places the spinner in Spin Mode, where the mouse cursor is captured, the cursor is modified to reflect the spin mode, and scrubbing North-South causes the Value property to be appropriately modified according to the current Scale value.

This function is normally internal, but could be triggered programmatically.

See also:
ExitSpinMode
void WPFCustomControls::WpfSpinner::ExitSpinMode ( ) [inline]

Exits the Spin mode.

This function is normally internal, but could be triggered programmatically.

See also:
EnterSpinMode
virtual void WPFCustomControls::WpfSpinner::AttachSpinModeHandlers ( ) [inline, protected, virtual]
virtual void WPFCustomControls::WpfSpinner::DetachSpinModeHandlers ( ) [inline, protected, virtual]
void WPFCustomControls::WpfSpinner::Increment ( ) [inline]

Increments the spinner value.

This value change is still coerced to remain with Min and Max values, as usual.

void WPFCustomControls::WpfSpinner::Decrement ( ) [inline]

Decrements the spinner value.

This value change is still coerced to remain with Min and Max values, as usual.

void WPFCustomControls::WpfSpinner::OnValueChanged ( ValueChangedEventArgs< decimal >  args ) [inline, protected]
void WPFCustomControls::WpfSpinner::OnIsSpinningChanged ( ValueChangedEventArgs< bool >  args ) [inline, protected]
virtual void WPFCustomControls::WpfSpinner::OnRequestHighlight ( EventArgs  args ) [inline, protected, virtual]
void WPFCustomControls::WpfSpinner::OnIsShowingEditBoxChanged ( EventArgs  args ) [inline, protected]
virtual void WPFCustomControls::WpfSpinner::OnPrecisionChanged ( EventArgs  args ) [inline, protected, virtual]
virtual void WPFCustomControls::WpfSpinner::RevertToPreviousValue ( ) [inline, protected, virtual]

Member Data Documentation

readonly DependencyProperty WPFCustomControls::WpfSpinner::ValueProperty [static]
Initial value:
 DependencyProperty.Register(
                "Value",
                typeof(decimal),
                typeof(WpfSpinner),
                new FrameworkPropertyMetadata(
                    0M,
                    FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                    new PropertyChangedCallback(ValuePropertyChanged),
                    new CoerceValueCallback(ValueCoerceValueCallback)))
readonly DependencyProperty WPFCustomControls::WpfSpinner::IsSpinningProperty [static]
Initial value:
 DependencyProperty.Register(
                "IsSpinning",
                typeof(bool),
                typeof(WpfSpinner),
                new PropertyMetadata(
                    false,
                    new PropertyChangedCallback(IsSpinningPropertyChanged)))
readonly DependencyProperty WPFCustomControls::WpfSpinner::IsCapturingProperty [static]
Initial value:
 DependencyProperty.Register(
                "IsCapturing",
                typeof(bool),
                typeof(WpfSpinner),
                new PropertyMetadata(
                    false))
readonly DependencyProperty WPFCustomControls::WpfSpinner::MinProperty [static]
Initial value:
 DependencyProperty.Register(
                "Min",
                typeof(decimal),
                typeof(WpfSpinner),
                new PropertyMetadata(Decimal.MinValue))
readonly DependencyProperty WPFCustomControls::WpfSpinner::MaxProperty [static]
Initial value:
 DependencyProperty.Register(
                "Max",
                typeof(decimal),
                typeof(WpfSpinner),
                new PropertyMetadata(Decimal.MaxValue))
readonly DependencyProperty WPFCustomControls::WpfSpinner::ScaleProperty [static]
Initial value:
 DependencyProperty.Register(
                "Scale",
                typeof(decimal),
                typeof(WpfSpinner),
                new PropertyMetadata(1M,
                    new PropertyChangedCallback(ScalePropertyChanged)))
readonly DependencyProperty WPFCustomControls::WpfSpinner::CanSpinProperty [static]
Initial value:
 DependencyProperty.Register(
                "CanSpin",
                typeof(bool),
                typeof(WpfSpinner),
                new PropertyMetadata(true))
Initial value:
 DependencyProperty.Register(
                "RightClickOnSpinnerBehavior",
                typeof(RightClickOnSpinnerBehaviorEnum),
                typeof(WpfSpinner),
                new FrameworkPropertyMetadata(RightClickOnSpinnerBehaviorEnum.Zeroes))
readonly DependencyProperty WPFCustomControls::WpfSpinner::PrecisionProperty [static]
Initial value:
 DependencyProperty.Register(
                "Precision",
                typeof(int),
                typeof(WpfSpinner),
                new FrameworkPropertyMetadata(ManagedServices.SpinnerSettings.GetPrecision(),
                    new PropertyChangedCallback(PrecisionPropertyChanged)))
readonly DependencyProperty WPFCustomControls::WpfSpinner::IsShowingEditBoxProperty [static]
Initial value:
 DependencyProperty.Register(
            "IsShowingEditBox",
            typeof(bool),
            typeof(WpfSpinner),
            new FrameworkPropertyMetadata(
                true,
                new PropertyChangedCallback(IsShowingEditBoxPropertyChanged)))
readonly DependencyProperty WPFCustomControls::WpfSpinner::ShouldRefreshProperty [static]
Initial value:
 DependencyProperty.Register(
            "ShouldRefresh",
            typeof(bool),
            typeof(WpfSpinner),
            new FrameworkPropertyMetadata(false))
readonly decimal WPFCustomControls::WpfSpinner::AltScaleModifier = 0.5M [static]

Property Documentation

decimal WPFCustomControls::WpfSpinner::Min [get, set]

The minimum value of the spinner.

This is a Dependency Property.

decimal WPFCustomControls::WpfSpinner::Max [get, set]

The maximum value of the spinner.

This is a Dependency Property.

decimal WPFCustomControls::WpfSpinner::Scale [get, set]

The scale determines the increment (per pixel) and precision of the spinner.

A Scale of 0.2 will show a Spinner with a precision of 1. A scale of 10 will show a Spinner with a precision of 0. Any scale with decimal points will result in a float spinner, while an integer-based spinner will be considered an Int spinner.

This is a Dependency Property.

bool WPFCustomControls::WpfSpinner::CanSpin [get, set]

If this value is false, the spinner cannot enter Spin mode, but can increment and decrement its value by clicking or holding the Up and Down arrows of the spinner or changing the text value.

This is a useful setting for spinners that control parameters that can drastically affect scene complexity and redraw times.

This is a Dependency Property.

RightClickOnSpinnerBehaviorEnum WPFCustomControls::WpfSpinner::RightClickOnSpinnerBehavior [get, set]

Determines the behaviour of the spinner when the user right-clicks on it.

The default behaviour is the same as all spinners in max - when you right-click on the spinner, it sets the minimize value. Other options include Maximize everywhere, and we can also split the spinner so that if a user right-clicks on the up arrow, it maximizes, and if the user right-clicks on the bottom arrow, it minimizes.

This is a Dependency Property.

decimal WPFCustomControls::WpfSpinner::Value [get, set]

The currently commited spinner value.

This is the final value kept after a user has adjusted the selection on the control.

int WPFCustomControls::WpfSpinner::Precision [get, set]
bool WPFCustomControls::WpfSpinner::IsCapturing [get, set]

Used to determine if the spinner is in a Spinning state.

bool WPFCustomControls::WpfSpinner::IsSpinning [get, set]

Used to determine if the spinner is in a Spinning state.

Point WPFCustomControls::WpfSpinner::ReportedMousePosition [get, set, protected]
bool WPFCustomControls::WpfSpinner::IsShowingEditBox [get, set]

If this property is false, then edit text box is not shown.

This is a Dependency Property.

bool WPFCustomControls::WpfSpinner::ShouldRefresh [get, set]

Event Documentation

EventHandler<EventArgs> WPFCustomControls::WpfSpinner::ScaleChanged
EventHandler<ValueChangedEventArgs<decimal> > WPFCustomControls::WpfSpinner::ValueChanged
EventHandler<ValueChangedEventArgs<bool> > WPFCustomControls::WpfSpinner::IsSpinningChanged
EventHandler WPFCustomControls::WpfSpinner::RequestHighlight
EventHandler<EventArgs> WPFCustomControls::WpfSpinner::IsShowingEditBoxChanged
EventHandler<EventArgs> WPFCustomControls::WpfSpinner::PrecisionChanged

WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner
WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner WPFCustomControls::WpfSpinner