1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-14 15:36:34 +00:00
Interlisp.maiko/inc/MyWindow.h

116 lines
3.6 KiB
C
Executable File

/* $Id: MyWindow.h,v 1.2 1999/01/03 02:05:47 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/************************************************************************/
/* */
/* M y W i n d o w . h */
/* */
/* */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* (C) Copyright 1989-92 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/* The contents of this file are proprietary information */
/* belonging to Venue, and are provided to you under license. */
/* They may not be further distributed or disclosed to third */
/* parties without the specific permission of Venue. */
/* */
/************************************************************************/
#include "ldeXdefs.h"
#define VERTICAL 0
#define HORIZONTAL 1
#define PERCENT_OF_SCREEN 95
#define SCROLL_PITCH 30
typedef struct _MyEvent
{
int type; /* Event type */
int (*func)(); /* Pointer to Event Handler */
struct _MyEvent *next; /* Pointer to next event */
} MyEvent;
typedef struct _MyWindow
{
char *name; /* name of this window */
Window win; /* window id */
int x,y; /* x and y coordinates */
int width,height;/* window size */
int border; /* border width */
GC *gc; /* Current GC */
unsigned long event_mask;
Cursor *cursor; /* Current Cursor */
int (*before_create)(); /* Pointer to Initializer */
int (*after_create)();
int (*before_resize)(); /* Pointer to Configurator */
int (*after_resize)();
int (*event_func)(); /* Pointer to Event Handler */
MyEvent *event_head;
struct _MyWindow *parent; /* pointer to parent window */
struct _MyWindow *next; /* pointer of next window */
} MyWindow;
typedef struct
{
int left_x; /* x cordinate of upperleft corner */
int top_y; /* y cordinate of upperlert corner */
int right_x; /* x cordinate of lowerright corner */
int bottom_y;/* y cordinate of lowerright corner */
} DisplayArea;
#define CreateWindow(display, parent_win,child_win) { \
if( parent_win && child_win ) { \
if( (child_win)->before_create ) \
((child_win)->before_create)(parent_win,child_win); \
(child_win)->win = XCreateSimpleWindow( display \
, (parent_win)->win \
, (child_win)->x \
, (child_win)->y \
, (child_win)->width \
, (child_win)->height \
, (child_win)->border \
, Black_Pixel \
, White_Pixel ); \
XLOCK; \
XFlush( display ); \
XUNLOCK; \
(child_win)->parent = parent_win; \
if( (child_win)->after_create ) \
((child_win)->after_create)(parent_win,child_win);\
} \
}
#define ResizeWindow(display,window) { \
if( window ) { \
if( (window)->before_resize ) \
((window)->before_resize)( window ); \
XLOCK;\
XMoveResizeWindow( (display) \
, (window)->win \
, (window)->x \
, (window)->y \
, (window)->width \
, (window)->height ); \
XFlush( display ); \
XUNLOCK; \
if( (window)->after_resize ) \
((window)->after_resize)( window ); \
} \
}
#define DefineCursor(display, window,mycursor) { \
XLOCK; \
XDefineCursor( display, (window)->win, *(mycursor) ); \
XFlush( display ); \
XUNLOCK; \
(window)->cursor = mycursor; \
}