Esempio n. 1
0
    /**
     * @brief Entity::drawHeader
     * @param painter
     */
    void Entity::drawHeader(QPainter *painter)
    {
        painter->save();

        QColor color = typeColor();

        // Fill background
        QLinearGradient gradient(0, -height() / 2, 0, -height() / 2 + minimumHeight );
        gradient.setColorAt(0, color);
        gradient.setColorAt(1, Qt::white);
        QRectF headerRect(-width() / 2, -height() / 2, width(), minimumHeight);
        painter->fillRect(headerRect, QBrush(gradient));

        // Draw frame
        painter->setPen(color);
        painter->drawRect(headerRect);

        // Add element name
        painter->setPen(Qt::black);
        painter->setRenderHint(QPainter::TextAntialiasing);
        QString name(cutText(G_ASSERT(m_Type)->name(), painter->fontMetrics(), width()));
        painter->drawText(headerRect, Qt::AlignCenter, name);

        painter->restore();
    }
Esempio n. 2
0
    /**
     * @brief Entity::drawFrame
     * @param painter
     */
    void Entity::drawFrame(QPainter *painter)
    {
        painter->save();

        QColor color = typeColor();
        QRectF rect(frameRect());
        painter->fillRect(rect, Qt::white);

        painter->setPen(color);
        painter->drawRect(rect);

        painter->restore();
    }
Esempio n. 3
0
    /**
     * @brief Entity::drawSections
     * @param painter
     */
    void Entity::drawSections(QPainter *painter)
    {
        painter->save();

        // Calculate initial parameters
        QColor color = typeColor();
        auto topLeft = boundingRect().topLeft() + QPointF(margin, margin);
        topLeft.ry() += minimumHeight;
        qreal len = height() - minimumHeight;

        // Draw sections
        drawSection(painter, tr("Properties"), m_Type->properties(), topLeft, len, width(), color);
        drawSection(painter, tr("Methods"), m_Type->methods(), topLeft, len, width(), color);
        drawSection(painter, tr("Fields"), m_Type->fields(), topLeft, len, width(), color);
        drawSection(painter, tr("Elements"), m_Type->enumerators(), topLeft, len, width(), color);

        painter->restore();
    }
Esempio n. 4
0
    /**
     * @brief Entity::drawResizeCorner
     * @param painter
     */
    void Entity::drawResizeCorner(QPainter *painter)
    {
        painter->save();

        painter->setRenderHint(QPainter::Antialiasing);

        painter->setPen(typeColor());

        QRectF rect(resizeCornerRect());
        QPointF bottomLeft(rect.bottomLeft());
        QPointF topRight(rect.topRight());

        // Draw hypotenuse
        painter->drawLine(bottomLeft, topRight);

        // Draw middle line
        bottomLeft.rx() += rect.width() / 2;
        topRight.ry() += rect.height() / 2;
        painter->drawLine(bottomLeft, topRight);

        painter->restore();
    }
COptionTreeWrapper::COptionTreeWrapper(DWORD dwStyle, RECT rcRect, CWnd* pParentWnd, DWORD dwTreeOptions, UINT nID, CString basePath)
{
	m_viewName = _T("COptionTreeWrapper");	
	
	m_Style = dwStyle;
	m_Rect = rcRect;
	m_pParentWnd = pParentWnd;
	m_TreeOptions = dwTreeOptions;
	m_ID = nID;

	m_mTrees[NULL].m_Tree = new COptionTree();	
	m_mTrees[NULL].m_Tree->Create(dwStyle, rcRect, pParentWnd, dwTreeOptions, nID);
	m_mTrees[NULL].m_Tree->SetNotify(TRUE, pParentWnd);

	m_ToolBox = EngineGetToolBox();

	m_szBasePath = basePath;
	
	MAPTYPECREATEFUNC *createFuncs;
	CHashString typeInt(_T("int"));
	CHashString typeFloat(_T("float"));
	CHashString typeDouble(_T("double"));
	CHashString typeBool(_T("bool"));
	CHashString typeString(_T("string"));
	
	CHashString typeCheckBox(_T("check"));
	CHashString typeRadio(_T("radio"));
	CHashString typeSpinner(_T("spinner"));
	CHashString typeEdit(_T("edit"));
	CHashString typeStatic(_T("static"));
	CHashString typeHidden(_T("hidden"));
	CHashString typeFile(_T("file"));
	CHashString typeCombo(_T("combo"));
	CHashString typeColor(_T("color"));

	// setting up optiontree additem function calls
	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeInt.GetUniqueID(), &COptionTreeWrapper::SerializeSpinnerItemInt) );
	createFuncs->insert( make_pair(typeFloat.GetUniqueID(), &COptionTreeWrapper::SerializeSpinnerItemFloat) );
	createFuncs->insert( make_pair(typeDouble.GetUniqueID(), &COptionTreeWrapper::SerializeSpinnerItemDouble) );
	m_TypeFuncMap[typeSpinner.GetUniqueID()] = createFuncs;

	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeInt.GetUniqueID(), &COptionTreeWrapper::SerializeEditItemInt) );
	createFuncs->insert( make_pair(typeFloat.GetUniqueID(), &COptionTreeWrapper::SerializeEditItemFloat) );
	createFuncs->insert( make_pair(typeDouble.GetUniqueID(), &COptionTreeWrapper::SerializeEditItemDouble) );
	createFuncs->insert( make_pair(typeString.GetUniqueID(), &COptionTreeWrapper::SerializeEditItemString) );
	m_TypeFuncMap[typeEdit.GetUniqueID()] = createFuncs;

	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeInt.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemInt) );
	createFuncs->insert( make_pair(typeFloat.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemFloat) );
	createFuncs->insert( make_pair(typeDouble.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemDouble) );
	createFuncs->insert( make_pair(typeString.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemString) );
	m_TypeFuncMap[typeStatic.GetUniqueID()] = createFuncs;

	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeInt.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemInt) );
	createFuncs->insert( make_pair(typeFloat.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemFloat) );
	createFuncs->insert( make_pair(typeDouble.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemDouble) );
	createFuncs->insert( make_pair(typeString.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemString) );
	createFuncs->insert( make_pair(typeBool.GetUniqueID(), &COptionTreeWrapper::SerializeStaticItemBool) );
	m_TypeFuncMap[typeHidden.GetUniqueID()] = createFuncs;

	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeString.GetUniqueID(), &COptionTreeWrapper::SerializeFileItem) );
	m_TypeFuncMap[typeFile.GetUniqueID()] = createFuncs;

	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeString.GetUniqueID(), &COptionTreeWrapper::SerializeComboItem) );
	m_TypeFuncMap[typeCombo.GetUniqueID()] = createFuncs;

	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeBool.GetUniqueID(), &COptionTreeWrapper::SerializeCheckBoxItem) );
	m_TypeFuncMap[typeCheckBox.GetUniqueID()] = createFuncs;

	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeString.GetUniqueID(), &COptionTreeWrapper::SerializeRadioItem) );
	m_TypeFuncMap[typeRadio.GetUniqueID()] = createFuncs;

	createFuncs = new MAPTYPECREATEFUNC;
	createFuncs->insert( make_pair(typeInt.GetUniqueID(), &COptionTreeWrapper::SerializeColorItem) );
	m_TypeFuncMap[typeColor.GetUniqueID()] = createFuncs;

	// setting up coptiontreeitem create functions
	m_TreeItemCreateFuncs[typeSpinner.GetUniqueID()] = &COptionTreeWrapper::CreateSpinnerItem;
	m_TreeItemCreateFuncs[typeEdit.GetUniqueID()] = &COptionTreeWrapper::CreateEditItem;
	m_TreeItemCreateFuncs[typeStatic.GetUniqueID()] = &COptionTreeWrapper::CreateStaticItem;
	m_TreeItemCreateFuncs[typeHidden.GetUniqueID()] = &COptionTreeWrapper::CreateHiddenItem;
	m_TreeItemCreateFuncs[typeFile.GetUniqueID()] = &COptionTreeWrapper::CreateFileItem;
	m_TreeItemCreateFuncs[typeCheckBox.GetUniqueID()] = &COptionTreeWrapper::CreateCheckBoxItem;
	m_TreeItemCreateFuncs[typeRadio.GetUniqueID()] = &COptionTreeWrapper::CreateRadioItem;
	m_TreeItemCreateFuncs[typeCombo.GetUniqueID()] = &COptionTreeWrapper::CreateComboItem;
	m_TreeItemCreateFuncs[typeColor.GetUniqueID()] = &COptionTreeWrapper::CreateColorItem;	
 }