blob: 21d77f7e3e3fbc4e77d999c5bc3f5c31967def0a [file] [log] [blame]
Alexandre Julliard21979011997-03-05 08:22:35 +00001/*
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"
Alexandre Julliard61fece01999-06-26 19:09:08 +000013#include "debugtools.h"
Alexandre Julliard21979011997-03-05 08:22:35 +000014
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000015DEFAULT_DEBUG_CHANNEL(gdi)
16
Alexandre Julliard21979011997-03-05 08:22:35 +000017
Alexandre Julliarda3960291999-02-26 11:11:13 +000018extern HBITMAP WIN16DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
Alexandre Julliard21979011997-03-05 08:22:35 +000019 BITMAPOBJ * bmp );
Alexandre Julliarda3960291999-02-26 11:11:13 +000020extern HBRUSH WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush,
Alexandre Julliard21979011997-03-05 08:22:35 +000021 BRUSHOBJ * brush );
Alexandre Julliarda3960291999-02-26 11:11:13 +000022extern HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont,
Alexandre Julliard21979011997-03-05 08:22:35 +000023 FONTOBJ * font );
Alexandre Julliarda3960291999-02-26 11:11:13 +000024extern HPEN WIN16DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen );
Alexandre Julliard21979011997-03-05 08:22:35 +000025
26
27/***********************************************************************
Alexandre Julliard670cdc41997-08-24 16:00:30 +000028 * WIN16DRV_SelectObject
Alexandre Julliard21979011997-03-05 08:22:35 +000029 */
Alexandre Julliarda3960291999-02-26 11:11:13 +000030HGDIOBJ WIN16DRV_SelectObject( DC *dc, HGDIOBJ handle )
Alexandre Julliard21979011997-03-05 08:22:35 +000031{
32 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
Alexandre Julliarda3960291999-02-26 11:11:13 +000033 HGDIOBJ ret = 0;
Alexandre Julliard21979011997-03-05 08:22:35 +000034
35 if (!ptr) return 0;
Alexandre Julliard61fece01999-06-26 19:09:08 +000036 TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
Alexandre Julliard21979011997-03-05 08:22:35 +000037
38 switch(ptr->wMagic)
39 {
40 case PEN_MAGIC:
Alexandre Julliard17216f51997-10-12 16:30:17 +000041 ret = WIN16DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
42 break;
Alexandre Julliard21979011997-03-05 08:22:35 +000043 case BRUSH_MAGIC:
Alexandre Julliard17216f51997-10-12 16:30:17 +000044 ret = WIN16DRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
45 break;
Alexandre Julliard21979011997-03-05 08:22:35 +000046 case BITMAP_MAGIC:
Alexandre Julliard61fece01999-06-26 19:09:08 +000047 FIXME("WIN16DRV_SelectObject for BITMAP not implemented\n");
Alexandre Julliard17216f51997-10-12 16:30:17 +000048 ret = 1;
49 break;
Alexandre Julliard21979011997-03-05 08:22:35 +000050 case FONT_MAGIC:
Alexandre Julliard670cdc41997-08-24 16:00:30 +000051 ret = WIN16DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
52 break;
Alexandre Julliard21979011997-03-05 08:22:35 +000053 case REGION_MAGIC:
Alexandre Julliard670cdc41997-08-24 16:00:30 +000054 ret = (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
55 break;
Alexandre Julliard21979011997-03-05 08:22:35 +000056 }
Alexandre Julliard2a2321b2000-08-19 21:38:55 +000057 GDI_ReleaseObj( handle );
Alexandre Julliard670cdc41997-08-24 16:00:30 +000058 return ret;
Alexandre Julliard21979011997-03-05 08:22:35 +000059}