Subversion Repositories Games.Chess Giants

Rev

Rev 4 | Rev 21 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4 Rev 5
Line 113... Line 113...
113
static int WINAPI _HyperlinkParentProc (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam)
113
static int WINAPI _HyperlinkParentProc (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam)
114
{
114
{
115
   // this function hooks the hyperlink parent's control drawing messages so as to draw hyperlinks differently from normal static controls
115
   // this function hooks the hyperlink parent's control drawing messages so as to draw hyperlinks differently from normal static controls
116
 
116
 
117
   hyperlinkparent_t *hyperlinkparent;
117
   hyperlinkparent_t *hyperlinkparent;
118
   WNDPROC OriginalWindowProc;
-
 
119
   LRESULT result;
118
   LRESULT result;
120
 
119
 
121
   // get a pointer to the hyperlink structure
120
   // get a pointer to the hyperlink structure
122
   hyperlinkparent = (hyperlinkparent_t *) GetProp (hWnd, PROP_HYPERLINKPARENT_STRUCT);
121
   hyperlinkparent = (hyperlinkparent_t *) GetProp (hWnd, PROP_HYPERLINKPARENT_STRUCT);
123
   if (hyperlinkparent == NULL)
122
   if (hyperlinkparent == NULL)
Line 133... Line 132...
133
   }
132
   }
134
 
133
 
135
   // else are we destroying ourselves ?
134
   // else are we destroying ourselves ?
136
   else if (message == WM_DESTROY)
135
   else if (message == WM_DESTROY)
137
   {
136
   {
138
      OriginalWindowProc = hyperlinkparent->pfnOrigProc;
-
 
139
      SetWindowLongPtr (hWnd, GWL_WNDPROC, (long) OriginalWindowProc); // restore the original window procedure
-
 
140
      if (hyperlinkparent != NULL)
137
      if (hyperlinkparent != NULL)
-
 
138
      {
-
 
139
         SetWindowLongPtr (hWnd, GWL_WNDPROC, (long) hyperlinkparent->pfnOrigProc); // restore the original window procedure
-
 
140
         RemoveProp (hWnd, PROP_HYPERLINKPARENT_STRUCT); // and remove the window property where we used to save it
141
         free (hyperlinkparent); // free the hyperlink parent structure
141
         free (hyperlinkparent); // free the hyperlink parent structure
142
      hyperlinkparent = NULL;
142
         hyperlinkparent = NULL;
143
      RemoveProp (hWnd, PROP_HYPERLINKPARENT_STRUCT); // and remove the window property where we used to save it
-
 
-
 
143
      }
-
 
144
 
144
      return (OriginalWindowProc (hWnd, message, wParam, lParam)); // now call the freshly restored window procedure to let things go
145
      return (DefWindowProc (hWnd, message, wParam, lParam)); // consistency fallback
145
   }
146
   }
146
 
147
 
147
   // now call the original window procedure to let things go normally
148
   // now call the original window procedure to let things go normally
148
   return (CallWindowProc (hyperlinkparent->pfnOrigProc, hWnd, message, wParam, lParam));
149
   return (CallWindowProc (hyperlinkparent->pfnOrigProc, hWnd, message, wParam, lParam));
149
}
150
}
Line 152... Line 153...
152
static int WINAPI _HyperlinkProc (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam)
153
static int WINAPI _HyperlinkProc (HWND hWnd, unsigned int message, WPARAM wParam, LPARAM lParam)
153
{
154
{
154
   // this function hooks the messages directed to the static text control that we turned into a hyperlink
155
   // this function hooks the messages directed to the static text control that we turned into a hyperlink
155
 
156
 
156
   hyperlink_t *hyperlink;
157
   hyperlink_t *hyperlink;
157
   WNDPROC OriginalWindowProc;
-
 
158
 
158
 
159
   // get a pointer to the hyperlink structure
159
   // get a pointer to the hyperlink structure
160
   hyperlink = (hyperlink_t *) GetProp (hWnd, PROP_HYPERLINK_STRUCT);
160
   hyperlink = (hyperlink_t *) GetProp (hWnd, PROP_HYPERLINK_STRUCT);
161
   if (hyperlink == NULL)
161
   if (hyperlink == NULL)
162
      return (DefWindowProc (hWnd, message, wParam, lParam)); // consistency check
162
      return (DefWindowProc (hWnd, message, wParam, lParam)); // consistency check
Line 164... Line 164...
164
   // is the mouse moving inside the static control ?
164
   // is the mouse moving inside the static control ?
165
   if (message == WM_SETCURSOR)
165
   if (message == WM_SETCURSOR)
166
   {
166
   {
167
      if (hyperlink_cursor != NULL)
167
      if (hyperlink_cursor != NULL)
168
         SetCursor (hyperlink_cursor); // set the static control cursor to be the pointing hand, if we have it
168
         SetCursor (hyperlink_cursor); // set the static control cursor to be the pointing hand, if we have it
169
 
169
 
170
      return (1); // halt further processing on this message
170
      return (1); // halt further processing on this message
171
   }
171
   }
172
 
172
 
173
   // else are we destroying the static control ?
173
   // else are we destroying the static control ?
174
   else if (message == WM_DESTROY)
174
   else if (message == WM_DESTROY)
175
   {
175
   {
176
      OriginalWindowProc = hyperlink->pfnOrigProc;
-
 
177
      SetWindowLongPtr (hWnd, GWL_WNDPROC, (long) OriginalWindowProc); // restore the original static control procedure
-
 
178
      if (hyperlink != NULL)
176
      if (hyperlink != NULL)
-
 
177
      {
-
 
178
         SetWindowLongPtr (hWnd, GWL_WNDPROC, (long) hyperlink->pfnOrigProc); // restore the original static control procedure
-
 
179
         RemoveProp (hWnd, PROP_HYPERLINK_STRUCT); // and remove the static control property where we used to save it
179
         free (hyperlink); // free the hyperlink structure
180
         free (hyperlink); // free the hyperlink structure
180
      hyperlink = NULL;
181
         hyperlink = NULL;
181
      RemoveProp (hWnd, PROP_HYPERLINK_STRUCT); // and remove the static control property where we used to save it
-
 
-
 
182
      }
-
 
183
 
182
      return (OriginalWindowProc (hWnd, message, wParam, lParam)); // now call the freshly restored window procedure to let things go
184
      return (DefWindowProc (hWnd, message, wParam, lParam)); // consistency fallback
183
   }
185
   }
184
 
186
 
185
   // now call the original static control procedure to let things go normally
187
   // now call the original static control procedure to let things go normally
186
   return (CallWindowProc (hyperlink->pfnOrigProc, hWnd, message, wParam, lParam));
188
   return (CallWindowProc (hyperlink->pfnOrigProc, hWnd, message, wParam, lParam));
187
}
189
}