예제 #1
0
sRect CCBFrameLook::GetClientRect(CCFrame* pFrame, sRect& r)
{
    if(GetCustomLook() == 1)
    {
        int al = FRAME_OUTLINE_WIDTH+FRAME_WIDTH+FRAME_INLINE_WIDTH+RECT_DEFAULT_SPACE;
        int au = m_pFrameBitmaps[7]->GetHeight() + FRAME_OUTLINE_WIDTH + FRAME_INLINE_WIDTH+RECT_DEFAULT_SPACE;
        return sRect(r.x+al, r.y+au, r.w-(al*2), r.h-(al+au));
    }
    if( GetCustomLook() == 2 )
    {
#define CUSTOM2_FRAME_OFFSET_WIDTH 2
#define CUSTOM2_FRAME_OFFSET_HEIGHT 10
        return sRect(r.x + CUSTOM2_FRAME_OFFSET_WIDTH, r.y + CUSTOM2_FRAME_OFFSET_HEIGHT , r.w - 2 * CUSTOM2_FRAME_OFFSET_WIDTH, r.h - 2 * CUSTOM2_FRAME_OFFSET_HEIGHT);
    }
    else
    {
        if(IsNull(m_pFrameBitmaps, FRAME_BITMAP_COUNT)==true) return r;

        float fScale = GetScale();
        int al = (int)(fScale * m_pFrameBitmaps[3]->GetWidth());
        int au = (int)(fScale * m_pFrameBitmaps[7]->GetHeight());
        int ar = (int)(fScale * m_pFrameBitmaps[5]->GetWidth());
        int ab = (int)(fScale * m_pFrameBitmaps[1]->GetHeight());
        return sRect(r.x+al, r.y+au, r.w-(al+ar), r.h-(au+ab));
    }
}
예제 #2
0
void KexiTableViewHeader::setSelectedSection(int section)
{
    if (m_selectedSection == section || (section != -1 && section >= count()))
        return;
    const int oldSection = m_selectedSection;
    m_selectedSection = section;
    if (oldSection != -1)
        update(sRect(oldSection));
    if (m_selectedSection != -1)
        update(sRect(m_selectedSection));
}
예제 #3
0
	ZQ<ZRectPOD> Insert(const ZDCPixmap& iPixmap)
		{
		const ZPointPOD theSourceSize = iPixmap.Size();
		const ZPointPOD thePaddedSize = theSourceSize + sPointPOD(2*fPaddingX,2*fPaddingY);

		for (;;)
			{
			int theX, theY;
			if (spInsert(fRoot, fCapX, fCapY, X(thePaddedSize), Y(thePaddedSize), 0, 0, theX, theY))
				{
				const ZPointPOD destLocation = sPointPOD(theX+fPaddingX, theY+fPaddingY);

				fPixmap.CopyFrom(destLocation, iPixmap, sRect(theSourceSize));

				const ZRectPOD result = sRect(theSourceSize) + destLocation;

				fUsedX = sMax(fUsedX, R(result) + fPaddingX);
				fUsedY = sMax(fUsedY, B(result) + fPaddingY);

				return result;
				}
			else
				{
				const int newCapX = fCapX + X(thePaddedSize);
				const int newCapY = fCapY + Y(thePaddedSize);
				fGrowHorizontal = not fGrowHorizontal;
				if (fGrowHorizontal && newCapX <= X(fPixmap.Size()))
					{
					ZRef<Node> newRoot = new Node;
					newRoot->fVertical = true;
					newRoot->fPos = fCapX;
					newRoot->f0 = fRoot;
					newRoot->f1 = new Node;
					fRoot = newRoot;
					fCapX = newCapX;
					}
				else if (newCapY <= Y(fPixmap.Size()))
					{
					ZRef<Node> newRoot = new Node;
					newRoot->fVertical = false;
					newRoot->fPos = fCapY;
					newRoot->f0 = fRoot;
					newRoot->f1 = new Node;
					fRoot = newRoot;
					fCapY = newCapY;
					}
				else
					{
					return null;
					}
				}
			}		
		}
예제 #4
0
/*!
  \reimp
*/
void QHeader::mouseReleaseEvent( QMouseEvent *e )
{
    if ( e->button() != LeftButton )
	return;
    State oldState = state;
    state = Idle;
    switch ( oldState ) {
    case Pressed: {
	int section = d->i2s[handleIdx];
	repaint(sRect( handleIdx ), FALSE);
	emit released( section );
	if ( sRect( handleIdx ).contains( e->pos() ) ) {
	    emit sectionClicked( handleIdx );
	    emit clicked( section );
	}
	} break;
    case Sliding: {
	int c = orient == Horizontal ? e->pos().x() : e->pos().y();
	c += offset();
	handleColumnResize( handleIdx, c, TRUE );
	} break;
    case Moving: {
#ifndef QT_NO_CURSOR
	unsetCursor();
#endif
	int section = d->i2s[handleIdx];
	if ( handleIdx != moveToIdx && moveToIdx != -1 ) {
	    moveSection( section, moveToIdx );
	    repaint(); // a bit overkill, but removes the handle as well
	    emit moved( handleIdx, moveToIdx );
	    emit indexChange( section, handleIdx, moveToIdx );
	    emit released( section );
	} else {
	    repaint(sRect( handleIdx ), FALSE );
	    if ( sRect( handleIdx).contains( e->pos() ) ) {
		emit released( section );
		emit sectionClicked( handleIdx );
		emit clicked( section );
	    }
	}
	break;
    }
    case Blocked:
	//nothing
	break;
    default:
	// empty, probably.  Idle, at any rate.
	break;
    }
}
예제 #5
0
void sTabBorderBase::OnPaint(int layer)
{
    auto sty = Style();
    auto pnt = Painter();

    if(BoxesDirty)
        UpdateElements();

    sRect r(Outer);
    r.y1 = r.y0 + ReqSizeY;

    sty->Rect(layer,this,sSK_ToolBorder_Top,r);

    sDragDropIcon icon;
    int mx,my;
    int drophere = -1;
    if(Gui->GetDragDropInfo(this,icon,mx,my))
        drophere = FindDragDrop(icon,mx,my);

    if(drophere==0)
    {
        pnt->SetLayer(layer+1);
        pnt->Rect(sty->Colors[sGC_HoverFeedback],sRect(Client.x0,Client.y0,Client.x0+2,Client.y1));
    }

    int n = 0;
    for(sTabDummyElement *e : *Array)
    {
        sTabElementInfo &info = e->*Info;
        int mod = 0;
        if(Pressed && e==Selected)
            mod |= sSM_Pressed;
        if(e==*WindowSelect)
            mod |= sSM_WindowSel;
        if(e==*GlobalSelect)
            mod |= sSM_GlobalSel;
        if(info.HoverDelete && (Flags & sWF_Hover))
            mod |= sSM_HoverIcon;

        sty->Rect(layer,this,sSK_TabItem,info.Client,mod,info.Name);

        n++;
        if(n==drophere)
        {
            int x = info.Client.x1 + 4;
            pnt->SetLayer(layer+1);
            pnt->Rect(sty->Colors[sGC_HoverFeedback],sRect(x-1,Client.y0,x+1,Client.y1));
        }
    }
}
예제 #6
0
BOOL CMsgReplayWnd::OnCreateClient(LPCREATESTRUCT lpcs,
                                   CCreateContext* pContext)
{
    //Creation of the listbox window
    CRect sRect(0,0,0,0);
    this->GetClientRect(sRect);
    int nReplayMode = m_ouReplayDetails.m_ouReplayFile.m_nReplayMode;
    DWORD wListStyle = WS_CHILD | WS_VISIBLE | WS_BORDER |
                       LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SHOWSELALWAYS |
                       LVS_OWNERDATA;    // Virtual List control

    if( nReplayMode == defREPLAY_MODE_MONOSHOT)
    {
        wListStyle |= LVS_SINGLESEL;
    }

    m_omMessageList.Create( wListStyle, sRect, this, IDC_LSTB_REPLAY );
    m_omMessageList.SetExtendedStyle( LVS_EX_FULLROWSELECT );
    // Create Image
    if( m_omImageList.Create( IDB_BMP_BREAKPOINT,
                              defICON_SIZE,
                              defICON_GROW,
                              WHITE_COLOR ) == TRUE )
    {
        m_omMessageList.SetImageList( &m_omImageList, LVSIL_SMALL );
    }
    // Insert invisible column
    m_omMessageList.InsertColumn( 0, "" );
    // Set the window icon
    SetIcon( AfxGetApp()->LoadIcon(IDI_ICO_REPLAY), TRUE);

    return CMDIChildWnd::OnCreateClient(lpcs, pContext);
}
예제 #7
0
/*!
  \reimp
*/
void QHeader::mousePressEvent( QMouseEvent *e )
{
    if ( e->button() != LeftButton || state != Idle )
	return;
    handleIdx = 0;
    int c = orient == Horizontal ? e->pos().x() : e->pos().y();
    c += offset();

    int section = sectionAt( c );
    if ( section < 0 )
	return;
    int index = d->s2i[section];

    if ( (index > 0 && c < d->positions[index] + GRIPMARGIN) ||
	 (c > d->positions[index] + d->sizes[section] - GRIPMARGIN) ) {
	if ( c < d->positions[index]  + GRIPMARGIN )
	    handleIdx = index-1;
	else
	    handleIdx = index;
	oldHIdxSize = d->sizes[ d->i2s[handleIdx] ];
	state = d->resize[d->i2s[handleIdx]  ] ? Sliding : Blocked;
    } else if ( index >= 0 ) {
	handleIdx = index;
	moveToIdx = -1;
	state = d->clicks[ d->i2s[handleIdx]  ] ? Pressed : Blocked;
	clickPos = c;
	repaint( sRect( handleIdx ) );
	emit pressed( section );
    }
}
예제 #8
0
void QHeader::mousePressEvent( QMouseEvent *m )
{
    if ( m->button() != LeftButton )
	return;
    handleIdx = 0;
    int c = orient == Horizontal ? m->pos().x() : m->pos().y();
    int i = 0;
    while ( i < (int) count() ) {
	if ( pPos(i+1) - MINSIZE/2 < c &&
	     c < pPos(i+1) + MINSIZE/2 ) {
		handleIdx = i+1;
		oldHIdxSize = cellSize( i );
	    if ( data->resize.testBit(i) )
		state = Sliding;
	    else
		state = Blocked;
	    break;
	} else if (  pPos(i)  < c && c < pPos( i+1 ) ) {
	    handleIdx = i;
	    moveToIdx = -1;
	    if ( data->clicks.testBit(i) )
		state = Pressed;
	    else
		state = Blocked;
	    clickPos = c;
	    repaint(sRect( handleIdx ));
	    break;
	}
	i++;
    }
}
sRect CCBButtonLook::GetClientRect(CCButton* pButton, sRect& r)
{
	float fScale = GetScale();

	int al = (int)(fScale * GETWIDTH(m_pUpBitmaps[3]));
	int au = (int)(fScale * GETHEIGHT(m_pUpBitmaps[7]));
	int ar = (int)(fScale * GETWIDTH(m_pUpBitmaps[5]));
	int ab = (int)(fScale * GETHEIGHT(m_pUpBitmaps[1]));
	return sRect(r.x+al, r.y+au, r.w-(al+ar), r.h-(au+ab));
}
예제 #10
0
void FlatCheckbox::paintEvent(QPaintEvent *e) {
	QPainter p(this);

	p.setOpacity(_opacity);
	if (_st.bgColor != st::transparent) {
		p.fillRect(rect(), _st.bgColor->b);
	}

	if (!_text.isEmpty()) {
		p.setFont(_st.font->f);
		p.setRenderHint(QPainter::TextAntialiasing);
		p.setPen((_state & StateDisabled ? _st.disColor : _st.textColor)->p);

		QRect tRect(rect());
		tRect.setTop(_st.textTop);
		tRect.setLeft(_st.textLeft);
//		p.drawText(_st.textLeft, _st.textTop + _st.font->ascent, _text);
		p.drawText(tRect, _text, QTextOption(style::al_topleft));
	}

	if (_state & StateDisabled) {
		QRect sRect(_checked ? _st.chkDisImageRect : _st.disImageRect);
		p.drawPixmap(_st.imagePos, App::sprite(), sRect);
	} else if ((_checked && _st.chkImageRect == _st.chkOverImageRect) || (!_checked && _st.imageRect == _st.overImageRect)) {
		p.setOpacity(_opacity);
		QRect sRect(_checked ? _st.chkImageRect : _st.imageRect);
		p.drawPixmap(_st.imagePos, App::sprite(), sRect);
	} else {
		if (a_over.current() < 1) {
			QRect sRect(_checked ? _st.chkImageRect : _st.imageRect);
			p.drawPixmap(_st.imagePos, App::sprite(), sRect);
		}
		if (a_over.current() > 0) {
			p.setOpacity(_opacity * a_over.current());
			QRect sRect(_checked ? _st.chkOverImageRect : _st.overImageRect);
			p.drawPixmap(_st.imagePos, App::sprite(), sRect);
		}
	}
}
sRect CCBTabCtrlLook::GetClientRect(CCTabCtrl* pTabCtrl, sRect& r)
{
	int al = GETWIDTH(m_pFrameBitmaps[3]);
	int au = GETHEIGHT(m_pFrameBitmaps[7]);
	int ar = GETWIDTH(m_pFrameBitmaps[5]);
	int ab = GETHEIGHT(m_pFrameBitmaps[1]);

	int nWidth = r.w-(al+ar);

	const int nMargin = 2;

	return sRect(r.x+al + nMargin, r.y+au + nMargin, nWidth -nMargin*2, r.h-(au+ab) -nMargin*2);
}
예제 #12
0
void QHeader::mouseReleaseEvent( QMouseEvent *m )
{
    if ( m->button() != LeftButton )
	return;
    State oldState = state;
    state = Idle;
    switch ( oldState ) {
    case Pressed:
	repaint(sRect( handleIdx ));
	if ( sRect( handleIdx ).contains( m->pos() ) )
	    emit sectionClicked( handleIdx );
	break;
    case Sliding: {
	int s = orient == Horizontal ? m->pos().x() : m->pos().y();
	// setCursor( arrowCursor ); // We're probably still there...
	handleColumnResize( handleIdx, s, TRUE );
	} break;
    case Moving: {
	setCursor( arrowCursor );
	if ( handleIdx != moveToIdx && moveToIdx != -1 ) {
	    moveAround( handleIdx, moveToIdx );
	    emit moved( handleIdx, moveToIdx );
	    repaint();
	} else {
	    if ( sRect( handleIdx).contains( m->pos() ) )
		emit sectionClicked( handleIdx );
	    repaint(sRect( handleIdx ));
	}
	break;
    }
    case Blocked:
	//nothing
	break;
    default:
	// empty, probably.  Idle, at any rate.
	break;
    }
}
예제 #13
0
void QDirectFbBlitter::drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity)
{
    QRect sQRect = subrect.toRect();
    QRect dQRect = rect.toRect();
    DFBRectangle sRect(sQRect.x(), sQRect.y(), sQRect.width(), sQRect.height());
    DFBRectangle dRect(dQRect.x(), dQRect.y(), dQRect.width(), dQRect.height());
    DFBResult result;

    // skip if dst too small
    if ((dRect.w <= 0) || (dRect.h <= 0)) return;

    // correct roundings if needed
    if (sRect.w <= 0) sRect.w = 1;
    if (sRect.h <= 0) sRect.h = 1;

    QDirectFbBlitterPlatformPixmap *blitPm = static_cast<QDirectFbBlitterPlatformPixmap *>(pixmap.handle());
    QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blitPm->blittable());
    dfbBlitter->unlock();

    IDirectFBSurface *s = dfbBlitter->m_surface.data();

    DFBSurfaceBlittingFlags blittingFlags = DFBSurfaceBlittingFlags(DSBLIT_BLEND_ALPHACHANNEL);
    DFBSurfacePorterDuffRule porterDuff = (cmode == QPainter::CompositionMode_SourceOver) ? DSPD_SRC_OVER : DSPD_SRC;

    if (opacity != 1.0)
    {
        blittingFlags = DFBSurfaceBlittingFlags(blittingFlags | DSBLIT_BLEND_COLORALPHA | (m_premult ? DSBLIT_SRC_PREMULTCOLOR : 0));
        m_surface->SetColor(m_surface.data(), 0xff, 0xff, 0xff, (u8) (opacity * 255.0));
    }

    m_surface->SetBlittingFlags(m_surface.data(), DFBSurfaceBlittingFlags(blittingFlags));
    m_surface->SetPorterDuff(m_surface.data(), porterDuff);

    if (cmode == QPainter::CompositionMode_SourceOver)
        m_surface->SetDstBlendFunction(m_surface.data(), DSBF_INVSRCALPHA);

    if ((sRect.w == dRect.w) && (sRect.h == dRect.h)) {
        result = m_surface->Blit(m_surface.data(), s, &sRect, dRect.x, dRect.y);
        if (result != DFB_OK)
            DirectFBError("QDirectFBBlitter::drawPixmapOpacity()", result);
        if (m_debugPaint)
            drawDebugRect(QRect(dRect.x, dRect.y, sRect.w, sRect.h), QColor(Qt::green));
    } else {
        result = m_surface->StretchBlit(m_surface.data(), s, &sRect, &dRect);
        if (result != DFB_OK)
            DirectFBError("QDirectFBBlitter::drawPixmapOpacity()", result);
        if (m_debugPaint)
            drawDebugRect(QRect(dRect.x, dRect.y, dRect.w, dRect.h), QColor(Qt::red));
    }
}
예제 #14
0
void GSDevice11::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset)
{
	GSVector4 s = GSVector4(dTex->GetSize());

	GSVector4 sRect(0, 0, 1, 1);
	GSVector4 dRect(0.0f, yoffset, s.x, s.y + yoffset);

	InterlaceConstantBuffer cb;

	cb.ZrH = GSVector2(0, 1.0f / s.y);
	cb.hH = s.y / 2;

	m_ctx->UpdateSubresource(m_interlace.cb, 0, NULL, &cb, 0, 0);

	StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader], m_interlace.cb, linear);
}
예제 #15
0
void GSDevice11::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
{
	GSVector2i s = dTex->GetSize();

	GSVector4 sRect(0, 0, 1, 1);
	GSVector4 dRect(0, 0, s.x, s.y);

	ShadeBoostConstantBuffer cb;

	cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
	cb.rcpFrameOpt = GSVector4::zero();

	m_ctx->UpdateSubresource(m_shadeboost.cb, 0, NULL, &cb, 0, 0);

	StretchRect(sTex, sRect, dTex, dRect, m_shadeboost.ps, m_shadeboost.cb, true);
}
예제 #16
0
파일: GSDevice.cpp 프로젝트: Coderx7/pcsx2
void GSDevice::ShadeBoost()
{
	GSVector2i s = m_current->GetSize();

	if(m_shadeboost == NULL || m_shadeboost->GetSize() != s)
	{
		delete m_shadeboost;
		m_shadeboost = CreateRenderTarget(s.x, s.y, false);
	}

	if(m_shadeboost != NULL)
	{
		GSVector4 sRect(0, 0, 1, 1);
		GSVector4 dRect(0, 0, s.x, s.y);

		StretchRect(m_current, sRect, m_shadeboost, dRect, 0, false);
		DoShadeBoost(m_shadeboost, m_current);
	}
}
예제 #17
0
파일: GSDevice.cpp 프로젝트: Coderx7/pcsx2
void GSDevice::ExternalFX()
{
	GSVector2i s = m_current->GetSize();

	if (m_shaderfx == NULL || m_shaderfx->GetSize() != s)
	{
		delete m_shaderfx;
		m_shaderfx = CreateRenderTarget(s.x, s.y, false);
	}

	if (m_shaderfx != NULL)
	{
		GSVector4 sRect(0, 0, 1, 1);
		GSVector4 dRect(0, 0, s.x, s.y);

		StretchRect(m_current, sRect, m_shaderfx, dRect, 7, false);
		DoExternalFX(m_shaderfx, m_current);
	}
}
예제 #18
0
파일: GSDevice.cpp 프로젝트: Coderx7/pcsx2
void GSDevice::FXAA()
{
	GSVector2i s = m_current->GetSize();

	if(m_fxaa == NULL || m_fxaa->GetSize() != s)
	{
		delete m_fxaa;
		m_fxaa = CreateRenderTarget(s.x, s.y, false);
	}

	if(m_fxaa != NULL)
	{
		GSVector4 sRect(0, 0, 1, 1);
		GSVector4 dRect(0, 0, s.x, s.y);

		StretchRect(m_current, sRect, m_fxaa, dRect, 7, false);
		DoFXAA(m_fxaa, m_current);
	}
}
예제 #19
0
void GSDevice11::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
{
	GSVector2i s = dTex->GetSize();

	GSVector4 sRect(0, 0, 1, 1);
	GSVector4 dRect(0, 0, s.x, s.y);

	ExternalFXConstantBuffer cb;

	InitExternalFX();

	cb.xyFrame = GSVector2((float)s.x, (float)s.y);
	cb.rcpFrame = GSVector4(1.0f / (float)s.x, 1.0f / (float)s.y, 0.0f, 0.0f);
	cb.rcpFrameOpt = GSVector4::zero();

	m_ctx->UpdateSubresource(m_shaderfx.cb, 0, NULL, &cb, 0, 0);

	StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps, m_shaderfx.cb, true);
}
예제 #20
0
void GSDevice11::DoFXAA(GSTexture* sTex, GSTexture* dTex)
{
	GSVector2i s = dTex->GetSize();

	GSVector4 sRect(0, 0, 1, 1);
	GSVector4 dRect(0, 0, s.x, s.y);

	FXAAConstantBuffer cb;

	InitFXAA();

	cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
	cb.rcpFrameOpt = GSVector4::zero();

	m_ctx->UpdateSubresource(m_fxaa.cb, 0, NULL, &cb, 0, 0);

	StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, m_fxaa.cb, true);

	//sTex->Save("c:\\temp1\\1.bmp");
	//dTex->Save("c:\\temp1\\2.bmp");
}
예제 #21
0
sRect CCWidget::GetClientRect(){
	return sRect(0, 0, m_Rect.w, m_Rect.h);
}
예제 #22
0
/*!
  \reimp
*/
void QHeader::mouseMoveEvent( QMouseEvent *e )
{
    int section;
    bool hit;

    int c = orient == Horizontal ? e->pos().x() : e->pos().y();
    c += offset();

    switch( state ) {
    case Idle:
	hit = FALSE;
	if ( (section = sectionAt( c )) >= 0 ) {
	    int index = d->s2i[section];
	    if ( (index > 0 && c < d->positions[index] + GRIPMARGIN) ||
		 (c > d->positions[index] + d->sizes[section] - GRIPMARGIN) ) {
		if ( index > 0 && c < d->positions[index]  + GRIPMARGIN )
		    section = d->i2s[--index];
		if ( d->resize.testBit(section) ) {
		    hit = TRUE;
#ifndef QT_NO_CURSOR
		    if ( orient == Horizontal )
			setCursor( splitHCursor );
		    else
			setCursor( splitVCursor );
#endif
		}
	    }
	}
#ifndef QT_NO_CURSOR
	if ( !hit )
	    unsetCursor();
#endif
	break;
    case Blocked:
	break;
    case Pressed:
	if ( QABS( c - clickPos ) > 4 && d->move ) {
	    state = Moving;
	    moveToIdx = -1;
#ifndef QT_NO_CURSOR
	    if ( orient == Horizontal )
		setCursor( sizeHorCursor );
	    else
		setCursor( sizeVerCursor );
#endif
	}
	break;
    case Sliding:
	handleColumnResize( handleIdx, c, FALSE );
	break;
    case Moving: {
	int newPos = findLine( c );
	if ( newPos != moveToIdx ) {
	    if ( moveToIdx == handleIdx || moveToIdx == handleIdx + 1 )
		repaint( sRect(handleIdx) );
	    else
		unMarkLine( moveToIdx );
	    moveToIdx = newPos;
	    if ( moveToIdx == handleIdx || moveToIdx == handleIdx + 1 )
		paintRect( pPos( handleIdx ), pSize( handleIdx ) );
	    else
		markLine( moveToIdx );
	}
	break;
    }
    default:
	qWarning( "QHeader::mouseMoveEvent: (%s) unknown state", name() );
	break;
    }
}
예제 #23
0
파일: splitter.cpp 프로젝트: 3rdexp/fxfile
void Splitter::resize(HDWP aHdwp)
{
    if (mRowCount <= 0 || mColumnCount <= 0)
        return;

    if (mWindowRect.Width() <= 0 || mWindowRect.Height() <= 0)
        return;

    xpr_sint_t i, j;
    xpr_sint_t sOldRight;
    xpr_sint_t sOldBottom;
    CRect sRect(mWindowRect);
    Pane *sPane;

    sOldRight = sOldBottom = 0;

    HDWP sHdwp = aHdwp;
    if (XPR_IS_NULL(aHdwp))
        sHdwp = ::BeginDeferWindowPos(mRowCount * mColumnCount);

    for (i = 0; i < mRowCount; ++i)
    {
        for (j = 0; j < mColumnCount; ++j)
        {
            sPane = mPanes[i] + j;

            if (j == 0)
                sRect.left = mWindowRect.left;
            else
                sRect.left = sOldRight + mSplitSize;

            if (i == 0)
                sRect.top = mWindowRect.top;
            else
                sRect.top = sOldBottom + mSplitSize;

            sRect.right  = sRect.left + sPane->mPaneSize.cx;
            sRect.bottom = sRect.top  + sPane->mPaneSize.cy;

            if (j == (mColumnCount - 1))
                sRect.right = mWindowRect.right;

            if (i == (mRowCount - 1))
                sRect.bottom = mWindowRect.bottom;

            sPane->mVertSplitterRect = mWindowRect;
            sPane->mVertSplitterRect.left  = sRect.right;
            sPane->mVertSplitterRect.right = sPane->mVertSplitterRect.left + mSplitSize;

            sPane->mHorzSplitterRect = mWindowRect;
            sPane->mHorzSplitterRect.top    = sRect.bottom;
            sPane->mHorzSplitterRect.bottom = sPane->mHorzSplitterRect.top + mSplitSize;

            sPane->mPaneSize.cx = sRect.Width();
            sPane->mPaneSize.cy = sRect.Height();

            sPane->mPaneRect = sRect;

            if (XPR_IS_NOT_NULL(sPane->mPaneWnd))
            {
                ::DeferWindowPos(sHdwp, *sPane->mPaneWnd, XPR_NULL, sRect.left, sRect.top, sRect.Width(), sRect.Height(), SWP_NOZORDER);
            }

            sOldRight = sRect.right;
        }

        sOldBottom = sRect.bottom;
    }

    if (XPR_IS_NULL(aHdwp))
        ::EndDeferWindowPos(sHdwp);
}
void DrawBitmapFrame2(CCDrawContext* pDC, sRect& r, sRect& cr, CCBitmap* Bms[9])
{
	if(Bms[0]&&Bms[0]) {

		//자신의 영역을 둘러싸는 이미지를 그려준다..
		// 9곳 회전해서 그리기..
		// 1 2 3 
		// 4 5 6
		// 7 8 9

		Bms[0]->SetDrawMode(CCBM_Normal);
		Bms[1]->SetDrawMode(CCBM_Normal);

		sRect cliprect = pDC->GetClipRect();//잠시풀어준다..

		pDC->SetColor(sColor(255,255,255,255));
//		pDC->SetOpacity(255);
//		pDC->SetClipRect(0,0,CCGetWorkspaceWidth(),CCGetWorkspaceHeight());
		pDC->SetClipRect( cr.x, cr.y, cr.w, cr.h );
//		pDC->SetBitmapColor(color);

		pDC->SetBitmap( Bms[0] );
		pDC->Draw(r.x, r.y, 16, 16);

		pDC->SetBitmap( Bms[1] );
		pDC->Draw(r.x+16, r.y, r.w-32,16);

		Bms[0]->SetDrawMode(CCBM_FlipLR);

		pDC->SetBitmap( Bms[0] );
		pDC->Draw(r.x+r.w-16, r.y, 16, 16);

		//그려야할사이즈가있다면~ 중간단계
		if(r.h > 32) {

			Bms[1]->SetDrawMode(CCBM_RotL90);
			pDC->SetBitmap( Bms[1] );
			pDC->Draw(r.x, r.y+16, 16, r.h-32);

			//중간색채우기
			pDC->SetColor(sColor(0xffD9D9D9));//임시
			pDC->FillRectangle(sRect(r.x+16,r.y+16,r.w-32,r.h-32));

			Bms[1]->SetDrawMode(CCBM_RotR90);
			pDC->SetBitmap( Bms[1] );
			pDC->Draw(r.x+r.w-16, r.y+16, 16, r.h-32);
		}

		// 아래부분~

		Bms[0]->SetDrawMode(CCBM_FlipUD);
		pDC->SetBitmap( Bms[0] );
		pDC->Draw(r.x, r.y+r.h-16, 16, 16);

		Bms[1]->SetDrawMode(CCBM_FlipUD);
		pDC->SetBitmap( Bms[1] );
		pDC->Draw(r.x+16, r.y+r.h-16, r.w-32,16);

		Bms[0]->SetDrawMode(CCBM_FlipUD|CCBM_FlipLR);
		pDC->SetBitmap( Bms[0] );
		pDC->Draw(r.x+r.w-16, r.y+r.h-16, 16, 16);

		Bms[0]->SetDrawMode(CCBM_Normal);
		Bms[1]->SetDrawMode(CCBM_Normal);

//		pDC->SetBitmapColor(sColor(255,255,255,255));
		pDC->SetClipRect(cliprect);
	}	
}
void DrawBitmapFrame9(CCDrawContext* pDC, sRect& r, CCBitmap* Bms[9],bool bStretch,float fScale)
{
	//if(IsNull(Bms, 9)==true) return;

	/*
	6 7 8
	3 4 5
	0 1 2
	*/

	int add_h = 0;//버튼이 너무 작아졌을때 뭉개지는것 우선 땜질~

	//if(button && (r.h < 24)) add_h = 1;

	int bmw[9] = {0,};
	int bmh[9] = {0,};
	int dtw[9] = {0,};		// scale 이 감안된 크기
	int dth[9] = {0,};
	for(int i=0; i<9; i++){
		 bmw[i] = GETWIDTH(Bms[i]);
		 bmh[i] = GETHEIGHT(Bms[i]);
		 dtw[i] = (int)(fScale * bmw[i]);
		 dth[i] = (int)(fScale * bmh[i]);
	}

	// Body(4)
	pDC->SetBitmap(Bms[4]);

	int bdw = dtw[4];
	int bdh = dth[4];
	int sx = min(min(dtw[3], dtw[0]), dtw[6]);
	int sy = min(min(dth[7], dth[6]), dth[8]);
	int ex = min(min(dtw[5], dtw[8]), dtw[2]);
	int ey = min(min(dth[1], dth[0]), dth[2]);
	int bw = r.w-sx-ex;
	int bh = r.h-sy-ey;
	int wc = 0;
	if(bdw>0) wc = bw/bdw;
	int hc = 0;
	if(bdh>0) hc = bh/bdh;
	/*
	if(bw%bdw!=0) wc += 1;
	if(bh%bdh!=0) hc += 1;
	*/

	if (!bStretch)
	{
		for(int y=0; y<hc; y++){
			for(int x=0; x<wc; x++){
				pDC->Draw(r.x+sx+x*bdw, r.y+sy+y*bdh , bdw, bdh);
			}
		}
		// Bms[4] 크기로는 모자른 부분을 짤라서 맞춰 찍음
		if(bdw>0 && (bw%bdw)>0){
			for(int y=0; y<hc; y++){
				//pDC->Draw(r.x+sx+bw-bdw, r.y+sy+y*bdh, true);
				pDC->Draw(r.x+sx+wc*bdw, r.y+sy+y*bdh, bw%bdw, bdh, 0, 0, bw%bdw, bdh);
			}
		}
		if(bdh>0 && (bh%bdh)>0){
			for(int x=0; x<wc; x++){
				//pDC->Draw(r.x+sx+x*bdw, r.y+sy+bh-bdh, true);
				pDC->Draw(r.x+sx+x*bdw, r.y+sy+hc*bdh, bdw, bh%bdh, 0, 0, bdw, bh%bdh);
			}
		}
		//모서리
		if(bdw>0 && bdh>0 && (bw%bdw)>0 && (bh%bdh)>0){
			pDC->Draw(r.x+sx+wc*bdw, r.y+sy+hc*bdh, bw%bdw, bh%bdh, 0, 0, bw%bdw, bh%bdh);
			//pDC->Draw(r.x+sx+bw-bdw, r.y+sy+bh-bdh, true);
		}
	}
	else
	{
		sRect rcClient = sRect(sx, sy, bw, bh);
		pDC->Draw(rcClient);
	}

	// Upper
	int uw = r.w - (dtw[6]+dtw[8]);
	HLineBitmap(pDC, r.x+dtw[6], r.y, uw, Bms[7], bStretch, fScale);

	// Bottom
	int dw = r.w - (dtw[0]+dtw[2]);
	HLineBitmap(pDC, r.x+dtw[0], r.y+r.h-dth[1], dw, Bms[1], bStretch, fScale);


	// Left
	int lh = r.h - (dth[0]+dth[6]);
	VLineBitmap(pDC, r.x, r.y+dth[6]+add_h, lh, Bms[3], bStretch, fScale);
	
	// Right
	int rh = r.h - (dth[2]+dth[8]);
	VLineBitmap(pDC, r.x+r.w-dtw[5], r.y+dth[8]+add_h, rh, Bms[5], bStretch, fScale);


	// 6
	pDC->SetBitmap(Bms[6]);
	pDC->Draw(r.x, r.y, dtw[6], dth[6]);

	// 8
	pDC->SetBitmap(Bms[8]);
	pDC->Draw(r.x+r.w-dtw[8], r.y, dtw[8], dth[8]);

	// 0
	pDC->SetBitmap(Bms[0]);
	pDC->Draw(r.x, r.y+r.h-dth[0], dtw[0], dth[0]);

	// 2
	pDC->SetBitmap(Bms[2]);
	pDC->Draw(r.x+r.w-dtw[2], r.y+r.h-dth[2], dtw[2], dth[2]);
}
예제 #26
0
sRect CCClientToScreen(CCWidget* pWidget, sRect& p){
	sRect r = pWidget->GetScreenRect();
	return sRect(p.x+r.x, p.y+r.y, p.w, p.h);
}
예제 #27
0
sRect CCScreenToClient(CCWidget* pWidget, sRect& p){
	sRect r = pWidget->GetScreenRect();
	return sRect(p.x-r.x, p.y-r.y, p.w, p.h);
}
예제 #28
0
sRect S_GetWindowSize(){
	cGraphics *gr = sEngine->GetGraphicsManager();
	return sRect(0, 0, gr->GetWidth(), gr->GetHeight());
}
예제 #29
0
void MainWindow::saveContextsPixmapToFile()
{
  
  QString fileName;
  bool quick = true;
  
  QString filep = filepath + ".temp/mask.png";  
  
  if(quick == true)
  {
    fileName = filep;
  }
  
  else
  {
    fileName = QFileDialog::getSaveFileName(this, 
                                            tr("Save contexts image"),
                                            tr((const char*)filep.toLatin1()),
                                            tr("*.png"));
  }
  
  if (fileName.isEmpty())
    return;
  
  QFile file(fileName);
  if (!file.open(QFile::WriteOnly | QFile::Text))
  {
    QMessageBox::warning(this, tr("Save mask image"),
                         tr("Cannot save file %1:\n%2.")
                         .arg(fileName)
                         .arg(file.errorString()));
    return;
  }
  
  QImage image(388,288,QImage::Format_ARGB32_Premultiplied);
  QRect sRect(0,0,388,288);
  QPainter painter(&image);
  rbeVisualizeWidget->getDrawScene()->render(&painter);  
  
  //traslate pixel
  QRgb pixColor;  
  
  //set a mask image, keep the area color, black the rest  
  for (int i = 0; i < image.width(); ++i)
  {
    for (int j = 0; j < image.height(); ++j)
    {
      pixColor = image.pixel(i, j);      
      bool value = false;
      for(int k = 0 ; k < generalContainer->getGeneralContextItems()->size(); k++)
      {
        if(rbeVisualizeWidget->getDrawScene()->items()[k]->type() == RbeVisualizeWidget_GraphicsScene::POLYGON_ITEM)
        {
          RbeVisualizeWidget_PolygonItem *item = qgraphicsitem_cast<RbeVisualizeWidget_PolygonItem*>(rbeVisualizeWidget->getDrawScene()->items()[k]);
          if(QColor::fromRgb(pixColor) == item->getColor())   
          {
            value = true;
          }
        }        
      }
      if(value == false)
      {
        image.setPixel(i, j, qRgb(0,0,0));//set to black
      }
    }
  }   
  image.save(fileName,"PNG");    
}
예제 #30
0
CCWidget::CCWidget(const char* szName, CCWidget* pParent, CCListener* pListener){
	g_nWidgetCount++;
	m_iID = g_nWidgetCount;

	if(szName==NULL) m_szName[0] = NULL;
	else{
		if(strlen(szName)<CCWIDGET_NAME_LENGTH){
			strcpy(m_szName, szName);
		}
		else{
			memcpy(m_szName, szName, CCWIDGET_NAME_LENGTH-4);
			m_szName[CCWIDGET_NAME_LENGTH-4] = '.';
			m_szName[CCWIDGET_NAME_LENGTH-3] = '.';
			m_szName[CCWIDGET_NAME_LENGTH-2] = '.';
			m_szName[CCWIDGET_NAME_LENGTH-1] = 0;
		}
	}

	// Default Region
	m_Rect.x = 0;
	m_Rect.y = 0;
	m_Rect.w = 100;
	m_Rect.h = 100;

	m_pParent = pParent;
	if(m_pParent!=NULL) m_pParent->AddChild(this);

	m_pListener = pListener;

	m_pCursor = NULL;		// NULL Cursor is Default Cursor
	m_pFont = NULL;			// NULL Font is Default Font

	m_bVisible = true;
	m_bEnable = true;
	m_bFocusEnable = false;	// Default Focus Disabled

	m_pToolTip = NULL;

	SetAccelerator(0);

	m_bZOrderChangable = false;
	m_bResizable = false;
	m_iResizeSide = 0;

	m_bClipByParent = true;

	m_iOpacity = 255;

	m_bEnableDesignerMode = true;
	m_iDragWidget = 0;
	m_bModifiedByDesigner = false;
	m_bAddedByDesigner = false;
	m_BoundsAlignment = CCD_NOTALIGN;

	m_iMinWidth = 10;
	m_iMinHeight = 10;

	m_bIsListBox = false;

	m_iDebugType = 0;
	m_bEventAcceleratorCall = false;

	m_IDLRect = sRect(-1,-1,-1,-1);

}