Ejemplo n.º 1
0
/*************ClientP: Delete Acc******************/
void MainWindow::on_btnDC_clicked()
{
    QMessageBox message(QMessageBox::Warning,"Are you sure?","Once it did, it can not be undo!",QMessageBox::Yes|QMessageBox::No,NULL);
    if (message.exec()==QMessageBox::Yes)
    {
       showme("yes!");
       Msg msg=sendAndGet(userName_,userPassword_,"dc","","","","","","");
       bool flag=msg.opResult;
       if(!flag){
           showme("Error in delete User");
       }
       ui->stackedWidget->setCurrentIndex(0);
       ui->widgetWelcome->show();
       ui->widgetLog->hide();
       QDesktopWidget* desktopWidget = QApplication::desktop();
       int winWidth=desktopWidget->screenGeometry().width();
       int winHeight=desktopWidget->screenGeometry().height();
       QRect winRect((winWidth-400)/2,(winHeight-300)/2,400,300);
       this->setGeometry(winRect);
       this->setFixedSize(400,300);
       userName_="";
       userPassword_="";
    }
    else
    {
        showme("no!");
    }
}
Ejemplo n.º 2
0
void wxSVGCtrlBase::Refresh(const wxSVGRect* rect) {
	if (!rect || rect->IsEmpty())
		Refresh(true, NULL);
	else {
		wxRect winRect((int) (rect->GetX() * GetScaleX()), (int) (rect->GetY() * GetScaleY()),
				(int) (rect->GetWidth() * GetScaleX()), (int) (rect->GetHeight() * GetScaleY()));
		RefreshRect(winRect);
	}
}
Ejemplo n.º 3
0
void BComboBox::ComboBoxWindow::DoPosition()
{
	BRect winRect(fParent->fText->Frame());
	winRect = fParent->ConvertToScreen(winRect);
//	winRect.left += fParent->Divider() + 5;
	winRect.right -= 2;
	winRect.OffsetTo(winRect.left, winRect.bottom + kTextInputMargin);
	winRect.bottom = winRect.top + 100;
	MoveTo(winRect.LeftTop());
	ResizeTo(winRect.IntegerWidth(), winRect.IntegerHeight());
}
Ejemplo n.º 4
0
/*************ClientP: log out******************/
void MainWindow::on_btnLO_clicked()
{
  ui->stackedWidget->setCurrentIndex(0);
  ui->widgetWelcome->show();
  ui->widgetLog->hide();
  QDesktopWidget* desktopWidget = QApplication::desktop();
  int winWidth=desktopWidget->screenGeometry().width();
  int winHeight=desktopWidget->screenGeometry().height();
  QRect winRect((winWidth-400)/2,(winHeight-300)/2,400,300);
  this->setGeometry(winRect);
  this->setFixedSize(400,300);
  userName_="";
  userPassword_="";
}
Ejemplo n.º 5
0
	//! constructor
	CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& params, const char* dataPak)
		: CIrrDeviceStub(params, dataPak)
	{
		// create driver
		createDriver();

		if (!VideoDriver)
			return;

		createGUIAndScene();
        
        static CAndroidCursor s_cursor;
        core::rect<s32> winRect(0,0,params.WindowSize.Width, params.WindowSize.Height);
        s_cursor.setReferenceRect(&winRect);
        CursorControl = &s_cursor;
	}
Ejemplo n.º 6
0
/**
 * This function is used to show the highscore table
 * @param a new time value to be entered to the list. If this param is 0 the highscore list will just be shown, no entry will be added
 */
void CHiScoreList::show(IGUIStaticText *pListField, IGUIEnvironment *pGuiEnv,const wchar_t *sLevelName) {
  dimension2du screenSize=m_pDevice->getVideoDriver()->getScreenSize();
  m_iRet=0;
  u32 iPos=0;
  list<CHiScoreEntry *>::Iterator i;
  //create a window to display the table
  rect<s32> winRect(screenSize.Width/2-249,130,screenSize.Width/2+248,screenSize.Height-25);

  iPos=1;
  position2di pos=position2di(10,10);
  wchar_t s[0xFFFF];
  swprintf(s,0xFFFF,L"\"%s\"\n\n",sLevelName);
  for (i=m_lList.begin(); i!=m_lList.end() && iPos<=10; i++) {
    swprintf(s,0xFFFF,L"%s%2i: %s (%.2f)\n",s,iPos++,(*i)->sName,((f32)(*i)->iTime)/1000.0f);
  }
  pListField->setText(s);
}
Ejemplo n.º 7
0
/*************loginP : login******************/
void MainWindow::on_btnLogIn_2_clicked()
{
    string name=ui->lineEditUserName_2->text().toStdString();
    string password=ui->lineEditPassword_2->text().toStdString();
    cout<<name<<" "<<password<<endl;
    Msg msg=sendAndGet(name,password,"l","","","","","","");
    bool flag=msg.opResult;
    if(!flag){
        QMessageBox::information(this,"Login Fail!","Please check your  imformations!");
    } else {
        userName_=name;
        userPassword_=password;
        ui->stackedWidget->setCurrentIndex(1);

       QDesktopWidget* desktopWidget = QApplication::desktop();
       int winWidth=desktopWidget->screenGeometry().width();
       int winHeight=desktopWidget->screenGeometry().height();
       QRect winRect((winWidth-520)/2,(winHeight-300)/2,520,300);
       this->setGeometry(winRect);
       this->setFixedSize(520,300);
    }
}
Ejemplo n.º 8
0
void CRRECRuler::OnPaint()
/* ============================================================
	Function :		CRRECRuler::OnPaint
	Description :	Handles the "WM_PAINT" message from Windows.
					Draws the ruler to a memory "CDC" that is 
					blitted to the screen (double buffering)
	Access :		Protected
					
	Return :		void
	Parameters :	none

	Usage :			Called from MFC

   ============================================================*/
{
	CPaintDC mainDC(this);

	// Set up data
	int pos = GetParent()->SendMessage( urm_GETSCROLLPOS );

	CRect rect;
	GetClientRect( rect );

	// Create off-screen canvas
	CDC dc;
	CBitmap bmp;
	bmp.CreateCompatibleBitmap( &mainDC, rect.Width(), rect.Height() );
	dc.CreateCompatibleDC( &mainDC );
	CBitmap* oldbmp = dc.SelectObject( &bmp );

	dc.FillSolidRect( rect, m_crBack);

	// Set up canvas
	BOOL bEnabled = IsWindowEnabled();

	COLORREF crBack = GetSysColor(bEnabled ? COLOR_WINDOW : COLOR_3DFACE);
	COLORREF crText = GetSysColor(bEnabled ? COLOR_WINDOWTEXT : COLOR_3DSHADOW);

	// Set up data for the inner ruler window
	CRect winRect( rect );
	winRect.top += 3;
	winRect.bottom -= 5;
	winRect.right -= 3;
	winRect.left += m_margin - 2;

	if (bEnabled) // else same as dialog bk color
		dc.FillSolidRect( winRect, GetSysColor(COLOR_WINDOW));

	// Frame the inside
	CThemed th(this, _T("EDIT"));

	if (th.AreControlsThemed()) 
	{
		winRect.InflateRect(0, 1, 0, 1);

		int nState = ETS_NORMAL;

		if (!bEnabled)
			nState = ETS_DISABLED;
		else if (GetStyle() & ES_READONLY)
			
			nState = ETS_READONLY;

		th.DrawBackground(&dc, EP_EDITTEXT, nState, winRect);

		// get the theme bk color for the text
		crBack = th.GetThemeColor(EP_EDITTEXT, nState, TMT_FILLCOLOR);
	}
	else
	{
		dc.Draw3dRect(winRect, ::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DHILIGHT));
		winRect.DeflateRect(1, 1);
		dc.Draw3dRect(winRect, ::GetSysColor(COLOR_3DDKSHADOW), ::GetSysColor(COLOR_3DFACE));
		winRect.InflateRect(1, 1);
	}

	int midpoint = winRect.top + ( winRect.Height() / 2 );
	int leftmarg = winRect.left + 2 - pos;
	int width = winRect.Height();
	int t;

	// Print the values in the ruler scale
	dc.SetBkColor(crBack);
	dc.SetTextColor(crText);
	dc.SelectStockObject( BLACK_PEN );
	dc.SelectStockObject( DEFAULT_GUI_FONT );
	
	if( m_mode == MODE_INCH )
	{
		int inch4 = ( int ) ( ( double ) m_physicalInch / 4.0 +.5 );
		int inch8 = ( int ) ( ( double ) m_physicalInch / 8.0 +.5 );

		// Drawing scale markers
		for( t = ( leftmarg + ( int ) ( inch8 +.5 ) ) ; t < rect.right - m_margin ; t += ( int ) ( inch8 + .5 ) )
		{
			dc.MoveTo( t, midpoint - 1 );
			dc.LineTo( t, midpoint + 1 );
		}

		for( t = leftmarg + inch4 ; t < rect.right - m_margin ; t += inch4 )
		{
			dc.MoveTo( t, midpoint - 3 );
			dc.LineTo( t, midpoint + 3 );
		}

		CRect rectInch;
		CString counter;
		int count = 1;

		// Drawing numbers
		for( t = leftmarg + m_physicalInch ; t < rect.right - m_margin ; t += m_physicalInch )
		{

			rectInch.SetRect( t - width / 2, winRect.top + 2, t + width / 2, winRect.bottom - 2 );
			counter.Format( _T( "%i" ), count );
			dc.DrawText( counter, rectInch, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
			count++;

		}
	}
	else
	{
		int cm = ( int ) ( ( double ) m_physicalInch / 2.54 + .5 );
		int cm2 = ( int ) ( ( double ) cm / 2.0 );

		// Drawing scale markers
		for( t = leftmarg + cm2 ; t < rect.right - m_margin ; t += cm2 )
		{
			dc.MoveTo( t, midpoint - 1 );
			dc.LineTo( t, midpoint + 2 );
		}

		CRect rectNum;
		CString counter;
		int count = 1;

		// Drawing numbers
		for( t = leftmarg + cm ; t < rect.right - m_margin ; t += cm )
		{
			rectNum.SetRect( t - width / 2, winRect.top + 2, t + width / 2, winRect.bottom - 2 );
			counter.Format( _T( "%i" ), count );
			dc.DrawText( counter, rectNum, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
			count++;

		}
	}

	// Draw tab markers
	int max = m_tabs.GetSize();
	for( t = 0 ; t < max ; t++ )
	{

		int x = ( leftmarg + m_tabs[ t ] - 2 );
		if( x > winRect.left && x + 3 < winRect.right )
		{
			dc.MoveTo( x, midpoint + 5 );
			dc.LineTo( x + 6, midpoint + 5 );
			dc.MoveTo( x, midpoint + 6 );
			dc.LineTo( x + 6, midpoint + 6 );

			dc.MoveTo( x + 2, midpoint + 7 );
			dc.LineTo( x + 2, midpoint + 10 );
			dc.MoveTo( x + 3, midpoint + 7 );
			dc.LineTo( x + 3, midpoint + 10 );
		}
	}

	//... and out to screen
	mainDC.BitBlt( 0, 0, rect.Width(), rect.Height(), &dc, 0, 0, SRCCOPY );
	dc.SelectObject( oldbmp );
}
Ejemplo n.º 9
0
void Node::visit()
{
    // quick return if not visible. children won't be drawn.
    if (!_visible)
    {
        return;
    }
    
    kmGLPushMatrix();

    this->transform();
    int i = 0;

    if(!_children.empty())
    {
        sortAllChildren();
        // draw children zOrder < 0
        for( ; i < _children.size(); i++ )
        {
            auto node = _children.at(i);

            if ( node && node->_ZOrder < 0 )
                node->visit();
            else
                break;
        }
        // self draw
		Size size = this->getContentSize();
		Point p = convertToWorldSpace(Point::ZERO);
		Size winSize = Director::getInstance()->getWinSize();
		//if((p.x > 0 && p.x < winSize.width && p.y > 0 && p.y < winSize.height)
		Rect winRect(0, 0, winSize.width, winSize.height);
		//if(winRect.containsPoint(p) || winRect.containsPoint(Point(p.x, p.y+winSize.height)) || 
		   //winRect.containsPoint(Point(p.x+winSize.width, p.y+winSize.height)) ||  winRect.containsPoint(Point(p.x+winSize.width, p.y)))
		if(winRect.intersectsRect(Rect(p.x, p.y, size.width, size.height)))
		{
			this->draw();
		}

        for(auto it=_children.cbegin()+i; it != _children.cend(); ++it)
            (*it)->visit();
    }
    else
    {
		Size size = this->getContentSize();
		Point p = convertToWorldSpace(Point::ZERO);
		Size winSize = Director::getInstance()->getWinSize();
		//if((p.x > 0 && p.x < winSize.width && p.y > 0 && p.y < winSize.height)
		Rect winRect(0, 0, winSize.width, winSize.height);
		//if(winRect.containsPoint(p) || winRect.containsPoint(Point(p.x, p.y+winSize.height)) || 
		//   winRect.containsPoint(Point(p.x+winSize.width, p.y+winSize.height)) ||  winRect.containsPoint(Point(p.x+winSize.width, p.y)))
		if(winRect.intersectsRect(Rect(p.x, p.y, size.width, size.height)))
		{
			this->draw();
		}
    }

    // reset for next frame
    _orderOfArrival = 0;
 
    kmGLPopMatrix();
}
Ejemplo n.º 10
0
void wxNonOwnedWindow::HandleQueuedPaintRequests()
{
    if ( m_toPaint->IsEmpty() )
        return; // nothing to do

    if ( IsFrozen() || !IsShown() )
    {
        // nothing to do if the window is frozen or hidden; clear the queue
        // and return (note that it's OK to clear the queue even if the window
        // is frozen, because Thaw() calls Refresh()):
        m_toPaint->Clear();
        return;
    }

    // process queued paint requests:
    wxRect winRect(wxPoint(0, 0), GetSize());
    wxRect paintedRect;

    // important note: all DCs created from now until m_isPainting is reset to
    // false will not update the front buffer as this flag indicates that we'll
    // blit the entire back buffer to front soon
    m_isPainting = true;

    int requestsCount = 0;

    wxRect request;
    while ( m_toPaint->GetNext(request) )
    {
        requestsCount++;
        wxRect clipped(request);
        clipped.Intersect(winRect);
        if ( clipped.IsEmpty() )
            continue; // nothing to refresh

        wxLogTrace(TRACE_PAINT,
                   "%p ('%s'): processing paint request [%i,%i,%i,%i]",
                   this, GetName().c_str(),
                   clipped.x, clipped.y, clipped.GetRight(), clipped.GetBottom());

        PaintWindow(clipped);

        // remember rectangle covering all repainted areas:
        if ( paintedRect.IsEmpty() )
            paintedRect = clipped;
        else
            paintedRect.Union(clipped);
    }

    m_isPainting = false;

    m_toPaint->Clear();

    if ( paintedRect.IsEmpty() )
        return; // no painting occurred, no need to flip

    // Flip the surface to make the changes visible. Note that the rectangle we
    // flip is *superset* of the union of repainted rectangles (created as
    // "rectangles union" by wxRect::Union) and so some parts of the back
    // buffer that we didn't touch in this HandleQueuedPaintRequests call will
    // be copied to the front buffer as well. This is safe/correct thing to do
    // *only* because wx always use wxIDirectFBSurface::FlipToFront() and so
    // the back and front buffers contain the same data.
    //
    // Note that we do _not_ split m_toPaint into disjoint rectangles and
    // do FlipToFront() for each of them, because that could result in visible
    // updating of the screen; instead, we prefer to flip everything at once.

    DFBRegion r = {paintedRect.GetLeft(), paintedRect.GetTop(),
                   paintedRect.GetRight(), paintedRect.GetBottom()};
    DFBRegion *rptr = (winRect == paintedRect) ? NULL : &r;

    GetDfbSurface()->FlipToFront(rptr);

    wxLogTrace(TRACE_PAINT,
               "%p ('%s'): processed %i paint requests, flipped surface: [%i,%i,%i,%i]",
               this, GetName().c_str(),
               requestsCount,
               paintedRect.x, paintedRect.y,
               paintedRect.GetRight(), paintedRect.GetBottom());
}