Subversion Repositories Games.Chess Giants

Rev

Rev 124 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
// dialog_messagebox.cpp
2
 
3
#include "../common.h"
4
 
5
 
6
// prototypes of local functions
7
static void StartThread_ThisDialog (void *thread_parms);
8
 
9
 
10
void DialogBox_Message (messagebox_t *messagebox_parms)
11
{
12
   // helper function to fire up the modeless dialog box
13
 
140 pmbaty 14
   is_dialogbox_displayed = true;
1 pmbaty 15
   _beginthread (StartThread_ThisDialog, 0, (void *) messagebox_parms); // fire up the thread
16
   return; // return as soon as the thread is fired up
17
}
18
 
19
 
20
void DialogBox_Message_Validated (void)
21
{
22
   // callback function called by the main game thread when the dialog box is validated
23
 
24
   // remember this callback is no longer to be called
25
   is_dialogbox_message_validated = false;
26
 
27
   return; // finished
28
}
29
 
30
 
31
static void StartThread_ThisDialog (void *thread_parms)
32
{
33
   // this function runs in a separate thread, for that's the only way (seemingly)
34
   // to implement a non-modal message box using the Common Controls library.
35
 
36
   messagebox_t *mb;
37
 
38
   mb = (messagebox_t *) thread_parms; // quick access to message box structure
39
 
40
   // display the message box and wait for it to return
41
   MessageBox (IsWindow (mb->hWndParent) ? mb->hWndParent : (IsWindow (hMainWnd) ? hMainWnd : NULL), mb->text, mb->title, mb->flags);
42
   is_dialogbox_message_validated = true;
140 pmbaty 43
   is_dialogbox_displayed = false;
1 pmbaty 44
 
124 pmbaty 45
   the_board.reevaluate = true; // refresh the GUI buttons if needed
1 pmbaty 46
   return; // _endthread() implied
47
}