void IntervalProgressDisplay::paintEvent(QPaintEvent *e)
{
    Q_UNUSED(e);

    if (paintStrategy) {
        QPainter p(this);
        p.setRenderHint(QPainter::Antialiasing, true);
        qreal elementsSize = getElementsSize(paintMode);
        qreal fontSize = getFontSize(paintMode);
        PaintContext paintContext(width(), height(), beatsPerInterval, currentBeat, isShowingAccents(), beatsPerAccent, elementsSize, fontSize);
        QColor currentBeatColor = usingLowContrastColors ? Qt::lightGray : Qt::white;
        QBrush textBrush = palette().text(); //using the color define in loaded stylesheet theme
        PaintColors paintColors(currentBeatColor, SECONDARY_BEATS_COLOR, ACCENT_COLOR, CURRENT_ACCENT_COLOR, DISABLED_BEATS_COLOR, textBrush);
        paintStrategy->paint(p, paintContext, paintColors);
    }
}
Пример #2
0
/*
 * ColorsWndProc - handle messages for the available color selection window
 */
WPI_MRESULT CALLBACK ColorsWndProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    static WPI_POINT            pt;

    switch( msg ) {
    case WM_CREATE:
        numberOfColors = 16;
        initPaletteBoxes( TRUE );
        InitPaletteBitmaps( hwnd, &hColorBitmap, &hMonoBitmap );
        break;

    case WM_PAINT:
        paintColors( hwnd );
        break;

    case WM_LBUTTONDOWN:
        IMGED_MAKEPOINT( wparam, lparam, pt );
        selectColor( &pt, LMOUSEBUTTON );
        break;

    case WM_LBUTTONDBLCLK:
        IMGED_MAKEPOINT( wparam, lparam, pt );
        editCurrentColor( &pt );
        break;

    case WM_RBUTTONDOWN:
        IMGED_MAKEPOINT( wparam, lparam, pt );
        selectColor( &pt, RMOUSEBUTTON );
        break;

    case WM_DESTROY:
        _wpi_deletebitmap( hColorBitmap );
        _wpi_deletebitmap( hMonoBitmap );
        break;

    default:
        return( DefWindowProc( hwnd, msg, wparam, lparam ) );
    }
    return( 0 );

} /* ColorsWndProc */