]>
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"
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
= (LPCSTR
) 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
);
119 // Set header title font of each internal page to MS Sans Serif, Bold, 8 Pt.
120 // This will just silently fail on the first and last pages.
121 SetDlgItemFont(IDC_STATIC_HEADER_TITLE
, "MS Sans Serif", 8, FW_BOLD
);
123 // TRUE = Set focus to default control (in wParam).
128 switch (((NMHDR FAR
*) lParam
)->code
)
131 SetWindowLong (GetHWND (), DWL_MSGRESULT
, PSNRET_NOERROR
);
138 // Tell our parent PropSheet what its own HWND is.
139 GetOwner ()->SetHWNDFromPage (((NMHDR FAR
*) lParam
)->
141 GetOwner ()->CenterWindow ();
142 DoOnceForSheet
= false;
145 // Set the wizard buttons apropriately
148 // Disable "Back" on first page.
149 GetOwner ()->SetButtons (PSWIZB_NEXT
);
153 // Disable "Next", enable "Finish" on last page
154 GetOwner ()->SetButtons (PSWIZB_BACK
| PSWIZB_FINISH
);
158 // Middle page, enable both "Next" and "Back" buttons
159 GetOwner ()->SetButtons (PSWIZB_BACK
| PSWIZB_NEXT
);
166 // -2 == disable unattended mode, display page
167 // -1 == display page but stay in unattended mode (progress bars)
168 // 0 == skip to next page
169 // IDD_* == skip to specified page
170 long nextwindow
= OnUnattended();
171 if (nextwindow
== -2)
173 unattended_mode
= false;
174 SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
177 else if (nextwindow
== -1)
179 SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
182 else if (nextwindow
== 0)
184 SetWindowLong (GetHWND (), DWL_MSGRESULT
, -1);
189 SetWindowLong (GetHWND (), DWL_MSGRESULT
, nextwindow
);
195 // 0 == Accept activation, -1 = Don't accept
196 ::SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
204 // FALSE = Allow deactivation
205 SetWindowLong (GetHWND (), DWL_MSGRESULT
, FALSE
);
212 SetWindowLong (GetHWND (), DWL_MSGRESULT
, retval
);
220 SetWindowLong (GetHWND (), DWL_MSGRESULT
, retval
);
225 retval
= OnFinish ();
226 // False = Allow the wizard to finish
227 SetWindowLong (GetHWND (), DWL_MSGRESULT
, FALSE
);
231 // Unrecognized notification
241 OnMessageCmd (LOWORD (wParam
), (HWND
) lParam
, HIWORD (wParam
));
245 SetWindowLong (GetHWND (), DWL_MSGRESULT
, 0);
248 else if (cmdproc
!= NULL
)
250 return HANDLE_WM_COMMAND (GetHWND (), wParam
, lParam
, cmdproc
);
258 if ((message
>= WM_APP
) && (message
< 0xC000))
260 // It's a private app message
261 return OnMessageApp (message
, wParam
, lParam
);
This page took 0.047419 seconds and 5 git commands to generate.