This commit was manufactured by cvs2svn to create branch 'XEmacs-21_4'.
[chise/xemacs-chise.git-] / src / glyphs-msw.h
1 /* mswindows-specific glyphs and related.
2    Copyright (C) 1998 Andy Piper
3
4 This file is part of XEmacs.
5
6 XEmacs is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
9 later version.
10
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with XEmacs; see the file COPYING.  If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Synched up with:  Not in FSF. */
22
23 #ifndef INCLUDED_glyphs_msw_h_
24 #define INCLUDED_glyphs_msw_h_
25
26 #ifdef HAVE_MS_WINDOWS
27
28 #include <windows.h>
29 #include "glyphs.h"
30
31 /****************************************************************************
32  *                         Image-Instance Object                            *
33  ****************************************************************************/
34
35 struct mswindows_image_instance_data
36 {
37   HBITMAP* bitmaps;
38   HICON icon;
39   int real_width, real_height;
40 };
41
42 #define MSWINDOWS_IMAGE_INSTANCE_DATA(i) \
43 ((struct mswindows_image_instance_data *) (i)->data)
44
45 #define IMAGE_INSTANCE_MSWINDOWS_BITMAP(i) \
46      (MSWINDOWS_IMAGE_INSTANCE_DATA (i)->bitmaps[0])
47 #define IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE(i,slice) \
48      (MSWINDOWS_IMAGE_INSTANCE_DATA (i)->bitmaps[slice])
49 #define IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES(i) \
50      (MSWINDOWS_IMAGE_INSTANCE_DATA (i)->bitmaps)
51 #define IMAGE_INSTANCE_MSWINDOWS_MASK(i) \
52      (*(HBITMAP*)&(IMAGE_INSTANCE_PIXMAP_MASK (i)))             /* Make it lvalue */
53 #define IMAGE_INSTANCE_MSWINDOWS_ICON(i) \
54      (MSWINDOWS_IMAGE_INSTANCE_DATA (i)->icon)
55 #define IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH(i) \
56      (MSWINDOWS_IMAGE_INSTANCE_DATA (i)->real_width)
57 #define IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT(i) \
58      (MSWINDOWS_IMAGE_INSTANCE_DATA (i)->real_height)
59
60 #define XIMAGE_INSTANCE_MSWINDOWS_BITMAP(i) \
61   IMAGE_INSTANCE_MSWINDOWS_BITMAP (XIMAGE_INSTANCE (i))
62 #define XIMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE(i,slice) \
63   IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (XIMAGE_INSTANCE (i,slice))
64 #define XIMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES(i) \
65   IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (XIMAGE_INSTANCE (i))
66 #define XIMAGE_INSTANCE_MSWINDOWS_MASK(i) \
67   IMAGE_INSTANCE_MSWINDOWS_MASK (XIMAGE_INSTANCE (i))
68 #define XIMAGE_INSTANCE_MSWINDOWS_ICON(i) \
69   IMAGE_INSTANCE_MSWINDOWS_ICON (XIMAGE_INSTANCE (i))
70
71 int
72 mswindows_resize_dibitmap_instance (Lisp_Image_Instance* ii,
73                                     struct frame* f,
74                                     int newx, int newy);
75 HBITMAP
76 mswindows_create_resized_bitmap (Lisp_Image_Instance* ii,
77                                  struct frame* f,
78                                  int newx, int newy);
79 HBITMAP
80 mswindows_create_resized_mask (Lisp_Image_Instance* ii,
81                                struct frame* f,
82                                int newx, int newy);
83 void
84 mswindows_initialize_image_instance_icon (Lisp_Image_Instance* image,
85                                           int cursor);
86
87 #define WIDGET_INSTANCE_MSWINDOWS_HANDLE(i) \
88      (HWND) (IMAGE_INSTANCE_SUBWINDOW_ID (i))
89
90 #define XWIDGET_INSTANCE_MSWINDOWS_HANDLE(i) \
91   WIDGET_INSTANCE_MSWINDOWS_HANDLE (XIMAGE_INSTANCE (i))
92
93 struct mswindows_subwindow_data
94 {
95   HWND clip_window;
96 };
97
98 #define MSWINDOWS_SUBWINDOW_DATA(i) \
99   ((struct mswindows_subwindow_data *) (i)->data)
100 #define IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW(i) \
101      (MSWINDOWS_SUBWINDOW_DATA (i)->clip_window)
102
103 #define XIMAGE_INSTANCE_MSWINDOWS_SUBWINDOW_DATA(i) \
104   MSWINDOWS_SUBWINDOW_DATA (XIMAGE_INSTANCE (i))
105 #define XIMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW(i) \
106   IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (XIMAGE_INSTANCE (i))
107
108 #define DOMAIN_MSWINDOWS_HANDLE(domain) \
109   ((IMAGE_INSTANCEP (domain) && \
110   XIMAGE_INSTANCE_MSWINDOWS_SUBWINDOW_DATA (domain)) ? \
111    XWIDGET_INSTANCE_MSWINDOWS_HANDLE (domain) : \
112    FRAME_MSWINDOWS_HANDLE (DOMAIN_XFRAME (domain)))
113
114 #endif /* HAVE_MS_WINDOWS */
115
116 #endif /* INCLUDED_glyphs_msw_h_ */