Scope
scope::gui::CScopeSliderCtrl Class Reference

#include <ScopeSliderCtrl.h>

Inherits CWindowImpl< CScopeSliderCtrl, CTrackBarCtrl >.

Public Member Functions

CScopeSliderCtrl (ScopeNumber< double > *_scopenum, const double &_increment=0, const bool &_connectback=false, const bool &_connectcontrolstate=false)
 
 ~CScopeSliderCtrl ()
 
BOOL AttachToDlgItem (HWND hWnd)
 
void SetState (const bool &state)
 
Called via Win32 messages
LRESULT OnKeyDown (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnKeyUp (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
void OnScroll (UINT nSBCode, UINT nPos, CScrollBar pScrollBar)
 
LRESULT OnUpdateControl (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
These send async Win32 messages

/**

void UpdateControl ()
 

Protected Attributes

bool created
 
ScopeNumber< double > *const scopenum
 
boost::signals2::connection stateconnection
 
boost::signals2::connection valueconnection
 
const double increment
 
const double scalefactor
 
const double offset
 
const int32_t rangehigh
 
const int32_t rangelow
 
bool shiftstate
 

Detailed Description

An adapted CTrackBarCtrl control around a ScopeNumber<double>.

Implements a slider control, either with incremental or continuous value changes.
ScopeNumber = slider * scalefactor + offset viceversa slider = (ScopeNumber - offset) / scalefactor
If not incrementing we have only 10 ticks (although we slider positions from 0...100)

Warning
Needs message reflection in containing (dialog) window via REFLECT_NOTIFICATIONS()

Definition at line 13 of file ScopeSliderCtrl.h.

Constructor & Destructor Documentation

scope::gui::CScopeSliderCtrl::CScopeSliderCtrl ( ScopeNumber< double > *  _scopenum,
const double &  _increment = 0,
const bool &  _connectback = false,
const bool &  _connectcontrolstate = false 
)

()

Gets a pointer to the ScopeNumber<double> and connects if desired

Parameters
[in]_scopenumScopeNumber to which the slider connects
[in]_incrementdiscrete increment of underlying ScopeNumber or 0 for (nearly) continuous changing of the ScopeNumber (slider range is 0-100 and converted accordingly)
[in]_connectbackchange slider value when ScopeNumber is changed
[in]_connectcontrolstatechange slider enabled/disabled state when read/write state is set at the ScopeNumber

Definition at line 8 of file ScopeSliderCtrl.cpp.

scope::gui::CScopeSliderCtrl::~CScopeSliderCtrl ( )

Disconnects everything.

Definition at line 22 of file ScopeSliderCtrl.cpp.

Member Function Documentation

BOOL scope::gui::CScopeSliderCtrl::AttachToDlgItem ( HWND  hWnd)

Attach the control to a dialog item and set range and tick frequency.

Definition at line 27 of file ScopeSliderCtrl.cpp.

LRESULT scope::gui::CScopeSliderCtrl::OnKeyDown ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Switches to next control on return or tab and updates ScopeValue scope_val Also sets state of shift key.

Definition at line 49 of file ScopeSliderCtrl.cpp.

LRESULT scope::gui::CScopeSliderCtrl::OnKeyUp ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Resets state of shift key.

Definition at line 61 of file ScopeSliderCtrl.cpp.

void scope::gui::CScopeSliderCtrl::OnScroll ( UINT  nSBCode,
UINT  nPos,
CScrollBar  pScrollBar 
)

Updates the ScopeNumber from the slider position.

Definition at line 39 of file ScopeSliderCtrl.cpp.

LRESULT scope::gui::CScopeSliderCtrl::OnUpdateControl ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL &  bHandled 
)

Worker for UpdateControl.

Definition at line 69 of file ScopeSliderCtrl.cpp.

void scope::gui::CScopeSliderCtrl::UpdateControl ( )

Updates the slider position from the ScopeNumber.

Definition at line 75 of file ScopeSliderCtrl.cpp.

void scope::gui::CScopeSliderCtrl::SetState ( const bool &  state)

Sets the enabled/disabled control state.

Definition at line 79 of file ScopeSliderCtrl.cpp.

Member Data Documentation

bool scope::gui::CScopeSliderCtrl::created
protected

true if window created

Definition at line 18 of file ScopeSliderCtrl.h.

ScopeNumber<double>* const scope::gui::CScopeSliderCtrl::scopenum
protected

Pointer to the underlying ScopeNumber.

Definition at line 21 of file ScopeSliderCtrl.h.

boost::signals2::connection scope::gui::CScopeSliderCtrl::stateconnection
protected

The connection object for the control state (connection to the scopenum rw state change)

Definition at line 24 of file ScopeSliderCtrl.h.

boost::signals2::connection scope::gui::CScopeSliderCtrl::valueconnection
protected

The connection object for the control state (connection to the scopenum value change)

Definition at line 27 of file ScopeSliderCtrl.h.

const double scope::gui::CScopeSliderCtrl::increment
protected

if != 0, then scopenum can only be changed by multiples of increment and the slider should display tick marks accordingly

Definition at line 30 of file ScopeSliderCtrl.h.

const double scope::gui::CScopeSliderCtrl::scalefactor
protected

scalefactor is increment or range/100 (if not incrementing)

Definition at line 33 of file ScopeSliderCtrl.h.

const double scope::gui::CScopeSliderCtrl::offset
protected

is ScopeNumber lower limit

Definition at line 36 of file ScopeSliderCtrl.h.

const int32_t scope::gui::CScopeSliderCtrl::rangehigh
protected

the upper end of the slider range (100 if not incrementing, otherwise range/increment)

Definition at line 39 of file ScopeSliderCtrl.h.

const int32_t scope::gui::CScopeSliderCtrl::rangelow
protected

lower end of the slider range, usually 0

Definition at line 42 of file ScopeSliderCtrl.h.

bool scope::gui::CScopeSliderCtrl::shiftstate
protected

stores state of shift key

Definition at line 45 of file ScopeSliderCtrl.h.


The documentation for this class was generated from the following files: