OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [start/] [insight/] [libgui/] [src/] [tclwingrab.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* tclwingrab.c -- Tcl routines to enable and disable windows on Windows.
2
   Copyright (C) 1997 Cygnus Solutions.
3
   Written by Ian Lance Taylor <ian@cygnus.com>.
4
 
5
   This file contains routines to enable and disable windows on
6
   Windows.  This is used to support grabs on Windows in Tk 8.0.
7
 
8
   The routines in this file are expected to be invoked from
9
   ide_grab_support, which is defined in libide/library/wingrab.tcl.
10
   They are not expected to be invoked directly, so they are not
11
   really documented.  */
12
 
13
#ifdef _WIN32
14
 
15
#include <windows.h>
16
 
17
#include <tcl.h>
18
#include <tk.h>
19
 
20
#include "guitcl.h"
21
 
22
/* FIXME: We need to dig into the Tk window implementation internals
23
   to convert a Tk window to an HWND.  */
24
 
25
#include <tkWinInt.h>
26
 
27
/* Enable or disable a window.  If the clientdata argument is NULL, we
28
   disable the window.  Otherwise we enable the window.  This is just
29
   a quick hack; if we ever need to do something else, we can use a
30
   more serious method to distinguish the commands.  */
31
 
32
static int
33
wingrab_command (ClientData cd, Tcl_Interp *interp, int objc,
34
                 Tcl_Obj *const *objv)
35
{
36
  long l;
37
  HWND hwnd;
38
 
39
  /* Note that here we understand the return value of wm frame.  */
40
 
41
  if (Tcl_GetLongFromObj (interp, objv[1], &l) != TCL_OK)
42
    return TCL_ERROR;
43
 
44
  hwnd = (HWND) l;
45
  EnableWindow (hwnd, cd != NULL);
46
 
47
  return TCL_OK;
48
}
49
 
50
/* Create the ide_grab_support_disable and ide_grab_support_enable
51
   commands.  */
52
 
53
int
54
ide_create_win_grab_command (Tcl_Interp *interp)
55
{
56
  if (Tcl_CreateObjCommand (interp, "ide_grab_support_disable",
57
                            wingrab_command, NULL, NULL) == NULL
58
      || Tcl_CreateObjCommand (interp, "ide_grab_support_enable",
59
                               wingrab_command, (ClientData) 1, NULL) == NULL)
60
    return TCL_ERROR;
61
  return TCL_OK;
62
}
63
 
64
#endif /* _WIN32 */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.