1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
#include "makewindows.h"
#include "editorsDlgProc.h"
DLGPROC procs[NUM_PAGES] =
{
&IMsgsDlgProc,
&PlyDlgProc,
&VictDlgProc,
&DisDlgProc,
&MapDlgProc,
&UnitDlgProc,
&TrigDlgProc,
&Units2DlgProc,
&Triggers2DlgProc
};
HWND MakeMapView(HWND sheet, int cmdshow)
{
HWND ret;
RECT rect;
GetWindowRect(sheet, &rect);
ret = CreateMapView(sheet, rect.right + MAP_OFFSET, rect.top, &scen);
ShowWindow(ret, cmdshow);
return ret;
}
/*
MakeSheet: Creates the main property sheet window.
Parameters:
HINSTANCE app: Handle to the application loading the sheet.
Note: Called once and only once by WinMain().
*/
HWND MakeSheet(HINSTANCE app)
{
PROPSHEETHEADER header;
HPROPSHEETPAGE pages[NUM_PAGES];
PROPSHEETPAGE pg; //used to create each page
HWND sheet;
//create pages
pg.dwSize = sizeof(PROPSHEETPAGE);
pg.dwFlags = PSP_DEFAULT;
pg.hInstance = app;
for (int i = 0; i < NUM_PAGES; i++)
{
pg.pszTemplate = MAKEINTRESOURCE(IDD_MSGS + i); //template IDs are in display order
/*
switch (i){
case 5: // Units
pagesBackup.Units1 = pg.pszTemplate;
break;
case 6: // Triggers
pagesBackup.Triggers1 = pg.pszTemplate;
break;
case 7: // Units 2
pagesBackup.Units2 = pg.pszTemplate;
break;
case 8: // Triggers 2
pagesBackup.Triggers2 = pg.pszTemplate;
break;
}
*/
pg.pfnDlgProc = procs[i];
pg.lParam = 0;
pages[i] = CreatePropertySheetPage(&pg);
}
//create sheet
header.dwSize = sizeof(header);
header.dwFlags = PSH_MODELESS | PSH_USECALLBACK |
PSH_NOAPPLYNOW | PSH_NOCONTEXTHELP | PSH_USEICONID;
header.hwndParent = NULL;
header.hInstance = app;
header.pszIcon = MAKEINTRESOURCE(IDI_LOGO);
header.pszCaption = szTitle;
header.nPages = NUM_PAGES;
header.nStartPage = 0;
header.phpage = pages;
header.pfnCallback = &PropSheetProc;
sheet = (HWND)PropertySheet(&header);
/* Remove Units and Triggers Page
until the Scenario is loaded;
The Units 2 and Triggers 2 Pages will be there
*/
PropSheet_RemovePage( sheet, 5, pages[5] );
PropSheet_RemovePage( sheet, 6, pages[6] );
//add status bar here (can't be done in PropertySheetProc)
propdata.statusbar = CreateWindow(STATUSCLASSNAME, welcome,
WS_CHILD | WS_VISIBLE, 0, 0, 0, 0,
sheet, (HMENU)IDS_MAIN, aokts, NULL);
return sheet;
}
// HINSTANCE app: Handle to the application using the sheet
HWND SwitchPages(HINSTANCE app, HWND hPropSheetDlg, scenario * scenario )
{
PropSheet_RemovePage( sheet, 5, pages[5] );
PropSheet_RemovePage( sheet, 6, pages[6] );
if ( scenario.isOpen() )
{
PropSheet_InsertPage( HWND hPropSheetDlg, 5, hpage);
PropSheet_InsertPage( HWND hPropSheetDlg, 6, hpage);
);
}
else
{
PropSheet_InsertPage( HWND hPropSheetDlg, 7, hpage);
PropSheet_InsertPage( HWND hPropSheetDlg, 8, hpage);
}
}
|