/** \file
 * \brief List Control (not exported API)
 *
 * See Copyright Notice in "iup.h"
 */

#ifndef __IUP_LIST_H
#define __IUP_LIST_H

#ifdef __cplusplus
extern "C" {
#endif

/** \defgroup drvlist Driver List Interface
 * \ingroup drv
 * @{ */
IUP_SDK_API void iupdrvListInitClass(Iclass* ic);
IUP_SDK_API void iupdrvListAddBorders(Ihandle* ih, int *w, int *h);
IUP_SDK_API void iupdrvListAddItemSpace(Ihandle* ih, int *h);
IUP_SDK_API int iupdrvListGetCount(Ihandle* ih);
IUP_SDK_API void iupdrvListAppendItem(Ihandle* ih, const char* value);
IUP_SDK_API void iupdrvListInsertItem(Ihandle* ih, int pos, const char* value);
IUP_SDK_API void iupdrvListRemoveItem(Ihandle* ih, int pos);
IUP_SDK_API void iupdrvListRemoveAllItems(Ihandle* ih);
IUP_SDK_API void* iupdrvListGetImageHandle(Ihandle* ih, int id);
IUP_SDK_API int iupdrvListSetImageHandle(Ihandle* ih, int id, void* hImage);
IUP_SDK_API void iupdrvListSetItemCount(Ihandle* ih, int count);
/** @} */

/* Used by List and Text, implemented in Text */
int iupEditCallActionCb(Ihandle* ih, IFnis cb, const char* insert_value, int start, int end, void *mask, int nc, int remove_dir, int utf8);

int iupListGetPosAttrib(Ihandle* ih, int id);
int iupListSetIdValueAttrib(Ihandle* ih, int id, const char* value);
char* iupListGetNCAttrib(Ihandle* ih);
char* iupListGetPaddingAttrib(Ihandle* ih);
char* iupListGetSpacingAttrib(Ihandle* ih);

void iupListSingleCallActionCb(Ihandle* ih, IFnsii cb, int pos);
void iupListMultipleCallActionCb(Ihandle* ih, IFnsii cb, IFns multi_cb, int* pos, int sel_count);
void iupListSingleCallDblClickCb(Ihandle* ih, IFnis cb, int pos);
int iupListCallDragDropCb(Ihandle* ih, int drag_id, int drop_id, int *is_ctrl);

void iupListSetInitialItems(Ihandle* ih);
void iupListUpdateOldValue(Ihandle* ih, int pos, int removed);

struct _IcontrolData
{
  int sb,  /* scrollbar configuration, can be changed only before map */
      nc,
      spacing,
      horiz_padding,
      vert_padding,
      last_caret_pos,
      is_multiple,
      is_dropdown,
      has_editbox,
      maximg_w, maximg_h, /* used only in Windows */
      show_image,
      fit_image,   /* scale images to fit row height, default 1 (YES) */
      show_dragdrop,
      is_virtual,  /* virtual mode flag, can be changed only before map */
      item_count;  /* number of items in virtual mode */
  Imask* mask;
};

int iupListIsVirtual(Ihandle* ih);
int iupListGetItemCount(Ihandle* ih);
char* iupListGetItemValueCb(Ihandle* ih, int pos);
char* iupListGetItemImageCb(Ihandle* ih, int pos);


#ifdef __cplusplus
}
#endif

#endif
