예제 #1
0
void BrushListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
{
	ASSERT(n < tileset->size());
	Sprite* spr = gui.gfx.getSprite(tileset->brushlist[n]->getLookID());
	if(spr) {
		spr->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight());
	}
	if(int(n) == GetSelection()) {
		dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF));
	} else {
		dc.SetTextForeground(wxColor(0x00, 0x00, 0x00));
	}
	dc.DrawText(wxstr(tileset->brushlist[n]->getName()), rect.GetX() + 40, rect.GetY() + 6);
}
예제 #2
0
void BrowseTileListBox::OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const
{
    ItemsMap::const_iterator item_iterator = items.find(int(n));
    Item* item = item_iterator->second;

    Sprite* sprite = gui.gfx.getSprite(item->getClientID());
    if (sprite)
        sprite->DrawTo(&dc, SPRITE_SIZE_32x32, rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight());

    if (IsSelected(n))
    {
        item->select();
        dc.SetTextForeground(wxColor(0xFF, 0xFF, 0xFF));
    }
    else {
        item->deselect();
        dc.SetTextForeground(wxColor(0x00, 0x00, 0x00));
    }

    wxString label;
    label << item->getID() << wxT(" - ") << item->getName();
    dc.DrawText(label, rect.GetX() + 40, rect.GetY() + 6);
}