summaryrefslogtreecommitdiff
path: root/indra/llui/llfloater.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llfloater.h')
-rw-r--r--indra/llui/llfloater.h127
1 files changed, 97 insertions, 30 deletions
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 5b7b020881..64d6dcea04 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,66 @@ 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
+ {
+ POSITIONING_RELATIVE,
+ POSITIONING_CASCADING,
+ POSITIONING_CASCADE_GROUP,
+ POSITIONING_CENTERED,
+ POSITIONING_SPECIFIED,
+ POSITIONING_COUNT
+ };
+}
+
+namespace LLInitParam
+{
+ template<>
+ struct TypeValues<LLFloaterEnums::EOpenPositioning> : public TypeValuesHelper<LLFloaterEnums::EOpenPositioning>
+ {
+ static void declareValues();
+ };
+}
+
+struct LL_COORD_FLOATER
+{
+ typedef F32 value_t;
+
+ LLCoordCommon convertToCommon() const;
+ void convertFromCommon(const LLCoordCommon& from);
+protected:
+ LLHandle<LLFloater> mFloater;
+};
+
+struct LLCoordFloater : LLCoord<LL_COORD_FLOATER>
+{
+ typedef LLCoord<LL_COORD_FLOATER> coord_t;
+
+ LLCoordFloater() {}
+ LLCoordFloater(F32 x, F32 y, LLFloater& floater);
+ LLCoordFloater(const LLCoordCommon& other, LLFloater& floater);
+
+ LLCoordFloater& operator=(const LLCoordCommon& other)
+ {
+ convertFromCommon(other);
+ return *this;
+ }
+
+ LLCoordFloater& operator=(const LLCoordFloater& other);
+
+ bool operator==(const LLCoordFloater& other) const;
+ bool operator!=(const LLCoordFloater& other) const { return !(*this == other); }
+
+ void setFloater(LLFloater& floater);
+};
+
+class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
+{
+ friend class LLFloaterView;
+ friend class LLFloaterReg;
+ friend class LLMultiFloater;
+
public:
struct KeyCompare
{
@@ -95,7 +151,7 @@ public:
short_title;
Optional<bool> single_instance,
- auto_tile,
+ reuse_instance,
can_resize,
can_minimize,
can_close,
@@ -105,7 +161,10 @@ public:
save_visibility,
save_dock_state,
can_dock,
- open_centered;
+ show_title;
+
+ Optional<LLFloaterEnums::EOpenPositioning> positioning;
+
Optional<S32> header_height,
legacy_header_height; // HACK see initFromXML()
@@ -125,6 +184,8 @@ public:
Optional<CommitCallbackParam> open_callback,
close_callback;
+
+ Ignored follows;
Params();
};
@@ -144,13 +205,14 @@ 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);
bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL);
/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
- /*virtual*/ BOOL canSnapTo(const LLView* other_view);
+ /*virtual*/ BOOL canSnapTo(const LLView* other_view);
/*virtual*/ void setSnappedTo(const LLView* snap_view);
/*virtual*/ void setFocus( BOOL b );
/*virtual*/ void setIsChrome(BOOL is_chrome);
@@ -179,7 +241,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,12 +264,11 @@ 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 );
void getResizeLimits( S32* min_width, S32* min_height ) { *min_width = mMinWidth; *min_height = mMinHeight; }
- LLRect getSavedRect() const;
- bool hasSavedRect() const;
static std::string getControlName(const std::string& name, const LLSD& key);
static LLControlGroup* getControlGroup();
@@ -251,9 +311,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 +348,19 @@ public:
void updateTransparency(ETypeTransparency transparency_type);
+ void enableResizeCtrls(bool enable, bool width = true, bool height = true);
+
+ bool isPositioning(LLFloaterEnums::EOpenPositioning p) const { return (p == mPositioning); }
protected:
+ void applyControlsAndPosition(LLFloater* other);
- void setRectControl(const std::string& rectname) { mRectControl = rectname; };
+ void stackWith(LLFloater& other);
- virtual void applySavedVariables();
+ virtual bool applyRectControl();
+ bool applyDockState();
+ void applyPositioning(LLFloater* other, bool on_open);
+ void applyRelativePosition();
- void applyRectControl();
- void applyDockState();
void storeRectControl();
void storeVisibilityControl();
void storeDockStateControl();
@@ -340,7 +405,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
@@ -360,7 +424,10 @@ public:
commit_signal_t* mMinimizeSignal;
protected:
+ bool mSaveRect;
std::string mRectControl;
+ std::string mPosXControl;
+ std::string mPosYControl;
std::string mVisibilityControl;
std::string mDocStateControl;
LLSD mKey; // Key used for retrieving instances; set (for now) by LLFLoaterReg
@@ -377,15 +444,17 @@ 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 mPositioning;
+ LLCoordFloater mPosition;
S32 mMinWidth;
S32 mMinHeight;
@@ -424,18 +493,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 +515,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 +543,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 +561,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;
};
//