]> cygwin.com Git - cygwin-apps/setup.git/blob - proppage.h
Indicate test packages in action menu
[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 "ControlAdjuster.h"
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;
44
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 ();
51
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
58 std::string url;
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
78 protected:
79 SizeProcessor sizeProcessor;
80
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);
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 };
130 virtual bool wantsActivation () const
131 {
132 return true;
133 };
134 virtual void OnDeactivate ()
135 {
136 };
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.
143 virtual long OnNext ()
144 {
145 return 0;
146 };
147 virtual long OnBack ()
148 {
149 return 0;
150 };
151
152 virtual bool OnFinish ()
153 {
154 return true;
155 };
156 virtual long OnUnattended ()
157 {
158 return -2;
159 };
160
161 PropSheet *GetOwner () const
162 {
163 return OurSheet;
164 };
165
166 void makeClickable (int id, std::string link);
167 };
168
169 #endif /* SETUP_PROPPAGE_H */
This page took 0.044354 seconds and 5 git commands to generate.