00001 // **************************************************************************** 00002 // Filename: GTKApplicationHandler.cpp 00003 // Author: Florian Hecht 00004 // Date: 2009 00005 // **************************************************************************** 00006 00007 00008 #include "GTKApplicationHandler.h" 00009 00010 #include <locale.h> 00011 00012 #include <gtk/gtk.h> 00013 #include <gtk/gtkmain.h> 00014 00015 static char app_name[] = "IVT_APPLICATION\0"; 00016 static int my_argc = 1; 00017 static char *my_argv[2] = {app_name, NULL}; 00018 00019 CGTKApplicationHandler *CGTKApplicationHandler::m_pGTKApplicationHandler = NULL; 00020 00021 CGTKApplicationHandler::CGTKApplicationHandler(int argc, char **argv) 00022 { 00023 if (argv != NULL) 00024 { 00025 gtk_init(&argc, &argv); 00026 } 00027 else 00028 { 00029 char **ptr = my_argv; 00030 gtk_init(&my_argc, &ptr); 00031 00032 } 00033 00034 // undo the setting of the locale by GTK 00035 // this makes dialogs appear in english on any system 00036 // but it doesn't screw with sscanf and fscanf, which 00037 // is more important to us 00038 setlocale(LC_ALL, "C"); 00039 00040 m_pGTKApplicationHandler = this; 00041 m_bExit = false; 00042 } 00043 00044 CGTKApplicationHandler::~CGTKApplicationHandler() 00045 { 00046 m_pGTKApplicationHandler = NULL; 00047 } 00048 00049 bool CGTKApplicationHandler::ProcessEventsAndGetExit() 00050 { 00051 while (gtk_events_pending()) 00052 gtk_main_iteration(); 00053 00054 return m_bExit; 00055 } 00056 00057 void CGTKApplicationHandler::Reset() 00058 { 00059 00060 }