]>
cygwin.com Git - cygwin-apps/setup.git/blob - proppage.cc
2 * Copyright (c) 2001, Gary R. Van Sickle.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
16 // This is the implementation of the PropertyPage class. It works closely with the
17 // PropSheet class to implement a single page of the property sheet.
20 #include "propsheet.h"
24 bool PropertyPage::DoOnceForSheet
= true;
26 PropertyPage::PropertyPage ()
34 PropertyPage::~PropertyPage ()
38 bool PropertyPage::Create (int TemplateID
)
40 return Create (NULL
, NULL
, TemplateID
);
43 bool PropertyPage::Create (DLGPROC dlgproc
, int TemplateID
)
45 return Create (dlgproc
, NULL
, TemplateID
);
49 PropertyPage::Create (DLGPROC dlgproc
,
50 BOOL (*cproc
) (HWND h
, int id
, HWND hwndctl
,
51 UINT code
), int TemplateID
)
53 psp
.dwSize
= sizeof (PROPSHEETPAGE
);
55 psp
.hInstance
= GetInstance ();
56 psp
.pfnDlgProc
= FirstDialogProcReflector
;
57 psp
.pszTemplate
= (LPCSTR
) TemplateID
;
58 psp
.lParam
= (LPARAM
) this;
59 psp
.pfnCallback
= NULL
;
68 PropertyPage::FirstDialogProcReflector (HWND hwnd
, UINT message
,
69 WPARAM wParam
, LPARAM lParam
)
73 if (message
!= WM_INITDIALOG
)
75 // Don't handle anything until we get a WM_INITDIALOG message, which
76 // will have our this pointer with it.
80 This
= (PropertyPage
*) (((PROPSHEETPAGE
*) lParam
)->lParam
);
82 SetWindowLong (hwnd
, DWL_USER
, (DWORD
) This
);
83 SetWindowLong (hwnd
, DWL_DLGPROC
, (DWORD
) DialogProcReflector
);
86 return This
->DialogProc (message
, wParam
, lParam
);
90 PropertyPage::DialogProcReflector (HWND hwnd
, UINT message
, WPARAM wParam
,
95 This
= (PropertyPage
*) GetWindowLong (hwnd
, DWL_USER
);
97 return This
->DialogProc (message
, wParam
, lParam
);
101 PropertyPage::DialogProc (UINT message
, WPARAM wParam
, LPARAM lParam
)
105 proc (GetHWND (), message
, wParam
, lParam
);
116 // Set header title font of each internal page to MS Sans Serif, Bold, 8 Pt.
117 // This will just silently fail on the first and last pages.
118 SetDlgItemFont(IDC_STATIC_HEADER_TITLE
, "MS Sans Serif", 8, FW_BOLD
);
120 // TRUE = Set focus to default control (in wParam).
125 switch (((NMHDR FAR
*) lParam
)->code
)
128 SetWindowLong (GetHWND (), DWL_MSGRESULT
, PSNRET_NOERROR
);
135 // Tell our parent PropSheet what its own HWND is.
136 GetOwner ()->SetHWNDFromPage (((NMHDR FAR
*) lParam
)->
138 GetOwner ()->CenterWindow ();
139 DoOnceForSheet
= false;
142 // Set the wizard buttons apropriately
145 // Disable "Back" on first page.
146 GetOwner ()->SetButtons (PSWIZB_NEXT
);
150 // Disable "Next", enable "Finish" on last page
151 GetOwner ()->SetButtons (PSWIZB_BACK
| PSWIZB_FINISH
);
155 // Middle page, enable both "Next" and "Back" buttons
156 GetOwner ()->SetButtons (PSWIZB_BACK
| PSWIZB_NEXT
);
161 // 0 == Accept activation, -1 = Don't accept
162 ::SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
168 // FALSE = Allow deactivation
169 SetWindowLong (GetHWND (), DWL_MSGRESULT
, FALSE
);
176 SetWindowLong (GetHWND (), DWL_MSGRESULT
, retval
);
184 SetWindowLong (GetHWND (), DWL_MSGRESULT
, retval
);
189 retval
= OnFinish ();
190 // False = Allow the wizard to finish
191 SetWindowLong (GetHWND (), DWL_MSGRESULT
, FALSE
);
195 // Unrecognized notification
205 OnMessageCmd (LOWORD (wParam
), (HWND
) lParam
, HIWORD (wParam
));
209 SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
212 else if (cmdproc
!= NULL
)
214 return HANDLE_WM_COMMAND (GetHWND (), wParam
, lParam
, cmdproc
);
222 if ((message
>= WM_APP
) && (message
< 0xC000))
224 // It's a private app message
225 return OnMessageApp (message
, wParam
, lParam
);
This page took 0.044482 seconds and 5 git commands to generate.