Commit 372d4c9f authored by Manuel Grizonnet's avatar Manuel Grizonnet
Browse files

MRG

parents 20720a49 5590a2bc
......@@ -61,7 +61,7 @@ template <class TModel, class TView>
*/
virtual bool HandleWidgetEvent(std::string widgetId, int event)
{
if(m_Model.IsNotNull() && m_View.IsNotNull())
if(m_Model.IsNotNull() && m_View.IsNotNull() && this->GetIsActive())
{
// Find the source widget
WidgetPointerType sourceWidget;
......
......@@ -65,7 +65,7 @@ public:
*/
virtual bool HandleWidgetEvent(std::string widgetId, int event)
{
if( m_View.IsNotNull() && m_Model.IsNotNull() )
if( m_View.IsNotNull() && m_Model.IsNotNull() && this->GetIsActive() )
{
if(widgetId == m_View->GetScrollWidget()->GetIdentifier()
&& event == FL_PUSH && Fl::event_button() == m_MouseButton)
......
......@@ -64,7 +64,7 @@ public:
*/
virtual bool HandleWidgetEvent(std::string widgetId, int event)
{
if( m_View.IsNotNull() && m_Model.IsNotNull() )
if( m_View.IsNotNull() && m_Model.IsNotNull() && this->GetIsActive() )
{
if(widgetId == m_View->GetZoomWidget()->GetIdentifier()
&& event == FL_MOUSEWHEEL)
......
......@@ -64,7 +64,7 @@ public:
*/
virtual bool HandleWidgetEvent(std::string widgetId, int event)
{
if( m_View.IsNotNull() && m_Model.IsNotNull() )
if( m_View.IsNotNull() && m_Model.IsNotNull() && this->GetIsActive() )
{
if(widgetId == m_View->GetFullWidget()->GetIdentifier()
&& event == FL_PUSH && Fl::event_button() == m_MouseButton)
......
......@@ -83,9 +83,14 @@ public:
return false;
}
/** IsActive Accessors */
itkSetMacro(IsActive,bool);
itkGetMacro(IsActive,bool);
itkBooleanMacro(IsActive);
protected:
/** Constructor */
ImageWidgetActionHandler(){}
ImageWidgetActionHandler(){m_IsActive = true;}
/** Destructor */
virtual ~ImageWidgetActionHandler(){}
/** Printself method */
......@@ -97,6 +102,10 @@ protected:
private:
ImageWidgetActionHandler(const Self&); // purposely not implemented
void operator=(const Self&); // purposely not implemented
/** The handler is active or not */
bool m_IsActive;
}; // end class
} // end namespace otb
#endif
......
......@@ -116,6 +116,45 @@ void ImageWidgetController::HandleWidgetMove(std::string widgetId, int x, int y)
}
void ImageWidgetController::ActivateActionHandlers()
{
otbMsgDevMacro(<<"ImageWidgetController::DectivateActionHandler(): ("<<widgetId<<")");
// Define an iterator on the action handlers list
ActionHandlerListType::Iterator it = m_ActionHandlersList->Begin();
// The action handler found
ActionHandlerType * handler;
while(it!=m_ActionHandlersList->End())
{
// Get the current handler
handler = it.Get();
// Check if it listens to (widget,event)
handler->SetIsActive(true);
++it;
}
}
void ImageWidgetController::DeactivateActionHandlers()
{
otbMsgDevMacro(<<"ImageWidgetController::DectivateActionHandler(): ("<<widgetId<<")");
// Define an iterator on the action handlers list
ActionHandlerListType::Iterator it = m_ActionHandlersList->Begin();
// The action handler found
ActionHandlerType * handler;
while(it!=m_ActionHandlersList->End())
{
// Get the current handler
handler = it.Get();
// Check if it listens to (widget,event)
handler->SetIsActive(false);
++it;
}
}
void ImageWidgetController::PrintSelf(std::ostream& os, itk::Indent indent) const
{
Superclass::PrintSelf(os,indent);
......
......@@ -89,6 +89,14 @@ public:
*/
void HandleWidgetMove(std::string widgetId, int x, int y);
/** Activate action all the handlers */
void ActivateActionHandlers();
/** Deactivate action all the handlers */
void DeactivateActionHandlers();
protected:
/** Constructor */
ImageWidgetController();
......
......@@ -62,7 +62,7 @@ public:
*/
virtual bool HandleWidgetEvent(std::string widgetId, int event)
{
if( m_View.IsNotNull() && m_Model.IsNotNull() )
if( m_View.IsNotNull() && m_Model.IsNotNull() && this->GetIsActive() )
{
typename ViewType::ImageWidgetType::Pointer source;
......
......@@ -62,7 +62,7 @@ public:
*/
virtual bool HandleWidgetEvent(std::string widgetId, int event)
{
if(m_Model.IsNotNull() && m_View.IsNotNull())
if(m_Model.IsNotNull() && m_View.IsNotNull() && this->GetIsActive())
{
// Find the source widget
WidgetPointerType sourceWidget;
......
......@@ -76,7 +76,7 @@ public:
return true;
}
if( m_Model.IsNotNull() )
if( m_Model.IsNotNull() && this->GetIsActive() )
{
if(widgetId == m_Widget->GetIdentifier() )
{
......
......@@ -63,7 +63,7 @@ public:
*/
virtual bool HandleWidgetEvent(std::string widgetId, int event)
{
if (m_View.IsNotNull() && m_Model.IsNotNull())
if (m_View.IsNotNull() && m_Model.IsNotNull() && this->GetIsActive())
{
//Left click
if (widgetId == m_View->GetFullWidget()->GetIdentifier() && event
......
......@@ -65,7 +65,7 @@ public:
*/
virtual bool HandleWidgetResize(std::string widgetId, int w, int h)
{
if(m_Model.IsNotNull() && m_View.IsNotNull())
if(m_Model.IsNotNull() && m_View.IsNotNull() && this->GetIsActive())
{
// If resizing the scroll widget, nothing has to be done.
if(widgetId == m_View->GetScrollWidget()->GetIdentifier() )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment