Release 970202
[wine] / graphics / x11drv / objects.c
1 /*
2  * GDI objects
3  *
4  * Copyright 1993 Alexandre Julliard
5  */
6
7 #include <stdlib.h>
8 #include <stdio.h>
9 #include "bitmap.h"
10 #include "brush.h"
11 #include "font.h"
12 #include "pen.h"
13 #include "stddebug.h"
14 #include "debug.h"
15
16
17 extern HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
18                                              BITMAPOBJ * bmp );
19 extern HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
20                                            BRUSHOBJ * brush );
21 extern HFONT32 X11DRV_FONT_SelectObject( DC * dc, HFONT32 hfont,
22                                          FONTOBJ * font );
23 extern HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen );
24
25
26 /***********************************************************************
27  *           X11DRV_SelectObject
28  */
29 HGDIOBJ32 X11DRV_SelectObject( DC *dc, HGDIOBJ32 handle )
30 {
31     GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
32
33     if (!ptr) return 0;
34     dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
35     
36     switch(ptr->wMagic)
37     {
38       case PEN_MAGIC:
39           return X11DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
40       case BRUSH_MAGIC:
41           return X11DRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
42       case BITMAP_MAGIC:
43           return X11DRV_BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
44       case FONT_MAGIC:
45           return X11DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );          
46       case REGION_MAGIC:
47           return (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
48     }
49     return 0;
50 }