ftp.nice.ch/Attic/openStep/implementation/gnustep/sources/alpha-snapshots/gnustep-xdps-960621.tgz#/gnustep-xdps-960621/Source/PXKDPSContext.m

This is PXKDPSContext.m in view mode; [Download] [Up]

/* 
   PXKDPSContext.m

   NSDPSContext for GNUstep GUI X/DPS Backend

   Copyright (C) 1996 Free Software Foundation, Inc.

   Author:  Scott Christley <scottc@net-community.com>
   Date: March 1996
   
   This file is part of the GNUstep GUI X/DPS Backend.

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.
   
   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   If you are interested in a warranty or support for this source code,
   contact Scott Christley <scottc@net-community.com> for more information.
   
   You should have received a copy of the GNU Library General Public
   License along with this library; if not, write to the Free
   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ 

#include <gnustep/xdps/PXKDPSContext.h>

// Backend instance variables structure
typedef struct _PXKDPSContext_struct
{
  Display *display;
  GC context;
} PXKDPSContext_struct;

#define PXKDISPLAY (((PXKDPSContext_struct *)be_context_reserved)->display)
#define PXKGC (((PXKDPSContext_struct *)be_context_reserved)->context)

//
// The backend implementation of NSDPSContext
//
@implementation PXKDPSContext

// Default initializer
- initWithMutableData:(NSMutableData *)data
	 forDebugging:(BOOL)debug
     languageEncoding:(DPSProgramEncoding)langEnc
	 nameEncoding:(DPSNameEncoding)nameEnc
	     textProc:(DPSTextProc)tProc
	    errorProc:(DPSErrorProc)errorProc
{
  [super initWithMutableData: data
	 forDebugging: debug
	 languageEncoding: langEnc
	 nameEncoding: nameEnc
	 textProc: tProc
	 errorProc: errorProc];

  // Allocate backend structure
  be_context_reserved = malloc(sizeof(PXKDPSContext_struct));

  PXKDISPLAY = NULL;

  return self;
}

- (void)dealloc
{
  // Release backend structure
  free(be_context_reserved);

  [super dealloc];
}

@end

//
// Methods for XWindows implementation
//
@implementation PXKDPSContext (GNUstepXDPS)

- (Display *)xDisplay
{
  return PXKDISPLAY;
}

- (void)setXDisplay:(Display *)xdisplay
{
  PXKDISPLAY = xdisplay;
}

- (GC)xGC
{
  return PXKGC;
}

/* return the current GC because the drawer may want to restore */
- (GC)setGC:(GC)xgc
{
  GC temp = PXKGC;
  PXKGC = xgc;
  return temp;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.