コード例 #1
0
ファイル: clrpickercmn.cpp プロジェクト: Zombiebest/Dolphin
bool wxColourPickerCtrl::Create( wxWindow *parent, wxWindowID id,
                        const wxColour &col,
                        const wxPoint &pos, const wxSize &size,
                        long style, const wxValidator& validator,
                        const wxString &name )
{
    if (!wxPickerBase::CreateBase(parent, id, col.GetAsString(), pos, size,
                                  style, validator, name))
        return false;

    // we are not interested to the ID of our picker as we connect
    // to its "changed" event dynamically...
    m_picker = new wxColourPickerWidget(this, wxID_ANY, col,
                                        wxDefaultPosition, wxDefaultSize,
                                        GetPickerStyle(style));

    // complete sizer creation
    wxPickerBase::PostCreation();

    m_picker->Connect(wxEVT_COMMAND_COLOURPICKER_CHANGED,
            wxColourPickerEventHandler(wxColourPickerCtrl::OnColourChange),
            NULL, this);

    return true;
}
コード例 #2
0
void LexerConf::SetLineNumbersFgColour(const wxColour& colour)
{
    StyleProperty& style = GetProperty(LINE_NUMBERS_ATTR_ID);
    if(!style.IsNull()) {
        style.SetFgColour(colour.GetAsString(wxC2S_HTML_SYNTAX));
    }
}
コード例 #3
0
void LexerConf::SetDefaultFgColour(const wxColour& colour)
{
    StyleProperty& style = GetProperty(0);
    if(!style.IsNull()) {
        style.SetFgColour(colour.GetAsString(wxC2S_HTML_SYNTAX));
    }
}
コード例 #4
0
ファイル: optionsconfig.cpp プロジェクト: 05storm26/codelite
void OptionsConfig::SetBookmarkBgColour(wxColour c, size_t index)
{
    wxArrayString arr = wxSplit(m_bookmarkBgColours, ';');
    if(index < arr.GetCount()) {
        arr.Item(index) = c.GetAsString(wxC2S_HTML_SYNTAX);
        m_bookmarkBgColours = wxJoin(arr, ';');
    }
}
コード例 #5
0
void HTMLButcherMaskAreaImageFormatDialog::AddTColor(const wxColour &color)
{
    wxSimpleHtmlListBox *tcolorsctrl=(wxSimpleHtmlListBox*)FindWindow(ID_TRANSPARENTCOLOR);

    // dont allow duplicates
    for (unsigned int i=0; i<tcolorsctrl->GetCount(); i++)
    {
        if (static_cast<ButcherColorClientData*>(tcolorsctrl->GetClientObject(i))->GetColor()==color)
            return;
    }


    // some combinations of the fg/bg colours may be unreadable, so we invert
    // the colour to make sure fg colour is different enough from m_colour
    wxColour colFg(~color.Red(), ~color.Green(), ~color.Blue());


    tcolorsctrl->Append(wxString::Format(wxT("<table bgcolor=\"%s\" width=\"100%%\"><tr><td><font color=\"%s\">%s</font></td></tr></table>"),
        color.GetAsString(wxC2S_HTML_SYNTAX).c_str(),
        colFg.GetAsString(wxC2S_HTML_SYNTAX).c_str(),
        color.GetAsString(wxC2S_HTML_SYNTAX).c_str()),
        new ButcherColorClientData(color));
}
コード例 #6
0
ファイル: useractions.cpp プロジェクト: UdjinM6/springlobby
void UserActions::SetGroupHLColor(const wxColour& color, const wxString& group)
{
	cfg().Write(_T( "/Groups/" ) + group + _T( "/Opts/HLColor" ), color.GetAsString(wxC2S_HTML_SYNTAX));
}
コード例 #7
0
ファイル: colour.cpp プロジェクト: ahlekoofe/gamekit
template<> void wxStringWriteValue(wxString &s , const wxColour &data )
{
    s = data.GetAsString(wxC2S_HTML_SYNTAX);
}
コード例 #8
0
ファイル: ConfigManager.hpp プロジェクト: brho/xword
 // wxColour
 static wxString ColorToString(const wxColour & color)
     { return color.GetAsString(); }
コード例 #9
0
wxString getColourIconKey( const wxColour& colour  )
{
	return colour.GetAsString(wxC2S_HTML_SYNTAX).AfterFirst('#');
}
コード例 #10
0
ファイル: variant.cpp プロジェクト: svn2github/fbide
wxString Variant::MakeString (const wxColour & colour)
{
    return colour.GetAsString(wxC2S_HTML_SYNTAX);
}
コード例 #11
0
ファイル: clippingbox.cpp プロジェクト: CodeTickler/wxWidgets
void ClippingBoxTestCaseBase::CheckBox(int x, int y, int width, int height)
{
    // Check clipping box boundaries.
    int clipX, clipY, clipW, clipH;
    m_dc->GetClippingBox(&clipX, &clipY, &clipW, &clipH);

    wxString msgPos;
    if ( x != clipX || y != clipY )
    {
        msgPos =
            wxString::Format(wxS("Invalid position: Actual: (%i, %i)  Expected: (%i, %i)"),
                                clipX, clipY, x, y);
    }
    wxString msgDim;
    if ( width != clipW || height != clipH )
    {
        msgDim =
            wxString::Format(wxS("Invalid dimension: Actual: %i x %i  Expected: %i x %i"),
                                clipW, clipH, width, height);
    }

    wxString msg;
    if ( !msgPos.empty() )
    {
        msg = msgPos;
        if ( !msgDim.empty() )
        {
            msg += wxS("\n- ");
            msg += msgDim;
        }
    }
    else if ( !msgDim.empty() )
    {
        msg = msgDim;
    }

    // We will examine pixels directly in the underlying bitmap
    // so we need to get device coordinates of examined area.
    x = m_dc->LogicalToDeviceX(x);
    y = m_dc->LogicalToDeviceY(y);
    width = m_dc->LogicalToDeviceXRel(width);
    height = m_dc->LogicalToDeviceYRel(height);

    // Update wxDC contents.
    FlushDC();

    // Check whether diagonal corners of the clipping box
    // are actually drawn at the edge of the clipping region.
#if wxUSE_IMAGE
    // For some renderers it's not possible to get pixels
    // value from wxDC so we would have to examine pixels
    // in the underlying bitmap.
    wxImage img;
    img = m_bmp.ConvertToImage();
#else
    return;
#endif // wxUSE_IMAGE

    // Check area near the top-left corner
    int ymin = y-1;
    int xmin = x-1;
    int ymax = y+1;
    int xmax = x+1;
    ymin = wxMin(wxMax(ymin, 0), s_dcSize.GetHeight()-1);
    xmin = wxMin(wxMax(xmin, 0), s_dcSize.GetWidth()-1);
    ymax = wxMin(wxMax(ymax, 0), s_dcSize.GetHeight()-1);
    xmax = wxMin(wxMax(xmax, 0), s_dcSize.GetWidth()-1);

    for( int py = ymin; py <= ymax; py++ )
        for( int px = xmin; px <= xmax; px++ )
        {
            wxColour c;
#if wxUSE_IMAGE
            unsigned char r = img.GetRed(px, py);
            unsigned char g = img.GetGreen(px, py);
            unsigned char b = img.GetBlue(px, py);
            c.Set(r, g, b);
#else
            // We cannot get pixel value
            break;
#endif // wxUSE_IMAGE / !wxUSE_IMAGE

            wxString msgColour;
            if ( px >= x && px <= x + (width-1) &&
                 py >= y && py <= y + (height-1) )
            {
                // Pixel inside the box.
                if ( c != s_fgColour )
                {
                    msgColour =
                        wxString::Format(wxS("Invalid colour drawn at (%i, %i): Actual: %s  Expected: %s"),
                                px, py, c.GetAsString().mbc_str(), s_fgColour.GetAsString().mbc_str());

                }
            }
            else
            {
                // Pixel outside the box.
                if ( c != s_bgColour )
                {
                    msgColour =
                        wxString::Format(wxS("Invalid colour drawn at (%i, %i): Actual: %s  Expected: %s"),
                                px, py, c.GetAsString().mbc_str(), s_bgColour.GetAsString().mbc_str());
                }
            }

            if ( !msgColour.empty() )
            {
                if ( !msg.empty() )
                {
                    msg += wxS("\n- ");
                    msg += msgColour;
                }
                else
                {
                    msg = msgColour;
                }
            }
        }

    // Check area near the bottom-right corner
    ymin = y+(height-1)-1;
    xmin = x+(width-1)-1;
    ymax = y+(height-1)+1;
    xmax = x+(width-1)+1;
    ymin = wxMin(wxMax(ymin, 0), s_dcSize.GetHeight()-1);
    xmin = wxMin(wxMax(xmin, 0), s_dcSize.GetWidth()-1);
    ymax = wxMin(wxMax(ymax, 0), s_dcSize.GetHeight()-1);
    xmax = wxMin(wxMax(ymax, 0), s_dcSize.GetWidth()-1);
    for( int py = ymin; py <= ymax; py++ )
        for( int px = xmin; px <= xmax; px++ )
        {
            wxColour c;
#if wxUSE_IMAGE
            unsigned char r = img.GetRed(px, py);
            unsigned char g = img.GetGreen(px, py);
            unsigned char b = img.GetBlue(px, py);
            c.Set(r, g, b);
#else
            // We cannot get pixel value
            break;
#endif // wxUSE_IMAGE / !wxUSE_IMAGE

            wxString msgColour;
            if ( px >= x && px <= x + (width-1) &&
                 py >= y && py <= y + (height-1) )
            {
                // Pixel inside the box.
                if ( c != s_fgColour )
                {
                    msgColour =
                        wxString::Format(wxS("Invalid colour drawn at (%i, %i): Actual: %s  Expected: %s"),
                                px, py, c.GetAsString().mbc_str(), s_fgColour.GetAsString().mbc_str());
                }
            }
            else
            {
                // Pixel outside the box.
                if ( c != s_bgColour )
                {
                    msgColour =
                        wxString::Format(wxS("Invalid colour drawn at (%i, %i): Actual: %s  Expected: %s"),
                                px, py, c.GetAsString().mbc_str(), s_bgColour.GetAsString().mbc_str());
                }
            }

            if ( !msgColour.empty() )
            {
                if ( !msg.empty() )
                {
                    msg += wxS("\n- ");
                    msg += msgColour;
                }
                else
                {
                    msg = msgColour;
                }
            }
        }

    if( !msg.empty() )
    {
        wxCharBuffer buffer = msg.ToUTF8();
        CPPUNIT_FAIL( buffer.data() );
    }
}