xwords/wince/cemain.h

155 lines
3.3 KiB
C
Raw Normal View History

2003-11-20 17:26:35 +01:00
/* -*-mode: C; fill-column: 78; c-basic-offset: 4;-*- */
/*
* Copyright 2000-2002 by Eric House (xwords@eehouse.org). All rights reserved.
2003-11-20 17:26:35 +01:00
*
* 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.
*/
#ifndef _CEMAIN_H_
#define _CEMAIN_H_
#ifndef CANT_DO_SHELL_THING
# include <aygshell.h>
#endif
2003-11-20 17:26:35 +01:00
#include "draw.h"
#include "game.h"
#include "util.h"
#include "mempool.h"
#include "cesockwr.h"
2004-03-28 03:14:34 +02:00
enum { BONUS1_COLOR,
BONUS2_COLOR,
BONUS3_COLOR,
BONUS4_COLOR,
BKG_COLOR,
TILEBACK_COLOR,
USER_COLOR1,
USER_COLOR2,
USER_COLOR3,
USER_COLOR4,
BLACK_COLOR, /* not editable by users */
WHITE_COLOR,
NUM_COLORS /* last */
};
#define CUR_CE_PREFS_FLAGS 0x0002
2003-11-20 17:26:35 +01:00
typedef struct CEAppPrefs {
XP_U16 versionFlags;
CommonPrefs cp;
2004-03-28 03:14:34 +02:00
COLORREF colors[NUM_COLORS];
2003-11-20 17:26:35 +01:00
XP_Bool showColors;
} CEAppPrefs;
#define NUM_BUTTONS 4
typedef struct CEAppGlobals {
HINSTANCE hInst;
HDC hdc; /* to pass drawing ctxt to draw code */
HWND hWnd;
#if defined TARGET_OS_WINCE
2003-11-20 17:26:35 +01:00
HWND hwndCB;
#endif
2003-11-20 17:26:35 +01:00
HWND buttons[NUM_BUTTONS];
#ifndef CANT_DO_SHELL_THING
SHACTIVATEINFO sai;
#endif
2003-11-20 17:26:35 +01:00
DrawCtx* draw;
XWGame game;
CurGameInfo gameInfo;
XP_UCHAR* curGameName; /* path to storage for current game */
XW_UtilCtxt util;
VTableMgr* vtMgr;
2004-01-29 05:45:53 +01:00
XP_U16* bonusInfo;
wchar_t* lastDefaultDir;
2003-11-20 17:26:35 +01:00
2005-08-21 16:05:29 +02:00
XP_U32 timerIDs[NUM_TIMERS_PLUS_ONE];
TimerProc timerProcs[NUM_TIMERS_PLUS_ONE];
void* timerClosures[NUM_TIMERS_PLUS_ONE];
2004-06-16 06:16:22 +02:00
2005-02-05 22:38:04 +01:00
#ifdef CEFEATURE_CANSCROLL
XP_U16 nHiddenRows;
HWND scrollHandle;
#endif
CeSocketWrapper* socketWrap;
2003-11-20 17:26:35 +01:00
CEAppPrefs appPrefs;
XP_Bool isNewGame;
XP_Bool penDown;
XP_Bool hintPending;
XP_Bool doGlobalPrefs;
2004-07-10 19:43:15 +02:00
#ifdef XWFEATURE_SEARCHLIMIT
XP_Bool askTrayLimits;
#endif
2003-11-20 17:26:35 +01:00
MPSLOT
} CEAppGlobals;
#define GAME_IN_PROGRESS(g) ((g)->gameInfo.dictName != 0)
enum {
XWWM_TIME_RQST = WM_APP
,XWWM_PACKET_ARRIVED
2003-11-20 17:26:35 +01:00
};
2004-03-28 03:14:34 +02:00
#define NUM_EDITABLE_COLORS BLACK_COLOR
2003-11-20 17:26:35 +01:00
typedef struct CEDrawCtx {
DrawCtxVTable* vtable;
HWND mainWin;
CEAppGlobals* globals;
COLORREF prevBkColor;
HBRUSH brushes[NUM_COLORS];
HFONT trayFont;
HFONT selPlayerFont;
HFONT playerFont;
HBITMAP rightArrow;
HBITMAP downArrow;
HBITMAP origin;
XP_U16 trayOwner;
2004-03-02 04:26:35 +01:00
XP_U16 miniLineHt;
2003-11-20 17:26:35 +01:00
MPSLOT
} CEDrawCtx;
DrawCtx* ce_drawctxt_make( MPFORMAL HWND mainWin, CEAppGlobals* globals );
2004-03-28 03:14:34 +02:00
void ce_drawctxt_update( DrawCtx* dctx, CEAppGlobals* globals );
2003-11-20 17:26:35 +01:00
#ifdef DEBUG
2006-01-31 15:40:49 +01:00
void logLastError( const char* comment );
#else
# define logLastError(c)
#endif
2003-11-20 17:26:35 +01:00
#endif /* _CEMAIN_H_ */