]>
Commit | Line | Data |
---|---|---|
b7301c43 | 1 | /* |
5296fc07 | 2 | * Copyright (c) 2001, 2002, 2003 Gary R. Van Sickle. |
b7301c43 RC |
3 | * |
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. | |
8 | * | |
9 | * A copy of the GNU General Public License can be found at | |
10 | * http://www.gnu.org/ | |
11 | * | |
12 | * Written by Gary R. Van Sickle <g.r.vansickle@worldnet.att.net> | |
13 | * | |
14 | */ | |
15 | ||
c93bc6d0 MB |
16 | #ifndef SETUP_PROPPAGE_H |
17 | #define SETUP_PROPPAGE_H | |
18 | ||
b7301c43 RC |
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. | |
21 | ||
22 | ||
daab12c7 | 23 | #include <map> |
ac949c48 | 24 | #include "win32.h" |
b7301c43 RC |
25 | #include <prsht.h> |
26 | ||
27 | #include "window.h" | |
ee91d9be | 28 | #include "ControlAdjuster.h" |
b7301c43 RC |
29 | |
30 | class PropSheet; | |
31 | ||
32 | class PropertyPage:public Window | |
33 | { | |
34 | static bool DoOnceForSheet; | |
35 | PROPSHEETPAGE psp; | |
36 | DLGPROC proc; | |
37 | BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, UINT code); | |
38 | ||
39 | // The sheet that owns this page. | |
40 | PropSheet *OurSheet; | |
41 | ||
42 | // For setting the back/finish buttons properly. | |
43 | bool IsFirst, IsLast; | |
ee91d9be | 44 | |
e08abe3f | 45 | static INT_PTR CALLBACK FirstDialogProcReflector (HWND hwnd, UINT message, |
b7301c43 RC |
46 | WPARAM wParam, |
47 | LPARAM lParam); | |
e08abe3f | 48 | static INT_PTR CALLBACK DialogProcReflector (HWND hwnd, UINT message, |
b7301c43 | 49 | WPARAM wParam, LPARAM lParam); |
25130a4d | 50 | void setTitleFont (); |
b7301c43 | 51 | |
daab12c7 BD |
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 | |
56 | { | |
57 | // the URL to load when clicked | |
08678720 | 58 | std::string url; |
daab12c7 BD |
59 | |
60 | // location of the control's original winproc that we are subclassing | |
61 | WNDPROC origWinProc; | |
62 | ||
63 | // font handle; note: it's our responsibility to DeleteObject() this | |
64 | HFONT font; | |
65 | ||
66 | // handle to the brush we return in response to WM_CTLCOLORSTATIC | |
67 | HBRUSH brush; | |
68 | } ClickableURL; | |
69 | ||
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; | |
73 | ||
74 | // subclass the static control with this winproc | |
75 | static LRESULT CALLBACK urlWinProc (HWND hwnd, UINT uMsg, WPARAM wParam, | |
76 | LPARAM lParam); | |
77 | ||
b7301c43 | 78 | protected: |
ee91d9be RC |
79 | SizeProcessor sizeProcessor; |
80 | ||
e08abe3f YS |
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); | |
1c1913d1 RR |
85 | virtual INT_PTR CALLBACK OnTimerMessage (UINT message, WPARAM wParam, |
86 | LPARAM lparam); | |
b7301c43 RC |
87 | |
88 | public: | |
89 | PropertyPage (); | |
90 | virtual ~ PropertyPage (); | |
91 | ||
92 | PROPSHEETPAGE *GetPROPSHEETPAGEPtr () | |
93 | { | |
94 | return &psp; | |
95 | }; | |
96 | ||
97 | // FIXME: These should be private and friended to PropSheet. | |
98 | void YouAreBeingAddedToASheet (PropSheet * ps) | |
99 | { | |
100 | OurSheet = ps; | |
101 | }; | |
102 | void YouAreFirst () | |
103 | { | |
104 | IsFirst = true; | |
105 | IsLast = false; | |
106 | }; | |
107 | void YouAreLast () | |
108 | { | |
109 | IsFirst = false; | |
110 | IsLast = true; | |
111 | }; | |
112 | void YouAreMiddle () | |
113 | { | |
114 | IsFirst = false; | |
115 | IsLast = false; | |
116 | }; | |
117 | ||
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); | |
123 | ||
124 | virtual void OnInit () | |
125 | { | |
126 | }; | |
127 | virtual void OnActivate () | |
128 | { | |
129 | }; | |
7f6de8c0 | 130 | virtual bool wantsActivation () const |
b28e9f01 MB |
131 | { |
132 | return true; | |
133 | }; | |
b7301c43 RC |
134 | virtual void OnDeactivate () |
135 | { | |
136 | }; | |
5296fc07 MB |
137 | |
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. | |
b7301c43 RC |
143 | virtual long OnNext () |
144 | { | |
145 | return 0; | |
146 | }; | |
147 | virtual long OnBack () | |
148 | { | |
149 | return 0; | |
150 | }; | |
5296fc07 | 151 | |
b7301c43 RC |
152 | virtual bool OnFinish () |
153 | { | |
154 | return true; | |
155 | }; | |
f2ff9838 RC |
156 | virtual long OnUnattended () |
157 | { | |
158 | return -2; | |
159 | }; | |
b7301c43 RC |
160 | |
161 | PropSheet *GetOwner () const | |
162 | { | |
163 | return OurSheet; | |
164 | }; | |
daab12c7 | 165 | |
08678720 | 166 | void makeClickable (int id, std::string link); |
b7301c43 RC |
167 | }; |
168 | ||
c93bc6d0 | 169 | #endif /* SETUP_PROPPAGE_H */ |