diff options
Diffstat (limited to 'indra/newview/llscreenchannel.h')
-rw-r--r-- | indra/newview/llscreenchannel.h | 77 |
1 files changed, 49 insertions, 28 deletions
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index d207d13981..56a9cf8b4b 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -53,22 +53,34 @@ class LLScreenChannelBase : public LLUICtrl { friend class LLChannelManager; public: - LLScreenChannelBase(const LLUUID& id); - ~LLScreenChannelBase(); + struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> + { + Mandatory<LLUUID> id; + Optional<bool> display_toasts_always; + Optional<EToastAlignment> toast_align; + Optional<EChannelAlignment> channel_align; + + Params() + : id("id", LLUUID("")), + display_toasts_always("display_toasts_always", false), + toast_align("toast_align", NA_BOTTOM), + channel_align("channel_align", CA_LEFT) + {} + }; + + LLScreenChannelBase(const Params&); + + BOOL postBuild(); + + void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); // Channel's outfit-functions // update channel's size and position in the World View - virtual void updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect); - void resetPositionAndSize(); + virtual void updatePositionAndSize(LLRect rect); // initialization of channel's shape and position virtual void init(S32 channel_left, S32 channel_right); - - virtual void setToastAlignment(EToastAlignment align) {mToastAlignment = align;} - - virtual void setChannelAlignment(EChannelAlignment align) {mChannelAlignment = align;} - // kill or modify a toast by its ID virtual void killToastByNotificationID(LLUUID id) {}; virtual void modifyToastNotificationByID(LLUUID id, LLSD data) {}; @@ -91,7 +103,6 @@ public: void setCanStoreToasts(bool store) { mCanStoreToasts = store; } - void setDisplayToastsAlways(bool display_toasts) { mDisplayToastsAlways = display_toasts; } bool getDisplayToastsAlways() { return mDisplayToastsAlways; } // get number of hidden notifications from a channel @@ -106,13 +117,15 @@ public: // get ID of a channel LLUUID getChannelID() { return mID; } + LLHandle<LLScreenChannelBase> getHandle() { return getDerivedHandle<LLScreenChannelBase>(); } protected: - void updateBottom(); + void updateRect(); + LLRect getChannelRect(); // Channel's flags bool mControlHovering; - LLToast* mHoveredToast; + LLToast* mHoveredToast; bool mCanStoreToasts; bool mDisplayToastsAlways; // controls whether a channel shows toasts or not @@ -125,9 +138,9 @@ protected: // channel's ID LLUUID mID; - - // store a connection to prevent futher crash that is caused by sending a signal to a destroyed channel - boost::signals2::connection mWorldViewRectConnection; + + LLView* mFloaterSnapRegion; + LLView* mChicletRegion; }; @@ -138,7 +151,7 @@ class LLScreenChannel : public LLScreenChannelBase { friend class LLChannelManager; public: - LLScreenChannel(LLUUID& id); + LLScreenChannel(const Params&); virtual ~LLScreenChannel(); class Matcher @@ -149,11 +162,11 @@ public: virtual bool matches(const LLNotificationPtr) const = 0; }; - std::list<LLToast*> findToasts(const Matcher& matcher); + std::list<const LLToast*> findToasts(const Matcher& matcher); // Channel's outfit-functions // update channel's size and position in the World View - void updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect); + void updatePositionAndSize(LLRect new_rect); // initialization of channel's shape and position void init(S32 channel_left, S32 channel_right); @@ -224,31 +237,39 @@ public: reject_tost_signal_t mRejectToastSignal; boost::signals2::connection setOnRejectToastCallback(reject_tost_callback_t cb) { return mRejectToastSignal.connect(cb); } private: - struct ToastElem + class ToastElem { - LLUUID id; - LLToast* toast; + public: + ToastElem(const LLHandle<LLToast>& toast) : mToast(toast) + { + } - ToastElem(LLToast::Params p) : id(p.notif_id) + ToastElem(const ToastElem& toast_elem) : mToast(toast_elem.mToast) { - toast = new LLToast(p); } - ToastElem(const ToastElem& toast_elem) + LLToast* getToast() const { - id = toast_elem.id; - toast = toast_elem.toast; + return mToast.get(); + } + + LLUUID getID() const + { + return mToast.isDead() ? LLUUID() : mToast.get()->getNotificationID(); } bool operator == (const LLUUID &id_op) const { - return (id == id_op); + return (getID() == id_op); } bool operator == (LLPanel* panel_op) const { - return (toast == panel_op); + return (mToast.get() == panel_op); } + + private: + LLHandle<LLToast> mToast; }; // Channel's handlers |