(* OCaml-Win32
 * win32_hotkey.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: Hot Key Controls *)

let hotkey_class = "msctls_hotkey32"

type hotkey_modifier =
    HOTKEYF_ALT
  | HOTKEYF_CONTROL
  | HOTKEYF_EXT
  | HOTKEYF_SHIFT
type hotkey = {
    hk_key : virtual_key_code;
    hk_modifiers : hotkey_modifier list }

(* Messages *)

let hkm_gethotkey = wm_user + 2
let pack_hkm_gethotkey = pack_simple_message ~id:hkm_gethotkey
external unpack_hkm_gethotkey : message_result -> hotkey = "unpack_hkm_gethotkey"
let issue_hkm_gethotkey ~sender = unpack_hkm_gethotkey (sender ~msg:pack_hkm_gethotkey)

let hkm_sethotkey = wm_user + 1
external pack_hkm_sethotkey : hotkey:hotkey -> message_contents = "pack_hkm_sethotkey"
let unpack_hkm_sethotkey = ignore
let issue_hkm_sethotkey ~sender ~hotkey = unpack_hkm_sethotkey (sender ~msg:(pack_hkm_sethotkey ~hotkey))

let hkm_setrules = wm_user + 3
type hotkey_combination =
    HKCOMB_A
  | HKCOMB_C
  | HKCOMB_CA
  | HKCOMB_NONE
  | HKCOMB_S
  | HKCOMB_SA
  | HKCOMB_SC
  | HKCOMB_SCA
external pack_hkm_setrules : invalid:hotkey_combination list -> modifiers:hotkey_modifier list -> message_contents = "pack_hkm_setrules"
let unpack_hkm_setrules = ignore
let issue_hkm_setrules ~sender ~invalid ~modifiers = unpack_hkm_setrules (sender ~msg:(pack_hkm_setrules ~invalid ~modifiers))
