Mercurial > hg > xemacs-beta
comparison src/glyphs-msw.c @ 408:501cfd01ee6d r21-2-34
Import from CVS: tag r21-2-34
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:18:11 +0200 |
parents | b8cc9ab3f761 |
children | de805c49cfc1 |
comparison
equal
deleted
inserted
replaced
407:ed6218a7d4d3 | 408:501cfd01ee6d |
---|---|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 Boston, MA 02111-1307, USA. */ | 19 Boston, MA 02111-1307, USA. */ |
20 | 20 |
21 /* Synched up with: Not in FSF. */ | 21 /* Synched up with: Not in FSF. */ |
22 | 22 |
23 /* written by Andy Piper <andy@xemacs.org> plagerising bits from | 23 /* written by Andy Piper <andy@xemacs.org> plagiarising bits from |
24 glyphs-x.c */ | 24 glyphs-x.c */ |
25 | 25 |
26 #include <config.h> | 26 #include <config.h> |
27 #include "lisp.h" | 27 #include "lisp.h" |
28 #include "lstream.h" | 28 #include "lstream.h" |
55 | 55 |
56 DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing); | 56 DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing); |
57 DECLARE_IMAGE_INSTANTIATOR_FORMAT (string); | 57 DECLARE_IMAGE_INSTANTIATOR_FORMAT (string); |
58 DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); | 58 DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); |
59 DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit); | 59 DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit); |
60 DECLARE_IMAGE_INSTANTIATOR_FORMAT (layout); | |
61 #ifdef HAVE_JPEG | 60 #ifdef HAVE_JPEG |
62 DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg); | 61 DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg); |
63 #endif | 62 #endif |
64 #ifdef HAVE_TIFF | 63 #ifdef HAVE_TIFF |
65 DECLARE_IMAGE_INSTANTIATOR_FORMAT (tiff); | 64 DECLARE_IMAGE_INSTANTIATOR_FORMAT (tiff); |
78 DEFINE_DEVICE_IIFORMAT (msprinter, xbm); | 77 DEFINE_DEVICE_IIFORMAT (msprinter, xbm); |
79 #ifdef HAVE_XFACE | 78 #ifdef HAVE_XFACE |
80 DEFINE_DEVICE_IIFORMAT (mswindows, xface); | 79 DEFINE_DEVICE_IIFORMAT (mswindows, xface); |
81 DEFINE_DEVICE_IIFORMAT (msprinter, xface); | 80 DEFINE_DEVICE_IIFORMAT (msprinter, xface); |
82 #endif | 81 #endif |
82 DECLARE_IMAGE_INSTANTIATOR_FORMAT (layout); | |
83 DEFINE_DEVICE_IIFORMAT (mswindows, native_layout); | |
83 DEFINE_DEVICE_IIFORMAT (mswindows, button); | 84 DEFINE_DEVICE_IIFORMAT (mswindows, button); |
84 DEFINE_DEVICE_IIFORMAT (mswindows, edit_field); | 85 DEFINE_DEVICE_IIFORMAT (mswindows, edit_field); |
85 DEFINE_DEVICE_IIFORMAT (mswindows, subwindow); | 86 DEFINE_DEVICE_IIFORMAT (mswindows, subwindow); |
86 DEFINE_DEVICE_IIFORMAT (mswindows, widget); | 87 DEFINE_DEVICE_IIFORMAT (mswindows, widget); |
87 DEFINE_DEVICE_IIFORMAT (mswindows, label); | 88 DEFINE_DEVICE_IIFORMAT (mswindows, label); |
130 * only here. | 131 * only here. |
131 * #### Add support for unscalable bitmaps. | 132 * #### Add support for unscalable bitmaps. |
132 */ | 133 */ |
133 static void init_image_instance_geometry (Lisp_Image_Instance *ii) | 134 static void init_image_instance_geometry (Lisp_Image_Instance *ii) |
134 { | 135 { |
135 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 136 struct device *d = DOMAIN_XDEVICE (ii->domain); |
136 struct device *d = XDEVICE (device); | |
137 | 137 |
138 if (/* #### Scaleable && */ DEVICE_MSPRINTER_P (d)) | 138 if (/* #### Scaleable && */ DEVICE_MSPRINTER_P (d)) |
139 { | 139 { |
140 HDC printer_dc = DEVICE_MSPRINTER_HCDC (d); | 140 HDC printer_dc = DEVICE_MSPRINTER_HCDC (d); |
141 HDC display_dc = CreateCompatibleDC (NULL); | 141 HDC display_dc = CreateCompatibleDC (NULL); |
347 int slices, | 347 int slices, |
348 Lisp_Object instantiator, | 348 Lisp_Object instantiator, |
349 int x_hot, int y_hot, | 349 int x_hot, int y_hot, |
350 int create_mask) | 350 int create_mask) |
351 { | 351 { |
352 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 352 struct device *d = XDEVICE (IMAGE_INSTANCE_DEVICE (ii)); |
353 struct device *d = XDEVICE (device); | |
354 void* bmp_buf=0; | 353 void* bmp_buf=0; |
355 enum image_instance_type type; | 354 enum image_instance_type type; |
356 HBITMAP bitmap; | 355 HBITMAP bitmap; |
357 HDC hdc; | 356 HDC hdc; |
358 | 357 |
2070 #endif | 2069 #endif |
2071 | 2070 |
2072 static void | 2071 static void |
2073 mswindows_finalize_image_instance (Lisp_Image_Instance *p) | 2072 mswindows_finalize_image_instance (Lisp_Image_Instance *p) |
2074 { | 2073 { |
2075 if (DEVICE_LIVE_P (XDEVICE (p->device))) | 2074 if (!p->data) |
2076 { | 2075 return; |
2077 if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET | 2076 |
2078 || | 2077 if (DEVICE_LIVE_P (XDEVICE (IMAGE_INSTANCE_DEVICE (p)))) |
2079 IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW) | 2078 { |
2079 if (image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (p)) | |
2080 & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK)) | |
2080 { | 2081 { |
2081 #ifdef DEBUG_WIDGETS | 2082 #ifdef DEBUG_WIDGETS |
2082 debug_widget_instances--; | 2083 debug_widget_instances--; |
2083 stderr_out ("widget destroyed, %d left\n", debug_widget_instances); | 2084 stderr_out ("widget destroyed, %d left\n", debug_widget_instances); |
2084 #endif | 2085 #endif |
2137 face, domain); | 2138 face, domain); |
2138 | 2139 |
2139 return mswindows_get_hfont (XFONT_INSTANCE (font), under, strike); | 2140 return mswindows_get_hfont (XFONT_INSTANCE (font), under, strike); |
2140 } | 2141 } |
2141 | 2142 |
2143 static HDWP | |
2144 begin_defer_window_pos (struct frame *f) | |
2145 { | |
2146 if (FRAME_MSWINDOWS_DATA (f)->hdwp == 0) | |
2147 FRAME_MSWINDOWS_DATA (f)->hdwp = BeginDeferWindowPos (10); | |
2148 return FRAME_MSWINDOWS_DATA (f)->hdwp; | |
2149 } | |
2150 | |
2142 /* unmap the image if it is a widget. This is used by redisplay via | 2151 /* unmap the image if it is a widget. This is used by redisplay via |
2143 redisplay_unmap_subwindows */ | 2152 redisplay_unmap_subwindows */ |
2144 static void | 2153 static void |
2145 mswindows_unmap_subwindow (Lisp_Image_Instance *p) | 2154 mswindows_unmap_subwindow (Lisp_Image_Instance *p) |
2146 { | 2155 { |
2147 if (IMAGE_INSTANCE_SUBWINDOW_ID (p)) | 2156 if (IMAGE_INSTANCE_SUBWINDOW_ID (p)) |
2148 { | 2157 { |
2149 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), | 2158 struct frame *f = XFRAME (IMAGE_INSTANCE_FRAME (p)); |
2150 NULL, | 2159 HDWP hdwp = begin_defer_window_pos (f); |
2151 0, 0, 0, 0, | 2160 HDWP new_hdwp; |
2152 SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE | 2161 new_hdwp = DeferWindowPos (hdwp, IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), |
2153 | SWP_NOSENDCHANGING); | 2162 NULL, |
2163 0, 0, 0, 0, | |
2164 SWP_HIDEWINDOW | SWP_NOACTIVATE | | |
2165 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | |
2166 /* Setting this flag causes the call to | |
2167 DeferWindowPos to fail with | |
2168 "Invalid parameter". I don't understand | |
2169 why we bother to try and set this | |
2170 anyway. -- ben */ | |
2171 /* | SWP_NOSENDCHANGING */ | |
2172 ); | |
2173 if (!new_hdwp) | |
2174 mswindows_output_last_error ("unmapping"); | |
2175 else | |
2176 hdwp = new_hdwp; | |
2177 FRAME_MSWINDOWS_DATA (f)->hdwp = hdwp; | |
2154 if (GetFocus() == WIDGET_INSTANCE_MSWINDOWS_HANDLE (p)) | 2178 if (GetFocus() == WIDGET_INSTANCE_MSWINDOWS_HANDLE (p)) |
2155 SetFocus (GetParent (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p))); | 2179 SetFocus (GetParent (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p))); |
2156 } | 2180 } |
2157 } | 2181 } |
2158 | 2182 |
2160 redisplay_output_subwindow */ | 2184 redisplay_output_subwindow */ |
2161 static void | 2185 static void |
2162 mswindows_map_subwindow (Lisp_Image_Instance *p, int x, int y, | 2186 mswindows_map_subwindow (Lisp_Image_Instance *p, int x, int y, |
2163 struct display_glyph_area* dga) | 2187 struct display_glyph_area* dga) |
2164 { | 2188 { |
2189 struct frame *f = XFRAME (IMAGE_INSTANCE_FRAME (p)); | |
2190 HDWP hdwp = begin_defer_window_pos (f); | |
2191 HDWP new_hdwp; | |
2165 /* move the window before mapping it ... */ | 2192 /* move the window before mapping it ... */ |
2166 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), | 2193 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), |
2167 NULL, | 2194 NULL, |
2168 x, y, dga->width, dga->height, | 2195 x, y, dga->width, dga->height, |
2169 SWP_NOZORDER | 2196 SWP_NOZORDER |
2173 NULL, | 2200 NULL, |
2174 -dga->xoffset, -dga->yoffset, 0, 0, | 2201 -dga->xoffset, -dga->yoffset, 0, 0, |
2175 SWP_NOZORDER | SWP_NOSIZE | 2202 SWP_NOZORDER | SWP_NOSIZE |
2176 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); | 2203 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); |
2177 /* ... now map it - we are not allowed to move it at the same time. */ | 2204 /* ... now map it - we are not allowed to move it at the same time. */ |
2178 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), | 2205 new_hdwp = DeferWindowPos (hdwp, IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), |
2179 NULL, | 2206 NULL, |
2180 0, 0, 0, 0, | 2207 0, 0, 0, 0, |
2181 SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | 2208 SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE |
2182 | SWP_SHOWWINDOW | SWP_NOCOPYBITS | 2209 | SWP_SHOWWINDOW |
2183 | SWP_NOSENDCHANGING); | 2210 /* | SWP_NOCOPYBITS */ |
2211 /* Setting this flag causes the call to | |
2212 DeferWindowPos to fail with | |
2213 "Invalid parameter". I don't understand | |
2214 why we bother to try and set this | |
2215 anyway. -- ben */ | |
2216 /* | SWP_NOSENDCHANGING */ | |
2217 | SWP_NOACTIVATE); | |
2218 if (!new_hdwp) | |
2219 mswindows_output_last_error ("mapping"); | |
2220 else | |
2221 hdwp = new_hdwp; | |
2222 FRAME_MSWINDOWS_DATA (f)->hdwp = hdwp; | |
2184 } | 2223 } |
2185 | 2224 |
2186 /* resize the subwindow instance */ | 2225 /* resize the subwindow instance */ |
2187 static void | 2226 static void |
2188 mswindows_resize_subwindow (Lisp_Image_Instance* ii, int w, int h) | 2227 mswindows_resize_subwindow (Lisp_Image_Instance* ii, int w, int h) |
2189 { | 2228 { |
2190 /* Set the size of the control .... */ | 2229 /* Set the size of the control .... */ |
2191 SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii), | 2230 if (!SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii), |
2192 NULL, | 2231 NULL, |
2193 0, 0, w, h, | 2232 0, 0, w, h, |
2194 SWP_NOZORDER | SWP_NOMOVE | 2233 SWP_NOZORDER | SWP_NOMOVE |
2195 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); | 2234 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING)) |
2235 mswindows_output_last_error ("resizing"); | |
2196 } | 2236 } |
2197 | 2237 |
2198 /* Simply resize the window here. */ | 2238 /* Simply resize the window here. */ |
2199 static void | 2239 static void |
2200 mswindows_update_subwindow (Lisp_Image_Instance *p) | 2240 mswindows_update_subwindow (Lisp_Image_Instance *p) |
2208 needs to be checked and all appropriate widgets updated */ | 2248 needs to be checked and all appropriate widgets updated */ |
2209 static void | 2249 static void |
2210 mswindows_update_widget (Lisp_Image_Instance *p) | 2250 mswindows_update_widget (Lisp_Image_Instance *p) |
2211 { | 2251 { |
2212 /* Possibly update the face font and colors. */ | 2252 /* Possibly update the face font and colors. */ |
2213 if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p) | 2253 if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (p)) |
2214 || | 2254 && (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p) |
2215 XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (p))->faces_changed | 2255 || XFRAME (IMAGE_INSTANCE_FRAME (p))->faces_changed |
2216 || | 2256 || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))) |
2217 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) | |
2218 { | 2257 { |
2219 /* set the widget font from the widget face */ | 2258 /* set the widget font from the widget face */ |
2220 SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), | 2259 SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), |
2221 WM_SETFONT, | 2260 WM_SETFONT, |
2222 (WPARAM) mswindows_widget_hfont | 2261 (WPARAM) mswindows_widget_hfont |
2223 (p, IMAGE_INSTANCE_SUBWINDOW_FRAME (p)), | 2262 (p, IMAGE_INSTANCE_FRAME (p)), |
2224 MAKELPARAM (TRUE, 0)); | 2263 MAKELPARAM (TRUE, 0)); |
2225 } | 2264 } |
2226 /* Possibly update the dimensions. */ | 2265 /* Possibly update the dimensions. */ |
2227 if (IMAGE_INSTANCE_SIZE_CHANGED (p)) | 2266 if (IMAGE_INSTANCE_SIZE_CHANGED (p)) |
2228 { | 2267 { |
2229 mswindows_resize_subwindow (p, | 2268 mswindows_resize_subwindow (p, |
2230 IMAGE_INSTANCE_WIDTH (p), | 2269 IMAGE_INSTANCE_WIDTH (p), |
2231 IMAGE_INSTANCE_HEIGHT (p)); | 2270 IMAGE_INSTANCE_HEIGHT (p)); |
2232 } | 2271 } |
2233 /* Possibly update the text in the widget. */ | 2272 /* Possibly update the text in the widget. */ |
2234 if (IMAGE_INSTANCE_TEXT_CHANGED (p)) | 2273 if (IMAGE_INSTANCE_TEXT_CHANGED (p) |
2274 && !NILP (IMAGE_INSTANCE_WIDGET_TEXT (p))) | |
2235 { | 2275 { |
2236 Extbyte* lparam=0; | 2276 Extbyte* lparam=0; |
2237 TO_EXTERNAL_FORMAT (LISP_STRING, IMAGE_INSTANCE_WIDGET_TEXT (p), | 2277 TO_EXTERNAL_FORMAT (LISP_STRING, IMAGE_INSTANCE_WIDGET_TEXT (p), |
2238 C_STRING_ALLOCA, lparam, | 2278 C_STRING_ALLOCA, lparam, |
2239 Qnative); | 2279 Qnative); |
2247 automatically */ | 2287 automatically */ |
2248 static int | 2288 static int |
2249 mswindows_register_gui_item (Lisp_Object image_instance, | 2289 mswindows_register_gui_item (Lisp_Object image_instance, |
2250 Lisp_Object gui, Lisp_Object domain) | 2290 Lisp_Object gui, Lisp_Object domain) |
2251 { | 2291 { |
2252 Lisp_Object frame = FW_FRAME (domain); | 2292 Lisp_Object frame = DOMAIN_FRAME (domain); |
2253 struct frame* f = XFRAME (frame); | 2293 struct frame* f = XFRAME (frame); |
2254 int id = gui_item_id_hash (FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), | 2294 int id = gui_item_id_hash (FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), |
2255 gui, | 2295 gui, |
2256 WIDGET_GLYPH_SLOT); | 2296 WIDGET_GLYPH_SLOT); |
2257 Fputhash (make_int (id), image_instance, | 2297 Fputhash (make_int (id), image_instance, |
2276 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 2316 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
2277 int dest_mask, Lisp_Object domain) | 2317 int dest_mask, Lisp_Object domain) |
2278 { | 2318 { |
2279 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2319 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2280 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 2320 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
2281 Lisp_Object frame = FW_FRAME (domain); | 2321 Lisp_Object frame = DOMAIN_FRAME (domain); |
2282 HWND wnd; | 2322 HWND wnd; |
2283 | 2323 |
2284 CHECK_MSWINDOWS_DEVICE (device); | 2324 CHECK_MSWINDOWS_DEVICE (device); |
2285 | 2325 |
2286 /* have to set the type this late in case there is no device | 2326 /* have to set the type this late in case there is no device |
2398 const char* class, int flags, int exflags) | 2438 const char* class, int flags, int exflags) |
2399 { | 2439 { |
2400 /* this function can call lisp */ | 2440 /* this function can call lisp */ |
2401 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2441 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2402 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii), style; | 2442 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii), style; |
2403 Lisp_Object frame = FW_FRAME (domain); | 2443 Lisp_Object frame = DOMAIN_FRAME (domain); |
2404 Extbyte* nm=0; | 2444 Extbyte* nm=0; |
2405 HWND wnd; | 2445 HWND wnd; |
2406 int id = 0xffff; | 2446 int id = 0xffff; |
2407 Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii); | 2447 Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii); |
2408 Lisp_Gui_Item* pgui = XGUI_ITEM (gui); | 2448 Lisp_Gui_Item* pgui = XGUI_ITEM (gui); |
2436 0, /* starting x position */ | 2476 0, /* starting x position */ |
2437 0, /* starting y position */ | 2477 0, /* starting y position */ |
2438 IMAGE_INSTANCE_WIDGET_WIDTH (ii), | 2478 IMAGE_INSTANCE_WIDGET_WIDTH (ii), |
2439 IMAGE_INSTANCE_WIDGET_HEIGHT (ii), | 2479 IMAGE_INSTANCE_WIDGET_HEIGHT (ii), |
2440 /* parent window */ | 2480 /* parent window */ |
2441 FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), | 2481 DOMAIN_MSWINDOWS_HANDLE (domain), |
2442 (HMENU)id, /* No menu */ | 2482 (HMENU)id, /* No menu */ |
2443 NULL, /* must be null for this class */ | 2483 NULL, /* must be null for this class */ |
2444 NULL)) == NULL) | 2484 NULL)) == NULL) |
2445 signal_simple_error ("window creation failed with code", | 2485 signal_simple_error ("window creation failed with code", |
2446 make_int (GetLastError())); | 2486 make_int (GetLastError())); |
2466 make_int (GetLastError())); | 2506 make_int (GetLastError())); |
2467 | 2507 |
2468 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd; | 2508 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd; |
2469 SetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance)); | 2509 SetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance)); |
2470 /* set the widget font from the widget face */ | 2510 /* set the widget font from the widget face */ |
2471 SendMessage (wnd, WM_SETFONT, | 2511 if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) |
2472 (WPARAM) mswindows_widget_hfont (ii, domain), | 2512 SendMessage (wnd, WM_SETFONT, |
2473 MAKELPARAM (TRUE, 0)); | 2513 (WPARAM) mswindows_widget_hfont (ii, domain), |
2514 MAKELPARAM (TRUE, 0)); | |
2515 } | |
2516 | |
2517 /* Instantiate a native layout widget. */ | |
2518 static void | |
2519 mswindows_native_layout_instantiate (Lisp_Object image_instance, | |
2520 Lisp_Object instantiator, | |
2521 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | |
2522 int dest_mask, Lisp_Object domain) | |
2523 { | |
2524 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | |
2525 | |
2526 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | |
2527 pointer_bg, dest_mask, domain, "STATIC", | |
2528 /* Approximation to styles available with | |
2529 an XEmacs layout. */ | |
2530 EQ (IMAGE_INSTANCE_LAYOUT_BORDER (ii), | |
2531 Qetched_in) || | |
2532 EQ (IMAGE_INSTANCE_LAYOUT_BORDER (ii), | |
2533 Qetched_out) || | |
2534 GLYPHP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) | |
2535 ? SS_ETCHEDFRAME : SS_SUNKEN, | |
2536 0); | |
2474 } | 2537 } |
2475 | 2538 |
2476 /* Instantiate a button widget. Unfortunately instantiated widgets are | 2539 /* Instantiate a button widget. Unfortunately instantiated widgets are |
2477 particular to a frame since they need to have a parent. It's not | 2540 particular to a frame since they need to have a parent. It's not |
2478 like images where you just select the image into the context you | 2541 like images where you just select the image into the context you |
2591 SendMessage (wnd, PBS_SETBKCOLOR, 0, | 2654 SendMessage (wnd, PBS_SETBKCOLOR, 0, |
2592 (LPARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR | 2655 (LPARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR |
2593 (XCOLOR_INSTANCE | 2656 (XCOLOR_INSTANCE |
2594 (FACE_BACKGROUND | 2657 (FACE_BACKGROUND |
2595 (XIMAGE_INSTANCE_WIDGET_FACE (ii), | 2658 (XIMAGE_INSTANCE_WIDGET_FACE (ii), |
2596 XIMAGE_INSTANCE_SUBWINDOW_FRAME (ii)))))); | 2659 XIMAGE_INSTANCE_FRAME (ii)))))); |
2597 #endif | 2660 #endif |
2598 #ifdef PBS_SETBARCOLOR | 2661 #ifdef PBS_SETBARCOLOR |
2599 SendMessage (wnd, PBS_SETBARCOLOR, 0, | 2662 SendMessage (wnd, PBS_SETBARCOLOR, 0, |
2600 (L:PARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR | 2663 (L:PARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR |
2601 (XCOLOR_INSTANCE | 2664 (XCOLOR_INSTANCE |
2602 (FACE_FOREGROUND | 2665 (FACE_FOREGROUND |
2603 (XIMAGE_INSTANCE_WIDGET_FACE (ii), | 2666 (XIMAGE_INSTANCE_WIDGET_FACE (ii), |
2604 XIMAGE_INSTANCE_SUBWINDOW_FRAME (ii)))))); | 2667 XIMAGE_INSTANCE_FRAME (ii)))))); |
2605 #endif | 2668 #endif |
2606 } | 2669 } |
2607 | 2670 |
2608 /* instantiate a tree view widget */ | 2671 /* instantiate a tree view widget */ |
2609 static HTREEITEM add_tree_item (Lisp_Object image_instance, | 2672 static HTREEITEM add_tree_item (Lisp_Object image_instance, |
2783 | 2846 |
2784 /* add items to the tab */ | 2847 /* add items to the tab */ |
2785 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii))) | 2848 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii))) |
2786 { | 2849 { |
2787 add_tab_item (image_instance, wnd, XCAR (rest), | 2850 add_tab_item (image_instance, wnd, XCAR (rest), |
2788 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii), i); | 2851 IMAGE_INSTANCE_FRAME (ii), i); |
2789 if (gui_item_selected_p (XCAR (rest))) | 2852 if (gui_item_selected_p (XCAR (rest))) |
2790 selected = i; | 2853 selected = i; |
2791 i++; | 2854 i++; |
2792 } | 2855 } |
2793 SendMessage (wnd, TCM_SETCURSEL, selected, 0); | 2856 SendMessage (wnd, TCM_SETCURSEL, selected, 0); |
3011 void | 3074 void |
3012 image_instantiator_format_create_glyphs_mswindows (void) | 3075 image_instantiator_format_create_glyphs_mswindows (void) |
3013 { | 3076 { |
3014 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, nothing); | 3077 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, nothing); |
3015 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, string); | 3078 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, string); |
3016 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, layout); | |
3017 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, formatted_string); | 3079 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, formatted_string); |
3018 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, inherit); | 3080 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, inherit); |
3019 /* image-instantiator types */ | 3081 /* image-instantiator types */ |
3020 INITIALIZE_DEVICE_IIFORMAT (mswindows, xbm); | 3082 INITIALIZE_DEVICE_IIFORMAT (mswindows, xbm); |
3021 INITIALIZE_DEVICE_IIFORMAT (msprinter, xbm); | 3083 INITIALIZE_DEVICE_IIFORMAT (msprinter, xbm); |
3044 #endif | 3106 #endif |
3045 #ifdef HAVE_GIF | 3107 #ifdef HAVE_GIF |
3046 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, gif); | 3108 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, gif); |
3047 #endif | 3109 #endif |
3048 #ifdef HAVE_WIDGETS | 3110 #ifdef HAVE_WIDGETS |
3111 INITIALIZE_DEVICE_IIFORMAT (mswindows, widget); | |
3112 IIFORMAT_HAS_DEVMETHOD (mswindows, widget, property); | |
3113 /* layout widget */ | |
3114 IIFORMAT_VALID_CONSOLE (mswindows, layout); | |
3115 INITIALIZE_DEVICE_IIFORMAT (mswindows, native_layout); | |
3116 IIFORMAT_HAS_DEVMETHOD (mswindows, native_layout, instantiate); | |
3049 /* button widget */ | 3117 /* button widget */ |
3050 INITIALIZE_DEVICE_IIFORMAT (mswindows, button); | 3118 INITIALIZE_DEVICE_IIFORMAT (mswindows, button); |
3051 IIFORMAT_HAS_DEVMETHOD (mswindows, button, property); | 3119 IIFORMAT_HAS_DEVMETHOD (mswindows, button, property); |
3052 IIFORMAT_HAS_DEVMETHOD (mswindows, button, instantiate); | 3120 IIFORMAT_HAS_DEVMETHOD (mswindows, button, instantiate); |
3053 IIFORMAT_HAS_DEVMETHOD (mswindows, button, update); | 3121 IIFORMAT_HAS_DEVMETHOD (mswindows, button, update); |
3054 | 3122 /* edit-field widget */ |
3055 INITIALIZE_DEVICE_IIFORMAT (mswindows, edit_field); | 3123 INITIALIZE_DEVICE_IIFORMAT (mswindows, edit_field); |
3056 IIFORMAT_HAS_DEVMETHOD (mswindows, edit_field, instantiate); | 3124 IIFORMAT_HAS_DEVMETHOD (mswindows, edit_field, instantiate); |
3057 | 3125 /* subwindow */ |
3058 INITIALIZE_DEVICE_IIFORMAT (mswindows, subwindow); | 3126 INITIALIZE_DEVICE_IIFORMAT (mswindows, subwindow); |
3059 IIFORMAT_HAS_DEVMETHOD (mswindows, subwindow, instantiate); | 3127 IIFORMAT_HAS_DEVMETHOD (mswindows, subwindow, instantiate); |
3060 | |
3061 INITIALIZE_DEVICE_IIFORMAT (mswindows, widget); | |
3062 IIFORMAT_HAS_DEVMETHOD (mswindows, widget, property); | |
3063 | |
3064 /* label */ | 3128 /* label */ |
3065 INITIALIZE_DEVICE_IIFORMAT (mswindows, label); | 3129 INITIALIZE_DEVICE_IIFORMAT (mswindows, label); |
3066 IIFORMAT_HAS_DEVMETHOD (mswindows, label, instantiate); | 3130 IIFORMAT_HAS_DEVMETHOD (mswindows, label, instantiate); |
3067 | |
3068 /* combo box */ | 3131 /* combo box */ |
3069 INITIALIZE_DEVICE_IIFORMAT (mswindows, combo_box); | 3132 INITIALIZE_DEVICE_IIFORMAT (mswindows, combo_box); |
3070 IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, property); | 3133 IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, property); |
3071 IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, instantiate); | 3134 IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, instantiate); |
3072 | |
3073 /* scrollbar */ | 3135 /* scrollbar */ |
3074 INITIALIZE_DEVICE_IIFORMAT (mswindows, scrollbar); | 3136 INITIALIZE_DEVICE_IIFORMAT (mswindows, scrollbar); |
3075 IIFORMAT_HAS_DEVMETHOD (mswindows, scrollbar, instantiate); | 3137 IIFORMAT_HAS_DEVMETHOD (mswindows, scrollbar, instantiate); |
3076 | |
3077 /* progress gauge */ | 3138 /* progress gauge */ |
3078 INITIALIZE_DEVICE_IIFORMAT (mswindows, progress_gauge); | 3139 INITIALIZE_DEVICE_IIFORMAT (mswindows, progress_gauge); |
3079 IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, update); | 3140 IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, update); |
3080 IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, instantiate); | 3141 IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, instantiate); |
3081 | |
3082 /* tree view widget */ | 3142 /* tree view widget */ |
3083 INITIALIZE_DEVICE_IIFORMAT (mswindows, tree_view); | 3143 INITIALIZE_DEVICE_IIFORMAT (mswindows, tree_view); |
3084 /* IIFORMAT_HAS_DEVMETHOD (mswindows, progress, set_property);*/ | 3144 /* IIFORMAT_HAS_DEVMETHOD (mswindows, progress, set_property);*/ |
3085 IIFORMAT_HAS_DEVMETHOD (mswindows, tree_view, instantiate); | 3145 IIFORMAT_HAS_DEVMETHOD (mswindows, tree_view, instantiate); |
3086 | |
3087 /* tab control widget */ | 3146 /* tab control widget */ |
3088 INITIALIZE_DEVICE_IIFORMAT (mswindows, tab_control); | 3147 INITIALIZE_DEVICE_IIFORMAT (mswindows, tab_control); |
3089 IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, instantiate); | 3148 IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, instantiate); |
3090 IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, update); | 3149 IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, update); |
3091 #endif | 3150 #endif |