]> cygwin.com Git - cygwin-apps/setup.git/blob - proppage.h
2005-05-05 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
85 public:
86 PropertyPage ();
87 virtual ~ PropertyPage ();
88
89 PROPSHEETPAGE *GetPROPSHEETPAGEPtr ()
90 {
91 return &psp;
92 };
93
94 // FIXME: These should be private and friended to PropSheet.
95 void YouAreBeingAddedToASheet (PropSheet * ps)
96 {
97 OurSheet = ps;
98 };
99 void YouAreFirst ()
100 {
101 IsFirst = true;
102 IsLast = false;
103 };
104 void YouAreLast ()
105 {
106 IsFirst = false;
107 IsLast = true;
108 };
109 void YouAreMiddle ()
110 {
111 IsFirst = false;
112 IsLast = false;
113 };
114
115 virtual bool Create (int TemplateID);
116 virtual bool Create (DLGPROC dlgproc, int TemplateID);
117 virtual bool Create (DLGPROC dlgproc,
118 BOOL (*cmdproc) (HWND h, int id, HWND hwndctl,
119 UINT code), int TemplateID);
120
121 virtual void OnInit ()
122 {
123 };
124 virtual void OnActivate ()
125 {
126 };
127 virtual bool wantsActivation () const
128 {
129 return true;
130 };
131 virtual void OnDeactivate ()
132 {
133 };
134
135 // Overload these to perform special processing when the user hits
136 // "Next" or "Back". Return:
137 // 0 == Go to next/previous page in sequence.
138 // -1 == Prevent wizard from changing page.
139 // Resource ID == go to a specific page specified by the resource ID.
140 virtual long OnNext ()
141 {
142 return 0;
143 };
144 virtual long OnBack ()
145 {
146 return 0;
147 };
148
149 virtual bool OnFinish ()
150 {
151 return true;
152 };
153 virtual long OnUnattended ()
154 {
155 return -2;
156 };
157
158 PropSheet *GetOwner () const
159 {
160 return OurSheet;
161 };
162
163 void makeClickable (int id, String link);
164 };
165
166 #endif /* SETUP_PROPPAGE_H */
This page took 0.046251 seconds and 6 git commands to generate.