diff options
Diffstat (limited to 'indra/llui/llfloater.h')
-rw-r--r-- | indra/llui/llfloater.h | 93 |
1 files changed, 65 insertions, 28 deletions
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 5b7b020881..59b35d206f 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -35,6 +35,7 @@ #include "lluuid.h" //#include "llnotificationsutil.h" #include <set> +#include <boost/signals2.hpp> class LLDragHandle; class LLResizeHandle; @@ -59,11 +60,35 @@ const BOOL CLOSE_NO = FALSE; const BOOL ADJUST_VERTICAL_YES = TRUE; const BOOL ADJUST_VERTICAL_NO = FALSE; -class LLFloater : public LLPanel +namespace LLFloaterEnums { -friend class LLFloaterView; -friend class LLFloaterReg; -friend class LLMultiFloater; + enum EOpenPositioning + { + OPEN_POSITIONING_NONE, + OPEN_POSITIONING_CASCADING, + OPEN_POSITIONING_CASCADE_GROUP, + OPEN_POSITIONING_CENTERED, + OPEN_POSITIONING_SPECIFIED, + OPEN_POSITIONING_COUNT + }; +} + +namespace LLInitParam +{ + template<> + struct TypeValues<LLFloaterEnums::EOpenPositioning> : public TypeValuesHelper<LLFloaterEnums::EOpenPositioning> + { + static void declareValues(); + }; +} + + +class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater> +{ + friend class LLFloaterView; + friend class LLFloaterReg; + friend class LLMultiFloater; + public: struct KeyCompare { @@ -95,7 +120,7 @@ public: short_title; Optional<bool> single_instance, - auto_tile, + reuse_instance, can_resize, can_minimize, can_close, @@ -105,7 +130,13 @@ public: save_visibility, save_dock_state, can_dock, - open_centered; + show_title; + + Optional<LLFloaterEnums::EOpenPositioning> open_positioning; + Optional<S32> specified_left; + Optional<S32> specified_bottom; + + Optional<S32> header_height, legacy_header_height; // HACK see initFromXML() @@ -125,6 +156,8 @@ public: Optional<CommitCallbackParam> open_callback, close_callback; + + Ignored follows; Params(); }; @@ -144,6 +177,7 @@ public: bool buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL); boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setOpenCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setCloseCallback( const commit_signal_t::slot_type& cb ); void initFromParams(const LLFloater::Params& p); @@ -179,7 +213,6 @@ public: std::string getTitle() const; void setShortTitle( const std::string& short_title ); std::string getShortTitle() const; - void setTitleVisible(bool visible); virtual void setMinimized(BOOL b); void moveResizeHandlesToFront(); void addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE); @@ -203,6 +236,7 @@ public: void setCanTearOff(BOOL can_tear_off); virtual void setCanResize(BOOL can_resize); void setCanDrag(BOOL can_drag); + bool getCanDrag(); void setHost(LLMultiFloater* host); BOOL isResizable() const { return mResizable; } void setResizeLimits( S32 min_width, S32 min_height ); @@ -251,9 +285,9 @@ public: void clearSnapTarget() { mSnappedTo.markDead(); } LLHandle<LLFloater> getSnapTarget() const { return mSnappedTo; } - LLHandle<LLFloater> getHandle() const { return mHandle; } + LLHandle<LLFloater> getHandle() const { return getDerivedHandle<LLFloater>(); } const LLSD& getKey() { return mKey; } - BOOL matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); } + virtual bool matchesKey(const LLSD& key) { return mSingleInstance || KeyCompare::equate(key, mKey); } const std::string& getInstanceName() { return mInstanceName; } @@ -288,14 +322,17 @@ public: void updateTransparency(ETypeTransparency transparency_type); -protected: + void enableResizeCtrls(bool enable, bool width = true, bool height = true); - void setRectControl(const std::string& rectname) { mRectControl = rectname; }; + bool isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mOpenPositioning); } +protected: + void applyControlsAndPosition(LLFloater* other); - virtual void applySavedVariables(); + void stackWith(LLFloater& other); - void applyRectControl(); - void applyDockState(); + virtual bool applyRectControl(); + bool applyDockState(); + void applyPositioning(LLFloater* other); void storeRectControl(); void storeVisibilityControl(); void storeDockStateControl(); @@ -340,7 +377,6 @@ private: BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); void addResizeCtrls(); void layoutResizeCtrls(); - void enableResizeCtrls(bool enable); void addDragHandle(); void layoutDragHandle(); // repair layout @@ -377,15 +413,18 @@ private: LLUIString mShortTitle; BOOL mSingleInstance; // TRUE if there is only ever one instance of the floater + bool mReuseInstance; // true if we want to hide the floater when we close it instead of destroying it std::string mInstanceName; // Store the instance name so we can remove ourselves from the list - BOOL mAutoTile; // TRUE if placement of new instances tiles BOOL mCanTearOff; BOOL mCanMinimize; BOOL mCanClose; BOOL mDragOnLeft; BOOL mResizable; - bool mOpenCentered; + + LLFloaterEnums::EOpenPositioning mOpenPositioning; + S32 mSpecifiedLeft; + S32 mSpecifiedBottom; S32 mMinWidth; S32 mMinHeight; @@ -424,18 +463,9 @@ private: typedef void(*click_callback)(LLFloater*); static click_callback sButtonCallbacks[BUTTON_COUNT]; - typedef std::map<LLHandle<LLFloater>, LLFloater*> handle_map_t; - typedef std::map<LLHandle<LLFloater>, LLFloater*>::iterator handle_map_iter_t; - static handle_map_t sFloaterMap; - - std::vector<LLHandle<LLView> > mMinimizedHiddenChildren; - BOOL mHasBeenDraggedWhileMinimized; S32 mPreviousMinimizedBottom; S32 mPreviousMinimizedLeft; - -// LLFloaterNotificationContext* mNotificationContext; - LLRootHandle<LLFloater> mHandle; }; @@ -455,8 +485,6 @@ protected: public: /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); - void reshapeFloater(S32 width, S32 height, BOOL called_from_parent, BOOL adjust_vertical); - /*virtual*/ void draw(); /*virtual*/ LLRect getSnapRect() const; /*virtual*/ void refresh(); @@ -485,6 +513,10 @@ public: BOOL allChildrenClosed(); void shiftFloaters(S32 x_offset, S32 y_offset); + void hideAllFloaters(); + void showHiddenFloaters(); + + LLFloater* getFrontmost() const; LLFloater* getBackmost() const; LLFloater* getParentFloater(LLView* viewp) const; @@ -499,11 +531,16 @@ public: void setFloaterSnapView(LLHandle<LLView> snap_view) {mSnapView = snap_view; } private: + void hiddenFloaterClosed(LLFloater* floater); + + LLRect mLastSnapRect; LLHandle<LLView> mSnapView; BOOL mFocusCycleMode; S32 mSnapOffsetBottom; S32 mSnapOffsetRight; S32 mMinimizePositionVOffset; + typedef std::vector<std::pair<LLHandle<LLFloater>, boost::signals2::connection> > hidden_floaters_t; + hidden_floaters_t mHiddenFloaters; }; // |