diff options
Diffstat (limited to 'app/wlib/mswlib/mswint.h')
-rw-r--r-- | app/wlib/mswlib/mswint.h | 179 |
1 files changed, 98 insertions, 81 deletions
diff --git a/app/wlib/mswlib/mswint.h b/app/wlib/mswlib/mswint.h index e560053..5fd5da9 100644 --- a/app/wlib/mswlib/mswint.h +++ b/app/wlib/mswlib/mswint.h @@ -1,15 +1,31 @@ +/** \file mswint.h + * Windows specific definitions and prototypes for wlib + */ + +/* XTrackCAD - Model Railroad CAD + * Copyright (C) 2005 Dave Bullis + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + #include "wlib.h" #include "mswlib.h" -//#include "dynarr.h" -#include "common.h" -#ifndef WIN32 -/*#define CONTROL3D*/ -#endif -#include "stdio.h" +#include "dynarr.h" -#ifdef CONTROL3D -#include "ctl3d.h" -#endif +#include <FreeImage.h> +#include <stdio.h> #ifdef WIN32 #ifdef FAR @@ -40,39 +56,39 @@ #endif #ifndef CAST_AWAY_CONST - #define CAST_AWAY_CONST (char *) +#define CAST_AWAY_CONST (char *) #endif #define BOOL_T wBool_t -#define POS_T wPos_t #define INDEX_T wIndex_t #define INTEGER_T wInteger_t typedef enum { - W_MAIN, W_POPUP, - B_BUTTON, B_STRING, B_INTEGER, B_FLOAT, - B_LIST, B_DROPLIST, B_COMBOLIST, - B_RADIO, B_TOGGLE, - B_DRAW, B_TEXT, B_MESSAGE, B_LINES, - B_MENUITEM, B_CHOICEITEM, B_BOX, - B_BITMAP } wType_e; - -typedef void (*repaintProcCallback_p)( HWND, wControl_p ); -typedef void (*doneProcCallback_p)( wControl_p b ); -typedef LRESULT (*messageCallback_p)( wControl_p, HWND, UINT, WPARAM, LPARAM ); -typedef void (*setTriggerCallback_p)( wControl_p b ); -typedef void (*setBusyCallback_p)( wControl_p, BOOL_T ); -typedef void (*showCallback_p)( wControl_p, BOOL_T ); -typedef void (*setPosCallback_p)( wControl_p, wPos_t, wPos_t ); + W_MAIN, W_POPUP, + B_BUTTON, B_STRING, B_INTEGER, B_FLOAT, + B_LIST, B_DROPLIST, B_COMBOLIST, + B_RADIO, B_TOGGLE, + B_DRAW, B_TEXT, B_MESSAGE, B_LINES, + B_MENUITEM, B_CHOICEITEM, B_BOX, + B_BITMAP +} wType_e; + +typedef void ( *repaintProcCallback_p )( HWND, wControl_p ); +typedef void ( *doneProcCallback_p )( wControl_p b ); +typedef LRESULT( *messageCallback_p )( wControl_p, HWND, UINT, WPARAM, LPARAM ); +typedef void ( *setTriggerCallback_p )( wControl_p b ); +typedef void ( *setBusyCallback_p )( wControl_p, BOOL_T ); +typedef void ( *showCallback_p )( wControl_p, BOOL_T ); +typedef void ( *setPosCallback_p )( wControl_p, wWinPix_t, wWinPix_t ); typedef struct { - repaintProcCallback_p repaintProc; - doneProcCallback_p doneProc; - messageCallback_p messageProc; - setBusyCallback_p setBusyProc; - showCallback_p showProc; - setPosCallback_p setPosProc; - } callBacks_t; + repaintProcCallback_p repaintProc; + doneProcCallback_p doneProc; + messageCallback_p messageProc; + setBusyCallback_p setBusyProc; + showCallback_p showProc; + setPosCallback_p setPosProc; +} callBacks_t; #define CALLBACK_CNT (B_BOX+1) extern callBacks_t *mswCallBacks[CALLBACK_CNT]; @@ -83,67 +99,68 @@ extern callBacks_t *mswCallBacks[CALLBACK_CNT]; wControl_p next; \ wControl_p synonym; \ wWin_p parent; \ - POS_T x, y; \ - POS_T w, h; \ + wWinPix_t x, y; \ + wWinPix_t w, h; \ long option; \ - POS_T labelX, labelY; \ + wWinPix_t labelX, labelY; \ const char * labelStr; \ const char * helpStr; \ const char * tipStr; \ + char * errStr; \ HWND hWnd; \ void * data;\ wControl_p focusChainNext; \ - wBool_t shown; + wBool_t shown; \ + wBool_t hilite; struct wControl_t { - WOBJ_COMMON - }; + WOBJ_COMMON +}; typedef struct { - unsigned key; - wDrawColor color; - } wIconColorMap_t; + unsigned key; + wDrawColor color; +} wIconColorMap_t; #define mswIcon_bitmap (1) #define mswIcon_pixmap (2) struct wIcon_t { - int type; - wPos_t w; /**< width */ - wPos_t h; /**< height */ - wDrawColor color; - int colorcnt; /**< number of colors */ - RGBQUAD *colormap; - char *pixels; /**< pointer to pixel information */ - int transparent; /**< index of transparent color */ - }; + int type; + wWinPix_t w; /**< width */ + wWinPix_t h; /**< height */ + wDrawColor color; + int colorcnt; /**< number of colors */ + RGBQUAD *colormap; + char *pixels; /**< pointer to pixel information */ + int transparent; /**< index of transparent color */ +}; struct wDraw_t { - WOBJ_COMMON - HDC hDc; - double wFactor; - double hFactor; - double DPI; - wDrawRedrawCallBack_p drawRepaint; - wDrawActionCallBack_p action; - HBITMAP hBmMain; - HBITMAP hBmTemp; - HBITMAP hBmOld; - HPEN hPen; - HBRUSH hBrush; - wDraw_p drawNext; - wBool_t hasPalette; - int paletteClock; - HBITMAP hBmBackup; - HDC hDcBackup; - HBITMAP hBmBackupOld; - void *background; - wBool_t bTempMode; - wBool_t bCopiedMain; - - wPos_t lastX; - wPos_t lastY; - - }; + WOBJ_COMMON + HDC hDc; + double wFactor; + double hFactor; + double DPI; + wDrawRedrawCallBack_p drawRepaint; + wDrawActionCallBack_p action; + HBITMAP hBmMain; + HBITMAP hBmTemp; + HBITMAP hBmOld; + HPEN hPen; + HBRUSH hBrush; + wDraw_p drawNext; + wBool_t hasPalette; + int paletteClock; + HBITMAP hBmBackup; + HDC hDcBackup; + HBITMAP hBmBackupOld; + FIBITMAP *background; + wBool_t bTempMode; + wBool_t bCopiedMain; + wDrawPix_t lastX; + wDrawPix_t lastY; + +}; extern HINSTANCE mswHInst; extern char mswTmpBuff[1024]; @@ -168,7 +185,7 @@ void mswResize( wWin_p ); wControl_p mswMapIndex( INDEX_T ); void mswButtPush( wControl_p ); void * mswAlloc( wWin_p, wType_e, const char *, int, void *, int * ); -void mswComputePos( wControl_p, wPos_t, wPos_t ); +void mswComputePos( wControl_p, wWinPix_t, wWinPix_t ); void mswAddButton( wControl_p, BOOL_T, const char * ); void mswRepaintLabel( HWND, wControl_p ); int mswRegister( wControl_p ); @@ -178,7 +195,7 @@ void mswSetFocus( wControl_p ); void mswSetTrigger( wControl_p, setTriggerCallback_p ); void mswMenuPush( wControl_p ); void mswCreateCheckBitmaps( void ); -long FAR PASCAL XEXPORT mswDrawPush( HWND, UINT, UINT, LONG ); +LRESULT FAR PASCAL XEXPORT mswDrawPush( HWND, UINT, WPARAM, LPARAM ); #ifdef WIN32 DWORD GetTextExtent( HDC, CHAR *, UINT ); #endif @@ -186,7 +203,7 @@ void mswRedrawAll( void ); void mswRepaintAll( void ); HDC mswGetPrinterDC( void ); int mswMenuAccelerator( wWin_p, long ); -void mswMenuMove( wMenu_p, wPos_t, wPos_t ); +void mswMenuMove( wMenu_p, wWinPix_t, wWinPix_t ); void mswRegisterBitMap( HBITMAP ); void mswFontInit( void ); void mswInitColorPalette( void ); @@ -202,5 +219,5 @@ void deleteBitmaps( void ); void mswDrawIcon( HDC, int, int, wIcon_p, int, COLORREF, COLORREF ); /* gwin32.c*/ -char *g_win32_getlocale (void); +char *g_win32_getlocale( void ); |