aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llnotify.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llnotify.h')
-rw-r--r--linden/indra/newview/llnotify.h60
1 files changed, 44 insertions, 16 deletions
diff --git a/linden/indra/newview/llnotify.h b/linden/indra/newview/llnotify.h
index eec27ec..ad9b24a 100644
--- a/linden/indra/newview/llnotify.h
+++ b/linden/indra/newview/llnotify.h
@@ -31,8 +31,8 @@
31 31
32#include "llfontgl.h" 32#include "llfontgl.h"
33#include "llpanel.h" 33#include "llpanel.h"
34#include "lldarray.h"
35#include "lltimer.h" 34#include "lltimer.h"
35#include <vector>
36 36
37class LLButton; 37class LLButton;
38class LLNotifyBoxTemplate; 38class LLNotifyBoxTemplate;
@@ -44,33 +44,36 @@ public:
44 typedef void (*notify_callback_t)(S32 option, void* data); 44 typedef void (*notify_callback_t)(S32 option, void* data);
45 typedef std::vector<LLString> option_list_t; 45 typedef std::vector<LLString> option_list_t;
46 46
47 static void showXml( const LLString& xml_desc, 47 static LLNotifyBox* showXml( const LLString& xml_desc,
48 notify_callback_t callback = NULL, void *user_data = NULL); 48 notify_callback_t callback = NULL, void *user_data = NULL);
49 static void showXml( const LLString& xml_desc, const LLString::format_map_t& args, BOOL is_caution, 49 static LLNotifyBox* showXml( const LLString& xml_desc, const LLString::format_map_t& args, BOOL is_caution,
50 notify_callback_t callback = NULL, void *user_data = NULL); 50 notify_callback_t callback = NULL, void *user_data = NULL);
51 static void showXml( const LLString& xml_desc, const LLString::format_map_t& args, 51 static LLNotifyBox* showXml( const LLString& xml_desc, const LLString::format_map_t& args,
52 notify_callback_t callback = NULL, void *user_data = NULL); 52 notify_callback_t callback = NULL, void *user_data = NULL);
53 // For script notifications: 53 // For script notifications:
54 static void showXml( const LLString& xml_desc, const LLString::format_map_t& args, 54 static LLNotifyBox* showXml( const LLString& xml_desc, const LLString::format_map_t& args,
55 notify_callback_t callback, void *user_data, 55 notify_callback_t callback, void *user_data,
56 const option_list_t& options, 56 const option_list_t& options,
57 BOOL layout_script_dialog = FALSE); 57 BOOL layout_script_dialog = FALSE);
58 58
59 static bool parseNotify(const LLString& xml_filename); 59 static bool parseNotify(const LLString& xml_filename);
60 static const LLString& getTemplateMessage(const LLString& xml_desc); 60 static const LLString getTemplateMessage(const LLString& xml_desc, const LLString::format_map_t& args);
61 static const LLString getTemplateMessage(const LLString& xml_desc);
61 static BOOL getTemplateIsCaution(const LLString& xml_desc); 62 static BOOL getTemplateIsCaution(const LLString& xml_desc);
62 63
63 BOOL isTip() const { return mIsTip; } 64 BOOL isTip() const { return mIsTip; }
64 BOOL isCaution() const { return mIsCaution; } 65 BOOL isCaution() const { return mIsCaution; }
65 /*virtual*/ void setVisible(BOOL visible); 66 /*virtual*/ void setVisible(BOOL visible);
67 void stopAnimation() { mAnimating = FALSE; }
66 68
67 notify_callback_t getNotifyCallback() { return mCallback; } 69 notify_callback_t getNotifyCallback() { return mBehavior->mCallback; }
68 void* getUserData() { return mData; } 70 void* getUserData() { return mBehavior->mData; }
71 void close();
69 72
70 static void cleanup(); 73 static void cleanup();
71 74
72protected: 75protected:
73 LLNotifyBox(const LLString& xml_desc, const LLString::format_map_t& args, 76 LLNotifyBox(LLPointer<LLNotifyBoxTemplate> notify_template, const LLString::format_map_t& args,
74 notify_callback_t callback, void* user_data, 77 notify_callback_t callback, void* user_data,
75 BOOL is_caution = FALSE, 78 BOOL is_caution = FALSE,
76 const option_list_t& extra_options = option_list_t(), 79 const option_list_t& extra_options = option_list_t(),
@@ -85,7 +88,6 @@ protected:
85 /*virtual*/ void draw(); 88 /*virtual*/ void draw();
86 /*virtual*/ void tick(); 89 /*virtual*/ void tick();
87 90
88 void close();
89 void moveToBack(); 91 void moveToBack();
90 92
91 // Returns the rect, relative to gNotifyView, where this 93 // Returns the rect, relative to gNotifyView, where this
@@ -99,25 +101,40 @@ protected:
99 // for "next" button 101 // for "next" button
100 static void onClickNext(void* data); 102 static void onClickNext(void* data);
101 103
104 static LLPointer<LLNotifyBoxTemplate> getTemplate(const LLString& xml_desc);
105 static LLNotifyBox* findExistingNotify(LLPointer<LLNotifyBoxTemplate> notify_template, const LLString::format_map_t& args);
106
102private: 107private:
103 void drawBackground() const; 108 void drawBackground() const;
104 109
105 static LLPointer<LLNotifyBoxTemplate> sDefaultTemplate; 110 static LLPointer<LLNotifyBoxTemplate> sDefaultTemplate;
106 111
107protected: 112protected:
113 LLString mMessage;
114
108 BOOL mIsTip; 115 BOOL mIsTip;
109 BOOL mIsCaution; // is this a caution notification? 116 BOOL mIsCaution; // is this a caution notification?
110 BOOL mAnimating; // Are we sliding onscreen? 117 BOOL mAnimating; // Are we sliding onscreen?
118 BOOL mUnique;
111 119
112 // Time since this notification was displayed. 120 // Time since this notification was displayed.
113 // This is an LLTimer not a frame timer because I am concerned 121 // This is an LLTimer not a frame timer because I am concerned
114 // that I could be out-of-sync by one frame in the animation. 122 // that I could be out-of-sync by one frame in the animation.
115 LLTimer mTimer; 123 LLTimer mAnimateTimer;
116 124
117 LLButton* mNextBtn; 125 LLButton* mNextBtn;
118 126
119 notify_callback_t mCallback; 127 // keep response behavior isolated here
120 void* mData; 128 struct LLNotifyBehavior
129 {
130 LLNotifyBehavior(notify_callback_t callback, void* data);
131
132 notify_callback_t mCallback;
133 void* mData;
134
135 };
136 LLNotifyBehavior* mBehavior;
137
121 S32 mNumOptions; 138 S32 mNumOptions;
122 S32 mDefaultOption; 139 S32 mDefaultOption;
123 140
@@ -127,7 +144,7 @@ protected:
127 LLNotifyBox* mSelf; 144 LLNotifyBox* mSelf;
128 S32 mButton; 145 S32 mButton;
129 }; 146 };
130 LLDynamicArray<InstanceAndS32*> mBtnCallbackData; 147 std::vector<InstanceAndS32*> mBtnCallbackData;
131 148
132 typedef std::map<LLString, LLPointer<LLNotifyBoxTemplate> > template_map_t; 149 typedef std::map<LLString, LLPointer<LLNotifyBoxTemplate> > template_map_t;
133 static template_map_t sNotifyTemplates; // by mLabel 150 static template_map_t sNotifyTemplates; // by mLabel
@@ -135,6 +152,9 @@ protected:
135 static S32 sNotifyBoxCount; 152 static S32 sNotifyBoxCount;
136 static const LLFontGL* sFont; 153 static const LLFontGL* sFont;
137 static const LLFontGL* sFontSmall; 154 static const LLFontGL* sFontSmall;
155
156 typedef std::map<LLString, LLNotifyBox*> unique_map_t;
157 static unique_map_t sOpenUniqueNotifyBoxes;
138}; 158};
139 159
140class LLNotifyBoxView : public LLUICtrl 160class LLNotifyBoxView : public LLUICtrl
@@ -154,7 +174,13 @@ extern LLNotifyBoxView* gNotifyBoxView;
154class LLNotifyBoxTemplate : public LLRefCount 174class LLNotifyBoxTemplate : public LLRefCount
155{ 175{
156public: 176public:
157 LLNotifyBoxTemplate() : mIsTip(FALSE), mIsCaution(FALSE), mDefaultOption(0) {} 177 LLNotifyBoxTemplate(BOOL unique, F32 duration) :
178 mIsTip(FALSE),
179 mIsCaution(FALSE),
180 mUnique(unique),
181 mDuration(duration),
182 mDefaultOption(0)
183 {}
158 184
159 void setMessage(const LLString& message) 185 void setMessage(const LLString& message)
160 { 186 {
@@ -174,7 +200,9 @@ public:
174 LLString mLabel; // Handle for access from code, etc 200 LLString mLabel; // Handle for access from code, etc
175 LLString mMessage; // Message to display 201 LLString mMessage; // Message to display
176 BOOL mIsTip; 202 BOOL mIsTip;
177 BOOL mIsCaution; 203 BOOL mIsCaution;
204 BOOL mUnique;
205 F32 mDuration;
178 LLNotifyBox::option_list_t mOptions; 206 LLNotifyBox::option_list_t mOptions;
179 S32 mDefaultOption; 207 S32 mDefaultOption;
180}; 208};