Ver código fonte

GuiListBoxCtrl

Added a few more improvement to support inactive state. Also touched up the documentation.
Peter Robinson 4 anos atrás
pai
commit
35763c5dde

+ 10 - 0
engine/source/gui/guiListBoxCtrl.cc

@@ -614,6 +614,11 @@ void GuiListBoxCtrl::drawBox(RectI &box, ColorI &boxColor)
 #pragma region InputEvents
 void GuiListBoxCtrl::onTouchDragged(const GuiEvent &event)
 {
+	if (!mActive)
+	{
+		return;
+	}
+
    Parent::onTouchDragged(event);
 
    Point2I localPoint = globalToLocalCoord(event.mousePoint);
@@ -632,6 +637,11 @@ void GuiListBoxCtrl::onTouchDragged(const GuiEvent &event)
 
 void GuiListBoxCtrl::onTouchDown( const GuiEvent &event )
 {
+	if (!mActive)
+	{
+		return;
+	}
+
    Point2I localPoint = globalToLocalCoord(event.mousePoint);
    S32 itemHit = ( localPoint.y < 0 ) ? -1 : (S32)mFloor( (F32)localPoint.y / (F32)mItemSize.y );
 

+ 6 - 6
engine/source/gui/guiListBoxCtrl_ScriptBinding.h

@@ -57,10 +57,10 @@ ConsoleMethodWithDocs(GuiListBoxCtrl, clearSelection, ConsoleVoid, 2, 2, "()")
 
 /*! Sets an item to selected or unselected using an index.
 	@param index The zero-based index of the item that should be selected.
-	@param setting If true, the item is selected. If false, it is unselected.
+	@param isSelected If true, the item is selected. If false, it is unselected. If omitted, will default to true.
 	@return No return value.
 */
-ConsoleMethodWithDocs(GuiListBoxCtrl, setSelected, ConsoleVoid, 3, 4, "(S32 index, bool setting)")
+ConsoleMethodWithDocs(GuiListBoxCtrl, setSelected, ConsoleVoid, 3, 4, "(S32 index, [bool isSelected])")
 {
 	bool value = true;
 	if (argc == 4)
@@ -97,7 +97,7 @@ ConsoleMethodWithDocs(GuiListBoxCtrl, getSelectedItem, ConsoleInt, 2, 2, "()")
 }
 
 /*! Returns a list of selected item indexes.
-	@return A spaced-delimited list of selected item indexes or -1 if no items are selected.
+	@return A space-delimited list of selected item indexes or -1 if no items are selected.
 */
 ConsoleMethodWithDocs(GuiListBoxCtrl, getSelectedItems, ConsoleString, 2, 2, "()")
 {
@@ -126,10 +126,10 @@ ConsoleMethodWithDocs(GuiListBoxCtrl, getSelectedItems, ConsoleString, 2, 2, "()
 	return retBuffer;
 }
 
-/*! Finds an item with the given text.
+/*! Finds all items with the given text.
 	@param itemText The text to search for.
-	@param caseSensitive If true, a cases sensitive search will be performed.
-	@return A spaced-delimited list of matching item indexes or -1 if no items are found.
+	@param caseSensitive If true, a case-sensitive search will be performed.
+	@return A space-delimited list of matching item indexes or -1 if no items are found.
 */
 ConsoleMethodWithDocs(GuiListBoxCtrl, findItemText, ConsoleInt, 3, 4, "(string itemText, bool caseSensitive)")
 {

+ 1 - 1
toybox/Sandbox/1/gui/guiProfiles.cs

@@ -220,7 +220,7 @@ if(!isObject(GuiListBoxProfile)) new GuiControlProfile (GuiListBoxProfile : GuiD
 	fontColor = $color3;
 	fontColorHL = AdjustColorValue($color3, 20);
 	fontColorSL = AdjustColorValue($color3, 20);
-	fontColorNA = SetColorAlpha($color1, 100);
+	fontColorNA = AdjustColorValue($color3, -30);
 
 	borderDefault = GuiListBoxBorderProfile;
 };