Beispiel #1
0
static void
MainHandleMenu(HWND hwnd, UINT uMenuItem)
{
    const PIXEL_FORMAT_INFO* pPixelFormat;
    const COLOR_INFO* pColor;
    const TRANSPARENCY_INFO* pTransparency;

    pPixelFormat = PixelFormatInfo(uMenuItem);
    if(pPixelFormat != NULL) {
        CheckMenuItem(hMenu, pCurrentPixelFormat->uMenuItem, MF_BYCOMMAND | MF_UNCHECKED);
        pCurrentPixelFormat = pPixelFormat;
        CheckMenuItem(hMenu, pCurrentPixelFormat->uMenuItem, MF_BYCOMMAND | MF_CHECKED);

        if(pCurrentPixelFormat->fIsAlphaSupported)
            EnableMenuItem(hMenu, 2, MF_BYPOSITION | MF_ENABLED);
        else
            EnableMenuItem(hMenu, 2, MF_BYPOSITION | MF_GRAYED);
        DrawMenuBar(hwnd);
    }

    pColor = ColorInfo(uMenuItem);
    if(pColor != NULL) {
        CheckMenuItem(hMenu, pCurrentColor->uMenuItem, MF_BYCOMMAND | MF_UNCHECKED);
        pCurrentColor = pColor;
        CheckMenuItem(hMenu, pCurrentColor->uMenuItem, MF_BYCOMMAND | MF_CHECKED);
    }

    pTransparency = TransparencyInfo(uMenuItem);
    if(pTransparency != NULL) {
        CheckMenuItem(hMenu, pCurrentTransparency->uMenuItem, MF_BYCOMMAND | MF_UNCHECKED);
        pCurrentTransparency = pTransparency;
        CheckMenuItem(hMenu, pCurrentTransparency->uMenuItem, MF_BYCOMMAND | MF_CHECKED);
    }

    /* Destroy the foreground image so it gets re-created
     * with the new options. */
    if(hForeImage != NULL) {
        wdDestroyImage(hForeImage);
        hForeImage = NULL;
    }

    InvalidateRect(hwnd, NULL, TRUE);
}
bool GCF::Components::ColorEditorCreator::paintValue(QPainter* paint, QRect rect, QVariant value)
{
    static QList<ColorInfo> colorInfoList;

    if(colorInfoList.isEmpty())
    {
        colorInfoList << ColorInfo(Qt::black, "Black");
        colorInfoList << ColorInfo(Qt::white, "White");
        colorInfoList << ColorInfo(Qt::red, "Red");
        colorInfoList << ColorInfo(Qt::darkRed, "Dark red");
        colorInfoList << ColorInfo(Qt::green, "Green");
        colorInfoList << ColorInfo(Qt::darkGreen, "Dark green");
        colorInfoList << ColorInfo(Qt::blue, "Blue");
        colorInfoList << ColorInfo(Qt::darkBlue, "Dark blue");
        colorInfoList << ColorInfo(Qt::cyan, "Cyan");
        colorInfoList << ColorInfo(Qt::darkCyan, "Dark cyan");
        colorInfoList << ColorInfo(Qt::magenta, "Magenta");
        colorInfoList << ColorInfo(Qt::darkMagenta, "Dark magenta");
        colorInfoList << ColorInfo(Qt::yellow, "Yellow");
        colorInfoList << ColorInfo(Qt::darkYellow, "Dark yellow");
        colorInfoList << ColorInfo(Qt::gray, "Gray");
        colorInfoList << ColorInfo(Qt::darkGray, "Dark gray");
        colorInfoList << ColorInfo(Qt::lightGray, "Light gray");
    }

    QString colorName = "User Color";
    QColor color = value.value<QColor>();
    QBrush brush = paint->brush();

    for(int i=0; i<colorInfoList.count(); i++)
    {
        if(colorInfoList[i].color == color)
        {
            colorName = colorInfoList[i].name;
            break;
        }
    }
    paint->setBrush(color);
    paint->drawRect(rect.left()+3, rect.center().y()-6, 12, 12);
    paint->drawText(rect.adjusted(18, 0, 0, 0), Qt::AlignVCenter|Qt::AlignLeft, colorName);
    paint->setBrush(brush);
    return true;
}
Beispiel #3
0
ColorInfo CPoint::GetColorLine() const
{
	return ColorInfo();
}