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 124
|
#include "makewindows.h"
#include "editorsDlgProc.h"
DLGPROC procs[NUM_PAGES] =
{
&IMsgsDlgProc,
&PlyDlgProc,
&VictDlgProc,
&DisDlgProc,
&MapDlgProc,
&UnitDlgProc,
&TrigDlgProc,
&Units2DlgProc,
&Triggers2DlgProc
};
// PAGES_TEMPLATES_BACKUP pagesBackup;
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().
*/
HPROPSHEETPAGE pages[NUM_PAGES];
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
pg.pfnDlgProc = procs[i];
pg.lParam = 0;
pages[i] = CreatePropertySheetPage(&pg);
} // for
//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);
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, hApp, NULL);
return sheet;
}
// HINSTANCE app: Handle to the application using the sheet
void SwitchPages(HINSTANCE app, HWND hPropSheetDlg, Scenario * scenario )
{
PropSheet_RemovePage( hPropSheetDlg, 5, pages[5] );
PropSheet_RemovePage( hPropSheetDlg, 6, pages[6] );
// Add two pages
// PROPSHEETHEADER header;
HPROPSHEETPAGE pages[2];
PROPSHEETPAGE pg; //used to create each page
//create pages
pg.dwSize = sizeof(PROPSHEETPAGE);
pg.dwFlags = PSP_DEFAULT;
pg.hInstance = app;
for (int i = 0; i < 4; i++)
{
pg.pszTemplate = MAKEINTRESOURCE(IDD_MSGS + (i+5) ); //template IDs are in display order
pg.pfnDlgProc = procs[5+i];
pg.lParam = 0;
pages[i] = CreatePropertySheetPage(&pg);
} // for
if ( scenario->isOpen() )
{
PropSheet_InsertPage( hPropSheetDlg, 5, pages[0]);
PropSheet_InsertPage( hPropSheetDlg, 6, pages[1]);
}
else
{
PropSheet_InsertPage( hPropSheetDlg, 5, pages[2]);
PropSheet_InsertPage( hPropSheetDlg, 6, pages[3]);
}
}
|