Ejemplo n.º 1
0
bool ScrollbarThemeWx::paint(Scrollbar* scrollbar, GraphicsContext* context, const IntRect& rect)
{
    wxOrientation orientation = (scrollbar->orientation() == HorizontalScrollbar) ? wxHORIZONTAL : wxVERTICAL;
    int flags = 0;
    if (scrollbar->scrollableArea()->isActive())
        flags |= wxCONTROL_FOCUSED;

    if (!scrollbar->enabled())
        flags |= wxCONTROL_DISABLED;

    wxDC* dc = static_cast<wxDC*>(context->platformContext());

    ScrollView* root = scrollbar->root();
    ASSERT(root);
    if (!root)
        return false;

    wxWindow* webview = root->hostWindow()->platformPageClient();
    LocalDC localDC(dc, scrollbar->frameRect());

    wxRenderer_DrawScrollbar(webview, *localDC.context(), scrollbar->frameRect(), orientation, scrollbar->currentPos(), static_cast<wxScrollbarPart>(scrollbar->pressedPart()),
                             static_cast<wxScrollbarPart>(scrollbar->hoveredPart()), scrollbar->maximum(), scrollbar->pageStep(), flags);

    return true;
}
Ejemplo n.º 2
0
bool RenderThemeWx::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& r)
{
    wxWindow* window = nativeWindowForRenderObject(o);
    wxDC* dc = static_cast<wxDC*>(i.context->platformContext());

    LocalDC localDC(dc, r);
    IntRect rect = r;

    int flags = 0;      
    if (!isEnabled(o))
        flags |= wxCONTROL_DISABLED;
        
    if (supportsFocus(o->style()->appearance()) && isFocused(o))
        flags |= wxCONTROL_FOCUSED;

    if (isPressed(o))
        flags |= wxCONTROL_PRESSED;

#if wxCHECK_VERSION(2,9,0)
    wxRendererNative::Get().DrawChoice(window, *localDC.context(), rect, flags);
#else
    wxRenderer_DrawChoice(window, *localDC.context(), rect, flags);
#endif

    return false;
}
Ejemplo n.º 3
0
void ZUITextPane_TextEngine::DoDraw(const ZDC& inDC, const ZDCRgn& inBoundsRgn)
	{
	ASSERTLOCKED();
#if 1
	ZSubPane::DoDraw(inDC, inBoundsRgn);
	fTextEngine->Draw(inDC);
#else
	ZDC_OffAuto localDC(inDC, false);
	ZSubPane::DoDraw(localDC);
	fTextEngine->Draw(localDC);
#endif
	}
Ejemplo n.º 4
0
void ZSuperPane::HandleDraw(const ZDC& inDC)
	{
	ZDC localDC(inDC);

	// Fix up the pattern origin
	ZPoint translation(this->GetTranslation());
	localDC.OffsetPatternOrigin(translation);

	ZDCRgn oldClip = localDC.GetClip();
	ZDCRgn boundsRgn = this->CalcBoundsRgn();
	if (ZDCRgn newClip = oldClip & boundsRgn)
		{
		// SuperPanes draw their own content, their adorners and then their sub panes
		localDC.SetClip(newClip);

		if (ZDCInk backInk = this->GetBackInk(localDC))
			localDC.SetInk(backInk);

		this->DoDraw(localDC, boundsRgn);

		if (fAdorners)
			{
			for (size_t x = 0; x < fAdorners->size(); ++x)
				(*fAdorners)[x]->AdornPane(inDC, this, boundsRgn);
			}

		if (ZDCInk internalBackInk = this->GetInternalBackInk(localDC))
			localDC.SetInk(internalBackInk);

		for (size_t x = 0; x < fSubPanes.size(); ++x)
			{
			if (fSubPanes[x]->GetVisible())
				{
				// Here we modify the ZDC's coordinate system to match the pane's
				ZPoint coordOffset(fSubPanes[x]->GetLocation() - translation);
				localDC.OffsetOrigin(coordOffset);
				// And tell our sub pane to draw itself
				fSubPanes[x]->HandleDraw(localDC);
				// Restore the coordinate system
				localDC.OffsetOrigin(-coordOffset);
				}
			}
		}
	else
		{
		if (fAdorners)
			{
			for (size_t x = 0; x < fAdorners->size(); ++x)
				(*fAdorners)[x]->AdornPane(inDC, this, boundsRgn);
			}
		}
	}
Ejemplo n.º 5
0
bool RenderThemeWx::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& r)
{
    wxWindow* window = nativeWindowForRenderObject(o);
    wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
    LocalDC localDC(dc, r);
    int flags = 0;
    
    IntRect rect = r;

    ControlPart part = o->style()->appearance();
    if (supportsFocus(part) && isFocused(o))
        flags |= wxCONTROL_FOCUSED;

#if wxCHECK_VERSION(2,9,0)
    wxRendererNative::Get().DrawTextCtrl(window, *localDC.context(), rect, flags);
#else
    wxRenderer_DrawTextCtrl(window, *localDC.context(), r, 0);
#endif

    return false;
}
Ejemplo n.º 6
0
bool RenderThemeWx::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& r)
{
    wxWindow* window = nativeWindowForRenderObject(o);
    wxDC* dc = static_cast<wxDC*>(i.context->platformContext());
    LocalDC localDC(dc, r);

    int flags = 0;
    
    IntRect rect = r;

    if (!isEnabled(o))
        flags |= wxCONTROL_DISABLED;

    ControlPart part = o->style()->appearance();
    if (supportsFocus(part) && isFocused(o))
        flags |= wxCONTROL_FOCUSED;

    if (isPressed(o))
        flags |= wxCONTROL_PRESSED;
    
    if (part == PushButtonPart || part == ButtonPart)
        wxRendererNative::Get().DrawPushButton(window, *localDC.context(), rect, flags);
    else if(part == RadioPart) {
        if (isChecked(o))
            flags |= wxCONTROL_CHECKED;
#if wxCHECK_VERSION(2,9,1)
        wxRendererNative::Get().DrawRadioBitmap(window, *localDC.context(), rect, flags);
#elif wxCHECK_VERSION(2,9,0)
        wxRendererNative::Get().DrawRadioButton(window, *localDC.context(), rect, flags);
#else
        wxRenderer_DrawRadioButton(window, *localDC.context(), rect, flags);
#endif
    }
    else if(part == CheckboxPart) {
        if (isChecked(o))
            flags |= wxCONTROL_CHECKED;
        wxRendererNative::Get().DrawCheckBox(window, *localDC.context(), rect, flags);
    }
    return false;
}
Ejemplo n.º 7
0
void ZSubPane::HandleDraw(const ZDC& inDC)
	{
	// inDC has been setup with our coords, but with our superPane's clip rgn. If we don't
	// have a superpane, then the clip is set to our visible bounds.
	ZDC localDC(inDC);

	ZDCRgn oldClip = localDC.GetClip();
	ZDCRgn boundsRgn = this->CalcBoundsRgn();
	if (ZDCRgn newClip = oldClip & boundsRgn)
		{
		localDC.SetClip(newClip);
		if (ZDCInk theInk = this->GetBackInk(inDC))
			localDC.SetInk(theInk);

		this->DoDraw(localDC, boundsRgn);
		}

	if (fAdorners)
		{
		for (size_t x = 0; x < fAdorners->size(); ++x)
			fAdorners[x][0]->AdornPane(inDC, this, boundsRgn);
		}
	}