home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Tk / win / tkWinInt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-21  |  4.6 KB  |  164 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.17 96/04/11 17:51:55
  14.  */
  15.  
  16. #ifndef _TKWININT
  17. #define _TKWININT
  18.  
  19. #ifndef _TKINT
  20. #include "tkInt.h"
  21. #endif
  22.  
  23. #ifdef STk_CODE
  24. /*
  25.  * These constants are not defined on all the BC++ compilers. Define them if 
  26.  * needed. These values were found in the gnu win32 and in the Wine packages.
  27.  *
  28.  */
  29. #  ifndef WM_ENTERSIZEMOVE
  30. #    define WM_ENTERSIZEMOVE (0x231)
  31. #  endif
  32. #  ifndef WM_EXITSIZEMOVE
  33. #    define WM_EXITSIZEMOVE (0x232)
  34. #  endif
  35. #  ifndef WS_EX_TIIKWINDOW
  36. #    define WS_EX_TOOLWINDOW (0x80L)
  37. #  endif
  38. #endif
  39.  
  40.  
  41. /*
  42.  * Note that the include of windows.h must not be done in tkWinPort.h,
  43.  * because some of the windows declarations conflict with internal static
  44.  * functions in the generic code (e.g. CreateBitmap).
  45.  */
  46.  
  47. #define WIN32_LEAN_AND_MEAN
  48. #include <windows.h>
  49. #undef WIN32_LEAN_AND_MEAN
  50.  
  51. /*
  52.  * The TkWinDCState is used to save the state of a device context
  53.  * so that it can be restored later.
  54.  */
  55.  
  56. typedef struct TkWinDCState {
  57.     HPALETTE palette;
  58. } TkWinDCState;
  59.  
  60.  
  61. /*
  62.  * The TkWinDrawable is the internal implementation of an X Drawable (either
  63.  * a Window or a Pixmap).  The following constants define the valid Drawable
  64.  * types.
  65.  */
  66.  
  67. #define TWD_BITMAP    1
  68. #define TWD_WINDOW    2
  69. #define TWD_WM_WINDOW    3
  70.  
  71. typedef struct {
  72.     int type;
  73.     HWND handle;
  74.     TkWindow *winPtr;
  75. } TkWinWindow;
  76.  
  77. typedef struct {
  78.     int type;
  79.     HBITMAP handle;
  80.     Colormap colormap;
  81.     int depth;
  82. } TkWinBitmap;
  83.     
  84. typedef union {
  85.     int type;
  86.     TkWinWindow window;
  87.     TkWinBitmap bitmap;
  88. } TkWinDrawable;
  89.  
  90. /*
  91.  * The following macros are used to retrieve internal values from a Drawable.
  92.  */
  93.  
  94. #define TkWinGetHWND(w) (((TkWinDrawable *) w)->window.handle)
  95. #define TkWinGetWinPtr(w) (((TkWinDrawable*)w)->window.winPtr)
  96. #define TkWinGetHBITMAP(w) (((TkWinDrawable*)w)->bitmap.handle)
  97. #define TkWinGetColormap(w) (((TkWinDrawable*)w)->bitmap.colormap)
  98.  
  99. /*
  100.  * The following structure is used to encapsulate palette information.
  101.  */
  102.  
  103. typedef struct {
  104.     HPALETTE palette;        /* Palette handle used when drawing. */
  105.     UINT size;            /* Number of entries in the palette. */
  106.     int stale;            /* 1 if palette needs to be realized,
  107.                  * otherwise 0.  If the palette is stale,
  108.                  * then an idle handler is scheduled to
  109.                  * realize the palette. */
  110.     Tcl_HashTable refCounts;    /* Hash table of palette entry reference counts
  111.                  * indexed by pixel value. */
  112. } TkWinColormap;
  113.  
  114. /*
  115.  * The following macro retrieves the Win32 palette from a colormap.
  116.  */
  117.  
  118. #define TkWinGetPalette(colormap) (((TkWinColormap *) colormap)->palette)
  119.  
  120. /*
  121.  * The following macros define the class names for Tk Window types.
  122.  */
  123.  
  124. #define TK_WIN_TOPLEVEL_CLASS_NAME "TkTopLevel"
  125. #define TK_WIN_CHILD_CLASS_NAME "TkChild"
  126.  
  127. /*
  128.  * Internal procedures used by more than one source file.
  129.  */
  130.  
  131. extern LRESULT CALLBACK    TkWinChildProc _ANSI_ARGS_((HWND hwnd, UINT message,
  132.                 WPARAM wParam, LPARAM lParam));
  133. extern void        TkWinClipboardRender _ANSI_ARGS_((TkWindow *winPtr,
  134.                 UINT format));
  135. extern HINSTANCE     TkWinGetAppInstance _ANSI_ARGS_((void));
  136. extern HDC        TkWinGetDrawableDC _ANSI_ARGS_((Display *display,
  137.                 Drawable d, TkWinDCState* state));
  138. extern TkWinDrawable *    TkWinGetDrawableFromHandle _ANSI_ARGS_((HWND hwnd));
  139. extern unsigned int    TkWinGetModifierState _ANSI_ARGS_((UINT message,
  140.                 WPARAM wParam, LPARAM lParam));
  141. extern HPALETTE        TkWinGetSystemPalette _ANSI_ARGS_((void));
  142. extern HMODULE        TkWinGetTkModule _ANSI_ARGS_((void));
  143. extern void        TkWinPointerDeadWindow _ANSI_ARGS_((TkWindow *winPtr));
  144. extern void        TkWinPointerEvent _ANSI_ARGS_((XEvent *event,
  145.                 TkWindow *winPtr));
  146. extern void        TkWinPointerInit _ANSI_ARGS_((void));
  147. extern void        TkWinReleaseDrawableDC _ANSI_ARGS_((Drawable d,
  148.                 HDC hdc, TkWinDCState* state));
  149. extern HPALETTE        TkWinSelectPalette _ANSI_ARGS_((HDC dc,
  150.                 Colormap colormap));
  151. extern LRESULT CALLBACK    TkWinTopLevelProc _ANSI_ARGS_((HWND hwnd, UINT message,
  152.                 WPARAM wParam, LPARAM lParam));
  153. extern void        TkWinUpdateCursor _ANSI_ARGS_((TkWindow *winPtr));
  154. extern void        TkWinWmConfigure _ANSI_ARGS_((TkWindow *winPtr,
  155.                 WINDOWPOS *pos));
  156. extern int        TkWinWmInstallColormaps _ANSI_ARGS_((HWND hwnd,
  157.                 int message, int isForemost));
  158. extern void        TkWinWmSetLimits _ANSI_ARGS_((HWND hwnd,
  159.                 MINMAXINFO *info));
  160. extern void         TkWinXInit _ANSI_ARGS_((HINSTANCE hInstance));
  161.  
  162. #endif /* _TKWININT */
  163.  
  164.