void eWidget::invalidate(eRect area, int force) { if ( (!(state & stateVisible)) && (!force)) return; if (area.isNull()) area=eRect(0, 0, size.width(), size.height()); eWidget *w=this; // problem: überlappende, nicht transparente fenster while (force || (((int)w->getBackgroundColor())==-1)) // while (1) { force=0; if (!w->parent) // spaetestens fuers TLW sollte backgroundcolor aber non-transparent sein break; area.moveBy(w->position.x(), w->position.y()); w=w->parent; area.moveBy(w->clientrect.x(), w->clientrect.y()); area&=w->clientrect; } w->redraw(area); }
void eDeferredRenderer::_renderLightPass(eScene &scene, const eCamera &cam, const eRect &area) { eStateManager::push(); eStateManager::bindTexture(0, m_diffuseRt); eStateManager::bindTexture(1, m_normalsRt); eStateManager::bindTexture(2, m_specularRt); eStateManager::bindTexture(3, m_positionRt); eStateManager::bindTexture(4, m_deferredShadowMap); eStateManager::setTextureFilter(0, eTEXFILTER_NEAREST); eStateManager::setTextureFilter(1, eTEXFILTER_NEAREST); eStateManager::setTextureFilter(2, eTEXFILTER_NEAREST); eStateManager::setTextureFilter(3, eTEXFILTER_NEAREST); eStateManager::setTextureFilter(4, eTEXFILTER_BILINEAR); eStateManager::setTextureAddressMode(4, eTEXADDRMODE_CLAMP); eStateManager::setCap(eCAP_BLENDING, eTRUE); eStateManager::setBlendModes(eBLEND_ONE, eBLEND_ONE, eBLENDOP_ADD); eStateManager::bindPixelShader(m_psDefLight); eStateManager::bindVertexShader(m_vsQuad); for (eU32 i=0; i<scene.getLightCount(); i++) { const eLight &light = scene.getLight(i); if (light.activateScissor(area.getDimension(), cam)) { _renderLightDistance(scene, light); _renderShadowMap(cam, light); light.activate(m_gfx, cam.getViewMatrix()); renderQuad(area, area.getDimension()); } } eStateManager::pop(); }
void eDeferredRenderer::_visualizeGeometryBuffer(const eRect &area) const { eStateManager::push(); eStateManager::bindVertexShader(m_vsQuad); eStateManager::bindPixelShader(m_psQuad); eStateManager::setCullingMode(eCULLING_NONE); eStateManager::setTextureAddressMode(0, eTEXADDRMODE_CLAMP); eStateManager::setCap(eCAP_ZBUFFER, eFALSE); eStateManager::setCap(eCAP_BLENDING, eFALSE); const eInt w = area.getWidth(); const eInt h = area.getHeight(); // Image at top left. eStateManager::bindTexture(0, m_specularRt); // renderQuad(eRect(0, h/2, w/2, h-1), area.getDimension()); // Image at top right. eStateManager::bindTexture(0, m_diffuseRt); renderQuad(eRect(w/2, h/2, w-1, h-1), area.getDimension()); // Image at bottom left. eStateManager::bindTexture(0, m_normalsRt); renderQuad(eRect(0, 0, w/2, h/2), area.getDimension()); // Image at bottom right. eStateManager::bindTexture(0, m_positionRt); renderQuad(eRect(w/2, 0, w-1, h/2), area.getDimension()); eStateManager::pop(); }
void PluginOffsetScreen::redrawWidget(gPainter *target, const eRect &where) { target->setForegroundColor( foreColor ); if ( where.intersects( eRect( ePoint( left, top ), eSize( 100, 100 ) ) ) ) redrawLeftTop( target ); if ( where.intersects( eRect( ePoint( right-3, bottom-100 ), eSize( 3, 100 ) ) ) ) redrawRightBottom( target ); }
void eVideoWidget::setFullScreenPosition(eRect pos) { posFullsizeLeft = pos.left(); posFullsizeTop = pos.top(); posFullsizeWidth = pos.width(); posFullsizeHeight = pos.height(); setPosition(0, posFullsizeLeft, posFullsizeTop, posFullsizeWidth, posFullsizeHeight); }
void eVideoWidget::setFullScreenPosition(eRect pos) { posFullsizeLeft = pos.left(); posFullsizeTop = pos.top(); posFullsizeWidth = pos.width(); posFullsizeHeight = pos.height(); cXineLib* xineLib = cXineLib::getInstance(); xineLib->setVideoWindow(posFullsizeLeft, posFullsizeTop, posFullsizeWidth, posFullsizeHeight); setPosition(0, posFullsizeLeft, posFullsizeTop, posFullsizeWidth, posFullsizeHeight); }
void eDeferredRenderer::_showGeometryBuffer(eTexture2d *target, const eRect &area) const { const eInt w = area.getWidth(); const eInt h = area.getHeight(); eGfx->freshRenderState().targets[0] = target; renderQuad(eRect( 0, h/3, w/2, h), area.getSize(), m_rtShadow); // top left renderQuad(eRect(w/2, h/3, w, h), area.getSize(), m_texDistMap); // top right renderQuad(eRect( 0, h/3, w/2, 2*h/3), area.getSize(), m_rtSpecular); // middle left renderQuad(eRect(w/2, h/3, w, 2*h/3), area.getSize(), m_rtDiffuse); // middle right renderQuad(eRect( 0, 0, w/2, h/3), area.getSize(), m_rtNormals); // bottom left renderQuad(eRect(w/2, 0, w, h/3), area.getSize(), m_rtPosition); // bottom right }
void eDeferredRenderer::_renderAmbientPass(eTexture2d *target, eTexture2d *depthTarget, const eScene &scene, const eRect &area) { // calculate the ambient color eColor ambient; for (eU32 i=0; i<scene.getLightCount(); i++) ambient += scene.getLight(i).getAmbient(); // render the ambient light static eConstBuffer<eVector4, eST_PS> cb; cb.data = ambient; eRenderState &rs = eGfx->freshRenderState(); rs.targets[0] = target; rs.depthTarget = depthTarget; rs.ps = m_psDefAmbient; rs.constBufs[eCBI_PASS_AMBIENT] = &cb; rs.textures[0] = m_rtDiffuse; rs.textures[3] = m_rtPosition; rs.textures[4] = m_rtEnvironment; rs.texFlags[0] = eTMF_CLAMP|eTMF_NEAREST; rs.texFlags[3] = eTMF_CLAMP|eTMF_NEAREST; rs.texFlags[4] = eTMF_CLAMP|eTMF_NEAREST; eGfx->clear(eCM_COLOR, eCOL_YELLOW); renderQuad(area, area.getSize(), nullptr); }
static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *local_style, ePyObject pforeColor, ePyObject pforeColorSelected, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip, const ePoint &offset, bool cursorValid, bool clear=true) { if (selected && sel_clip.valid()) { gRegion part = rc - sel_clip; if (!part.empty()) { painter.clip(part); style.setStyle(painter, eWindowStyle::styleListboxNormal); clearRegionHelper(painter, local_style, offset, pbackColor, cursorValid, clear); painter.clippop(); selected = 0; } part = rc & sel_clip; if (!part.empty()) { painter.clip(part); style.setStyle(painter, eWindowStyle::styleListboxSelected); clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected, cursorValid, clear); painter.clippop(); selected = 1; } } else if (selected) { style.setStyle(painter, eWindowStyle::styleListboxSelected); clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected, cursorValid, clear); if (local_style && local_style->m_selection) painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST); } else { style.setStyle(painter, eWindowStyle::styleListboxNormal); clearRegionHelper(painter, local_style, offset, pbackColor, cursorValid, clear); } if (selected) { if (pforeColorSelected) { unsigned int color = PyInt_AsUnsignedLongMask(pforeColorSelected); painter.setForegroundColor(gRGB(color)); } /* if we have a local foreground color set, use that. */ else if (local_style && local_style->m_foreground_color_selected_set) painter.setForegroundColor(local_style->m_foreground_color_selected); } else { if (pforeColor) { unsigned int color = PyInt_AsUnsignedLongMask(pforeColor); painter.setForegroundColor(gRGB(color)); } /* if we have a local foreground color set, use that. */ else if (local_style && local_style->m_foreground_color_set) painter.setForegroundColor(local_style->m_foreground_color); } }
gPainter::gPainter(gDC &dc, eRect rect): dc(dc), rc(gRC::getInstance()), foregroundColor(0), backgroundColor(0), cornerRound(0) { if (rect.isNull()) rect=eRect(ePoint(0, 0), dc.getSize()); // ASSERT(!gPainter_instances); gPainter_instances++; begin(rect); }
void gDC::setSpinner(eRect pos, ePtr<gPixmap> *pic, int len) { ASSERT(m_pixmap); ASSERT(m_pixmap->surface); m_spinner_saved = new gPixmap(pos.size(), m_pixmap->surface->bpp); m_spinner_temp = new gPixmap(pos.size(), m_pixmap->surface->bpp); m_spinner_pos = pos; m_spinner_i = 0; m_spinner_num = len; int i; if (m_spinner_pic) delete[] m_spinner_pic; m_spinner_pic = new ePtr<gPixmap>[len]; for (i = 0; i < len; ++i) m_spinner_pic[i] = pic[i]; }
void eListboxPythonMultiContent::setSelectionClip(eRect &rect, bool update) { m_selection_clip = rect; if (m_listbox) rect.moveBy(ePoint(0, m_listbox->getEntryTop())); if (m_clip.valid()) m_clip |= rect; else m_clip = rect; if (update && m_listbox) m_listbox->entryChanged(m_cursor); }
void gPainter::clip(eRect clip) { if ( dc.islocked() ) return; gOpcode o; o.dc=&dc; o.opcode=gOpcode::clip; clip.moveBy(logicalZero.x(), logicalZero.y()); cliparea.push(cliparea.top()&clip); o.parm.clip=new gOpcode::para::pclip(cliparea.top()); rc.submit(o); }
void eDeferredRenderer::_renderLightPass(eTexture2d *target, eTexture2d *depthTarget, const eScene &scene, const eCamera &cam, const eRect &area) { for (eU32 i=0; i<scene.getLightCount(); i++) { const eLight &light = scene.getLight(i); if (light.activateScissor(area.getSize(), cam)) { // create shadow map for light #ifndef eCFG_NO_ENGINE_DEFERRED_SHADOWS _renderLightDistance(scene, light); _renderShadowMap(cam, light, depthTarget); #endif // perform deferred lighting+shadowing eRenderState &rs = eGfx->freshRenderState(); rs.targets[0] = target; rs.depthTarget = depthTarget; rs.textures[0] = m_rtDiffuse; rs.textures[1] = m_rtNormals; rs.textures[2] = m_rtSpecular; rs.textures[3] = m_rtPosition; rs.textures[4] = m_rtShadow; rs.texFlags[0] = eTMF_CLAMP|eTMF_NEAREST; rs.texFlags[1] = eTMF_CLAMP|eTMF_NEAREST; rs.texFlags[2] = eTMF_CLAMP|eTMF_NEAREST; rs.texFlags[3] = eTMF_CLAMP|eTMF_NEAREST; rs.texFlags[4] = eTMF_BILINEAR; rs.blending = eTRUE; rs.blendSrc = eBM_ONE; rs.blendDst = eBM_ONE; rs.ps = m_psDefLight; rs.vs = m_vsQuad; light.activate(cam.getViewMatrix()); renderQuad(area, area.getSize()); } } }
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 DrawText(const eRect& r, const char* s) { // strupr(const_cast<char*>(s)); ePoint p = r.Beg(); for(int i = 0; s[i]; ++i) { if(p.x + font.w > r.right) break; char c = s[i]; if(c >= 96) c -= 32; font.Draw(c, p); p.x += font.w; } }
void DrawText(const eRect& r, const char* s) { // strupr(const_cast<char*>(s)); ePoint p = r.Beg(); for(int i = 0; s[i]; ++i) { if(p.x + font.w > r.right) break; char c = toupper(s[i]); if(byte(c) >= 128) // non-ASCII c = '?'; font.Draw(c, p); p.x += font.w; } }
int gAccel::fill(gSurface *dst, const eRect &area, unsigned long col) { #ifdef ATI_ACCEL ati_accel_fill( dst->data_phys, dst->x, dst->y, dst->stride, area.left(), area.top(), area.width(), area.height(), col); return 0; #endif #if 0 // def BCM_ACCEL bcm_accel_fill( dst->data_phys, dst->x, dst->y, dst->stride, area.left(), area.top(), area.width(), area.height(), col); return 0; #endif return -1; }
void eDeferredRenderer::_renderAlphaLightPass(eTexture2d *target, eTexture2d *depthTarget, const eScene &scene, const eCamera &cam, const eRect &area) { eRenderState &rs = eGfx->freshRenderState(); rs.targets[0] = target; rs.depthTarget = depthTarget; rs.viewport.set(0, 0, m_rtNormals->width, m_rtNormals->height); for (eU32 i=0; i<scene.getLightCount(); i++) { const eLight &light = scene.getLight(i); if (light.activateScissor(area.getSize(), cam)) { light.activate(cam.getViewMatrix()); m_allJobs.render(cam, eRJW_ALPHA_ON|eRJW_LIGHTED_ON|eRJW_SHADOWS_BOTH); } } }
eRect eRect::operator|(const eRect &r) const { if ( valid() ) { if ( r.valid() ) { eRect tmp; tmp.setLeft( MIN( x1, r.x1 ) ); tmp.setRight( MAX( x2, r.x2 ) ); tmp.setTop( MIN( y1, r.y1 ) ); tmp.setBottom( MAX( y2, r.y2 ) ); return tmp; } else { return *this; } } else { return r; } }
void eDeferredRenderer::_renderAlphaLightPass(const eScene &scene, const eCamera &cam, const eRect &area) { eStateManager::push(); eStateManager::bindVertexShader(m_vsInstGeo); eStateManager::bindPixelShader(m_psForwLight); for (eU32 i=0; i<scene.getLightCount(); i++) { const eLight &light = scene.getLight(i); if (light.activateScissor(area.getDimension(), cam)) { light.activate(m_gfx, cam.getViewMatrix()); _renderRenderJobs(m_allJobs, cam, eRenderJob::ALPHA_ON | eRenderJob::LIGHTED_ON | eRenderJob::CASTSHADOW_BOTH | eRenderJob::REFRACTED_OFF); } } eStateManager::pop(); }
void eWindowStyleSimple::drawFrame(gPainter &painter, const eRect &frame, int what) { gColor c1, c2; switch (what) { case frameButton: c1 = m_border_color_tl; c2 = m_border_color_br; break; case frameListboxEntry: c1 = m_border_color_br; c2 = m_border_color_tl; break; } painter.setForegroundColor(c2); painter.line(frame.topLeft1(), frame.topRight1()); painter.line(frame.topRight1(), frame.bottomRight1()); painter.setForegroundColor(c1); painter.line(frame.bottomRight1(), frame.bottomLeft1()); painter.line(frame.bottomLeft1(), frame.topLeft1()); }
void eDeferredRenderer::_renderAmbientPass(const eScene &scene, const eRect &area) { // Calculate the ambient color. eColor ambient; for (eU32 i=0; i<scene.getLightCount(); i++) { ambient += scene.getLight(i).getAmbient(); } m_gfx->setPsConst(ePSCONST_LIGHT_TOTALAMBIENT, ambient); // Render the ambient light. eStateManager::push(); eStateManager::bindTexture(0, m_diffuseRt); eStateManager::bindVertexShader(m_vsQuad); eStateManager::bindPixelShader(m_psDefAmbient); renderQuad(area, area.getDimension()); eStateManager::pop(); }
void eDeferredRenderer::_renderEnvPass(const eRect &area) { eStateManager::push(); eStateManager::bindTexture(1, m_normalsRt); eStateManager::bindTexture(2, m_specularRt); eStateManager::bindTexture(3, m_positionRt); eStateManager::setTextureFilter(0, eTEXFILTER_BILINEAR); eStateManager::setTextureFilter(1, eTEXFILTER_NEAREST); eStateManager::setTextureFilter(3, eTEXFILTER_NEAREST); eStateManager::setCap(eCAP_BLENDING, eTRUE); eStateManager::bindVertexShader(m_vsQuad); eStateManager::bindPixelShader(m_psDefEnv); for (eU32 i=0; i<m_materialArray.size(); i++) { const eMaterial* mat = m_materialArray[i]; eStateManager::bindTexture(0, mat->getTexture(eMaterial::UNIT_ENVIRONMENT)); m_gfx->setPsConst(ePSCONST_MAT_INDEX, (eF32)mat->m_render_material_id/256.0f); renderQuad(area, area.getDimension()); } eStateManager::pop(); }
int gAccel::blit(gSurface *dst, const gSurface *src, const eRect &p, const eRect &area, int flags) { #ifdef ATI_ACCEL ati_accel_blit( src->data_phys, src->x, src->y, src->stride, dst->data_phys, dst->x, dst->y, dst->stride, area.left(), area.top(), area.width(), area.height(), p.x(), p.y()); return 0; #endif #ifdef BCM_ACCEL if (!m_bcm_accel_state) { if (flags & (gPixmap::blitAlphaTest|gPixmap::blitAlphaBlend)) /* unsupported flags */ return -1; unsigned long pal_addr = 0; int src_format = 0; if (src->bpp == 32) src_format = 0; else if ((src->bpp == 8) && src->clut.data) { src_format = 1; /* sync pal */ int i; pal_addr = src->stride * src->y; unsigned long *pal = (unsigned long*)(((unsigned char*)src->data) + pal_addr); pal_addr += src->data_phys; for (i = 0; i < src->clut.colors; ++i) *pal++ = src->clut.data[i].argb() ^ 0xFF000000; } else return -1; /* unsupported source format */ bcm_accel_blit( src->data_phys, src->x, src->y, src->stride, src_format, dst->data_phys, dst->x, dst->y, dst->stride, area.left(), area.top(), area.width(), area.height(), p.x(), p.y(), p.width(), p.height(), pal_addr, flags); return 0; } #endif return -1; }
int gAccel::blit(gSurface *dst, const gSurface *src, const eRect &p, const eRect &area, int flags) { #ifdef STMFB_ACCEL //eDebug( "src: %4d %4d %4d %4d\tdst: %4d %4d %4d %4d\n" // "area: %4d %4d %4d %4d\tp: %4d %4d %4d %4d\n", // src->data_phys, src->x, src->y, src->stride, // dst->data_phys, dst->x, dst->y, dst->stride, // area.left(), area.top(), area.width(), area.height(), // p.x(), p.y(), p.width(), p.height()); int src_format = 0; void *data = 0; int data_phys = 0; if (src->bpp == 32) src_format = 0; else if ((src->bpp == 8) && (dst->bpp == 32)) { src_format = 1; if(accelAlloc(data, data_phys, area.height() * area.width() * 4)) return -1; __u8 *srcptr=(__u8*)src->data; __u8 *dstptr=(__u8*)data; __u32 pal[256]; for (int i=0; i<256; ++i) { if (src->clut.data && (i<src->clut.colors)) pal[i]=(src->clut.data[i].a<<24)|(src->clut.data[i].r<<16)|(src->clut.data[i].g<<8)|(src->clut.data[i].b); else pal[i]=0x010101*i; if((pal[i]&0xFF000000) >= 0xE0000000) pal[i] = 0xFF000000; pal[i]^=0xFF000000; } srcptr+=area.left()*src->bypp+area.top()*src->stride; for (int y=0; y<area.height(); y++) { int width=area.width(); unsigned char *psrc=(unsigned char*)srcptr; __u32 *pdst=(__u32*)dstptr; while (width--) *pdst++=pal[*psrc++]; srcptr+=src->stride; dstptr+=area.width() * 4; } } else { if(data_phys) accelFree(data_phys); return -1; } if(data_phys) { stmfb_accel_blit( data_phys, 0, 0, area.width() * 4, src_format, dst->data_phys, dst->x, dst->y, dst->stride, 0, 0, area.width(), area.height(), p.x(), p.y(), p.width(), p.height()); accelFree(data_phys); } else { stmfb_accel_blit( src->data_phys, src->x, src->y, src->stride, src_format, dst->data_phys, dst->x, dst->y, dst->stride, area.left(), area.top(), area.width(), area.height(), p.x(), p.y(), p.width(), p.height()); } return 0; #endif #ifdef ATI_ACCEL ati_accel_blit( src->data_phys, src->x, src->y, src->stride, dst->data_phys, dst->x, dst->y, dst->stride, area.left(), area.top(), area.width(), area.height(), p.x(), p.y()); return 0; #endif #ifdef BCM_ACCEL if (!m_bcm_accel_state) { if (flags & (gPixmap::blitAlphaTest|gPixmap::blitAlphaBlend)) /* unsupported flags */ return -1; unsigned long pal_addr = 0; int src_format = 0; if (src->bpp == 32) src_format = 0; else if ((src->bpp == 8) && src->clut.data) { src_format = 1; /* sync pal */ int i; pal_addr = src->stride * src->y; unsigned long *pal = (unsigned long*)(((unsigned char*)src->data) + pal_addr); pal_addr += src->data_phys; for (i = 0; i < src->clut.colors; ++i) *pal++ = src->clut.data[i].argb() ^ 0xFF000000; } else return -1; /* unsupported source format */ bcm_accel_blit( src->data_phys, src->x, src->y, src->stride, src_format, dst->data_phys, dst->x, dst->y, dst->stride, area.left(), area.top(), area.width(), area.height(), p.x(), p.y(), p.width(), p.height(), pal_addr, flags); return 0; } #endif return -1; }
// requires 24bit picture! void gPixmap::FBblitAccel(const gPixmap &src, eRect &fbDst) { fbClass *fb = fbClass::getInstance(); unsigned char *tempSpace = fb->lfb + 1920 * 1080 * 4 + 1280 * 720 * 4; int lines = 602112 / (src.surface->x * 3); int linesMem = lines * src.surface->x * 3; int startLine = 0; STMFBIO_BLT_DATA bltData; memset(&bltData, 0, sizeof(STMFBIO_BLT_DATA)); bltData.operation = BLT_OP_COPY; bltData.ulFlags = BLT_OP_FLAGS_GLOBAL_ALPHA; bltData.srcOffset = 1920 * 1080 * 4 + 1280 * 720 * 4; bltData.srcPitch = src.surface->x * 3; bltData.dstOffset = 1920 * 1080 * 4; bltData.dstPitch = fbDst.width() * 4; bltData.src_top = 0; bltData.src_left = 0; bltData.src_right = src.surface->x; bltData.src_bottom = src.surface->y; bltData.dst_left = fbDst.left(); bltData.dst_right = fbDst.left() + fbDst.width(); bltData.srcFormat = SURF_BGR888; bltData.dstFormat = SURF_ARGB8888; bltData.globalAlpha = 255; bool scaleWidth; if((float)src.surface->y / src.surface->y > (float)fbDst.height() / fbDst.width()) scaleWidth = true; else scaleWidth = false; unsigned char *dataPt = (unsigned char *)src.surface->data; while(startLine < src.surface->y) { if(src.surface->y - startLine < lines) { lines = src.surface->y - startLine; bltData.src_bottom = lines; linesMem = lines * src.surface->x * 3; } memcpy(dataPt, tempSpace, linesMem); dataPt += linesMem; if(scaleWidth) { bltData.dst_top = (fbDst.width() * startLine) / src.surface->y + fbDst.top(); bltData.dst_bottom = (fbDst.width() * (startLine + lines)) / src.surface->y + fbDst.top(); } else { bltData.dst_top = (src.surface->y * startLine) / fbDst.width() + fbDst.top(); bltData.dst_bottom = (src.surface->y * (startLine + lines)) / fbDst.width(); } fb->directBlit(bltData); // In case of concurrency problems sync blitter here startLine += lines; } }
void eListBoxBase::redrawWidget(gPainter *target, const eRect &where) { // redraw scrollbar only... if ( where.size() == scrollbar->getSize() && where.topLeft() == scrollbar->getPosition() ) return; eRect rc; if (deco_selected && have_focus) { deco_selected.drawDecoration(target, ePoint(width(), height())); rc = crect_selected; } else if (deco) { deco.drawDecoration(target, ePoint(width(), height())); rc = crect; } else rc = where; if ( currentPos == -1 ) { currentPos = 0; ePtrList<eListBoxEntry>::iterator it = childs.begin(); for (; it != childs.end() ;++it, ++currentPos ) if ( it == current ) break; } if ( entries > (unsigned int)(MaxEntries*columns) && MaxEntries*columns > 1 ) { int pages = entries / (MaxEntries*columns); if ( (unsigned int)(pages*MaxEntries*columns) < entries ) pages++; int start=(currentPos/(MaxEntries*columns)*MaxEntries*columns*100)/(pages*MaxEntries*columns); int vis=MaxEntries*columns*100/(pages*MaxEntries*columns); if (vis < 3) vis=3; scrollbar->setParams(start,vis); scrollbar->show(); } else scrollbar->hide(); int i=0; for (ePtrList<eListBoxEntry>::iterator entry(top); ((flags & flagShowPartial) || (entry != bottom)) && (entry != childs.end()); ++entry) { eRect rect = getEntryRect(i); if ( rc.intersects(rect) ) { target->clip(rect & rc); if ( entry == current ) { #ifndef DISABLE_LCD if ( LCDTmp ) // LCDTmp is only valid, when we have the focus LCDTmp->setText( entry->redraw(target, rect, colorActiveB, colorActiveF, getBackgroundColor(), getForegroundColor(), 1 ) ); else if ( parent->LCDElement && have_focus ) parent->LCDElement->setText( entry->redraw(target, rect, colorActiveB, colorActiveF, getBackgroundColor(), getForegroundColor(), 1 ) ); else #endif entry->redraw(target, rect, colorActiveB, colorActiveF, getBackgroundColor(), getForegroundColor(), ( have_focus ? 1 : ( MaxEntries > 1 ? 2 : 0 ) ) ); } else entry->redraw(target, rect, colorActiveB, colorActiveF, getBackgroundColor(), getForegroundColor(), 0 /*( have_focus ? 0 : ( MaxEntries > 1 ? 2 : 0 ) )*/ ); target->clippop(); } // special case for "showPartial": as bottom is set to the // last, half visible entry we want to redraw this, too. if (flags & flagShowPartial) if (entry == bottom) break; ++i; } }
void eListBoxEntry::drawEntryBorder(gPainter *rc, const eRect& rect, gColor coActiveB, gColor coActiveF, gColor coNormalB, gColor coNormalF ) { rc->setForegroundColor(coActiveB); rc->line( ePoint(rect.left(), rect.bottom()-1), ePoint(rect.right()-1, rect.bottom()-1) ); rc->line( ePoint(rect.left(), rect.top()), ePoint(rect.right()-1, rect.top()) ); rc->line( ePoint(rect.left(), rect.top()), ePoint(rect.left(), rect.bottom()-1) ); rc->line( ePoint(rect.right()-1, rect.top()), ePoint(rect.right()-1, rect.bottom()-1) ); rc->line( ePoint(rect.left()+1, rect.bottom()-2), ePoint(rect.right()-2, rect.bottom()-2) ); rc->line( ePoint(rect.left()+1, rect.top()+1), ePoint(rect.right()-2, rect.top()+1) ); rc->line( ePoint(rect.left()+1, rect.top()+2), ePoint(rect.left()+1, rect.bottom()-3) ); rc->line( ePoint(rect.right()-2, rect.top()+2), ePoint(rect.right()-2, rect.bottom()-3) ); rc->line( ePoint(rect.left()+2, rect.bottom()-3), ePoint(rect.right()-3, rect.bottom()-3) ); rc->line( ePoint(rect.left()+2, rect.top()+2), ePoint(rect.right()-3, rect.top()+2) ); rc->line( ePoint(rect.left()+2, rect.top()+3), ePoint(rect.left()+2, rect.bottom()-4) ); rc->line( ePoint(rect.right()-3, rect.top()+3), ePoint(rect.right()-3, rect.bottom()-4) ); }