Beispiel #1
0
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];
}
Beispiel #2
0
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;
	}
}