/* * * Copyright (c) 1995 * Knowledge Science Institute, University of Calgary * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. The Knowledge Science Institute makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ #ifndef MPLATFORM_H #define MPLATFORM_H #define override virtual //#define hide virtual int askUser_string(const char* title, const char* prompt, char* buf, unsigned int siz); #ifdef _Windows //****************************** MS WINDOWS ************************************ #ifdef __BCPLUSPLUS__ //---Borland C++ #ifndef OWL_OWLALL_H #pragma hdrfile "owlpch.csm" #include #pragma hdrstop #endif //so STL doesn't try to redefine new(size,void*)... #define NEW_ARENA_DEFINED 1 #else //---Non-Borland #ifndef __WINDOWS_H #include #endif #endif #ifndef MAXLONG #include #endif #ifdef __WIN32__ #define huge #endif #define DEVICE HDC #define WINDOWHANDLE HWND #define MENU HMENU #define CURSOR HCURSOR #ifdef __WIN32__ #define COORDINATE_INDICI long #else #define COORDINATE_INDICI short #endif #define POINT POINT #define RECTANGLE RECT #define COLOR long const RECTANGLE RECTANGLE_EMPTY = {0,0,0,0}; const RECTANGLE MAXRECTANGLE = {-MAXLONG,-MAXLONG,MAXLONG,MAXLONG}; const COLOR COLOR_WHITE = 0xFFFFFFL; const COLOR COLOR_BLACK = 0L; int MRectangle(DEVICE, RECTANGLE, COLOR* fill=NULL, COLOR* border=NULL, int width=1, unsigned long style=PS_SOLID); int MEllipse(DEVICE, RECTANGLE, COLOR* fill=NULL, COLOR* border=NULL, int width=1, unsigned long style=PS_SOLID); int MRoundRect(DEVICE, RECTANGLE, COORDINATE_INDICI w, COORDINATE_INDICI h, COLOR* fill=NULL, COLOR* border=NULL, int width=1, unsigned long style=PS_SOLID); int MPolygon(DEVICE, POINT* pVector, int count, COLOR* fill=NULL, COLOR* border=NULL, int width=1, unsigned long style=PS_SOLID); int MDrawLine(DEVICE,POINT,POINT, COLOR* color=NULL, int width=1, unsigned long style=PS_SOLID); bool MIsPointInRectangle(POINT, RECTANGLE); bool MIsPointInEllipse(POINT, RECTANGLE); bool MIsPointInRoundRect(POINT, RECTANGLE, COORDINATE_INDICI w, COORDINATE_INDICI h); bool MIsPointInPolygon(POINT, POINT* pVector, int count); #define createPopupMenu CreatePopupMenu #define appendMenu_String(menu,id,stringVal) AppendMenu(menu,MF_ENABLED|MF_STRING,id,stringVal) #define appendMenu_Popup(menu,popup,stringVal) AppendMenu(menu,MF_ENABLED|MF_POPUP,(unsigned int)popup,stringVal) #define appendMenu_Separator(menu) AppendMenu(menu,MF_SEPARATOR,0,NULL) #define destroyMenu(menu) ::DestroyMenu(menu) #else //***************************** UNKNOWN OS ************************************* #define huge typedef int DEVICE; typedef int WINDOWHANDLE; typedef int MENU; typedef int CURSOR; typedef long COORDINATE_INDICI; typedef struct {COORDINATE_INDICI x; COORDINATE_INDICI y;} POINT; typedef struct {COORDINATE_INDICI left; COORDINATE_INDICI top; COORDINATE_INDICI right; COORDINATE_INDICI bottom;} RECTANGLE; typedef unsigned long COLOR; const RECTANGLE RECTANGLE_EMPTY = {0,0,0,0}; const RECTANGLE MAXRECTANGLE = {-MAXLONG,MAXLONG,-MAXLONG,MAXLONG}; const COLOR COLOR_WHITE = 0xFFFFFFL; const COLOR COLOR_BLACK = 0L; #define MRectange(device,rect) error(0,'W',"Call on unspecified M-function MRectangle()") #define MEllipse(device,rect) error(0,'W',"Call on unspecified M-function MEllipse()") #define MRoundRect(device,rect,w,h) error(0,'W',"Call on unspecified M-function MRoundRect()") #define createPopupMenu error(0,'W',"Call on unspecified M-function createPopupMenu()") #define appendMenu_String(menu,id,stringVal) error(0,'W',"Call on unspecified M-function appendMenu_String()") #define appendMenu_Popup(menu,popup,stringVal) error(0,'W',"Call on unspecified M-function appendMenu_Popup()") #define appendMenu_Separator(menu) error(0,'W',"Call on unspecified M-function appendMenu_Separator()") #define destroyMenu(menu) error(0,'W',"Call on unspecified M-function destroyMenu()") #endif //****************************** ALL OSs ************************************ int trackPopupMenu(MENU& menu, POINT& pt, char* menuName, int len); typedef enum {N=0x1,E=0x2,S=0x4,W=0x8,NE=0x3,NW=0x9,SW=0xC,SE=0x6} COMPASEPOINTS; RECTANGLE trackRectangle(RECTANGLE r, COMPASEPOINTS p=SE, WINDOWHANDLE hwnd=0); POINT trackElasticLine(POINT anchor, POINT movePoint, WINDOWHANDLE hwnd=0); //#ifndef ERROR_H // #include //#endif #endif