fshake3d
0.0.1
FreeformDensity3DSurfaceEditor
|
00001 #include "dialog.hpp" 00002 #include <windows.h> 00003 00004 const char* filters = "function mix file\0*.fmix\0\0"; 00005 00006 bool dialog_load(std::string& out) 00007 { 00008 OPENFILENAMEA ofn; 00009 ZeroMemory(&ofn, sizeof(OPENFILENAMEA)); 00010 char fn[1024]; 00011 fn[0] = '\0'; 00012 ofn.lStructSize = sizeof(OPENFILENAMEA); 00013 ofn.lpstrFile = fn; 00014 ofn.nMaxFile = sizeof(fn); 00015 ofn.lpstrTitle = "Open fmix file"; 00016 ofn.lpstrDefExt = ".fmix"; 00017 ofn.lpstrFilter = filters; 00018 00019 if ( GetOpenFileNameA(&ofn) ) 00020 { 00021 out = fn; 00022 return true; 00023 } 00024 return false; 00025 } 00026 00027 bool dialog_save(std::string& out) 00028 { 00029 OPENFILENAMEA ofn; 00030 ZeroMemory(&ofn, sizeof(OPENFILENAMEA)); 00031 char fn[1024]; 00032 fn[0] = '\0'; 00033 ofn.lStructSize = sizeof(OPENFILENAMEA); 00034 ofn.lpstrFile = fn; 00035 ofn.nMaxFile = sizeof(fn); 00036 ofn.lpstrTitle = "Save as fmix file"; 00037 ofn.lpstrDefExt = ".fmix"; 00038 ofn.lpstrFilter = filters; 00039 if ( GetSaveFileNameA(&ofn) ) 00040 { 00041 out = fn; 00042 return true; 00043 } 00044 return false; 00045 } 00046 00047 bool dialog_yesno(const char* text) 00048 { 00049 return ( MessageBoxA(NULL, text, "", MB_YESNO) == IDYES ); 00050 } 00051 00052 void dialog_ok(const char* text) 00053 { 00054 MessageBoxA(NULL, text, "", MB_OK); 00055 }