]>
cygwin.com Git - cygwin-apps/setup.git/blob - proppage.cc
2 * Copyright (c) 2001, 2002, 2003 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"
25 #include "getopt++/BoolOption.h"
27 bool PropertyPage::DoOnceForSheet
= true;
29 PropertyPage::PropertyPage ()
37 PropertyPage::~PropertyPage ()
41 bool PropertyPage::Create (int TemplateID
)
43 return Create (NULL
, NULL
, TemplateID
);
46 bool PropertyPage::Create (DLGPROC dlgproc
, int TemplateID
)
48 return Create (dlgproc
, NULL
, TemplateID
);
52 PropertyPage::Create (DLGPROC dlgproc
,
53 BOOL (*cproc
) (HWND h
, int id
, HWND hwndctl
,
54 UINT code
), int TemplateID
)
56 psp
.dwSize
= sizeof (PROPSHEETPAGE
);
58 psp
.hInstance
= GetInstance ();
59 psp
.pfnDlgProc
= FirstDialogProcReflector
;
60 psp
.pszTemplate
= MAKEINTRESOURCE(TemplateID
);
61 psp
.lParam
= (LPARAM
) this;
62 psp
.pfnCallback
= NULL
;
71 PropertyPage::FirstDialogProcReflector (HWND hwnd
, UINT message
,
72 WPARAM wParam
, LPARAM lParam
)
76 if (message
!= WM_INITDIALOG
)
78 // Don't handle anything until we get a WM_INITDIALOG message, which
79 // will have our 'this' pointer with it.
83 This
= (PropertyPage
*) (((PROPSHEETPAGE
*) lParam
)->lParam
);
85 SetWindowLong (hwnd
, DWL_USER
, (DWORD
) This
);
86 SetWindowLong (hwnd
, DWL_DLGPROC
, (DWORD
) DialogProcReflector
);
89 return This
->DialogProc (message
, wParam
, lParam
);
93 PropertyPage::DialogProcReflector (HWND hwnd
, UINT message
, WPARAM wParam
,
98 This
= (PropertyPage
*) GetWindowLong (hwnd
, DWL_USER
);
100 return This
->DialogProc (message
, wParam
, lParam
);
104 PropertyPage::DialogProc (UINT message
, WPARAM wParam
, LPARAM lParam
)
108 proc (GetHWND (), message
, wParam
, lParam
);
121 // TRUE = Set focus to default control (in wParam).
126 switch (((NMHDR FAR
*) lParam
)->code
)
129 SetWindowLong (GetHWND (), DWL_MSGRESULT
, PSNRET_NOERROR
);
136 // Tell our parent PropSheet what its own HWND is.
137 GetOwner ()->SetHWNDFromPage (((NMHDR FAR
*) lParam
)->
139 GetOwner ()->CenterWindow ();
140 DoOnceForSheet
= false;
143 // Set the wizard buttons apropriately
146 // Disable "Back" on first page.
147 GetOwner ()->SetButtons (PSWIZB_NEXT
);
151 // Disable "Next", enable "Finish" on last page
152 GetOwner ()->SetButtons (PSWIZB_BACK
| PSWIZB_FINISH
);
156 // Middle page, enable both "Next" and "Back" buttons
157 GetOwner ()->SetButtons (PSWIZB_BACK
| PSWIZB_NEXT
);
160 if(!wantsActivation())
162 ::SetWindowLong (GetHWND (), DWL_MSGRESULT
, -1);
170 // -2 == disable unattended mode, display page
171 // -1 == display page but stay in unattended mode (progress bars)
172 // 0 == skip to next page
173 // IDD_* == skip to specified page
174 long nextwindow
= OnUnattended();
175 if (nextwindow
== -2)
177 unattended_mode
= false;
178 SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
181 else if (nextwindow
== -1)
183 SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
186 else if (nextwindow
== 0)
188 SetWindowLong (GetHWND (), DWL_MSGRESULT
, -1);
193 SetWindowLong (GetHWND (), DWL_MSGRESULT
, nextwindow
);
199 // 0 == Accept activation, -1 = Don't accept
200 ::SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
208 // FALSE = Allow deactivation
209 SetWindowLong (GetHWND (), DWL_MSGRESULT
, FALSE
);
216 SetWindowLong (GetHWND (), DWL_MSGRESULT
, retval
);
224 SetWindowLong (GetHWND (), DWL_MSGRESULT
, retval
);
229 retval
= OnFinish ();
230 // False = Allow the wizard to finish
231 SetWindowLong (GetHWND (), DWL_MSGRESULT
, FALSE
);
235 // Unrecognized notification
245 OnMessageCmd (LOWORD (wParam
), (HWND
) lParam
, HIWORD (wParam
));
249 SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
252 else if (cmdproc
!= NULL
)
254 return HANDLE_WM_COMMAND (GetHWND (), wParam
, lParam
, cmdproc
);
262 if ((message
>= WM_APP
) && (message
< 0xC000))
264 // It's a private app message
265 return OnMessageApp (message
, wParam
, lParam
);
273 PropertyPage::setTitleFont ()
275 // These font settings will just silently fail when the resource id
276 // is not present on a page.
277 // Set header title font of each internal page
278 SetDlgItemFont(IDC_STATIC_HEADER_TITLE
, "MS Shell Dlg", 8, FW_BOLD
);
279 // Set the font for the IDC_STATIC_WELCOME_TITLE
280 SetDlgItemFont(IDC_STATIC_WELCOME_TITLE
, "Arial", 12, FW_BOLD
);
This page took 0.048423 seconds and 5 git commands to generate.