(* OCaml-Win32
 * win32_progressbar.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: Progress Bar Controls *)

let progress_class = "msctls_progress32"

(* Styles *)

type progressbar_style_option =
    PBS_SMOOTH
  | PBS_VERTICAL

external progressbar_style_of_option : progressbar_style_option -> style = "progressbar_style_of_option"

let progressbar_style_of_options = special_style_of_options ~special_func:progressbar_style_of_option

(* Messages *)

let pbm_deltapos = wm_user + 3
external pack_pbm_deltapos : delta:int -> message_contents = "pack_pbm_deltapos"
external unpack_pbm_deltapos : message_result -> int = "unpack_pbm_deltapos"
let issue_pbm_deltapos ~sender ~delta = unpack_pbm_deltapos (sender ~msg:(pack_pbm_deltapos ~delta))

let pbm_getpos = wm_user + 8
let pack_pbm_getpos = pack_simple_message ~id:pbm_getpos
external unpack_pbm_getpos : message_result -> int = "unpack_pbm_getpos"
let issue_pbm_getpos ~sender = unpack_pbm_getpos (sender ~msg:pack_pbm_getpos)

let pbm_getrange = wm_user + 7
external issue_pbm_getrange : sender:message_sender -> (int * int) = "issue_pbm_getrange"

let pbm_setbarcolor = wm_user + 9
external pack_pbm_setbarcolor : color:color -> message_contents = "pack_pbm_setbarcolor"
external unpack_pbm_setbarcolor : message_result -> color = "unpack_pbm_setbarcolor"
let issue_pbm_setbarcolor ~sender ~color = unpack_pbm_setbarcolor (sender ~msg:(pack_pbm_setbarcolor ~color))

let pbm_setbkcolor = ccm_first + 1
external pack_pbm_setbkcolor : color:color -> message_contents = "pack_pbm_setbkcolor"
external unpack_pbm_setbkcolor : message_result -> color = "unpack_pbm_setbkcolor"
let issue_pbm_setbkcolor ~sender ~color = unpack_pbm_setbkcolor (sender ~msg:(pack_pbm_setbkcolor ~color))

let pbm_setpos = wm_user + 2
external pack_pbm_setpos : pos:int -> message_contents = "pack_pbm_setpos"
external unpack_pbm_setpos : message_result -> int = "unpack_pbm_setpos"
let issue_pbm_setpos ~sender ~pos = unpack_pbm_setpos (sender ~msg:(pack_pbm_setpos ~pos))

let pbm_setrange = wm_user + 1
external pack_pbm_setrange : min:int -> max:int -> message_contents = "pack_pbm_setrange"
external unpack_pbm_setrange : message_result -> (int * int) = "unpack_pbm_setrange"
let issue_pbm_setrange ~sender ~min ~max = unpack_pbm_setrange (sender ~msg:(pack_pbm_setrange ~min ~max))

let pbm_setrange32 = wm_user + 6
external pack_pbm_setrange32 : min:int -> max:int -> message_contents = "pack_pbm_setrange32"
external unpack_pbm_setrange32 : message_result -> (int * int) = "unpack_pbm_setrange32"
let issue_pbm_setrange32 ~sender ~min ~max = unpack_pbm_setrange32 (sender ~msg:(pack_pbm_setrange32 ~min ~max))

let pbm_setstep = wm_user + 4
external pack_pbm_setstep : step:int -> message_contents = "pack_pbm_setstep"
external unpack_pbm_setstep : message_result -> int = "unpack_pbm_setstep"
let issue_pbm_setstep ~sender ~step = unpack_pbm_setstep (sender ~msg:(pack_pbm_setstep ~step))

let pbm_stepit = wm_user + 5
let pack_pbm_stepit = pack_simple_message ~id:pbm_stepit
external unpack_pbm_stepit : message_result -> int = "unpack_pbm_stepit"
let issue_pbm_stepit ~sender = unpack_pbm_stepit (sender ~msg:pack_pbm_stepit)
