DropDown example added 4.x-dev

Wed, 18 Nov 2020 00:48:16 +0200

author
Yakup Beyoglu
date
Wed, 18 Nov 2020 00:48:16 +0200
branch
4.x-dev
changeset 1489
74f95fea7d11
parent 1488
82a11d6bd77c
child 1490
b2f4ecae7d7b

DropDown example added

Source/Gorgon/Widgets/Dropdown.h file | annotate | diff | comparison | revisions
Testing/Source/Manual/UI_Generate.cpp file | annotate | diff | comparison | revisions
--- a/Source/Gorgon/Widgets/Dropdown.h	Sun Nov 15 18:08:43 2020 +0200
+++ b/Source/Gorgon/Widgets/Dropdown.h	Wed Nov 18 00:48:16 2020 +0200
@@ -11,6 +11,32 @@
     /**
      * This is the dropdown base for all dropdown lists, including ones that are
      * not for item selection (e.g., DropdownChecklist).
+     *
+     * **Example**
+     * @code
+     * // Do not forget to define enum and Enum Strings before the create your DropDown with the enum
+     * enum CoffeType {
+            Americano, Latte, Cappuccino, Espresso
+     * };
+     * DefineEnumStrings(CoffeType, {
+     *      {Americano,"Americano"},
+     *      {Latte,"Latte"},
+     *      {Cappuccino,"Cappuccino"},
+     *      {Espresso,"Espresso"}
+     *      //...
+     * });
+     * //...
+     * // Define your DropDown with : 
+     * Widgets::DropdownList<CoffeType> Coffes(begin(Enumerate<CoffeType>()), end(Enumerate<CoffeType>()));
+     * // Select Default value with SetSelectedIndex 
+     * Coffes.List.SetSelectedIndex(1);
+     * // Use SelectionChanged.Register  to handle selection event
+     * Coffes.SelectionChanged.Register([&](long index){
+     *      std::cout << "Your Coffe is "<<CoffeType(index)<< std::endl;   
+     * });
+     * //...
+     *
+     *@encode
      */
     template <class T_, void (*TW_)(const T_ &, ListItem &), class L_>
     class DropdownBase : public virtual UI::ComponentStackWidget, protected ListItem
--- a/Testing/Source/Manual/UI_Generate.cpp	Sun Nov 15 18:08:43 2020 +0200
+++ b/Testing/Source/Manual/UI_Generate.cpp	Wed Nov 18 00:48:16 2020 +0200
@@ -32,6 +32,7 @@
     Sunday
 };
 
+
 DefineEnumStrings(DaysOfWeek, {
     {Monday, "Monday"},
     {Tuesday, "Tuesday"},

mercurial