TEST(CSSTokenizerTest, MultipleCharacterTokens)
{
    TEST_TOKENS("~=", includeMatch());
    TEST_TOKENS("|=", dashMatch());
    TEST_TOKENS("^=", prefixMatch());
    TEST_TOKENS("$=", suffixMatch());
    TEST_TOKENS("*=", substringMatch());
    TEST_TOKENS("||", column());
    TEST_TOKENS("|||", column(), delim('|'));
    TEST_TOKENS("<!--", cdo());
    TEST_TOKENS("<!---", cdo(), delim('-'));
    TEST_TOKENS("-->", cdc());
}
/*
 * Class:     com_sun_glass_ui_win_WinCommonDialogs
 * Method:    _showFolderChooser
 * Signature: (JLjava/lang/String;Ljava/lang/String;)Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_com_sun_glass_ui_win_WinCommonDialogs__1showFolderChooser
  (JNIEnv *env, jclass cls, jlong owner, jstring jFolder, jstring jTitle)
{
    CommonDialogOwner cdo((HWND)jlong_to_ptr(owner));
    JString folder(env, jFolder);
    JString title(env, jTitle);

    if (IS_WINVISTA) {
        return COMFolderChooser_Show((HWND)jlong_to_ptr(owner), folder, title);
    } else {
        return StandardFolderChooser_Show((HWND)jlong_to_ptr(owner), folder, title);
    }
}
/*
 * Class:     com_sun_glass_ui_win_WinCommonDialogs
 * Method:    _showFileChooser
 * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;IZ[Lcom/sun/glass/ui/CommonDialogs$ExtensionFilter;)Lcom/sun/glass/ui/CommonDialogs$FileChooserResult;
 */
JNIEXPORT jobject JNICALL Java_com_sun_glass_ui_win_WinCommonDialogs__1showFileChooser
  (JNIEnv *env, jobject jThis, jlong owner, jstring jFolder, jstring jFilename, jstring jTitle, jint type,
        jboolean multipleMode, jobjectArray jFilters, jint defaultFilterIndex)
{
    CommonDialogOwner cdo((HWND)jlong_to_ptr(owner));
    JString folder(env, jFolder);
    JString filename(env, jFilename);
    JString title(env, jTitle);

    if (IS_WINVISTA) {
        return COMFileChooser_Show((HWND)jlong_to_ptr(owner), folder, filename, title, type, multipleMode, jFilters, defaultFilterIndex);
    } else {
        return StandardFileChooser_Show((HWND)jlong_to_ptr(owner), folder, filename, title, type, multipleMode, jFilters, defaultFilterIndex);
    }
}
Example #4
0
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
                                 ColourAllocated fill, int alphaFill,
                                 ColourAllocated outline, int alphaOutline,
                                 int /*flags*/) {
#if wxUSE_GRAPHICS_CONTEXT
    wxGCDC dc(*(wxMemoryDC*)hdc);
    wxColour penColour(wxColourFromCAandAlpha(outline, alphaOutline));
    wxColour brushColour(wxColourFromCAandAlpha(fill, alphaFill));
    dc.SetPen(wxPen(penColour));
    dc.SetBrush(wxBrush(brushColour));
    dc.DrawRoundedRectangle(wxRectFromPRectangle(rc), cornerSize);
    return;
#else

#ifdef wxHAVE_RAW_BITMAP

    // TODO:  do something with cornerSize
    wxUnusedVar(cornerSize);
    
    int x, y;
    wxRect r = wxRectFromPRectangle(rc);
    wxBitmap bmp(r.width, r.height, 32);
    wxAlphaPixelData pixData(bmp);
    pixData.UseAlpha();

    // Set the fill pixels
    ColourDesired cdf(fill.AsLong());
    int red   = cdf.GetRed();
    int green = cdf.GetGreen();
    int blue  = cdf.GetBlue();

    wxAlphaPixelData::Iterator p(pixData);
    for (y=0; y<r.height; y++) {
        p.MoveTo(pixData, 0, y);
        for (x=0; x<r.width; x++) {
            p.Red()   = wxPy_premultiply(red,   alphaFill);
            p.Green() = wxPy_premultiply(green, alphaFill);
            p.Blue()  = wxPy_premultiply(blue,  alphaFill);
            p.Alpha() = alphaFill;
            ++p; 
        }
    }

    // Set the outline pixels
    ColourDesired cdo(outline.AsLong());
    red   = cdo.GetRed();
    green = cdo.GetGreen();
    blue  = cdo.GetBlue();
    for (x=0; x<r.width; x++) {
        p.MoveTo(pixData, x, 0);
        p.Red()   = wxPy_premultiply(red,   alphaOutline);
        p.Green() = wxPy_premultiply(green, alphaOutline);
        p.Blue()  = wxPy_premultiply(blue,  alphaOutline);
        p.Alpha() = alphaOutline;        
        p.MoveTo(pixData, x, r.height-1);
        p.Red()   = wxPy_premultiply(red,   alphaOutline);
        p.Green() = wxPy_premultiply(green, alphaOutline);
        p.Blue()  = wxPy_premultiply(blue,  alphaOutline);
        p.Alpha() = alphaOutline;        
    }

    for (y=0; y<r.height; y++) {
        p.MoveTo(pixData, 0, y);
        p.Red()   = wxPy_premultiply(red,   alphaOutline);
        p.Green() = wxPy_premultiply(green, alphaOutline);
        p.Blue()  = wxPy_premultiply(blue,  alphaOutline);
        p.Alpha() = alphaOutline;        
        p.MoveTo(pixData, r.width-1, y);
        p.Red()   = wxPy_premultiply(red,   alphaOutline);
        p.Green() = wxPy_premultiply(green, alphaOutline);
        p.Blue()  = wxPy_premultiply(blue,  alphaOutline);
        p.Alpha() = alphaOutline;        
    }
    
    // Draw the bitmap
    hdc->DrawBitmap(bmp, r.x, r.y, true);

#else
    wxUnusedVar(cornerSize);
    wxUnusedVar(alphaFill);
    wxUnusedVar(alphaOutline);
    RectangleDraw(rc, outline, fill);
#endif
#endif
}
Example #5
0
void SurfaceImpl::AlphaRectangle (PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, ColourAllocated outline, int alphaOutline, int WXUNUSED(flags)) {

#ifdef wxHAVE_RAW_BITMAP
    wxUnusedVar(cornerSize);
    int x, y;
    wxRect r = wxRectFromPRectangle(rc);
    wxBitmap bmp(r.width, r.height, 32);
    wxAlphaPixelData pixData(bmp);
    pixData.UseAlpha();
    wxAlphaPixelData::Iterator p(pixData);

    // Set the fill pixels
    ColourDesired cdf(fill.AsLong());
    int red   = cdf.GetRed();
    int green = cdf.GetGreen();
    int blue  = cdf.GetBlue();
#ifdef __WXMSW__
    int aFill = alphaFill;
#else
    int aFill = 0xff;
#endif
    for (y=0; y<r.height; y++) {
        p.MoveTo(pixData, 0, y);
        for (x=0; x<r.width; x++) {
            p.Red()   = red   * aFill / 0xff;
            p.Green() = green * aFill / 0xff;
            p.Blue()  = blue  * aFill / 0xff;
            p.Alpha() = alphaFill;
            ++p;
        }
    }

    // Set the outline pixels
    ColourDesired cdo(outline.AsLong());
    red   = cdo.GetRed();
    green = cdo.GetGreen();
    blue  = cdo.GetBlue();
#ifdef __WXMSW__
    int aOutline = alphaOutline;
#else
    int aOutline = 0xff;
#endif
    for (x=0; x<r.width; x++) {
        p.MoveTo(pixData, x, 0);
        p.Red()   = red   * aOutline / 0xff;
        p.Green() = green * aOutline / 0xff;
        p.Blue()  = blue  * aOutline / 0xff;
        p.Alpha() = alphaOutline;
        p.MoveTo(pixData, x, r.height-1);
        p.Red()   = red   * aOutline / 0xff;
        p.Green() = green * aOutline / 0xff;
        p.Blue()  = blue  * aOutline / 0xff;
        p.Alpha() = alphaOutline;
    }
    for (y=0; y<r.height; y++) {
        p.MoveTo(pixData, 0, y);
        p.Red()   = red   * aOutline / 0xff;
        p.Green() = green * aOutline / 0xff;
        p.Blue()  = blue  * aOutline / 0xff;
        p.Alpha() = alphaOutline;
        p.MoveTo(pixData, r.width-1, y);
        p.Red()   = red   * aOutline / 0xff;
        p.Green() = green * aOutline / 0xff;
        p.Blue()  = blue  * aOutline / 0xff;
        p.Alpha() = alphaOutline;
    }

    // Draw the bitmap
    hdc->DrawBitmap(bmp, r.x, r.y, true);

#else
    wxUnusedVar(cornerSize);
    wxUnusedVar(alphaFill);
    wxUnusedVar(alphaOutline);
    RectangleDraw(rc, outline, fill);
#endif

}