(* OCaml-Win32
 * win32_imagelist.ml
 * Copyright (c) 2002-2004 by Harry Chomsky
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *)

open Win32_core

(********************************************************************)
(* User Interface: Windows User Experience: Windows Shell: SDK: Windows Controls: Individual Control Information: Image Lists *)

type image_list_draw_style =
    ILD_BLEND25
  | ILD_BLEND50
  | ILD_IMAGE
  | ILD_MASK
  | ILD_NORMAL
  | ILD_TRANSPARENT

external image_list_add : iml:himagelist -> image:hbitmap -> mask:hbitmap -> int = "image_list_add"

external image_list_add_icon : iml:himagelist -> icon:hicon -> int = "image_list_add_icon"

external image_list_add_masked : iml:himagelist -> image:hbitmap -> mask:color -> int = "image_list_add_masked"

external image_list_begin_drag : iml:himagelist -> index:int -> hotspot:point -> unit = "image_list_begin_drag"

type image_list_copy_mode =
    ILCF_MOVE
  | ILCF_SWAP
external image_list_copy :
    dest_iml:himagelist ->
    dest_index:int ->
    src_iml:himagelist ->
    src_index:int ->
    mode:image_list_copy_mode ->
    unit = "image_list_copy"

type image_list_color_type =
    ILC_COLOR
  | ILC_COLOR4
  | ILC_COLOR8
  | ILC_COLOR16
  | ILC_COLOR24
  | ILC_COLOR32
  | ILC_COLORDDB
external image_list_create :
    size:size ->
    color_type:image_list_color_type ->
    mask:bool ->
    initial:int ->
    grow:int ->
    himagelist = "image_list_create"

external image_list_destroy : iml:himagelist -> unit = "image_list_destroy"

external image_list_drag_enter : lock:hwnd -> pt:point -> unit = "image_list_drag_enter"

external image_list_drag_leave : lock:hwnd -> unit = "image_list_drag_leave"

external image_list_drag_move : pt:point -> unit = "image_list_drag_move"

external image_list_drag_show_nolock : show:bool -> unit = "image_list_drag_show_nolock"

external image_list_draw :
    iml:himagelist ->
    index:int ->
    dst:hdc ->
    pt:point ->
    style:image_list_draw_style ->
    overlay:int option ->
    unit = "image_list_draw_bytecode" "image_list_draw_native"

type imagelistdrawparams = {
    ildp_iml : himagelist;
    ildp_index : int;
    ildp_dst : hdc;
    ildp_pt : point;
    ildp_size : size option;
    ildp_bitmap : point;
    ildp_bk_color : color;
    ildp_fg_color : color;
    ildp_style : image_list_draw_style;
    ildp_overlay : int option;
    ildp_rop : rop3 option }
let default_imagelistdrawparams = {
    ildp_iml = null_handle;
    ildp_index = 0;
    ildp_dst = null_handle;
    ildp_pt = { x = 0; y = 0 };
    ildp_size = None;
    ildp_bitmap = { x = 0; y = 0 };
    ildp_bk_color = Clr_default;
    ildp_fg_color = Clr_default;
    ildp_style = ILD_NORMAL;
    ildp_overlay = None;
    ildp_rop = None }
external image_list_draw_indirect : params:imagelistdrawparams -> unit = "image_list_draw_indirect"

external image_list_duplicate : iml:himagelist -> himagelist = "image_list_duplicate"

external image_list_end_drag : unit -> unit = "image_list_end_drag"

external image_list_extract_icon : iml:himagelist -> index:int -> hicon = "image_list_extract_icon"

external image_list_get_bk_color : iml:himagelist -> color = "image_list_get_bk_color"

external image_list_get_drag_image : unit -> (himagelist * point * point) = "image_list_get_drag_image"

external image_list_get_icon :
    iml:himagelist ->
    index:int ->
    style:image_list_draw_style ->
    overlay:int option ->
    hicon = "image_list_get_icon"

external image_list_get_icon_size : iml:himagelist -> size = "image_list_get_icon_size"

external image_list_get_image_count : iml:himagelist -> int = "image_list_get_image_count"

type imageinfo = {
    ii_image : hbitmap;
    ii_mask : hbitmap;
    ii_rect : rect }
external image_list_get_image_info : iml:himagelist -> index:int -> imageinfo = "image_list_get_image_info"

external image_list_load_bitmap :
    inst:hinstance ->
    name:resource_name ->
    width:int ->
    grow:int ->
    mask:color ->
    himagelist = "image_list_load_bitmap"

external image_list_load_image :
    src:resource_or_file ->
    width:int ->
    grow:int ->
    mask:color ->
    typ:image_type ->
    options:load_image_option list ->
    himagelist = "image_list_load_image_bytecode" "image_list_load_image_native"

external image_list_merge :
    iml1:himagelist ->
    index1:int ->
    iml2:himagelist ->
    index2:int ->
    offset:point ->
    himagelist = "image_list_merge"

external image_list_remove : iml:himagelist -> index:int -> unit = "image_list_remove"

external image_list_remove_all : iml:himagelist -> unit = "image_list_remove_all"

external image_list_replace : iml:himagelist -> index:int -> image:hbitmap -> mask:hbitmap -> unit = "image_list_replace"

external image_list_replace_icon : iml:himagelist -> index:int -> icon:hicon -> int = "image_list_replace_icon"

external image_list_set_bk_color : iml:himagelist -> color:color -> unit = "image_list_set_bk_color"

external image_list_set_drag_cursor_image : iml:himagelist -> index:int -> hotspot:point -> unit = "image_list_set_drag_cursor_image"

external image_list_set_icon_size : iml:himagelist -> size:size -> unit = "image_list_set_icon_size"

external image_list_set_image_count : iml:himagelist -> count:int -> unit = "image_list_set_image_count"

external image_list_set_overlay_image : iml:himagelist -> index:int -> overlay:int -> unit = "image_list_set_overlay_image"
