瀏覽代碼

Merge pull request #5468 from jejung/itemlist-get-selected_items

itemlist-get_selected_items
George Marques 9 年之前
父節點
當前提交
5e0edcc480
共有 3 個文件被更改,包括 96 次插入42 次删除
  1. 81 40
      doc/base/classes.xml
  2. 14 2
      scene/gui/item_list.cpp
  3. 1 0
      scene/gui/item_list.h

+ 81 - 40
doc/base/classes.xml

@@ -2517,12 +2517,6 @@
 			Return whether the animation has the loop flag set.
 			</description>
 		</method>
-		<method name="has_loop_interpolation" qualifiers="const">
-			<return type="bool">
-			</return>
-			<description>
-			</description>
-		</method>
 		<method name="method_track_get_key_indices" qualifiers="const">
 			<return type="IntArray">
 			</return>
@@ -2579,12 +2573,6 @@
 			Set a flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
 			</description>
 		</method>
-		<method name="set_loop_interpolation">
-			<argument index="0" name="enabled" type="bool">
-			</argument>
-			<description>
-			</description>
-		</method>
 		<method name="set_step">
 			<argument index="0" name="size_sec" type="float">
 			</argument>
@@ -4685,6 +4673,12 @@
 			</description>
 		</method>
 	</methods>
+	<signals>
+		<signal name="atlas_changed">
+			<description>
+			</description>
+		</signal>
+	</signals>
 	<constants>
 	</constants>
 </class>
@@ -6994,6 +6988,12 @@
 			Set a custom transform for drawing. Anything drawn afterwards will be transformed by this.
 			</description>
 		</method>
+		<method name="draw_set_transform_matrix">
+			<argument index="0" name="xform" type="Matrix32">
+			</argument>
+			<description>
+			</description>
+		</method>
 		<method name="draw_string">
 			<argument index="0" name="font" type="Font">
 			</argument>
@@ -17507,6 +17507,13 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
 			<description>
 			</description>
 		</method>
+		<method name="get_selected_items">
+			<return type="IntArray">
+			</return>
+			<description>
+			Returns a list of selected indexes.
+			</description>
+		</method>
 		<method name="is_item_disabled" qualifiers="const">
 			<return type="bool">
 			</return>
@@ -18912,6 +18919,34 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
 			Clear the [LineEdit] text.
 			</description>
 		</method>
+		<method name="cursor_get_blink_enabled" qualifiers="const">
+			<return type="bool">
+			</return>
+			<description>
+			Gets whether the line edit caret is blinking.
+			</description>
+		</method>
+		<method name="cursor_get_blink_speed" qualifiers="const">
+			<return type="float">
+			</return>
+			<description>
+			Gets the line edit caret blink speed.
+			</description>
+		</method>
+		<method name="cursor_set_blink_enabled">
+			<argument index="0" name="enable" type="bool">
+			</argument>
+			<description>
+			Set the line edit caret to blink.
+			</description>
+		</method>
+		<method name="cursor_set_blink_speed">
+			<argument index="0" name="blink_speed" type="float">
+			</argument>
+			<description>
+			Set the line edit caret blink speed. Cannot be less then or equal to 0.
+			</description>
+		</method>
 		<method name="get_align" qualifiers="const">
 			<return type="int">
 			</return>
@@ -18991,34 +19026,6 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
 			Set the cursor position inside the [LineEdit], causing it to scroll if needed.
 			</description>
 		</method>
-		<method name="cursor_set_blink_enabled">
-			<argument index="0" name="enable" type="bool">
-			</argument>
-			<description>
-			Set the line edit caret to blink.
-			</description>
-		</method>
-		<method name="cursor_get_blink_enabled" qualifiers="const">
-			<return type="float">
-			</return>
-			<description>
-			Gets whether the line edit caret is blinking.
-			</description>
-		</method>
-		<method name="cursor_set_blink_speed">
-			<argument index="0" name="blink_speed" type="float">
-			</argument>
-			<description>
-			Set the line edit caret blink speed. Cannot be less then or equal to 0.
-			</description>
-		</method>
-		<method name="cursor_get_blink_speed" qualifiers="const">
-			<return type="float">
-			</return>
-			<description>
-			Gets the line edit caret blink speed.
-			</description>
-		</method>
 		<method name="set_editable">
 			<argument index="0" name="enabled" type="bool">
 			</argument>
@@ -24036,6 +24043,12 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
 			Return the mirroring of the ParallaxLayer.
 			</description>
 		</method>
+		<method name="get_motion_offset" qualifiers="const">
+			<return type="Vector2">
+			</return>
+			<description>
+			</description>
+		</method>
 		<method name="get_motion_scale" qualifiers="const">
 			<return type="Vector2">
 			</return>
@@ -24050,6 +24063,12 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
 			Set the mirroring of the ParallaxLayer. If an axis is set to 0 then that axis will have no mirroring.
 			</description>
 		</method>
+		<method name="set_motion_offset">
+			<argument index="0" name="offset" type="Vector2">
+			</argument>
+			<description>
+			</description>
+		</method>
 		<method name="set_motion_scale">
 			<argument index="0" name="scale" type="Vector2">
 			</argument>
@@ -24882,6 +24901,12 @@ Example: (content-length:12), (Content-Type:application/json; charset=UTF-8)
 			</description>
 		</method>
 	</methods>
+	<signals>
+		<signal name="texture_changed">
+			<description>
+			</description>
+		</signal>
+	</signals>
 	<constants>
 	</constants>
 </class>
@@ -36504,6 +36529,10 @@ A similar effect may be achieved moving this node's descendants.
 			<description>
 			</description>
 		</signal>
+		<signal name="texture_changed">
+			<description>
+			</description>
+		</signal>
 	</signals>
 	<constants>
 	</constants>
@@ -38495,6 +38524,12 @@ A similar effect may be achieved moving this node's descendants.
 			</description>
 		</method>
 	</methods>
+	<signals>
+		<signal name="texture_changed">
+			<description>
+			</description>
+		</signal>
+	</signals>
 	<constants>
 	</constants>
 </class>
@@ -39357,6 +39392,10 @@ A similar effect may be achieved moving this node's descendants.
 		</theme_item>
 		<theme_item name="completion" type="StyleBox">
 		</theme_item>
+		<theme_item name="completion_background_color" type="Color">
+		</theme_item>
+		<theme_item name="completion_existing_color" type="Color">
+		</theme_item>
 		<theme_item name="completion_lines" type="int">
 		</theme_item>
 		<theme_item name="completion_max_width" type="int">
@@ -39365,6 +39404,8 @@ A similar effect may be achieved moving this node's descendants.
 		</theme_item>
 		<theme_item name="completion_scroll_width" type="int">
 		</theme_item>
+		<theme_item name="completion_selected_color" type="Color">
+		</theme_item>
 		<theme_item name="current_line_color" type="Color">
 		</theme_item>
 		<theme_item name="focus" type="StyleBox">

+ 14 - 2
scene/gui/item_list.cpp

@@ -1245,6 +1245,19 @@ real_t ItemList::get_icon_scale() const {
 	return icon_scale;
 }
 
+Vector<int> ItemList::get_selected_items() {
+	Vector<int> selected;
+	for (int i = 0; i < items.size(); i++) {
+		if (items[i].selected) {
+			selected.push_back(i);
+			if (this->select_mode == SELECT_SINGLE) {
+				break;
+			}
+		}
+	}
+	return selected;
+}
+
 void ItemList::_bind_methods(){
 
 	ObjectTypeDB::bind_method(_MD("add_item","text","icon:Texture","selectable"),&ItemList::add_item,DEFVAL(Variant()),DEFVAL(true));
@@ -1277,6 +1290,7 @@ void ItemList::_bind_methods(){
 	ObjectTypeDB::bind_method(_MD("select","idx","single"),&ItemList::select,DEFVAL(true));
 	ObjectTypeDB::bind_method(_MD("unselect","idx"),&ItemList::unselect);
 	ObjectTypeDB::bind_method(_MD("is_selected","idx"),&ItemList::is_selected);
+	ObjectTypeDB::bind_method(_MD("get_selected_items"),&ItemList::get_selected_items);
 
 	ObjectTypeDB::bind_method(_MD("get_item_count"),&ItemList::get_item_count);
 	ObjectTypeDB::bind_method(_MD("remove_item","idx"),&ItemList::remove_item);
@@ -1330,8 +1344,6 @@ void ItemList::_bind_methods(){
 	ADD_SIGNAL( MethodInfo("item_activated",PropertyInfo(Variant::INT,"index")));
 }
 
-
-
 ItemList::ItemList() {
 
 	current=-1;

+ 1 - 0
scene/gui/item_list.h

@@ -144,6 +144,7 @@ public:
 	void select(int p_idx,bool p_single=true);
 	void unselect(int p_idx);
 	bool is_selected(int p_idx) const;
+	Vector<int> get_selected_items();
 
 	void set_current(int p_current);
 	int get_current() const;