Ejemplo n.º 1
0
void QueueListBox::AcceptDrops(const std::vector<GG::Wnd*>& wnds, const GG::Pt& pt) {
    if (wnds.size() != 1)
        return;
    GG::Wnd* wnd = *wnds.begin();
    const std::string& drop_type = wnd->DragDropDataType();
    if (AllowedDropTypes().find(drop_type) == AllowedDropTypes().end())
        return;
    GG::ListBox::Row* row = boost::polymorphic_downcast<GG::ListBox::Row*>(wnd);
    if (!row)
        return;
    if (std::find(begin(), end(), row) == end())
        return;
    iterator it = RowUnderPt(pt);
    QueueItemMovedSignal(row, std::distance(begin(), it));
}
Ejemplo n.º 2
0
void QueueListBox::AcceptDrops(const GG::Pt& pt, const std::vector<GG::Wnd*>& wnds, GG::Flags<GG::ModKey> mod_keys) {
    if (wnds.empty())
        return;
    if (wnds.size() > 1) {
        // delete any extra wnds that won't be processed below
        for (std::vector<GG::Wnd*>::const_iterator it = ++wnds.begin(); it != wnds.end(); ++it)
            delete *it;
        ErrorLogger() << "QueueListBox::AcceptDrops given multiple wnds unexpectedly...";
    }
    GG::Wnd* wnd = *wnds.begin();
    const std::string& drop_type = wnd->DragDropDataType();
    GG::ListBox::Row* row = boost::polymorphic_downcast<GG::ListBox::Row*>(wnd);
    if (AllowedDropTypes().find(drop_type) == AllowedDropTypes().end() ||
        !row ||
        std::find(begin(), end(), row) == end())
    {
        delete wnd;
        return;
    }
    iterator it = RowUnderPt(pt);
    QueueItemMovedSignal(row, std::distance(begin(), it));
}