]> cygwin.com Git - cygwin-apps/setup.git/blob - proppage.h
2005-05-21 Brian Dessent <brian@dessent.net>
[cygwin-apps/setup.git] / proppage.h
1 /*
2 * Copyright (c) 2001, 2002, 2003 Gary R. Van Sickle.
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
16 #ifndef SETUP_PROPPAGE_H
17 #define SETUP_PROPPAGE_H
18
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
23 #include <map>
24 #include "win32.h"
25 #include <prsht.h>
26
27 #include "window.h"
28 #include "String++.h"
29 #include "ControlAdjuster.h"
30
31 class PropSheet;
32
33 class PropertyPage:public Window
34 {
35 static bool DoOnceForSheet;
36 PROPSHEETPAGE psp;
37 DLGPROC proc;
38 BOOL (*cmdproc) (HWND h, int id, HWND hwndctl, UINT code);
39
40 // The sheet that owns this page.
41 PropSheet *OurSheet;
42
43 // For setting the back/finish buttons properly.
44 bool IsFirst, IsLast;
45
46 static BOOL CALLBACK FirstDialogProcReflector (HWND hwnd, UINT message,
47 WPARAM wParam,
48 LPARAM lParam);
49 static BOOL CALLBACK DialogProcReflector (HWND hwnd, UINT message,
50 WPARAM wParam, LPARAM lParam);
51 void setTitleFont ();
52
53 // this is an internal structure that is used to store information
54 // about static text controls in the dialog that have been turned
55 // into clickable URLs
56 typedef struct
57 {
58 // the URL to load when clicked
59 String url;
60
61 // location of the control's original winproc that we are subclassing
62 WNDPROC origWinProc;
63
64 // font handle; note: it's our responsibility to DeleteObject() this
65 HFONT font;
66
67 // handle to the brush we return in response to WM_CTLCOLORSTATIC
68 HBRUSH brush;
69 } ClickableURL;
70
71 // the list of controls that we have modified to be clickable is
72 // stored in the following which maps the ID to the above data
73 static std::map <int, ClickableURL> urls;
74
75 // subclass the static control with this winproc
76 static LRESULT CALLBACK urlWinProc (HWND hwnd, UINT uMsg, WPARAM wParam,
77 LPARAM lParam);
78
79 protected:
80 SizeProcessor sizeProcessor;
81
82 virtual BOOL CALLBACK DialogProc (UINT message, WPARAM wParam,
83 LPARAM lParam);
84 virtual BOOL CALLBACK OnMouseWheel (UINT message, WPARAM wParam,
85 LPARAM lParam);
86
87 public:
88 PropertyPage ();
89 virtual ~ PropertyPage ();
90
91 PROPSHEETPAGE *GetPROPSHEETPAGEPtr ()
92 {
93 return &psp;
94 };
95
96 // FIXME: These should be private and friended to PropSheet.
97 void YouAreBeingAddedToASheet (PropSheet * ps)
98 {
99 OurSheet = ps;
100 };
101 void YouAreFirst ()
102 {
103 IsFirst = true;
104 IsLast = false;
105 };
106 void YouAreLast ()
107 {
108 IsFirst = false;
109 IsLast = true;
110 };
111 void YouAreMiddle ()
112 {
113 IsFirst = false;
114 IsLast = false;
115 };
116
117 virtual bool Create (int TemplateID);
118 virtual bool Create (DLGPROC dlgproc, int TemplateID);
119 virtual bool Create (DLGPROC dlgproc,
120 BOOL (*cmdproc) (HWND h, int id, HWND hwndctl,
121 UINT code), int TemplateID);
122
123 virtual void OnInit ()
124 {
125 };
126 virtual void OnActivate ()
127 {
128 };
129 virtual bool wantsActivation () const
130 {
131 return true;
132 };
133 virtual void OnDeactivate ()
134 {
135 };
136
137 // Overload these to perform special processing when the user hits
138 // "Next" or "Back". Return:
139 // 0 == Go to next/previous page in sequence.
140 // -1 == Prevent wizard from changing page.
141 // Resource ID == go to a specific page specified by the resource ID.
142 virtual long OnNext ()
143 {
144 return 0;
145 };
146 virtual long OnBack ()
147 {
148 return 0;
149 };
150
151 virtual bool OnFinish ()
152 {
153 return true;
154 };
155 virtual long OnUnattended ()
156 {
157 return -2;
158 };
159
160 PropSheet *GetOwner () const
161 {
162 return OurSheet;
163 };
164
165 void makeClickable (int id, String link);
166 };
167
168 #endif /* SETUP_PROPPAGE_H */
This page took 0.041684 seconds and 5 git commands to generate.