void eWidget::redraw(eRect area) // area bezieht sich nicht auf die clientarea { if (getTLW()->just_showing) return; if (state & stateVisible ) { if (area.isNull()) area=eRect(0, 0, size.width(), size.height()); if (area.width()>0) { gPainter *p=getPainter(area); if (p) { eraseBackground(p, area); redrawWidget(p, area); delete p; } } if(!childlist.empty()) { area.moveBy(-clientrect.x(), -clientrect.y()); // ab hier jetzt schon. ePtrList<eWidget>::iterator It(childlist); while (It != childlist.end()) { eRect cr=area&eRect((*It)->position, (*It)->size); if (!cr.isEmpty()) { cr.moveBy(-It->position.x(), -It->position.y()); It->redraw(cr); } ++It; } } } }
void eTextInputField::drawCursor() { // eDebug("length = %d", isotext.length()); if ( !cursorRect.isEmpty() ) eWidget::invalidate(cursorRect); cursorRect.setTop((deco_selected?crect_selected.bottom():deco?crect.bottom():clientrect.bottom())-4); cursorRect.setHeight( 3 ); if ( isotext.length() ) // text exist? { if ( (int)isotext.length() > curPos) // before or on the last char? { const eRect &bbox = editLabel->getPara()->getGlyphBBox(curPos); if ( !bbox.width() ) // Space { if (curPos) // char before space? { const eRect &bbBefore = editLabel->getPara()->getGlyphBBox(curPos-1); cursorRect.setLeft( bbBefore.right()+2 ); } if ( (int)isotext.length() > curPos+1) // char after space ? { const eRect &bbAfter = editLabel->getPara()->getGlyphBBox(curPos+1); cursorRect.setRight( bbAfter.left()-2 ); } else // no char behind Space cursorRect.setWidth( 10 ); } else { cursorRect.setLeft( bbox.left() ); cursorRect.setWidth( bbox.width() ); } } else // we are behind the last character { const eRect &bbox = editLabel->getPara()->getGlyphBBox(isotext.length()-1); cursorRect.setLeft( bbox.right() + ( ( curPos-isotext.length() ) * 10 ) + 2 ); cursorRect.setWidth( 10 ); } } else // no one character in text { cursorRect.setLeft( 0 ); cursorRect.setWidth( 10 ); } eRect tmp = deco_selected?crect_selected:deco?crect:clientrect; if ( cursorRect.right() > scroll.top().second ) { int newpos = scroll.top().first + cursorRect.left(); scroll.push( std::pair<int,int>( newpos, newpos+tmp.width() ) ); editLabel->move( ePoint( (-newpos)+tmp.left(), editLabel->getPosition().y() ) ); } else if ( scroll.size() > 1 && cursorRect.left() < scroll.top().first ) { scroll.pop(); editLabel->move( ePoint( (-scroll.top().first)+tmp.left() , editLabel->getPosition().y() ) ); } cursorRect.moveBy( (deco_selected?crect_selected.left():deco?crect.left():clientrect.left())-scroll.top().first+1, 0 ); gPainter *painter = getPainter( eRect( ePoint(0,0), size ) ); painter->setForegroundColor( getForegroundColor() ); painter->setBackgroundColor( getBackgroundColor() ); painter->fill( cursorRect ); if(capslock) { if ( !capsRect.isEmpty() ) eWidget::invalidate( capsRect ); capsRect=cursorRect; capsRect.setTop(deco_selected?crect_selected.top():deco?crect.top():clientrect.top()); capsRect.setHeight( 3 ); painter->fill( capsRect ); } if (deco_selected && have_focus) deco_selected.drawDecoration(painter, ePoint(width(), height())); else if (deco) deco.drawDecoration(painter, ePoint(width(), height())); delete painter; }
void AclGlobalWidget::rectangle(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { getPainter()->drawRect(nLeftRect, nTopRect, nRightRect - nLeftRect, nBottomRect - nTopRect); }
void AclGlobalWidget::ellipse(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { getPainter()->drawEllipse(nLeftRect, nTopRect, nRightRect, nBottomRect); }
void AclGlobalWidget::lineRel(int dx, int dy) { getPainter()->drawLine(currentPoint->x, currentPoint->y, currentPoint->x + dx, currentPoint->y + dy); }
void AclGlobalWidget::addLineTo(int endX, int endY) { getPainter()->drawLine(currentPoint->x, currentPoint->y, endX, endY); }
void AclGlobalWidget::addLine(int startX, int startY, int endX, int endY) { getPainter()->drawLine(startX, startY, endX, endY); }