home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / Tk / pTk / tkWinInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-10  |  4.7 KB  |  159 lines

  1. /*
  2.  * tkWinInt.h --
  3.  *
  4.  *    This file contains declarations that are shared among the
  5.  *    Windows-specific parts of Tk, but aren't used by the rest of
  6.  *    Tk.
  7.  *
  8.  * Copyright (c) 1995 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * SCCS: @(#) tkWinInt.h 1.19 96/08/23 11:28:12
  14.  */
  15.  
  16. #ifndef _TKWININT
  17. #define _TKWININT
  18.  
  19. #ifndef _TKINT
  20. #include "tkInt.h"
  21. #endif
  22.  
  23. /*
  24.  * Note that the include of windows.h must not be done in tkWinPort.h,
  25.  * because some of the windows declarations conflict with internal static
  26.  * functions in the generic code (e.g. CreateBitmap).
  27.  */
  28.  
  29. #define WIN32_LEAN_AND_MEAN
  30. #include <windows.h>
  31. #undef WIN32_LEAN_AND_MEAN
  32.  
  33. /*
  34.  * Define constants missing from older Win32 SDK header files.
  35.  */
  36.  
  37. #ifndef WS_EX_TOOLWINDOW
  38. #define WS_EX_TOOLWINDOW    0x00000080L 
  39. #endif
  40.  
  41. /*
  42.  * The TkWinDCState is used to save the state of a device context
  43.  * so that it can be restored later.
  44.  */
  45.  
  46. typedef struct TkWinDCState {
  47.     HPALETTE palette;
  48. } TkWinDCState;
  49.  
  50.  
  51. /*
  52.  * The TkWinDrawable is the internal implementation of an X Drawable (either
  53.  * a Window or a Pixmap).  The following constants define the valid Drawable
  54.  * types.
  55.  */
  56.  
  57. #define TWD_BITMAP    1
  58. #define TWD_WINDOW    2
  59. #define TWD_WM_WINDOW    3
  60.  
  61. typedef struct {
  62.     int type;
  63.     HWND handle;
  64.     TkWindow *winPtr;
  65. } TkWinWindow;
  66.  
  67. typedef struct {
  68.     int type;
  69.     HBITMAP handle;
  70.     Colormap colormap;
  71.     int depth;
  72. } TkWinBitmap;
  73.     
  74. typedef union {
  75.     int type;
  76.     TkWinWindow window;
  77.     TkWinBitmap bitmap;
  78. } TkWinDrawable;
  79.  
  80. /*
  81.  * The following macros are used to retrieve internal values from a Drawable.
  82.  */
  83.  
  84. #define TkWinGetHWND(w) (((TkWinDrawable *) w)->window.handle)
  85. #define TkWinGetWinPtr(w) (((TkWinDrawable*)w)->window.winPtr)
  86. #define TkWinGetHBITMAP(w) (((TkWinDrawable*)w)->bitmap.handle)
  87. #define TkWinGetColormap(w) (((TkWinDrawable*)w)->bitmap.colormap)
  88.  
  89. /*
  90.  * The following structure is used to encapsulate palette information.
  91.  */
  92.  
  93. typedef struct {
  94.     HPALETTE palette;        /* Palette handle used when drawing. */
  95.     UINT size;            /* Number of entries in the palette. */
  96.     int stale;            /* 1 if palette needs to be realized,
  97.                  * otherwise 0.  If the palette is stale,
  98.                  * then an idle handler is scheduled to
  99.                  * realize the palette. */
  100.     Tcl_HashTable refCounts;    /* Hash table of palette entry reference counts
  101.                  * indexed by pixel value. */
  102. } TkWinColormap;
  103.  
  104. /*
  105.  * The following macro retrieves the Win32 palette from a colormap.
  106.  */
  107.  
  108. #define TkWinGetPalette(colormap) (((TkWinColormap *) colormap)->palette)
  109.  
  110. /*
  111.  * The following macros define the class names for Tk Window types.
  112.  */
  113.  
  114. #define TK_WIN_TOPLEVEL_CLASS_NAME "TkTopLevel"
  115. #define TK_WIN_CHILD_CLASS_NAME "TkChild"
  116.  
  117. /*
  118.  * Internal procedures used by more than one source file.
  119.  */
  120.  
  121. extern LRESULT CALLBACK    TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message,
  122.                 WPARAM wParam, LPARAM lParam));
  123. extern void        TkWinClipboardRender _ANSI_ARGS_((TkWindow *winPtr,
  124.                 UINT format));
  125. extern void        TkWinEnterModalLoop _ANSI_ARGS_((
  126.                 Tcl_Interp * interp));
  127. extern HINSTANCE     TkWinGetAppInstance _ANSI_ARGS_((void));
  128. extern HDC        TkWinGetDrawableDC _ANSI_ARGS_((Display *display,
  129.                 Drawable d, TkWinDCState* state));
  130. extern TkWinDrawable *    TkWinGetDrawableFromHandle _ANSI_ARGS_((HWND hwnd));
  131. extern unsigned int    TkWinGetModifierState _ANSI_ARGS_((UINT message,
  132.                 WPARAM wParam, LPARAM lParam));
  133. extern HPALETTE        TkWinGetSystemPalette _ANSI_ARGS_((void));
  134. extern HMODULE        TkWinGetTkModule _ANSI_ARGS_((void));
  135. extern void        TkWinLeaveModalLoop _ANSI_ARGS_((
  136.                 Tcl_Interp * interp));
  137. extern void        TkWinPointerDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  138. extern void        TkWinPointerEvent _ANSI_ARGS_((XEvent *event,
  139.                 TkWindow *winPtr));
  140. extern void        TkWinPointerInit _ANSI_ARGS_((void));
  141. extern void        TkWinReleaseDrawableDC _ANSI_ARGS_((Drawable d,
  142.                 HDC hdc, TkWinDCState* state));
  143. extern HPALETTE        TkWinSelectPalette _ANSI_ARGS_((HDC dc,
  144.                 Colormap colormap));
  145. extern LRESULT CALLBACK    TkWinTopLevelProc _ANSI_ARGS_((HWND hwnd, UINT message,
  146.                 WPARAM wParam, LPARAM lParam));
  147. extern void        TkWinUpdateCursor _ANSI_ARGS_((TkWindow *winPtr));
  148. extern void        TkWinWmConfigure _ANSI_ARGS_((TkWindow *winPtr,
  149.                 WINDOWPOS *pos));
  150. extern int        TkWinWmInstallColormaps _ANSI_ARGS_((HWND hwnd,
  151.                 int message, int isForemost));
  152. extern void        TkWinWmSetLimits _ANSI_ARGS_((HWND hwnd,
  153.                 MINMAXINFO *info));
  154. extern void         TkWinXInit _ANSI_ARGS_((HINSTANCE hInstance));
  155.  
  156. extern int        TkWin32DllPresent _ANSI_ARGS_((void));
  157. #endif /* _TKWININT */
  158.  
  159.