+ update(aModel->index(i, 1, aParent));
+ }
+}
+
+#if (!defined HAVE_SALOME) && (defined WIN32)
+void XGUI_DataTree::drawRow(QPainter* thePainter,
+ const QStyleOptionViewItem& theOptions,
+ const QModelIndex& theIndex) const
+{
+ QStyleOptionViewItemV4 aOptions = theOptions;
+ myStyle->setIndex(theIndex);
+ QTreeView::drawRow(thePainter, aOptions, theIndex);
+}
+
+//********************************************************************
+//********************************************************************
+//********************************************************************
+void XGUI_TreeViewStyle::drawPrimitive(PrimitiveElement theElement,
+ const QStyleOption* theOption,
+ QPainter* thePainter, const QWidget* theWidget) const
+{
+ if ((theElement == QStyle::PE_PanelItemViewRow) || (theElement == QStyle::PE_PanelItemViewItem)) {
+ const QStyleOptionViewItemV4* aOptions = qstyleoption_cast<const QStyleOptionViewItemV4 *>(theOption);
+ if (myIndex.isValid() && ((myIndex.flags() & Qt::ItemIsSelectable) == 0)) {
+ QStyle::State aState = aOptions->state;
+ if ((aState & QStyle::State_MouseOver) != 0)
+ aState &= ~QStyle::State_MouseOver;
+ QStyleOptionViewItemV4* aOpt = (QStyleOptionViewItemV4*) aOptions;
+ aOpt->state = aState;
+ QWindowsVistaStyle::drawPrimitive(theElement, aOpt, thePainter, theWidget);
+ }
+ }
+ QWindowsVistaStyle::drawPrimitive(theElement, theOption, thePainter, theWidget);
+}
+#endif
+
+
+//********************************************************************
+//********************************************************************
+//********************************************************************
+XGUI_ActiveDocLbl::XGUI_ActiveDocLbl(const QString& theText, QWidget* theParent )
+ : QLabel(theText, theParent),
+ myPreSelectionStyle(""),
+ myNeutralStyle(""),
+ mySelectionStyle(""),
+ myIsSelected(false)
+{
+}
+
+void XGUI_ActiveDocLbl::setTreeView(QTreeView* theView)
+{
+ myTreeView = theView;
+ setFont(myTreeView->font());
+
+ QPalette aPalet = myTreeView->palette();
+ QColor aHighlight = aPalet.highlight().color();
+ QColor aHighlightText = aPalet.highlightedText().color();
+
+ myPreSelectionStyle = "QLabel {background-color: ";
+ myPreSelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 white, stop:1 " + aHighlight.lighter(170).name() + ");";
+ myPreSelectionStyle += "border: 1px solid lightblue; border-radius: 2px }";
+
+ QString aName = aPalet.color(QPalette::Base).name();
+ myNeutralStyle = "QLabel { border: 1px solid " + aName + " }";
+
+
+#if (!defined HAVE_SALOME) && (defined WIN32)
+ mySelectionStyle = "QLabel {background-color: ";
+ mySelectionStyle += "qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 rgb(236, 245, 255)";
+ mySelectionStyle += ", stop:1 rgb(208, 229, 255));";
+ mySelectionStyle += "border: 1px solid rgb(132, 172, 221); border-radius: 2px }";
+#else
+ mySelectionStyle = "QLabel {background-color: " + aHighlight.name();
+ mySelectionStyle += "; color : " + aHighlightText.name() + "}";
+#endif
+
+ myTreeView->viewport()->installEventFilter(this);
+}
+
+
+#if (!defined HAVE_SALOME) && (defined WIN32)
+bool XGUI_ActiveDocLbl::event(QEvent* theEvent)
+{
+ switch (theEvent->type()) {
+ case QEvent::Enter:
+ if (!myIsSelected)
+ setStyleSheet(myPreSelectionStyle);
+ break;
+ case QEvent::Leave:
+ if (!myIsSelected)
+ setStyleSheet(myNeutralStyle);
+ break;
+ }
+ return QLabel::event(theEvent);
+}
+#endif
+
+bool XGUI_ActiveDocLbl::eventFilter(QObject* theObj, QEvent* theEvent)
+{
+ if (theObj == myTreeView->viewport()) {
+ if (theEvent->type() == QEvent::MouseButtonRelease)
+ unselect();