Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

bcdialog.C

Go to the documentation of this file.
00001 #include "bcdialog.h"
00002 #include "condition.h"
00003 #include "mutex.h"
00004 
00005 
00006 
00007 
00008 
00009 BC_DialogThread::BC_DialogThread()
00010  : Thread(1, 0, 0)
00011 {
00012         gui = 0;
00013         startup_lock = new Condition(1, "BC_DialogThread::startup_lock");
00014         window_lock = new Mutex("BC_DialogThread::window_lock");
00015 }
00016 
00017 BC_DialogThread::~BC_DialogThread()
00018 {
00019         startup_lock->lock("BC_DialogThread::~BC_DialogThread");
00020         if(gui)
00021         {
00022                 gui->lock_window();
00023                 gui->set_done(1);
00024                 gui->unlock_window();
00025         }
00026         startup_lock->unlock();
00027         Thread::join();
00028 
00029         delete startup_lock;
00030         delete window_lock;
00031 }
00032 
00033 void BC_DialogThread::start()
00034 {
00035         if(Thread::running())
00036         {
00037                 window_lock->lock("BC_DialogThread::start");
00038                 if(gui)
00039                 {
00040                         gui->lock_window("BC_DialogThread::start");
00041                         gui->raise_window(1);
00042                         gui->unlock_window();
00043                 }
00044                 window_lock->unlock();
00045                 return;
00046         }
00047 
00048 // Don't allow anyone else to create the window
00049         startup_lock->lock("BC_DialogThread::start");
00050         Thread::start();
00051 
00052 // Wait for startup
00053         startup_lock->lock("BC_DialogThread::start");
00054         startup_lock->unlock();
00055 }
00056 
00057 void BC_DialogThread::run()
00058 {
00059         gui = new_gui();
00060         startup_lock->unlock();
00061         int result = gui->run_window();
00062 
00063         handle_done_event(result);
00064 
00065         window_lock->lock("BC_DialogThread::run");
00066         delete gui;
00067         gui = 0;
00068         window_lock->unlock();
00069 
00070         handle_close_event(result);
00071 }
00072 
00073 BC_Window* BC_DialogThread::new_gui()
00074 {
00075         printf("BC_DialogThread::new_gui called\n");
00076         return 0;
00077 }
00078 
00079 BC_Window* BC_DialogThread::get_gui()
00080 {
00081         return gui;
00082 }
00083 
00084 void BC_DialogThread::handle_done_event(int result)
00085 {
00086 }
00087 
00088 void BC_DialogThread::handle_close_event(int result)
00089 {
00090 }
00091 
00092 
00093 
00094 

Generated on Sun Jan 8 13:26:32 2006 for Guicast-svn by  doxygen 1.4.4