Beispiel #1
0
void QueueListBox::AcceptDrops(const std::vector<GG::Wnd*>& wnds, const GG::Pt& pt)
{
    assert(wnds.size() == 1);
    assert(AllowedDropTypes().find((*wnds.begin())->DragDropDataType()) != AllowedDropTypes().end());
    GG::ListBox::Row* row = boost::polymorphic_downcast<GG::ListBox::Row*>(*wnds.begin());
    assert(std::find(begin(), end(), row) != end());
    iterator it = RowUnderPt(pt);
    QueueItemMoved(row, std::distance(begin(), it));
}
Beispiel #2
0
void QueueListBox::DragDropHere(const GG::Pt& pt, const std::map<GG::Wnd*, GG::Pt>& drag_drop_wnds,
                                GG::Flags<GG::ModKey> mod_keys)
{
    CUIListBox::DragDropHere(pt, drag_drop_wnds, mod_keys);
    if (drag_drop_wnds.size() == 1 &&
        AllowedDropTypes().find(drag_drop_wnds.begin()->first->DragDropDataType()) !=
        AllowedDropTypes().end()) {
        m_drop_point = RowUnderPt(pt);
        m_show_drop_point = true;
    } else {
        m_drop_point = end();
        m_show_drop_point = false;
    }
}
Beispiel #3
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));
}
Beispiel #4
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));
}