Add ProgramData to the env var whitelist for running scripts
[cygwin-setup.git] / proppage.h
blob9424ffc21a4a05ac9de0e3343c8ec633c61d6ad3
1 /*
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
10 * http://www.gnu.org/
12 * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
16 #ifndef SETUP_PROPPAGE_H
17 #define SETUP_PROPPAGE_H
19 // This is the header for the PropertyPage class. It works closely with the
20 // PropSheet class to implement a single page of the property sheet.
23 #include <map>
24 #include "win32.h"
25 #include <prsht.h>
27 #include "window.h"
28 #include "ControlAdjuster.h"
30 class PropSheet;
32 class PropertyPage:public Window
34 static bool DoOnceForSheet;
35 PROPSHEETPAGE psp;
36 DLGPROC proc;
37 BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, UINT code);
39 // The sheet that owns this page.
40 PropSheet *OurSheet;
42 // For setting the back/finish buttons properly.
43 bool IsFirst, IsLast;
45 static INT_PTR CALLBACK FirstDialogProcReflector (HWND hwnd, UINT message,
46 WPARAM wParam,
47 LPARAM lParam);
48 static INT_PTR CALLBACK DialogProcReflector (HWND hwnd, UINT message,
49 WPARAM wParam, LPARAM lParam);
50 void setTitleFont ();
52 // this is an internal structure that is used to store information
53 // about static text controls in the dialog that have been turned
54 // into clickable URLs
55 typedef struct
57 // the URL to load when clicked
58 std::string url;
60 // location of the control's original winproc that we are subclassing
61 WNDPROC origWinProc;
63 // font handle; note: it's our responsibility to DeleteObject() this
64 HFONT font;
66 // handle to the brush we return in response to WM_CTLCOLORSTATIC
67 HBRUSH brush;
68 } ClickableURL;
70 // the list of controls that we have modified to be clickable is
71 // stored in the following which maps the ID to the above data
72 static std::map <int, ClickableURL> urls;
74 // subclass the static control with this winproc
75 static LRESULT CALLBACK urlWinProc (HWND hwnd, UINT uMsg, WPARAM wParam,
76 LPARAM lParam);
78 protected:
79 SizeProcessor sizeProcessor;
81 virtual INT_PTR CALLBACK DialogProc (UINT message, WPARAM wParam,
82 LPARAM lParam);
83 virtual INT_PTR CALLBACK OnMouseWheel (UINT message, WPARAM wParam,
84 LPARAM lParam);
85 virtual INT_PTR CALLBACK OnTimerMessage (UINT message, WPARAM wParam,
86 LPARAM lparam);
88 public:
89 PropertyPage ();
90 virtual ~ PropertyPage ();
92 PROPSHEETPAGE *GetPROPSHEETPAGEPtr ()
94 return &psp;
97 // FIXME: These should be private and friended to PropSheet.
98 void YouAreBeingAddedToASheet (PropSheet * ps)
100 OurSheet = ps;
102 void YouAreFirst ()
104 IsFirst = true;
105 IsLast = false;
107 void YouAreLast ()
109 IsFirst = false;
110 IsLast = true;
112 void YouAreMiddle ()
114 IsFirst = false;
115 IsLast = false;
118 virtual bool Create (int TemplateID);
119 virtual bool Create (DLGPROC dlgproc, int TemplateID);
120 virtual bool Create (DLGPROC dlgproc,
121 BOOL (*cmdproc) (HWND h, int id, HWND hwndctl,
122 UINT code), int TemplateID);
124 virtual void OnInit ()
127 virtual void OnActivate ()
130 virtual bool wantsActivation () const
132 return true;
134 virtual void OnDeactivate ()
138 // Overload these to perform special processing when the user hits
139 // "Next" or "Back". Return:
140 // 0 == Go to next/previous page in sequence.
141 // -1 == Prevent wizard from changing page.
142 // Resource ID == go to a specific page specified by the resource ID.
143 virtual long OnNext ()
145 return 0;
147 virtual long OnBack ()
149 return 0;
152 virtual bool OnFinish ()
154 return true;
156 virtual long OnUnattended ()
158 return -2;
161 PropSheet *GetOwner () const
163 return OurSheet;
166 void makeClickable (int id, std::string link);
169 #endif /* SETUP_PROPPAGE_H */