Пример #1
0
void DispLoading::onEraseBG( wxEraseEvent& event )
{
	wxDC *dc = event.GetDC();

	if (!m_imgHandle.getImg() || !m_imgHandle->IsOk())
	{
		dc->SetTextForeground(wxColor(0,0,0));
		dc->Clear();
		return;
	}

	int h = GetSize().GetHeight();
	int w = GetSize().GetWidth();
	int iw = m_imgHandle->GetSize().GetWidth();


	//size 7
	const int l_start = 0;
	const int l_width = 2;

	//size 6
	const int m_start = 2;
	const int m_width = 15;

	//size 7 with 1 pix gap
	const int r_start = 17;
	const int r_width = 2;


	wxBitmap   tmpBmp(w, h);
	wxMemoryDC tmpDC(tmpBmp);

	tmpDC.SetBrush(wxBrush(wxColor(255,0,255)));
	tmpDC.SetPen( wxPen(wxColor(255,0,255),1) );
	tmpDC.DrawRectangle(0,0,w,h);

	wxImage scaled = m_imgHandle->Scale(iw, h);

	if (scaled.IsOk())
	{
		wxBitmap left = wxBitmap(scaled.GetSubImage( wxRect(l_start,0,l_width,h)) );
		wxBitmap right = wxBitmap(scaled.GetSubImage( wxRect(r_start,0,r_width,h)) );
		wxBitmap center(w-(l_width+r_width),h);

		wxColor c(255,0,255);
		gcImage::tileImg(center, wxBitmap(scaled.GetSubImage( wxRect(m_start,0,m_width,h)) ), &c);

		tmpDC.DrawBitmap(left, l_start,0,true);
		tmpDC.DrawBitmap(center, m_start,0,true);
		tmpDC.DrawBitmap(right, w-r_width,0,true);
	}

	tmpDC.SelectObject(wxNullBitmap);
	dc->DrawBitmap(tmpBmp, 0,0, true);

	wxRegion region = wxRegion(tmpBmp, wxColor(255,0,255), 1);
	SetShape(region, this);
}
Пример #2
0
void gcProgressBar::doImgPaint(wxPaintDC& dc)
{
	int h = GetSize().GetHeight();
	int w = GetSize().GetWidth();
#ifdef WIN32 // unused AFAIK
	int ih = m_imgProg->GetSize().GetHeight();
#endif
	int iw = m_imgProg->GetSize().GetWidth();

	uint32 wp = w*m_uiProg/100;

	wxImage scaled = m_imgProg->Scale(iw, h);
	wxBitmap norm = GetGCThemeManager()->getSprite(scaled, "progressbar", "Norm");
	wxBitmap nedge = GetGCThemeManager()->getSprite(scaled, "progressbar", "NormEdge");
	wxBitmap empty = GetGCThemeManager()->getSprite(scaled, "progressbar", "Empty");

	wxBitmap   tmpBmp(w, h);
	wxMemoryDC tmpDC(tmpBmp);

	tmpDC.SetBrush(wxBrush(wxColor(255,0,255)));
	tmpDC.SetPen( wxPen(wxColor(255,0,255),1) );
	tmpDC.DrawRectangle(0,0,w,h);


	uint32 neWidth = nedge.GetWidth();
	wxColor c(255,0,255);

	if (wp == 0)
	{
		//dont do any thing
	}
	else if (wp <= neWidth)
	{
		wxBitmap left = nedge.ConvertToImage().GetSubImage(wxRect(neWidth-wp,0,neWidth,h));
		tmpDC.DrawBitmap(left, 0, 0, true);
	}
	else
	{
		wxBitmap left(wp-neWidth, h);
		
		gcImage::tileImg(left, norm, &c);

		tmpDC.DrawBitmap(left, 0, 0, true);
		tmpDC.DrawBitmap(nedge, wp-neWidth, 0, true);
	}

	wxBitmap right(w-wp, h);
	gcImage::tileImg(right, empty, &c);
	tmpDC.DrawBitmap(right, wp,0,true);

	tmpDC.SelectObject(wxNullBitmap);

	doExtraImgPaint(tmpBmp, w, h);

	dc.DrawBitmap(tmpBmp, 0,0, true);
}
Пример #3
0
void gcStaticLine::onPaint( wxPaintEvent& event )
{
	wxPaintDC dc(this);

	if (!m_imgHR.getImg() || !m_imgHR->IsOk())
	{
		dc.SetTextForeground(wxColor(25,25,25));
		dc.Clear();
		return;
	}

	int h = GetSize().GetHeight();
	int w = GetSize().GetWidth();
#ifdef WIN32 // unused AFAIK
	int ih = m_imgHR->GetSize().GetHeight();
#endif 
	int iw = m_imgHR->GetSize().GetWidth();

	wxBitmap   tmpBmp(w, h);
	wxMemoryDC tmpDC(tmpBmp);

	tmpDC.SetBrush(wxBrush(wxColor(255,0,255)));
	tmpDC.SetPen( wxPen(wxColor(255,0,255),1) );
	tmpDC.DrawRectangle(0,0,w,h);

	wxImage scaled = m_imgHR->Scale(iw, h);

	wxBitmap left = GetGCThemeManager()->getSprite(scaled, "horizontal_rule", "Left");
	wxBitmap right = GetGCThemeManager()->getSprite(scaled, "horizontal_rule", "Right");
	wxBitmap centerImg = GetGCThemeManager()->getSprite(scaled, "horizontal_rule", "Center");

	wxBitmap center(w-(left.GetWidth()+right.GetWidth()),h);

	wxColor c(255,0,255);
	gcImage::tileImg(center, centerImg, &c);

	tmpDC.DrawBitmap(left, 0,0,true);
	tmpDC.DrawBitmap(center, left.GetWidth(),0,true);
	tmpDC.DrawBitmap(right, w-right.GetWidth(),0,true);

	tmpDC.SelectObject(wxNullBitmap);
	dc.DrawBitmap(tmpBmp, 0,0, true);

	wxRegion region = wxRegion(tmpBmp, wxColor(255,0,255), 1);
	SetShape(region, this);
}
void clTabRendererCurved::Draw(wxDC& dc, const clTabInfo& tabInfo, const clTabColours& colours, size_t style)
{
    const int TOP_SMALL_HEIGHT = 0;
    wxColour bgColour(tabInfo.IsActive() ? colours.activeTabBgColour : colours.inactiveTabBgColour);
    wxColour penColour(tabInfo.IsActive() ? colours.activeTabPenColour : colours.inactiveTabPenColour);
    wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
    dc.SetTextForeground(tabInfo.IsActive() ? colours.activeTabTextColour : colours.inactiveTabTextColour);
    dc.SetFont(font);

    if(style & kNotebook_BottomTabs) {
        // Bottom tabs
        {
            wxPoint points[6];
            points[0] = tabInfo.m_rect.GetTopLeft();

            points[1].x = points[0].x + majorCurveWidth;
            points[1].y = tabInfo.m_rect.GetBottomLeft().y - TOP_SMALL_HEIGHT;

            points[2].x = points[1].x + smallCurveWidth;
            points[2].y = points[1].y + TOP_SMALL_HEIGHT;

            points[3].x = points[0].x + (tabInfo.m_rect.GetWidth() - (majorCurveWidth + smallCurveWidth));
            points[3].y = points[2].y;

            points[4].x = points[3].x + smallCurveWidth;
            points[4].y = points[1].y;

            points[5] = tabInfo.m_rect.GetTopRight();

            dc.SetPen(penColour);
            dc.SetBrush(bgColour);
            dc.DrawPolygon(6, points);
        }
        {
            wxPoint points[6];
            points[0] = tabInfo.m_rect.GetTopLeft();
            points[0].x += 1;

            points[1].x = points[0].x + majorCurveWidth;
            points[1].y = tabInfo.m_rect.GetBottomLeft().y - TOP_SMALL_HEIGHT - 1;

            points[2].x = points[1].x + smallCurveWidth;
            points[2].y = points[1].y + TOP_SMALL_HEIGHT;

            points[3].x = points[0].x + (tabInfo.m_rect.GetWidth() - 2 - (majorCurveWidth + smallCurveWidth));
            points[3].y = points[2].y;

            points[4].x = points[3].x + smallCurveWidth;
            points[4].y = points[1].y;

            points[5] = tabInfo.m_rect.GetTopRight();
            points[5].x -= 2;

            dc.SetPen(tabInfo.IsActive() ? colours.activeTabInnerPenColour : colours.inactiveTabInnerPenColour);
            dc.SetBrush(bgColour);
            dc.DrawPolygon(6, points);
        }
    } else if(IS_VERTICAL_TABS(style)) {

        // Left side tabs
        wxRect rotatedRect(0, 0, tabInfo.m_rect.GetHeight(), tabInfo.m_rect.GetWidth());
        wxBitmap b(rotatedRect.GetSize());

        wxMemoryDC tmpDC(b);
        tmpDC.SetPen(colours.tabAreaColour);
        tmpDC.SetBrush(colours.tabAreaColour);
        tmpDC.DrawRectangle(rotatedRect);
        tmpDC.SetFont(font);
        tmpDC.SetTextForeground(tabInfo.IsActive() ? colours.activeTabTextColour : colours.inactiveTabTextColour);

        tmpDC.SetPen(penColour);
        tmpDC.SetBrush(bgColour);
        if(tabInfo.IsActive()) {
            {
                wxPoint points[6];
                points[0] = rotatedRect.GetBottomLeft();
                points[1].x = points[0].x + majorCurveWidth;
                points[1].y = rotatedRect.GetLeftTop().y + TOP_SMALL_HEIGHT;

                points[2].x = points[1].x + smallCurveWidth;
                points[2].y = points[1].y - TOP_SMALL_HEIGHT;

                points[3].x = points[0].x + (rotatedRect.GetWidth() - (majorCurveWidth + smallCurveWidth));
                points[3].y = points[2].y;

                points[4].x = points[3].x + smallCurveWidth;
                points[4].y = points[3].y + TOP_SMALL_HEIGHT;

                points[5] = rotatedRect.GetBottomRight();

                tmpDC.SetPen(penColour);
                tmpDC.SetBrush(bgColour);
                tmpDC.DrawPolygon(6, points);
            }

            {
                wxPoint points[6];
                points[0] = rotatedRect.GetBottomLeft();
                points[0].x += 1;

                points[1].x = points[0].x + majorCurveWidth;
                points[1].y = rotatedRect.GetLeftTop().y + TOP_SMALL_HEIGHT + 1;

                points[2].x = points[1].x + smallCurveWidth;
                points[2].y = points[1].y - TOP_SMALL_HEIGHT;

                points[3].x = points[0].x + (rotatedRect.GetWidth() - 2 - (majorCurveWidth + smallCurveWidth));
                points[3].y = points[2].y;

                points[4].x = points[3].x + smallCurveWidth;
                points[4].y = points[3].y + TOP_SMALL_HEIGHT;

                points[5] = rotatedRect.GetBottomRight();
                points[5].x -= 2;

                tmpDC.SetPen(tabInfo.IsActive() ? colours.activeTabInnerPenColour : colours.inactiveTabInnerPenColour);
                tmpDC.SetBrush(bgColour);
                tmpDC.DrawPolygon(6, points);
            }
        } else {
            // Inactive tabs
            wxDirection direction = wxNORTH;
            wxPoint basePoint = ((style & kNotebook_LeftTabs) ? rotatedRect.GetLeftTop() : rotatedRect.GetRightTop());
            {
                wxPoint pt = basePoint;
                pt.x -= 1;
                wxRect gr(pt, wxSize(1, rotatedRect.GetHeight()));
                tmpDC.SetPen(*wxTRANSPARENT_PEN);
                tmpDC.GradientFillLinear(gr, colours.inactiveTabPenColour, bgColour, direction);
            }
            {
                wxPoint pt = basePoint;
                wxRect gr(pt, wxSize(1, rotatedRect.GetHeight()));
                tmpDC.SetPen(*wxTRANSPARENT_PEN);
                tmpDC.GradientFillLinear(gr, colours.inactiveTabInnerPenColour, bgColour, direction);
            }
            {
                wxPoint pt = basePoint;
                pt.x += 1;
                wxRect gr(pt, wxSize(1, rotatedRect.GetHeight()));
                tmpDC.SetPen(*wxTRANSPARENT_PEN);
                tmpDC.GradientFillLinear(gr, colours.inactiveTabPenColour, bgColour, direction);
            }
        }

        // Vertical tabs
        // Draw bitmap
        if(tabInfo.GetBitmap().IsOk()) {
            tmpDC.DrawBitmap(tabInfo.GetBitmap(), tabInfo.m_bmpY, tabInfo.m_bmpX);
        }

        tmpDC.DrawText(tabInfo.m_label, tabInfo.m_textY, tabInfo.m_textX);
        if(tabInfo.IsActive() && (style & kNotebook_CloseButtonOnActiveTab)) {
            tmpDC.DrawBitmap(colours.closeButton, tabInfo.m_bmpCloseY, tabInfo.m_bmpCloseX);
        }
        tmpDC.SelectObject(wxNullBitmap);
        wxImage img = b.ConvertToImage();
        img = img.Rotate90((style & kNotebook_RightTabs));
        b = wxBitmap(img);
        dc.DrawBitmap(b, tabInfo.m_rect.GetTopLeft());

    } else {
        // Default tabs (placed at the top)
        {
            wxPoint points[6];
            points[0] = tabInfo.m_rect.GetBottomLeft();

            points[1].x = points[0].x + majorCurveWidth;
            points[1].y = tabInfo.m_rect.GetLeftTop().y + TOP_SMALL_HEIGHT;

            points[2].x = points[1].x + smallCurveWidth;
            points[2].y = points[1].y - TOP_SMALL_HEIGHT;

            points[3].x = points[0].x + (tabInfo.m_rect.GetWidth() - (majorCurveWidth + smallCurveWidth));
            points[3].y = points[2].y;

            points[4].x = points[3].x + smallCurveWidth;
            points[4].y = points[3].y + TOP_SMALL_HEIGHT;

            points[5] = tabInfo.m_rect.GetBottomRight();

            dc.SetPen(penColour);
            dc.SetBrush(bgColour);
            dc.DrawPolygon(6, points);
        }

        {
            wxPoint points[6];
            points[0] = tabInfo.m_rect.GetBottomLeft();
            points[0].x += 1;

            points[1].x = points[0].x + majorCurveWidth;
            points[1].y = tabInfo.m_rect.GetLeftTop().y + TOP_SMALL_HEIGHT + 1;

            points[2].x = points[1].x + smallCurveWidth;
            points[2].y = points[1].y - TOP_SMALL_HEIGHT;

            points[3].x = points[0].x + (tabInfo.m_rect.GetWidth() - 2 - (majorCurveWidth + smallCurveWidth));
            points[3].y = points[2].y;

            points[4].x = points[3].x + smallCurveWidth;
            points[4].y = points[3].y + TOP_SMALL_HEIGHT;

            points[5] = tabInfo.m_rect.GetBottomRight();
            points[5].x -= 2;

            dc.SetPen(tabInfo.IsActive() ? colours.activeTabInnerPenColour : colours.inactiveTabInnerPenColour);
            dc.SetBrush(bgColour);
            dc.DrawPolygon(6, points);
        }
    }

    if(!IS_VERTICAL_TABS(style)) {
        // Draw bitmap
        if(tabInfo.GetBitmap().IsOk()) {
            dc.DrawBitmap(tabInfo.GetBitmap(), tabInfo.m_bmpX + tabInfo.m_rect.GetX(), tabInfo.m_bmpY);
        }
        dc.DrawText(tabInfo.m_label, tabInfo.m_textX + tabInfo.m_rect.GetX(), tabInfo.m_textY);
        if(tabInfo.IsActive() && (style & kNotebook_CloseButtonOnActiveTab)) {
            dc.DrawBitmap(colours.closeButton, tabInfo.m_bmpCloseX + tabInfo.m_rect.GetX(), tabInfo.m_bmpCloseY);
        }
    }
}
Пример #5
0
	virtual void doPaint(wxDC* dc)
	{
		if (!m_imgHandle.getImg() || !m_imgHandle->IsOk())
		{
			dc->SetTextForeground(wxColor(0,0,0));
			dc->Clear();
			return;
		}

		dc->SetFont(GetFont());
		dc->SetTextBackground(GetBackgroundColour());

		if (m_bHovering)
			dc->SetTextForeground(m_colHover);
		else if (m_bSelected)
			dc->SetTextForeground(m_colSelected);
		else
			dc->SetTextForeground(m_colNormal);


		int h = GetSize().GetHeight();
		int w = GetSize().GetWidth();
		int iw = m_imgHandle->GetSize().GetWidth();

		wxBitmap   tmpBmp(w, h);
		wxMemoryDC tmpDC(tmpBmp);

		tmpDC.SetBrush(wxBrush(wxColor(255,0,255)));
		tmpDC.SetPen( wxPen(wxColor(255,0,255),1) );
		tmpDC.DrawRectangle(0,0,w,h);

		wxImage scaled = m_imgHandle->Scale(iw, h);

		wxBitmap left;
		wxBitmap right;
		wxBitmap centerImg = GetGCThemeManager()->getSprite(scaled, "playlist_button", "fill");

		if (m_uiPos == LEFT)
		{
			left = GetGCThemeManager()->getSprite(scaled, "playlist_button", "left");
		}
		else
		{
			left = GetGCThemeManager()->getSprite(scaled, "playlist_button", "fill");
		}

		if (m_uiPos == RIGHT)
		{
			right = GetGCThemeManager()->getSprite(scaled, "playlist_button", "right");
		}
		else
		{
			right = GetGCThemeManager()->getSprite(scaled, "playlist_button", "seperator");
		}


		wxBitmap center(w-(left.GetWidth()+right.GetWidth()),h);

		wxColor c(255,0,255);
		gcImage::tileImg(center, centerImg, &c);

		tmpDC.DrawBitmap(left, 0,0,true);
		tmpDC.DrawBitmap(center, left.GetWidth(),0,true);
		tmpDC.DrawBitmap(right, w-right.GetWidth(),0,true);

		tmpDC.SelectObject(wxNullBitmap);
		dc->DrawBitmap(tmpBmp, 0,0, true);

		if (m_bTransEnabled)
		{
			wxRegion region = wxRegion(tmpBmp, wxColor(255,0,255), 1);
			SetShape(region, this);
		}

		wxString lab = GetLabel();

		long x = (w - dc->GetTextExtent(lab).GetWidth())/2;
		long y = (h - dc->GetTextExtent(lab).GetHeight())/2;

		dc->DrawText(lab, x, y);
	}