AntTweakBar.Tw.AddButton C# (CSharp) Method

AddButton() public static method

This function adds a button entry to a tweak bar. When the button is clicked by a user, the callback function provided to this function is called.
public static AddButton ( IntPtr bar, String name, ButtonCallback callback, IntPtr clientData, String def ) : void
bar System.IntPtr The tweak bar to which adding a new variable.
name String The name of the button. It will be displayed in the tweak bar if no label is specified for this button. It will also be used to refer to this button in other functions.
callback ButtonCallback The callback function that will be called by AntTweakBar when the button is clicked.
clientData System.IntPtr For your convenience, this is a supplementary pointer that will be passed to the callback function when it is called.
def String An optional definition string used to modify the behavior of this new entry.
return void
        public static void AddButton(IntPtr bar, String name, ButtonCallback callback, IntPtr clientData, String def)
        {
            if (bar == IntPtr.Zero) {
                throw new ArgumentOutOfRangeException("bar");
            } else if (name == null) {
                throw new ArgumentNullException("name");
            } else if (callback == null) {
                throw new ArgumentNullException("callback");
            }

            if (!NativeMethods.TwAddButton(bar, name, callback, clientData, def)) {
                throw new AntTweakBarException("TwAddButton failed.");
            }
        }