alert.hpp
Go to the documentation of this file.
00001 /* 00002 Copyright 2005-2007 Adobe Systems Incorporated 00003 Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt 00004 or a copy at http://stlab.adobe.com/licenses.html) 00005 */ 00006 00007 /****************************************************************************************************/ 00008 00009 #ifndef ADOBE_ALERT_HPP 00010 #define ADOBE_ALERT_HPP 00011 00012 /****************************************************************************************************/ 00013 00014 #include <adobe/name.hpp> 00015 00016 #include <utility> 00017 00018 #include <boost/filesystem/path.hpp> 00019 #include <boost/array.hpp> 00020 00021 /****************************************************************************************************/ 00022 00023 namespace adobe { 00024 00025 /****************************************************************************************************/ 00026 00027 std::pair<const char*, bool> alert(const char* message_text = "There was an error.", 00028 const char* window_name = "Alert", 00029 const char* button_0_name = "OK", 00030 const char* button_1_name = 0, 00031 const char* button_2_name = 0, 00032 const char* checkbox_name = 0, 00033 const boost::filesystem::path& icon_path = boost::filesystem::path(), 00034 std::size_t default_button_index = 0, 00035 std::size_t cancel_button_index = 1); 00036 00037 /****************************************************************************************************/ 00038 00039 struct alert_helper_t 00040 { 00041 alert_helper_t() : 00042 window_name_m("Alert"), 00043 message_m("There was an error."), 00044 button_0_m("OK"), 00045 button_1_m(0), 00046 button_2_m(0), 00047 checkbox_name_m(0), 00048 default_button_index_m(0), 00049 cancel_button_index_m(1) 00050 { } 00051 00052 std::pair<const char*, bool> run() 00053 { 00054 return alert(message_m, 00055 window_name_m, 00056 button_0_m, 00057 button_1_m, 00058 button_2_m, 00059 checkbox_name_m, 00060 icon_path_m, 00061 default_button_index_m, 00062 cancel_button_index_m); 00063 } 00064 00065 const char* window_name_m; 00066 const char* message_m; 00067 const char* button_0_m; 00068 const char* button_1_m; 00069 const char* button_2_m; 00070 const char* checkbox_name_m; 00071 boost::filesystem::path icon_path_m; 00072 std::size_t default_button_index_m; 00073 std::size_t cancel_button_index_m; 00074 }; 00075 00076 /****************************************************************************************************/ 00077 00078 } // namespace adobe 00079 00080 /****************************************************************************************************/ 00081 00082 #endif 00083 00084 /****************************************************************************************************/ |