@@ -32,6 +32,7 @@ struct ButtonEventHandler::PrivateData {
3232 bool checkable;
3333 bool checked;
3434 bool enabled;
35+ bool enabledInput;
3536
3637 Point<double > lastClickPos;
3738 Point<double > lastMotionPos;
@@ -46,12 +47,13 @@ struct ButtonEventHandler::PrivateData {
4647 checkable(false ),
4748 checked(false ),
4849 enabled(true ),
50+ enabledInput(true ),
4951 lastClickPos(0 , 0 ),
5052 lastMotionPos(0 , 0 ) {}
5153
5254 bool mouseEvent (const Widget::MouseEvent& ev)
5355 {
54- if (! enabled )
56+ if (! enabledInput )
5557 return false ;
5658
5759 lastClickPos = ev.pos ;
@@ -103,7 +105,7 @@ struct ButtonEventHandler::PrivateData {
103105
104106 bool motionEvent (const Widget::MotionEvent& ev)
105107 {
106- if (! enabled )
108+ if (! enabledInput )
107109 return false ;
108110
109111 // keep pressed
@@ -179,8 +181,11 @@ struct ButtonEventHandler::PrivateData {
179181 }
180182 }
181183
182- void setEnabled (const bool enabled2) noexcept
184+ void setEnabled (const bool enabled2, const bool appliesToEventInput ) noexcept
183185 {
186+ if (appliesToEventInput)
187+ enabledInput = enabled2;
188+
184189 if (enabled == enabled2)
185190 return ;
186191
@@ -248,9 +253,9 @@ bool ButtonEventHandler::isEnabled() const noexcept
248253 return pData->enabled ;
249254}
250255
251- void ButtonEventHandler::setEnabled (const bool enabled) noexcept
256+ void ButtonEventHandler::setEnabled (const bool enabled, const bool appliesToEventInput ) noexcept
252257{
253- pData->setEnabled (enabled);
258+ pData->setEnabled (enabled, appliesToEventInput );
254259}
255260
256261Point<double > ButtonEventHandler::getLastClickPosition () const noexcept
@@ -318,6 +323,7 @@ struct KnobEventHandler::PrivateData {
318323 float valueDef;
319324 float valueTmp;
320325 bool enabled;
326+ bool enabledInput;
321327 bool usingDefault;
322328 bool usingLog;
323329 Orientation orientation;
@@ -339,6 +345,7 @@ struct KnobEventHandler::PrivateData {
339345 valueDef(value),
340346 valueTmp(value),
341347 enabled(true ),
348+ enabledInput(true ),
342349 usingDefault(false ),
343350 usingLog(false ),
344351 orientation(Vertical),
@@ -359,6 +366,7 @@ struct KnobEventHandler::PrivateData {
359366 valueDef(other->valueDef),
360367 valueTmp(value),
361368 enabled(other->enabled),
369+ enabledInput(other->enabledInput),
362370 usingDefault(other->usingDefault),
363371 usingLog(other->usingLog),
364372 orientation(other->orientation),
@@ -378,6 +386,7 @@ struct KnobEventHandler::PrivateData {
378386 valueDef = other->valueDef ;
379387 valueTmp = value;
380388 enabled = other->enabled ;
389+ enabledInput = other->enabledInput ;
381390 usingDefault = other->usingDefault ;
382391 usingLog = other->usingLog ;
383392 orientation = other->orientation ;
@@ -403,7 +412,7 @@ struct KnobEventHandler::PrivateData {
403412
404413 bool mouseEvent (const Widget::MouseEvent& ev, const double scaleFactor)
405414 {
406- if (! enabled )
415+ if (! enabledInput )
407416 return false ;
408417
409418 if (ev.button != 1 )
@@ -459,7 +468,7 @@ struct KnobEventHandler::PrivateData {
459468
460469 bool motionEvent (const Widget::MotionEvent& ev, const double scaleFactor)
461470 {
462- if (! enabled )
471+ if (! enabledInput )
463472 return false ;
464473
465474 if ((state & kKnobStateDragging ) == 0x0 )
@@ -547,7 +556,7 @@ struct KnobEventHandler::PrivateData {
547556
548557 bool scrollEvent (const Widget::ScrollEvent& ev)
549558 {
550- if (! enabled )
559+ if (! enabledInput )
551560 return false ;
552561
553562 if (! widget->contains (ev.pos ))
@@ -590,8 +599,11 @@ struct KnobEventHandler::PrivateData {
590599 return ((usingLog ? invlogscale (value) : value) - minimum) / diff;
591600 }
592601
593- void setEnabled (const bool enabled2) noexcept
602+ void setEnabled (const bool enabled2, const bool appliesToEventInput ) noexcept
594603 {
604+ if (appliesToEventInput)
605+ enabledInput = enabled2;
606+
595607 if (enabled == enabled2)
596608 return ;
597609
@@ -671,9 +683,9 @@ bool KnobEventHandler::isEnabled() const noexcept
671683 return pData->enabled ;
672684}
673685
674- void KnobEventHandler::setEnabled (const bool enabled) noexcept
686+ void KnobEventHandler::setEnabled (const bool enabled, const bool appliesToEventInput ) noexcept
675687{
676- pData->setEnabled (enabled);
688+ pData->setEnabled (enabled, appliesToEventInput );
677689}
678690
679691bool KnobEventHandler::isInteger () const noexcept
0 commit comments