diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llui/llalertdialog.h | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llui/llalertdialog.h')
-rw-r--r-- | linden/indra/llui/llalertdialog.h | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/linden/indra/llui/llalertdialog.h b/linden/indra/llui/llalertdialog.h index 8633164..fc3bdea 100644 --- a/linden/indra/llui/llalertdialog.h +++ b/linden/indra/llui/llalertdialog.h | |||
@@ -47,8 +47,10 @@ class LLAlertDialog : public LLModalDialog | |||
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | typedef void (*alert_callback_t)(S32 option, void* user_data); | 49 | typedef void (*alert_callback_t)(S32 option, void* user_data); |
50 | typedef void (*alert_text_callback_t)(S32 option, const LLString& text, void* user_data); | 50 | typedef void (*alert_text_callback_t)(S32 option, const std::string& text, void* user_data); |
51 | typedef bool (*display_callback_t)(S32 modal); | 51 | typedef bool (*display_callback_t)(S32 modal); |
52 | typedef std::vector<std::string> options_list_t; | ||
53 | |||
52 | enum { IGNORE_USE_DEFAULT=1, IGNORE_USE_SAVED=2, IGNORE_SHOW_AGAIN=3 }; | 54 | enum { IGNORE_USE_DEFAULT=1, IGNORE_USE_SAVED=2, IGNORE_SHOW_AGAIN=3 }; |
53 | 55 | ||
54 | class URLLoader | 56 | class URLLoader |
@@ -65,7 +67,7 @@ public: | |||
65 | 67 | ||
66 | public: | 68 | public: |
67 | // User's responsibility to call show() after creating these. | 69 | // User's responsibility to call show() after creating these. |
68 | LLAlertDialog( const LLAlertDialogTemplate* xml_template, const LLString::format_map_t& args, | 70 | LLAlertDialog( const LLAlertDialogTemplate* xml_template, const LLStringUtil::format_map_t& args, |
69 | alert_callback_t callback = NULL, void *user_data = NULL); | 71 | alert_callback_t callback = NULL, void *user_data = NULL); |
70 | 72 | ||
71 | virtual BOOL handleKeyHere(KEY key, MASK mask ); | 73 | virtual BOOL handleKeyHere(KEY key, MASK mask ); |
@@ -74,13 +76,13 @@ public: | |||
74 | virtual void setVisible( BOOL visible ); | 76 | virtual void setVisible( BOOL visible ); |
75 | virtual void onClose(bool app_quitting); | 77 | virtual void onClose(bool app_quitting); |
76 | 78 | ||
77 | bool setCheckBox( const LLString&, const LLString& ); | 79 | bool setCheckBox( const std::string&, const std::string& ); |
78 | void setOptionEnabled( S32 option, BOOL enable ); | 80 | void setOptionEnabled( S32 option, BOOL enable ); |
79 | void setCaution(BOOL val = TRUE) { mCaution = val; } | 81 | void setCaution(BOOL val = TRUE) { mCaution = val; } |
80 | // If mUnique==TRUE only one copy of this message should exist | 82 | // If mUnique==TRUE only one copy of this message should exist |
81 | void setUnique(BOOL val = TRUE) { mUnique = val; } | 83 | void setUnique(BOOL val = TRUE) { mUnique = val; } |
82 | void setEditTextCallback(alert_text_callback_t callback, void *user_data); | 84 | void setEditTextCallback(alert_text_callback_t callback, void *user_data); |
83 | void setEditTextArgs(const LLString::format_map_t& edit_args); | 85 | void setEditTextArgs(const LLStringUtil::format_map_t& edit_args); |
84 | void setDrawAsterixes(BOOL enable); | 86 | void setDrawAsterixes(BOOL enable); |
85 | 87 | ||
86 | bool show(); // May instantly destroy the message if it is unique (returns false) | 88 | bool show(); // May instantly destroy the message if it is unique (returns false) |
@@ -88,44 +90,45 @@ public: | |||
88 | //statics | 90 | //statics |
89 | static void onButtonPressed(void* userdata); | 91 | static void onButtonPressed(void* userdata); |
90 | 92 | ||
91 | static LLAlertDialog* createXml( const LLString& xml_desc, | 93 | static LLAlertDialog* createXml( const std::string& xml_desc, |
92 | alert_callback_t callback = NULL, void *user_data = NULL); | 94 | alert_callback_t callback = NULL, void *user_data = NULL); |
93 | static LLAlertDialog* createXml( const LLString& xml_desc, const LLString::format_map_t& args, | 95 | static LLAlertDialog* createXml( const std::string& xml_desc, const LLStringUtil::format_map_t& args, |
94 | alert_callback_t callback = NULL, void *user_data = NULL); | 96 | alert_callback_t callback = NULL, void *user_data = NULL); |
95 | 97 | ||
96 | static LLAlertDialog* showXml( const LLString& xml_desc, | 98 | static LLAlertDialog* showXml( const std::string& xml_desc, |
97 | alert_callback_t callback = NULL, void *user_data = NULL); | 99 | alert_callback_t callback = NULL, void *user_data = NULL); |
98 | static LLAlertDialog* showXml( const LLString& xml_desc, const LLString::format_map_t& args, | 100 | static LLAlertDialog* showXml( const std::string& xml_desc, const LLStringUtil::format_map_t& args, |
99 | alert_callback_t callback = NULL, void *user_data = NULL); | 101 | alert_callback_t callback = NULL, void *user_data = NULL); |
100 | 102 | ||
101 | static LLAlertDialog* showCritical( const LLString& msg, alert_callback_t callback = NULL, void *user_data = NULL); | 103 | static LLAlertDialog* showCritical( const std::string& msg, alert_callback_t callback = NULL, void *user_data = NULL); |
102 | 104 | ||
103 | static bool parseAlerts(const LLString& xml_filename, LLControlGroup* settings = NULL, BOOL settings_only = FALSE); | 105 | static bool parseAlerts(const std::string& xml_filename, LLControlGroup* settings = NULL, BOOL settings_only = FALSE); |
104 | static const LLString& getTemplateMessage(const LLString& xml_desc); | 106 | static const std::string& getTemplateMessage(const std::string& xml_desc); |
105 | 107 | ||
106 | static void setDisplayCallback(display_callback_t callback) { sDisplayCallback = callback; } | 108 | static void setDisplayCallback(display_callback_t callback) { sDisplayCallback = callback; } |
107 | 109 | ||
108 | void format(LLString& msg, const LLString::format_map_t& args); | 110 | private: |
111 | void format(std::string& msg, const LLStringUtil::format_map_t& args); | ||
109 | 112 | ||
113 | public: | ||
110 | static LLControlGroup* sSettings; | 114 | static LLControlGroup* sSettings; |
111 | 115 | ||
112 | // use LLPointer so they delete themselves when sTemplates is destroyed | 116 | // use LLPointer so they delete themselves when sTemplates is destroyed |
113 | typedef std::map<LLString, LLPointer<LLAlertDialogTemplate> > template_map_t; | 117 | typedef std::map<std::string, LLPointer<LLAlertDialogTemplate> > template_map_t; |
114 | static template_map_t sAlertTemplates; // by mLabel | 118 | static template_map_t sAlertTemplates; // by mLabel |
115 | static template_map_t sIgnorableTemplates; // by mIgnoreLabel | 119 | static template_map_t sIgnorableTemplates; // by mIgnoreLabel |
116 | 120 | ||
117 | |||
118 | private: | 121 | private: |
119 | 122 | ||
120 | static std::map<LLString, LLAlertDialog*> sUniqueActiveMap; | 123 | static std::map<std::string, LLAlertDialog*> sUniqueActiveMap; |
121 | static display_callback_t sDisplayCallback; | 124 | static display_callback_t sDisplayCallback; |
122 | 125 | ||
123 | static LLString sStringSkipNextTime; | 126 | static std::string sStringSkipNextTime; |
124 | static LLString sStringAlwaysChoose; | 127 | static std::string sStringAlwaysChoose; |
125 | 128 | ||
126 | void createDialog(const std::vector<LLString>* options, S32 default_option, | 129 | void createDialog(const options_list_t& options_in, S32 default_option, |
127 | const LLString& msg, const LLString::format_map_t& args, | 130 | const std::string& msg, const LLStringUtil::format_map_t& args, |
128 | const LLString& edit_text); | 131 | const std::string& edit_text); |
129 | 132 | ||
130 | virtual ~LLAlertDialog(); | 133 | virtual ~LLAlertDialog(); |
131 | void handleCallbacks(); | 134 | void handleCallbacks(); |
@@ -150,14 +153,14 @@ private: | |||
150 | BOOL mCaution; | 153 | BOOL mCaution; |
151 | BOOL mUnique; | 154 | BOOL mUnique; |
152 | S32 mIgnorable; | 155 | S32 mIgnorable; |
153 | LLString mLabel; | 156 | std::string mLabel; |
154 | LLString mIgnoreLabel; | 157 | std::string mIgnoreLabel; |
155 | LLFrameTimer mDefaultBtnTimer; | 158 | LLFrameTimer mDefaultBtnTimer; |
156 | // For Dialogs that take a line as text as input: | 159 | // For Dialogs that take a line as text as input: |
157 | LLLineEditor* mLineEditor; | 160 | LLLineEditor* mLineEditor; |
158 | alert_text_callback_t mTextCallback; | 161 | alert_text_callback_t mTextCallback; |
159 | // For Dialogs linked to a URL | 162 | // For Dialogs linked to a URL |
160 | LLString mURL; // Some alerts will direct the resident to a URL | 163 | std::string mURL; // Some alerts will direct the resident to a URL |
161 | S32 mURLOption; | 164 | S32 mURLOption; |
162 | 165 | ||
163 | private: | 166 | private: |
@@ -171,7 +174,7 @@ class LLAlertDialogTemplate : public LLRefCount | |||
171 | public: | 174 | public: |
172 | LLAlertDialogTemplate() : mTitle(), mURLOption(0), mModal(FALSE), mCaution(FALSE), mUnique(FALSE), mIgnorable(0), mDefaultOption(0) {} | 175 | LLAlertDialogTemplate() : mTitle(), mURLOption(0), mModal(FALSE), mCaution(FALSE), mUnique(FALSE), mIgnorable(0), mDefaultOption(0) {} |
173 | 176 | ||
174 | void addOption(const LLString& label, const LLString& ignore_text, BOOL is_default = FALSE) | 177 | void addOption(const std::string& label, const std::string& ignore_text, BOOL is_default = FALSE) |
175 | { | 178 | { |
176 | if (is_default) | 179 | if (is_default) |
177 | { | 180 | { |
@@ -203,21 +206,21 @@ public: | |||
203 | 206 | ||
204 | 207 | ||
205 | public: | 208 | public: |
206 | LLString mLabel; // Handle for access from code, etc | 209 | std::string mLabel; // Handle for access from code, etc |
207 | LLString mTitle; // (optional) text to display in title bar | 210 | std::string mTitle; // (optional) text to display in title bar |
208 | LLString mMessage; // Message to display | 211 | std::string mMessage; // Message to display |
209 | LLString mIgnoreListText; // Text to display in enable/disable dialog (if mIgnorable == TRUE) | 212 | std::string mIgnoreListText; // Text to display in enable/disable dialog (if mIgnorable == TRUE) |
210 | LLString mIgnoreLabel; // Handle for ignore variable (may be shared by multiple templates) | 213 | std::string mIgnoreLabel; // Handle for ignore variable (may be shared by multiple templates) |
211 | LLString mURL; // Some alerts will direct the resident to a URL | 214 | std::string mURL; // Some alerts will direct the resident to a URL |
212 | S32 mURLOption; | 215 | S32 mURLOption; |
213 | BOOL mModal; | 216 | BOOL mModal; |
214 | BOOL mCaution; | 217 | BOOL mCaution; |
215 | BOOL mUnique; | 218 | BOOL mUnique; |
216 | S32 mIgnorable; // 0 = Never Ignore, 1 = Do default option, 2 = Do saved option | 219 | S32 mIgnorable; // 0 = Never Ignore, 1 = Do default option, 2 = Do saved option |
217 | std::vector<LLString> mOptions; | 220 | LLAlertDialog::options_list_t mOptions; |
218 | std::vector<LLString> mOptionDefaultText; | 221 | LLAlertDialog::options_list_t mOptionDefaultText; |
219 | S32 mDefaultOption; | 222 | S32 mDefaultOption; |
220 | LLString mEditLineText; | 223 | std::string mEditLineText; |
221 | }; | 224 | }; |
222 | 225 | ||
223 | #endif // LL_ALERTDIALOG_H | 226 | #endif // LL_ALERTDIALOG_H |