/*
* Copyright 2022 Peter Han
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using UnityEngine;
namespace PeterHan.PLib.UI {
///
/// Delegate types used in the UI event system.
///
public sealed class PUIDelegates {
///
/// The delegate type invoked when a dialog is closed.
///
/// The key of the chosen option, or PDialog.DIALOG_CLOSE_KEY if
/// the dialog was closed with ESC or the X button.
public delegate void OnDialogClosed(string option);
///
/// The delegate type invoked when a button is pressed.
///
/// The source button.
public delegate void OnButtonPressed(GameObject source);
///
/// The delegate type invoked when a checkbox is clicked.
///
/// The source button.
/// The checkbox state.
public delegate void OnChecked(GameObject source, int state);
///
/// The delegate type invoked when an option is selected from a combo box.
///
/// The source dropdown.
/// The option chosen.
/// The type of the objects in the drop down.
public delegate void OnDropdownChanged(GameObject source, T choice) where T :
class, IListableOption;
///
/// The delegate type invoked when components are converted into Unity game objects.
///
/// The realized object.
public delegate void OnRealize(GameObject realized);
///
/// The delegate type invoked once after a slider is changed and released.
///
/// The source slider.
/// The new slider value.
public delegate void OnSliderChanged(GameObject source, float newValue);
///
/// The delegate type invoked while a slider is being changed.
///
/// The source slider.
/// The new slider value.
public delegate void OnSliderDrag(GameObject source, float newValue);
///
/// The delegate type invoked when text in a text field is changed.
///
/// The source text field.
/// The new text.
public delegate void OnTextChanged(GameObject source, string text);
///
/// The delegate type invoked when a toggle button is swapped between states.
///
/// The source button.
/// true if the button is toggled on, or false otherwise.
public delegate void OnToggleButton(GameObject source, bool on);
}
}