|
IVT
|
00001 // **************************************************************************** 00002 // This file is part of the Integrating Vision Toolkit (IVT). 00003 // 00004 // The IVT is maintained by the Karlsruhe Institute of Technology (KIT) 00005 // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de). 00006 // 00007 // Copyright (C) 2013 Karlsruhe Institute of Technology (KIT). 00008 // All rights reserved. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are met: 00012 // 00013 // 1. Redistributions of source code must retain the above copyright 00014 // notice, this list of conditions and the following disclaimer. 00015 // 00016 // 2. Redistributions in binary form must reproduce the above copyright 00017 // notice, this list of conditions and the following disclaimer in the 00018 // documentation and/or other materials provided with the distribution. 00019 // 00020 // 3. Neither the name of the KIT nor the names of its contributors may be 00021 // used to endorse or promote products derived from this software 00022 // without specific prior written permission. 00023 // 00024 // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY 00025 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00026 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY 00028 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00029 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00031 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00033 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 // **************************************************************************** 00035 // **************************************************************************** 00036 // Filename: GUIFactory.cpp 00037 // Author: Florian Hecht 00038 // Date: 2008 00039 // **************************************************************************** 00040 00041 00042 // **************************************************************************** 00043 // Includes 00044 // **************************************************************************** 00045 00046 #include "Image/ByteImage.h" 00047 00048 #include <string.h> 00049 00050 00051 00052 #ifdef USE_QTGUI 00053 00054 #include "gui/Qt/QtApplicationHandler.h" 00055 #include "gui/Qt/QtMainWindow.h" 00056 00057 CApplicationHandlerInterface *CreateApplicationHandler(int argc, char **argv) 00058 { 00059 return new CQtApplicationHandler(argc, argv); 00060 } 00061 00062 CMainWindowInterface *CreateMainWindow(int x, int y, int width, int height, const char *title) 00063 { 00064 return new CQtMainWindow(x, y, width, height, title); 00065 } 00066 00067 #include <qapplication.h> 00068 #include <qfiledialog.h> 00069 00070 #if QT_VERSION >= 0x040000 00071 #define GET_ASCII toAscii 00072 #else 00073 #define GET_ASCII ascii 00074 #endif 00075 00076 static char app_name[] = "IVT_APPLICATION\0"; 00077 static int my_argc = 1; 00078 static char *my_argv[2] = { app_name, NULL}; 00079 00080 // opens a file dialog and returns true if a filename was selected. The compelete path is returned in filename (the buffer has to be big enough) 00081 bool FileDialog(bool save_dialog, const char **filter, int num_filter, const char *caption, char *filename, int max_length) 00082 { 00083 QApplication *pApp = NULL; 00084 if (qApp == NULL) 00085 { 00086 pApp = new QApplication(my_argc, my_argv); 00087 } 00088 00089 char filter_str[1024]; 00090 char *fs = filter_str; 00091 *fs = 0; 00092 00093 for (int i = 0; i < num_filter; i++) 00094 { 00095 if (i == num_filter - 1) 00096 { 00097 sprintf(fs, "%s (%s)", filter[(2*i)], filter[(2*i) + 1]); 00098 fs += strlen(filter[(2*i)]) + strlen(filter[(2*i) + 1]) + 3; 00099 } 00100 else 00101 { 00102 sprintf(fs, "%s (%s);;", filter[(2*i)], filter[(2*i) + 1]); 00103 fs += strlen(filter[(2*i)]) + strlen(filter[(2*i) + 1]) + 5; 00104 } 00105 } 00106 *fs++ = 0; 00107 00108 if (save_dialog) 00109 { 00110 #if QT_VERSION >= 0x040000 00111 QString s = QFileDialog::getSaveFileName(0, caption, NULL, filter_str); 00112 #else 00113 QString s = QFileDialog::getSaveFileName(QString(filename), filter_str, 0, "Save File Dialog", caption); 00114 #endif 00115 00116 if (s.length() > 0) 00117 { 00118 strncpy(filename, s.GET_ASCII(), max_length); 00119 00120 if (pApp) 00121 { 00122 delete pApp; 00123 pApp = NULL; 00124 } 00125 00126 return true; 00127 } 00128 } 00129 else 00130 { 00131 #if QT_VERSION >= 0x040000 00132 QString s = QFileDialog::getOpenFileName(0, caption, NULL, filter_str); 00133 #else 00134 QString s = QFileDialog::getOpenFileName(QString(filename), filter_str, 0, "Open File Dialog", caption); 00135 #endif 00136 00137 if (s.length() > 0) 00138 { 00139 strncpy(filename, s.GET_ASCII(), max_length); 00140 00141 if (pApp) 00142 { 00143 delete pApp; 00144 pApp = NULL; 00145 } 00146 00147 return true; 00148 } 00149 } 00150 00151 if (pApp) 00152 { 00153 delete pApp; 00154 pApp = NULL; 00155 } 00156 00157 return false; 00158 } 00159 00160 #include <qimage.h> 00161 00162 // load an image from file. The supported filetypes depend on the plattform 00163 bool LoadImageFromFile(const char *filename, CByteImage *pImage) 00164 { 00165 QApplication *pApp = NULL; 00166 if (qApp == NULL) 00167 { 00168 int argc = 1; 00169 char *argv[] = {app_name, NULL}; 00170 00171 pApp = new QApplication(argc, argv); 00172 } 00173 00174 QImage img(filename, 0); 00175 00176 if (!img.isNull()) 00177 { 00178 if (img.depth() != 8 && img.depth() != 24 && img.depth() != 32) 00179 { 00180 printf("error: LoadImageFromFile: image '%s' has an unsupported bit depth of %d bpp\n", filename, img.depth()); 00181 return false; 00182 } 00183 00184 int width = img.width(); 00185 int height = img.height(); 00186 00187 if (pImage->m_bOwnMemory) 00188 delete [] pImage->pixels; 00189 00190 pImage->width = width; 00191 pImage->height = height; 00192 pImage->bytesPerPixel = (img.depth() == 8 ? 1 : 3); 00193 pImage->type = (img.depth() <= 8 ? CByteImage::eGrayScale : CByteImage::eRGB24); 00194 pImage->pixels = new unsigned char[pImage->bytesPerPixel * width*height]; 00195 pImage->m_bOwnMemory = true; 00196 00197 uchar *ptr = img.bits(); 00198 if (img.depth() == 32) 00199 { 00200 unsigned char *output = pImage->pixels; 00201 00202 int size = width * height; 00203 for (int i = 0; i < size; i++) 00204 { 00205 output[3*i ] = ptr[4*i + 2]; 00206 output[3*i + 1] = ptr[4*i + 1]; 00207 output[3*i + 2] = ptr[4*i ]; 00208 } 00209 } 00210 else 00211 { 00212 memcpy(pImage->pixels, ptr, pImage->bytesPerPixel * width*height); 00213 } 00214 00215 if (pApp) 00216 { 00217 delete pApp; 00218 pApp = NULL; 00219 } 00220 00221 return true; 00222 } 00223 00224 if (pApp) 00225 { 00226 delete pApp; 00227 pApp = NULL; 00228 } 00229 00230 return false; 00231 } 00232 00233 #else 00234 00235 00236 #if defined(USE_GTKGUI) && !defined(USE_REMOTEGUI) 00237 00238 #include "gui/GTK/GTKApplicationHandler.h" 00239 #include "gui/GTK/GTKMainWindow.h" 00240 00241 CApplicationHandlerInterface *CreateApplicationHandler(int argc, char **argv) 00242 { 00243 return new CGTKApplicationHandler(argc, argv); 00244 } 00245 00246 CMainWindowInterface *CreateMainWindow(int x, int y, int width, int height, const char *title) 00247 { 00248 return new CGTKMainWindow(x, y, width, height, title); 00249 } 00250 00251 // opens a file dialog and returns true if a filename was selected. The complete path is returned in filename (the buffer has to be big enough) 00252 bool FileDialog(bool save_dialog, const char **filter, int num_filter, const char *caption, char *filename, int max_length) 00253 { 00254 // TODO: implement for GTK 00255 GtkWidget *dialog; 00256 00257 if (save_dialog) 00258 { 00259 dialog = gtk_file_chooser_dialog_new (caption, 00260 NULL, 00261 GTK_FILE_CHOOSER_ACTION_SAVE, 00262 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 00263 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, 00264 NULL); 00265 } 00266 else 00267 { 00268 dialog = gtk_file_chooser_dialog_new (caption, 00269 NULL, 00270 GTK_FILE_CHOOSER_ACTION_OPEN, 00271 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, 00272 GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, 00273 NULL); 00274 } 00275 00276 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog), filename); 00277 00278 for (int i = 0; i < num_filter; i++) 00279 { 00280 GtkFileFilter *f = gtk_file_filter_new(); 00281 gtk_file_filter_set_name(f, filter[2*i]); 00282 gtk_file_filter_add_pattern(f, filter[2*i+1]); 00283 gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), f); 00284 } 00285 00286 if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) 00287 { 00288 char *file; 00289 file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); 00290 strncpy(filename, file, max_length); 00291 g_free (file); 00292 00293 gtk_widget_destroy (dialog); 00294 00295 return true; 00296 } 00297 00298 gtk_widget_destroy (dialog); 00299 00300 return false; 00301 } 00302 00303 00304 // load an image from file. The supported filetypes depend on the plattform 00305 bool LoadImageFromFile(const char *filename, CByteImage *pImage) 00306 { 00307 bool success = false; 00308 00309 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(filename, NULL); 00310 if (pixbuf) 00311 { 00312 int channels = gdk_pixbuf_get_n_channels(pixbuf); 00313 int bits_per_sample = gdk_pixbuf_get_bits_per_sample(pixbuf); 00314 unsigned char *pixels = gdk_pixbuf_get_pixels(pixbuf); 00315 int width = gdk_pixbuf_get_width(pixbuf); 00316 int height = gdk_pixbuf_get_height(pixbuf); 00317 int rowstride = gdk_pixbuf_get_rowstride(pixbuf); 00318 00319 if (bits_per_sample == 8 && (channels == 1 || channels == 3 || channels == 4)) 00320 { 00321 if (pImage->m_bOwnMemory) 00322 delete [] pImage->pixels; 00323 00324 pImage->width = width; 00325 pImage->height = height; 00326 pImage->bytesPerPixel = channels; 00327 pImage->type = (channels == 3 ? CByteImage::eGrayScale : CByteImage::eRGB24); 00328 pImage->pixels = new unsigned char[pImage->bytesPerPixel * width * height]; 00329 pImage->m_bOwnMemory = true; 00330 00331 if (channels == 1) 00332 { 00333 for (int y = 0; y < height; y++) 00334 { 00335 memcpy(&pImage->pixels[y*width], pixels, width); 00336 pixels += rowstride; 00337 } 00338 } 00339 else 00340 { 00341 if (channels == 3) 00342 { 00343 for (int y = 0; y < height; y++) 00344 { 00345 memcpy(&pImage->pixels[3*y*width], pixels, 3*width); 00346 pixels += rowstride; 00347 } 00348 } 00349 else 00350 { 00351 // discard the alpha channel 00352 for (int y = 0; y < height; y++) 00353 { 00354 for (int x = 0; x < width; x++) 00355 { 00356 pImage->pixels[3*(y*width + x)] = pixels[4*x]; 00357 pImage->pixels[3*(y*width + x)+1] = pixels[4*x+1]; 00358 pImage->pixels[3*(y*width + x)+2] = pixels[4*x+2]; 00359 } 00360 00361 pixels += rowstride; 00362 } 00363 } 00364 } 00365 00366 success = true; 00367 } 00368 00369 } 00370 00371 return success; 00372 } 00373 00374 #else 00375 00376 00377 #if defined(WIN32) && !defined(USE_REMOTEGUI) 00378 00379 #include "gui/win32/Win32ApplicationHandler.h" 00380 #include "gui/win32/Win32MainWindow.h" 00381 00382 CApplicationHandlerInterface *CreateApplicationHandler(int argc, char **argv) 00383 { 00384 return new CWin32ApplicationHandler(); 00385 } 00386 00387 CMainWindowInterface *CreateMainWindow(int x, int y, int width, int height, const char *title) 00388 { 00389 return new CWin32MainWindow(x, y, width, height, title); 00390 } 00391 00392 #include <windows.h> 00393 00394 // opens a file dialog and returns true if a filename was selected. The compelete path is returned in filename (the buffer has to be big enough) 00395 bool FileDialog(bool save_dialog, const char **filter, int num_filter, const char *caption, char *filename, int max_length) 00396 { 00397 char filter_str[1024]; 00398 char *fs = filter_str; 00399 *fs = 0; 00400 00401 for (int i = 0; i < num_filter; i++) 00402 { 00403 sprintf(fs, "%s", filter[(2*i)]); 00404 fs += strlen(filter[(2*i)]) + 1; 00405 00406 sprintf(fs, "%s", filter[(2*i) + 1]); 00407 fs += strlen(filter[(2*i) + 1]) + 1; 00408 } 00409 *fs++ = 0; 00410 00411 OPENFILENAME ofn; 00412 memset(&ofn, 0, sizeof(OPENFILENAME)); 00413 00414 ofn.lStructSize = sizeof(OPENFILENAME); 00415 ofn.hwndOwner = NULL; 00416 ofn.hInstance = NULL; 00417 ofn.lpstrFilter = filter_str; 00418 ofn.lpstrCustomFilter = NULL; 00419 ofn.nMaxCustFilter = 0; 00420 ofn.nFilterIndex = 1; 00421 ofn.lpstrFile = filename; 00422 ofn.nMaxFile = max_length; 00423 ofn.lpstrFileTitle = NULL; 00424 ofn.nMaxFileTitle = 0; 00425 ofn.lpstrInitialDir = NULL; 00426 ofn.lpstrTitle = caption; 00427 ofn.Flags = 0; //OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; 00428 ofn.nFileOffset = 0; 00429 ofn.nFileExtension = 0; 00430 ofn.lpstrDefExt = NULL; 00431 ofn.lCustData = 0; 00432 ofn.lpfnHook = NULL; 00433 ofn.lpTemplateName = NULL; 00434 00435 if (save_dialog) 00436 { 00437 if (GetSaveFileName(&ofn)) 00438 { 00439 return true; 00440 } 00441 } 00442 else 00443 { 00444 if (GetOpenFileName(&ofn)) 00445 { 00446 return true; 00447 } 00448 } 00449 00450 return false; 00451 } 00452 00453 #include <olectl.h> 00454 00455 // load an image from file. The supported filetypes depend on the plattform 00456 bool LoadImageFromFile(const char *filename, CByteImage *pImage) 00457 { 00458 HDC hdcTemp; // The DC To Hold Our Bitmap 00459 HBITMAP hbmpTemp; // Holds The Bitmap Temporarily 00460 IPicture *pPicture; // IPicture Interface 00461 OLECHAR wszPath[MAX_PATH+1]; // Full Path To Picture (WCHAR) 00462 long lWidth; // Width In Logical Units 00463 long lHeight; // Height In Logical Units 00464 long lWidthPixels; // Width In Pixels 00465 long lHeightPixels; // Height In Pixels 00466 00467 MultiByteToWideChar(CP_ACP, 0, filename, -1, wszPath, MAX_PATH); // Convert From ASCII To Unicode 00468 HRESULT hr = OleLoadPicturePath(wszPath, 0, 0, 0, IID_IPicture, (void**)&pPicture); 00469 00470 if(FAILED(hr)) // If Loading Failed 00471 return false; // Return False 00472 00473 hdcTemp = CreateCompatibleDC(GetDC(0)); // Create The Windows Compatible Device Context 00474 if(!hdcTemp) // Did Creation Fail? 00475 { 00476 pPicture->Release(); // Decrements IPicture Reference Count 00477 return false; // Return False (Failure) 00478 } 00479 00480 pPicture->get_Width(&lWidth); // Get IPicture Width (Convert To Pixels) 00481 lWidthPixels = MulDiv(lWidth, GetDeviceCaps(hdcTemp, LOGPIXELSX), 2540); 00482 pPicture->get_Height(&lHeight); // Get IPicture Height (Convert To Pixels) 00483 lHeightPixels = MulDiv(lHeight, GetDeviceCaps(hdcTemp, LOGPIXELSY), 2540); 00484 00485 // Create A Temporary Bitmap 00486 BITMAPINFO bi = {0}; // The Type Of Bitmap We Request 00487 DWORD *pBits = 0; // Pointer To The Bitmap Bits 00488 00489 bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); // Set Structure Size 00490 bi.bmiHeader.biBitCount = 32; // 32 Bit 00491 bi.bmiHeader.biWidth = lWidthPixels; // Power Of Two Width 00492 bi.bmiHeader.biHeight = lHeightPixels; // Make Image Top Up (Positive Y-Axis) 00493 bi.bmiHeader.biCompression = BI_RGB; // RGB Encoding 00494 bi.bmiHeader.biPlanes = 1; // 1 Bitplane 00495 00496 // Creating A Bitmap This Way Allows Us To Specify Color Depth And Gives Us Imediate Access To The Bits 00497 hbmpTemp = CreateDIBSection(hdcTemp, &bi, DIB_RGB_COLORS, (void**)&pBits, 0, 0); 00498 00499 if(!hbmpTemp) // Did Creation Fail? 00500 { 00501 DeleteDC(hdcTemp); // Delete The Device Context 00502 pPicture->Release(); // Decrements IPicture Reference Count 00503 return false; // Return False (Failure) 00504 } 00505 00506 SelectObject(hdcTemp, hbmpTemp); // Select Handle To Our Temp DC And Our Temp Bitmap Object 00507 00508 // Render The IPicture On To The Bitmap 00509 pPicture->Render(hdcTemp, 0, 0, lWidthPixels, lHeightPixels, 0, 0, lWidth, lHeight, 0); 00510 00511 00512 if (pImage->m_bOwnMemory) 00513 delete [] pImage->pixels; 00514 00515 pImage->width = lWidthPixels; 00516 pImage->height = lHeightPixels; 00517 pImage->bytesPerPixel = 3; 00518 pImage->type = CByteImage::eRGB24; 00519 pImage->pixels = new unsigned char[pImage->bytesPerPixel * lWidthPixels*lHeightPixels]; 00520 pImage->m_bOwnMemory = true; 00521 00522 unsigned char *output = pImage->pixels; 00523 00524 // Convert From BGR To RGB Format And Add An Alpha Value Of 255 00525 for(long i = 0; i < lWidthPixels * lHeightPixels; i++) // Loop Through All Of The Pixels 00526 { 00527 BYTE* pPixel = (BYTE*)(&pBits[i]); // Grab The Current Pixel 00528 output[3*i] = pPixel[2]; // Store 1st Color In Temp Variable (Blue) 00529 output[3*i + 1] = pPixel[1]; // Move Red Value To Correct Position (1st) 00530 output[3*i + 2] = pPixel[0]; // Move Temp Value To Correct Blue Position (3rd) 00531 } 00532 00533 DeleteObject(hbmpTemp); // Delete The Object 00534 DeleteDC(hdcTemp); // Delete The Device Context 00535 00536 pPicture->Release(); // Decrements IPicture Reference Count 00537 00538 return true; 00539 } 00540 00541 #else 00542 00543 00544 #ifdef USE_COCOAGUI 00545 00546 #include "gui/Cocoa/CocoaApplicationHandler.h" 00547 #include "gui/Cocoa/CocoaMainWindow.h" 00548 00549 CApplicationHandlerInterface *CreateApplicationHandler(int argc, char **argv) 00550 { 00551 return new CCocoaApplicationHandler(); 00552 } 00553 00554 CMainWindowInterface *CreateMainWindow(int x, int y, int width, int height, const char *title) 00555 { 00556 return new CCocoaMainWindow(x, y, width, height, title); 00557 } 00558 00559 // these functions are defined in GUIFactory.m 00560 extern "C" 00561 { 00562 bool CocoaFileDialog(bool save_dialog, const char **filter, int num_filter, const char *caption, char *filename, int max_length); 00563 bool CocoaLoadImage(const char *filename, unsigned char **ptr, int *width, int *height, int *type); 00564 void CocoaFreeImageMem(unsigned char *ptr); 00565 } 00566 00567 // opens a file dialog and returns true if a filename was selected. The compelete path is returned in filename (the buffer has to be big enough) 00568 bool FileDialog(bool save_dialog, const char **filter, int num_filter, const char *caption, char *filename, int max_length) 00569 { 00570 char buf[64]; 00571 00572 char **cocoa_filters = NULL; 00573 if (filter != NULL) { 00574 cocoa_filters = new char*[num_filter]; 00575 for (int i = 0; i < num_filter; i++) 00576 { 00577 sscanf(filter[2*i + 1], "*.%s", buf); 00578 cocoa_filters[i] = new char[strlen(buf) + 1]; 00579 strcpy(cocoa_filters[i], buf); 00580 } 00581 } 00582 00583 bool result = CocoaFileDialog(save_dialog, (const char**)cocoa_filters, num_filter, caption, filename, max_length); 00584 00585 if (cocoa_filters != NULL) 00586 { 00587 for (int i = 0; i < num_filter; i++) 00588 { 00589 delete [] cocoa_filters[i]; 00590 } 00591 delete [] cocoa_filters; 00592 } 00593 00594 return result; 00595 } 00596 00597 // load an image from file. The supported filetypes depend on the plattform 00598 bool LoadImageFromFile(const char *filename, CByteImage *pImage) 00599 { 00600 unsigned char *ptr = NULL; 00601 int width = -1; 00602 int height = -1; 00603 int type = -1; 00604 00605 if (CocoaLoadImage(filename, &ptr, &width, &height, &type)) 00606 { 00607 if (pImage->m_bOwnMemory) 00608 delete [] pImage->pixels; 00609 00610 pImage->width = width; 00611 pImage->height = height; 00612 pImage->bytesPerPixel = (type == 1 ? 1 : 3); 00613 pImage->type = (type == 1 ? CByteImage::eGrayScale : CByteImage::eRGB24); 00614 pImage->pixels = new unsigned char[pImage->bytesPerPixel * width * height]; 00615 pImage->m_bOwnMemory = true; 00616 00617 memcpy(pImage->pixels, ptr, pImage->bytesPerPixel * width * height); 00618 00619 CocoaFreeImageMem(ptr); 00620 00621 return true; 00622 } 00623 00624 return false; 00625 } 00626 00627 #else 00628 00629 00630 #ifdef USE_REMOTEGUI 00631 00632 #include "gui/Remote/RemoteApplicationHandler.h" 00633 #include "gui/Remote/RemoteMainWindow.h" 00634 00635 CApplicationHandlerInterface *CreateApplicationHandler(int argc, char **argv) 00636 { 00637 return new CRemoteApplicationHandler(argc, argv); 00638 } 00639 00640 CMainWindowInterface *CreateMainWindow(int x, int y, int width, int height, const char *title) 00641 { 00642 CRemoteApplicationHandler *app_handler = CRemoteApplicationHandler::GetApplicationHandler(); 00643 00644 if (!app_handler) 00645 return NULL; 00646 00647 return app_handler->CreateMainWindow(x, y, width, height, title); 00648 } 00649 00650 // opens a file dialog and returns true if a filename was selected. The compelete path is returned in filename (the buffer has to be big enough) 00651 bool FileDialog(bool save_dialog, const char **filter, int num_filter, const char *caption, char *filename, int max_length) 00652 { 00653 // not available for the remote gui system 00654 return false; 00655 } 00656 00657 // load an image from file. The supported filetypes depend on the plattform 00658 bool LoadImageFromFile(const char *filename, CByteImage *pImage) 00659 { 00660 // not available for the remote gui system 00661 return false; 00662 } 00663 00664 #endif /* ifdef USE_REMOTEGUI */ 00665 00666 00667 #endif /* ifdef USE_COCOAGUI */ 00668 00669 00670 #endif /* ifdef WIN32 */ 00671 00672 00673 #endif /* ifdef USE_GTKGUI */ 00674 00675 00676 #endif /* ifdef USE_QTGUI */ 00677 00678 00679