-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "ModuleBase_ModelWidget.h"
//#define DEBUG_WIDGET_INSTANCE
//#define DEBUG_ENABLE_SKETCH_INPUT_FIELDS
+//**************************************************************
ModuleBase_ModelWidget::ModuleBase_ModelWidget(QWidget* theParent,
const Config_WidgetAPI* theData)
: QWidget(theParent),
connect(this, SIGNAL(valuesModified()), this, SLOT(onWidgetValuesModified()));
}
+//**************************************************************
ModuleBase_ModelWidget::~ModuleBase_ModelWidget()
{
#ifdef DEBUG_WIDGET_INSTANCE
#endif
}
+//**************************************************************
bool ModuleBase_ModelWidget::reset()
{
bool aResult = resetCustom();
return aResult;
}
+//**************************************************************
bool ModuleBase_ModelWidget::isInitialized(ObjectPtr theObject) const
{
return theObject->data()->attribute(attributeID())->isInitialized();
}
+//**************************************************************
+void ModuleBase_ModelWidget::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
+{
+ theModuleSelectionModes = -1;
+ if (myWidgetValidator)
+ myWidgetValidator->selectionModes(theModuleSelectionModes, theModes);
+}
+
+//**************************************************************
+void ModuleBase_ModelWidget::selectionFilters(QIntList& theModuleSelectionFilters,
+ SelectMgr_ListOfFilter& theSelectionFilters)
+{
+ if (myWidgetValidator)
+ myWidgetValidator->selectionFilters(theModuleSelectionFilters, theSelectionFilters);
+}
+
+//**************************************************************
bool ModuleBase_ModelWidget::isValueEnabled() const
{
bool anEnabled = true;
return anEnabled;
}
+//**************************************************************
void ModuleBase_ModelWidget::processValueState()
{
if (myState == ModifiedInPP || myState == ModifiedInViewer)
storeValue();
}
+//**************************************************************
Events_InfoMessage ModuleBase_ModelWidget::getValueStateError() const
{
Events_InfoMessage aMessage;
return aMessage;
}
+//**************************************************************
QString ModuleBase_ModelWidget::getError(const bool theValueStateChecked) const
{
QString anError;
return anError;
}
+//**************************************************************
void ModuleBase_ModelWidget::enableFocusProcessing()
{
QList<QWidget*> aMyControls = getControls();
}
}
+//**************************************************************
void ModuleBase_ModelWidget::setHighlighted(bool isHighlighted)
{
QList<QWidget*> aWidgetList = getControls();
}
}
+//**************************************************************
void ModuleBase_ModelWidget::setFeature(const FeaturePtr& theFeature, const bool theToStoreValue,
const bool isUpdateFlushed)
{
myFlushUpdateBlocked = false;
}
+//**************************************************************
bool ModuleBase_ModelWidget::focusTo()
{
#ifdef DEBUG_WIDGET_INSTANCE
return isFocusAccepted;
}
+//**************************************************************
void ModuleBase_ModelWidget::activate()
{
#ifdef DEBUG_WIDGET_INSTANCE
if (anAttribute.get() != NULL && !anAttribute->isInitialized())
initializeValueByActivate();
}
-
- if (myWidgetValidator)
- myWidgetValidator->activateFilters(true);
-
activateCustom();
}
+//**************************************************************
void ModuleBase_ModelWidget::deactivate()
{
#ifdef DEBUG_WIDGET_INSTANCE
myIsValueStateBlocked = false;
myState = Stored;
if (myWidgetValidator)
- myWidgetValidator->activateFilters(false);
+ myWidgetValidator->clearValidatedCash();
}
+//**************************************************************
void ModuleBase_ModelWidget::initializeValueByActivate()
{
if (isComputedDefault()) {
}
}
+//**************************************************************
QWidget* ModuleBase_ModelWidget::getControlAcceptingFocus(const bool isFirst)
{
QWidget* aControl = 0;
return aControl;
}
+//**************************************************************
void ModuleBase_ModelWidget::setDefaultValue(const std::string& theValue)
{
myDefaultValue = theValue;
}
+//**************************************************************
bool ModuleBase_ModelWidget::storeValue()
{
setValueState(Stored);
return isDone;
}
#ifdef DEBUG_VALUE_STATE
+
+//**************************************************************
std::string getDebugInfo(const ModuleBase_ModelWidget::ValueState& theState)
{
std::string anInfo;
}
return anInfo;
}
-
#endif
+
+//**************************************************************
ModuleBase_ModelWidget::ValueState ModuleBase_ModelWidget::setValueState
(const ModuleBase_ModelWidget::ValueState& theState)
{
return aState;
}
+//**************************************************************
bool ModuleBase_ModelWidget::blockValueState(const bool theBlocked)
{
bool isBlocked = myIsValueStateBlocked;
return isBlocked;
}
+//**************************************************************
bool ModuleBase_ModelWidget::restoreValue()
{
emit beforeValuesRestored();
return isDone;
}
+//**************************************************************
void ModuleBase_ModelWidget::updateObject(ObjectPtr theObject)
{
if (!myFlushUpdateBlocked) {
}
}
+//**************************************************************
bool ModuleBase_ModelWidget::canProcessAction(ModuleBase_ActionType theActionType,
bool& isActionEnabled)
{
case ActionEnter: return false;
case ActionEscape: return false;
case ActionDelete: return true;
+ case ActionSelection: return true;
case ActionUndo:
case ActionRedo:
default:
}
}
+//**************************************************************
bool ModuleBase_ModelWidget::processAction(ModuleBase_ActionType theActionType,
const ActionParamPtr& theParam)
{
return processEscape();
case ActionDelete:
return processDelete();
+ case ActionSelection:
+ processSelection();
case ActionUndo:
case ActionRedo:
default:
}
}
+//**************************************************************
bool ModuleBase_ModelWidget::processEnter()
{
return false;
}
+//**************************************************************
bool ModuleBase_ModelWidget::processEscape()
{
return false;
}
+//**************************************************************
bool ModuleBase_ModelWidget::processDelete()
{
// we consider that model objects eats delete key in order to
return true;
}
+//**************************************************************
+bool ModuleBase_ModelWidget::processSelection()
+{
+ return false;
+}
+
+//**************************************************************
bool ModuleBase_ModelWidget::eventFilter(QObject* theObject, QEvent *theEvent)
{
QWidget* aWidget = qobject_cast<QWidget*>(theObject);