/*  Archiving Category for Matrix
    Copyright (C)  1993  The Board of Trustees of
    The Leland Stanford Junior University.  All Rights Reserved.

Authors: Paul Kunz, Imran Qureshi and Libing Wang

 * This file is part of the nib translator for 
 * an Objective-C class library for X/Motif

XmMatrix.m,v 1.14 1995/01/03 21:27:23 pfkeb Exp

*/

#include "/NextDeveloper/Headers/objc/typedstream.h"
#include "/NextDeveloper/Headers/objc/Object.h"

#define NXTypedStream TypedStream
#include <objc/typedstream.h>
#include <appkit/Matrix.h>
#include <stdlib.h>

@interface Matrix (XmArchiving)
- write:(TypedStream *)stream;
@end

#include "archive-def.h"

@implementation Matrix (XmArchiving)
- write:(TypedStream *)stream
{
    char	*cellClassName;
    int		mode;
    int		h, w;

    [super write:stream];
    
#ifdef DEBUG
    printf("->Matrix");
#endif

    objc_write_object(stream, cellList);

    if ( cellClass ) {
        cellClassName = NXCopyStringBuffer([cellClass name]);
    } else {
        cellClassName = NXCopyStringBuffer("");
    }
    objc_write_type(stream, "*", &cellClassName);
    objc_write_object(stream, protoCell);
    w = cellSize.width;
    h = cellSize.height;
    objc_write_types(stream, "ii", &w, &h);
    objc_write_types(stream, "ii", &numRows, &numCols);
    objc_write_types(stream, "ii", &selectedRow, &selectedCol);
    mode = mFlags.radioMode;
    objc_write_type(stream, "i", &mode);
    
    free(cellClassName);
    return self;
}
@end
