浏览代码

LibGUI: Add GUI::Model::accepts_drag(index, data_type)

This allows a model to indicate whether it would accept a drag with a
given data type being dropped on a given index.
Andreas Kling 5 年之前
父节点
当前提交
6e7ca44dee
共有 2 个文件被更改,包括 6 次插入0 次删除
  1. 5 0
      Libraries/LibGUI/Model.cpp
  2. 1 0
      Libraries/LibGUI/Model.h

+ 5 - 0
Libraries/LibGUI/Model.cpp

@@ -77,4 +77,9 @@ ModelIndex Model::sibling(int row, int column, const ModelIndex& parent) const
     return index(row, column, parent);
     return index(row, column, parent);
 }
 }
 
 
+bool Model::accepts_drag(const ModelIndex&, const StringView&)
+{
+    return false;
+}
+
 }
 }

+ 1 - 0
Libraries/LibGUI/Model.h

@@ -88,6 +88,7 @@ public:
     virtual bool is_editable(const ModelIndex&) const { return false; }
     virtual bool is_editable(const ModelIndex&) const { return false; }
     virtual void set_data(const ModelIndex&, const Variant&) {}
     virtual void set_data(const ModelIndex&, const Variant&) {}
     virtual int tree_column() const { return 0; }
     virtual int tree_column() const { return 0; }
+    virtual bool accepts_drag(const ModelIndex&, const StringView& data_type);
 
 
     bool is_valid(const ModelIndex& index) const
     bool is_valid(const ModelIndex& index) const
     {
     {