import elm_general;

enum Elm.Gengrid.Reorder_Type
{
   normal, [[ normal reorder type ]]
   swap    [[ swap reorder type ]]
}

class Elm.Gengrid (Elm.Layout, Elm_Interface_Scrollable,
                   Evas.Clickable_Interface, Elm_Interface_Atspi_Widget_Action,
                   Elm_Interface_Atspi_Selection)
{
   eo_prefix: elm_obj_gengrid;
   methods {
      @property align {
         set {
            [[\@MOBILE_ONLY

              Set the items grid's alignment within a given gengrid widget.

              This sets the alignment of the whole grid of items of a gengrid
              within its given viewport. By default, those values are both
              0.5, meaning that the gengrid will have its items grid placed
              exactly in the middle of its viewport.

              Note: If given alignment values are out of the cited ranges,
              they'll be changed to the nearest boundary values on the valid
              ranges.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              Get the items grid's alignment values within a given gengrid
              widget.

              Note: Use $null pointers on the alignment values you're not
              interested in: they'll be ignored by the function.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            align_x: double; [[Alignment in the horizontal axis (0 <= align_x <= 1).]]
            align_y: double; [[Alignment in the vertical axis (0 <= align_y <= 1).]]
         }
      }
      @property filled {
         set {
            [[\@MOBILE_ONLY

              Set how the items grid's filled within a given gengrid widget

              This sets the fill state of the whole grid of items of a
              gengrid within its given viewport. By default, this value
              is false, meaning that if the first line of items grid's
              isn't filled, the items are centered with the alignment.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              Get how the items grid's filled within a given gengrid widget

              Note: Use $null pointers on the alignment values you're not
              interested in: they'll be ignored by the function.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            fill: bool;
         }
      }
      @property page_relative {
         [[Control  a given gengrid widget's scrolling page size, relative
           to its viewport size.
         ]]
         set @internal {
         }
         get @internal {
         }
         values {
            h_pagerel: double;
            v_pagerel: double;
         }
      }
      @property multi_select {
         set {
            [[\@MOBILE_ONLY

              Enable or disable multi-selection in a given gengrid widget.

              Multi-selection is the ability to have more than one item
              selected, on a given gengrid, simultaneously. When it is
              enabled, a sequence of clicks on different items will make
              them all selected, progressively. A click on an already
              selected item will unselect it. If interacting via the
              keyboard, multi-selection is enabled while holding the
              "Shift" key.

              Note: By default, multi-selection is disabled on gengrids.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              Get whether multi-selection is enabled or disabled for a given
              gengrid widget.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            multi: bool;
         }
      }
      @property group_item_size {
         set {
            [[\@MOBILE_ONLY

              Set the size for the group items of a given gengrid widget.

              A gengrid, after creation, has still no information on the size
              to give to each of its cells. So, you most probably will end up
              with squares one \@ref Fingers "finger" wide, the default
              size. Use this function to force a custom size for you group
              items, making them as big as you wish.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              Get the size set for the group items of a given gengrid widget.

              Note: Use $null pointers on the size values you're not
              interested in: they'll be ignored by the function.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            w: Evas.Coord; [[The group items' width.]]
            h: Evas.Coord; [[The group items' height.]]
         }
      }
      @property select_mode {
         set {
            [[\@MOBILE_ONLY

              Set the gengrid select mode.

              This changes item select mode in the gengrid widget.
              #ELM_OBJECT_SELECT_MODE_DEFAULT means that items will only
              call their selection func and callback when first becoming
              selected. Any further clicks will do nothing, unless you set
              always select mode. #ELM_OBJECT_SELECT_MODE_ALWAYS means that
              even if selected, every click will make the selected callbacks
              be called. #ELM_OBJECT_SELECT_MODE_NONE will turn off the
              ability to select items entirely and they will neither appear
              selected nor call selected callback functions.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              Get the gengrid select mode.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            mode: Elm.Object.Select_Mode(Elm.Object.Select_Mode.max); [[The select mode.]]
         }
      }
      @property reorder_mode {
         set {
            [[\@MOBILE_ONLY

              Set whether a given gengrid widget is or not able have items
              reordered.

              If a gengrid is set to allow reordering, a click held for more
              than 0.5 over a given item will highlight it specially,
              signaling the gengrid has entered the reordering state. From
              that time on, the user will be able to, while still holding the
              mouse button down, move the item freely in the gengrid's
              viewport, replacing to said item to the locations it goes to.
              The replacements will be animated and, whenever the user
              releases the mouse button, the item being replaced gets a new
              definitive place in the grid.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              Get whether a given gengrid widget is or not able have items
              reordered.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            reorder_mode: bool; [[Use $true to turn reordering on,
                                  $false to turn it off.]]
         }
      }
      @property highlight_mode {
         [[Control whether the gengrid items' should be highlighted when
           item selected.
         ]]
         set {
            [[\@MOBILE_ONLY

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            highlight: bool;
         }
      }
      @property reorder_type {
         set @internal {
            [[ Set the Gengrid reorder type
               @since 1.11
            ]]
         }
         values {
            type: Elm.Gengrid.Reorder_Type; [[ Reorder type value ]]
         }
      }
      @property item_size {
         set {
            [[\@MOBILE_ONLY

              Set the size for the items of a given gengrid widget.

              A gengrid, after creation, has still no information on the size
              to give to each of its cells. So, you most probably will end up
              with squares one \@ref Fingers "finger" wide, the default
              size. Use this function to force a custom size for you items,
              making them as big as you wish.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              Get the size set for the items of a given gengrid widget.

              Note: Use $null pointers on the size values you're not
              interested in: they'll be ignored by the function.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            w: Evas.Coord; [[The items' width.]]
            h: Evas.Coord; [[The items' height.]]
         }
      }
      @property multi_select_mode {
         set @internal {
            [[Set the gengrid multi select mode.

              #ELM_OBJECT_MULTI_SELECT_MODE_DEFAULT means that
              select/unselect items whenever each item is clicked.
              #ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL means that
              only one item will be selected although multi-selection
              is enabled, if clicked without pressing control key. This
              mode is only available with multi-selection.

              @since 1.8
            ]]
         }
         get @internal {
            [[Get the gengrid multi select mode.

              If getting mode fails, it returns
              #ELM_OBJECT_MULTI_SELECT_MODE_MAX.

              @since 1.8
            ]]
         }
         values {
            mode: Elm.Object.Multi_Select_Mode(Elm.Object.Multi_Select_Mode.max); [[The multi select mode.]]
         }
      }
      @property horizontal {
         set {
            [[\@MOBILE_ONLY

              Set the direction in which a given gengrid widget will
              expand while placing its items.

              When in "horizontal mode" ($true), items will be placed in
              columns, from top to bottom and, when the space for a column
              is filled, another one is started on the right, thus expanding
              the grid horizontally. When in "vertical mode" ($false),
              though, items will be placed in rows, from left to right
              and, when the space for a row is filled, another one is
              started below, thus expanding the grid vertically.

              Note: By default, gengrid is in vertical mode, $false.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         get {
            [[\@MOBILE_ONLY

              Get for what direction a given gengrid widget will expand while
              placing its items.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
         }
         values {
            horizontal: bool; [[$true to make the gengrid expand horizontally,
            $false to expand vertically.]]
         }
      }
      @property page_size {
         set @internal {
            [[Set a given gengrid widget's scrolling page size.]]
         }
         values {
            h_pagesize: Evas.Coord;
            v_pagesize: Evas.Coord;
         }
      }
      @property selected_item {
         get {
            [[\@MOBILE_ONLY

              Get the selected item in a given gengrid widget.

              This returns the selected item in $obj. If multi selection is
              enabled on $obj (See @.multi_select.set), only the first item
              in the list is selected, which might not be very useful. For
              that case, see @.selected_items.get.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
            return: Elm.Widget_Item *; [[The selected item's handle or $null
                                         if none is selected at the moment
                                         (and on errors).]]
         }
      }
      @property realized_items {
         get {
            [[\@MOBILE_ONLY

              Get a list of realized items in gengrid.

              This returns a list of the realized items in the gengrid. The
              list contains gengrid item pointers. The list must be freed by
              the caller when done with eina_list_free(). The item pointers
              in the list are only valid so long as those items are not
              deleted or the gengrid is not deleted.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
            return: free(own(list<Elm_Gen_Item *> *), eina_list_free) @warn_unused; [[
                The list of realized items or $null if none are realized.
            ]]
         }
      }
      @property first_item {
         get {
            [[\@MOBILE_ONLY

              Get the first item in a given gengrid widget.

              This returns the first item in the $obj's internal list of
              items.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
            return: Elm.Widget_Item *; [[
               The first item's handle or $null, if there are no
               items in $obj (and on errors)
            ]]
         }
      }
      @property selected_items {
         get {
            [[\@MOBILE_ONLY

              Get a list of selected items in a given gengrid.

              This returns a list of the selected items, in the order that
              they appear in the grid. This list is only valid as long as no
              more items are selected or unselected (or unselected implicitly
              by deletion). The list contains Gengrid item pointers as
              data, naturally.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
            return: const(list<Elm.Widget_Item *>)*; [[
               The list of selected items or $null, if none is
               selected at the moment (and on errors).
            ]]
         }
      }
      @property last_item {
         get {
            [[\@MOBILE_ONLY

              Get the last item in a given gengrid widget.

              This returns the last item in the $obj's internal list of
              items.

              \@if MOBILE \@since_tizen 2.3
              \@endif
            ]]
            return: Elm.Widget_Item *; [[The last item's handle or $null
                                         if there are no  items in $obj
                                         (and on errors).]]
         }
      }
      @property wheel_disabled {
         set @internal {
            [[Enable or disable mouse wheel to be used to scroll the gengrid.

              Mouse wheel can be used for the user to scroll up and down
              the gengrid.

              Wheel is enabled by default.
            ]]
         }
         get @internal {
            [[Get a value whether mouse wheel is enabled or not.

              Mouse wheel can be used for the user to scroll up and down
              the gengrid.
            ]]
         }
         values {
            disabled: bool; [[Use $true to disable mouse wheel or $false
                              to enable it.]]
         }
      }
      item_insert_before {
         [[\@MOBILE_ONLY

           Insert an item before another in a gengrid widget.

           This inserts an item before another in the gengrid.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
         return: Elm.Widget_Item *; [[A handle to the item added or $null on errors.]]
         params {
            @in itc: const(Elm_Gengrid_Item_Class)*; [[The item class for the item.]]
            @in data: const(void)*; [[The item data.]]
            @in relative: Elm.Widget_Item *; [[The item to place this new one before.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called
                                                 when the item is selected.]]
            @in func_data: const(void)* @optional; [[Data to be passed to $func.]]
         }
      }
      realized_items_update {
         [[\@MOBILE_ONLY

           Update the contents of all realized items.

           This updates all realized items by calling all the item class
           functions again to get the contents, texts and states. Use this
           when the original item data has changed and the changes are
           desired to be reflected.

           To update just one item, use \@ref elm_gengrid_item_update.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
      }
      item_insert_after {
         [[\@MOBILE_ONLY

           Insert an item after another in a gengrid widget.

           This inserts an item after another in the gengrid.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
         return: Elm.Widget_Item *; [[A handle to the item added or $null on error.]]
         params {
            @in itc: const(Elm_Gengrid_Item_Class)*; [[The item class for the item.]]
            @in data: const(void)*; [[The item data.]]
            @in relative: Elm.Widget_Item *; [[The item to place this new one after.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called
                                                 when the item is selected.]]
            @in func_data: const(void)* @optional; [[Data to be passed to $func.]]
         }
      }
      items_count @const {
         [[\@MOBILE_ONLY

           Return how many items are currently in a list

           This behavior is O(1) and includes items which may or may not
           be realized.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
         return: uint;
      }
      at_xy_item_get @const {
         [[\@MOBILE_ONLY

           Get the item that is at the x, y canvas coords.

           This returns the item at the given coordinates (which are canvas
           relative, not object-relative). If an item is at that coordinate,
           that item handle is returned, and if $xposret is not $null, the
           integer pointed to is set to a value of -1, 0 or 1, depending if
           the coordinate is on the left portion of that item (-1), on the
           middle section (0) or on the right part (1).

           If $yposret is not $null, the integer pointed to is set to a
           value of -1, 0 or 1, depending if the coordinate is on the upper
           portion of that item (-1), on the middle section (0) or on the
           lower part (1). If NULL is returned as an item (no item found
           there), then posret may indicate -1 or 1 based if the coordinate
           is above or below all items respectively in the gengrid.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
         return: Elm.Widget_Item *; [[The item at the coordinates or $null if none.]]
         params {
            @in x: Evas.Coord; [[The input x coordinate.]]
            @in y: Evas.Coord; [[The input y coordinate.]]
            @out xposret: int; [[The position relative to the item returned here.]]
            @out yposret: int; [[The position relative to the item returned here.]]
         }
      }
      item_append {
         [[\@MOBILE_ONLY

           Append a new item in a given gengrid widget.

           This adds an item to the beginning of the gengrid.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
         return: Elm.Widget_Item *; [[A handle to the item added or $null on errors.]]
         params {
            @in itc: const(Elm_Gengrid_Item_Class)*; [[The item class for the item.]]
            @in data: const(void)*; [[The item data.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called
                                                 when the item is selected.]]
            @in func_data: const(void)* @optional; [[Data to be passed to $func.]]
         }
      }
      item_prepend {
         [[\@MOBILE_ONLY

           Prepend a new item in a given gengrid widget.

           This adds an item to the end of the gengrid.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
         return: Elm.Widget_Item *; [[A handle to the item added or $null on errors.]]
         params {
            @in itc: const(Elm_Gengrid_Item_Class)*; [[The item class for the item.]]
            @in data: const(void)*; [[The item data.]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called
                                                 when the item is selected.]]
            @in func_data: const(void)* @optional; [[Data to be passed to $func.]]
         }
      }
      clear {
         [[\@MOBILE_ONLY

           Remove all items from a given gengrid widget.

           This removes (and deletes) all items in $obj, leaving it empty.

           See \@ref elm_gengrid_item_del to remove just one item.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
      }
      item_sorted_insert {
         [[\@MOBILE_ONLY

           Insert an item in a gengrid widget using a user-defined sort
           function.

           This inserts an item in the gengrid based on user defined
           comparison function. The two arguments passed to the function
           $func are gengrid item handles to compare.

           \@if MOBILE \@since_tizen 2.3
           \@endif
         ]]
         return: Elm.Widget_Item *; [[A handle to the item added or $null on errors.]]
         params {
            @in itc: const(Elm_Gengrid_Item_Class)*; [[The item class for the item.]]
            @in data: const(void)*; [[The item data.]]
            @in comp: Eina_Compare_Cb; [[User defined comparison function
                                         that defines the sort order based
                                         on gengrid item and its data.
                                       ]]
            @in func: Evas_Smart_Cb @optional; [[Convenience function called when the item is selected.]]
            @in func_data: const(void)* @optional; [[Data to be passed to $func.]]
         }
      }
      search_by_text_item_get @internal {
         [[Get gengrid item by given string.

           It takes pointer to the gengrid item that will be used to start
           search from it.

           This function uses globs (like "*.jpg") for searching and takes
           search flags as last parameter That is a bitfield with values
           to be ored together or 0 for no flags.

           @since 1.11
         ]]
         return: Elm.Widget_Item *; [[Pointer to the gengrid item which matches
                                      search_string in case of success,
                                      otherwise $null.]]
         params {
            @in item_to_search_from: Elm.Widget_Item * @optional; [[
               Pointer to item to start search from. If $null, search will
               be started from the first item of the gengrid.
            ]]
            @in part_name: const(char) *; [[Name of the TEXT part of gengrid item to search string in.]]
            @in pattern: const(char) *; [[The search pattern.]]
            @in flags: Elm_Glob_Match_Flags; [[Search flags.]]
         }
      }
      reorder_mode_start @internal {
         [[
            Starts the reorder mode of Gengrid
            @since 1.10
         ]]
         params {
            @in tween_mode: Ecore_Pos_Map; [[ Position mappings for animation ]]
         }
      }
      reorder_mode_stop @internal {
         [[
            Stops the reorder mode of Gengrid
            @since 1.10
         ]]
      }
   }
   implements {
      class.constructor;
      Eo.Base.constructor;
      Evas.Object_Smart.move;
      Evas.Object_Smart.add;
      Evas.Object_Smart.del;
      Evas.Object_Smart.member_add;
      Evas.Object_Smart.resize;
      Elm.Widget.theme_apply;
      Elm.Widget.focus_next_manager_is;
      Elm.Widget.focus_direction_manager_is;
      Elm.Widget.access;
      //TIZEN_ONLY(20160822): When atspi mode is dynamically switched on/off,
      //register/unregister access objects accordingly.
      // TIZEN_ONLY(20170516): connect to at-spi dbus based on org.a11y.Status.IsEnabled property
      Elm.Widget.screen_reader;
      //
      //
      Elm.Widget.focus_next;
      Elm.Widget.focus_direction;
      Elm.Widget.on_focus;
      Elm.Widget.on_focus_region;
      Elm.Widget.event;
      Elm.Widget.focus_highlight_geometry_get;
      Elm.Widget.focused_item.get;
      Elm.Widget.item_loop_enabled.set;
      Elm.Widget.item_loop_enabled.get;
      Elm.Layout.sizing_eval;
      Elm_Interface_Scrollable.bounce_allow.set;
      Elm_Interface_Scrollable.policy;
      Elm_Interface_Atspi_Accessible.children.get;
      Elm_Interface_Atspi_Accessible.state_set.get;
      Elm_Interface_Atspi_Widget_Action.elm_actions.get;
      Elm_Interface_Atspi_Selection.selected_children_count.get;
      Elm_Interface_Atspi_Selection.selected_child.get;
      Elm_Interface_Atspi_Selection.selected_child_deselect;
      Elm_Interface_Atspi_Selection.child_select;
      Elm_Interface_Atspi_Selection.child_deselect;
      Elm_Interface_Atspi_Selection.is_child_selected;
      Elm_Interface_Atspi_Selection.all_children_select;
      Elm_Interface_Atspi_Selection.clear;
      // TIZEN only (20151009) : Accessibility: updated highlight change during gengrid scroll
      Elm_Interface_Scrollable.content_pos_set;
      //
      // TIZEN_ONLY(20150825) : Use the specific wanted_region_set func only for gengrid. */
      Elm_Interface_Scrollable.wanted_region_set;
      //
      /* TIZEN_ONLY(20150909) : Use the specific bar_chagnged_bar_pos_adjust func only for gengrid. */
      Elm_Interface_Scrollable.custom_pan_pos_adjust;
   }
   events {
      language,changed;
      access,changed;
      realized;
      unrealized;
      index,update;
      scroll,page,changed;
      edge,bottom;
      edge,top;
      edge,right;
      edge,left;
      item,focused;
      item,unfocused;
      item,reorder,anim,start;
      item,reorder,anim,stop;
      activated;
      highlighted;
      unhighlighted;
      released;
   }

}
