cleaned up and commented some code
parent
b6b463dd39
commit
ce693aa79a
|
|
@ -66,6 +66,7 @@ public:
|
|||
void reshape(S32 width, S32 height, BOOL called_from_parent = true);
|
||||
void setEnabled(BOOL enabled);
|
||||
void setCommandId(const LLCommandId& id) { mId = id; }
|
||||
LLCommandId getCommandId() { return mId; }
|
||||
|
||||
void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; }
|
||||
void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
|
||||
|
|
@ -164,7 +165,8 @@ public:
|
|||
pad_bottom,
|
||||
pad_between,
|
||||
min_girth;
|
||||
// get rid of this
|
||||
|
||||
// default command set
|
||||
Multiple<LLCommandId::Params> commands;
|
||||
|
||||
Optional<LLPanel::Params> button_panel;
|
||||
|
|
@ -175,8 +177,6 @@ public:
|
|||
// virtuals
|
||||
void draw();
|
||||
void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
|
||||
int getRankFromPosition(S32 x, S32 y);
|
||||
int getRankFromPosition(const LLCommandId& id);
|
||||
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
||||
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
|
||||
EDragAndDropType cargo_type,
|
||||
|
|
@ -185,15 +185,14 @@ public:
|
|||
std::string& tooltip_msg);
|
||||
|
||||
static const int RANK_NONE = -1;
|
||||
|
||||
bool addCommand(const LLCommandId& commandId, int rank = RANK_NONE);
|
||||
int removeCommand(const LLCommandId& commandId); // Returns the rank the removed command was at, RANK_NONE if not found
|
||||
bool hasCommand(const LLCommandId& commandId) const;
|
||||
bool enableCommand(const LLCommandId& commandId, bool enabled);
|
||||
bool stopCommandInProgress(const LLCommandId& commandId);
|
||||
bool flashCommand(const LLCommandId& commandId, bool flash);
|
||||
bool hasCommand(const LLCommandId& commandId) const; // is this command bound to a button in this toolbar
|
||||
bool enableCommand(const LLCommandId& commandId, bool enabled); // enable/disable button bound to the specified command, if it exists in this toolbar
|
||||
bool stopCommandInProgress(const LLCommandId& commandId); // stop command if it is currently active
|
||||
bool flashCommand(const LLCommandId& commandId, bool flash); // flash button associated with given command, if in this toolbar
|
||||
|
||||
void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; }
|
||||
void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; } // connects drag and drop behavior to external logic
|
||||
void setHandleDragCallback(tool_handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
|
||||
void setHandleDropCallback(tool_handledrop_callback_t cb) { mHandleDropCallback = cb; }
|
||||
bool isReadOnly() const { return mReadOnly; }
|
||||
|
|
@ -206,18 +205,48 @@ public:
|
|||
boost::signals2::connection setButtonLeaveCallback(const button_signal_t::slot_type& cb);
|
||||
boost::signals2::connection setButtonRemoveCallback(const button_signal_t::slot_type& cb);
|
||||
|
||||
void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; }
|
||||
// append the specified string to end of tooltip
|
||||
void setTooltipButtonSuffix(const std::string& suffix) { mButtonTooltipSuffix = suffix; }
|
||||
|
||||
LLToolBarEnums::SideType getSideType() const { return mSideType; }
|
||||
bool hasButtons() const { return !mButtons.empty(); }
|
||||
bool isModified() const { return mModified; }
|
||||
|
||||
protected:
|
||||
int getRankFromPosition(S32 x, S32 y);
|
||||
int getRankFromPosition(const LLCommandId& id);
|
||||
|
||||
// Methods used in loading and saving toolbar settings
|
||||
void setButtonType(LLToolBarEnums::ButtonType button_type);
|
||||
LLToolBarEnums::ButtonType getButtonType() { return mButtonType; }
|
||||
command_id_list_t& getCommandsList() { return mButtonCommands; }
|
||||
void clearCommandsList();
|
||||
|
||||
private:
|
||||
friend class LLUICtrlFactory;
|
||||
LLToolBar(const Params&);
|
||||
~LLToolBar();
|
||||
|
||||
void initFromParams(const Params&);
|
||||
void createContextMenu();
|
||||
void updateLayoutAsNeeded();
|
||||
void createButtons();
|
||||
void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth);
|
||||
BOOL isSettingChecked(const LLSD& userdata);
|
||||
void onSettingEnable(const LLSD& userdata);
|
||||
|
||||
private:
|
||||
// static layout state
|
||||
const bool mReadOnly;
|
||||
const LLToolBarEnums::SideType mSideType;
|
||||
const bool mWrap;
|
||||
const S32 mPadLeft,
|
||||
mPadRight,
|
||||
mPadTop,
|
||||
mPadBottom,
|
||||
mPadBetween,
|
||||
mMinGirth;
|
||||
|
||||
// drag and drop state
|
||||
tool_startdrag_callback_t mStartDragItemCallback;
|
||||
tool_handledrag_callback_t mHandleDragItemCallback;
|
||||
tool_handledrop_callback_t mHandleDropCallback;
|
||||
|
|
@ -227,49 +256,23 @@ protected:
|
|||
mDragy,
|
||||
mDragGirth;
|
||||
|
||||
public:
|
||||
// Methods used in loading and saving toolbar settings
|
||||
void setButtonType(LLToolBarEnums::ButtonType button_type);
|
||||
LLToolBarEnums::ButtonType getButtonType() { return mButtonType; }
|
||||
command_id_list_t& getCommandsList() { return mButtonCommands; }
|
||||
void clearCommandsList();
|
||||
|
||||
private:
|
||||
void createContextMenu();
|
||||
void updateLayoutAsNeeded();
|
||||
void createButtons();
|
||||
void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth);
|
||||
BOOL isSettingChecked(const LLSD& userdata);
|
||||
void onSettingEnable(const LLSD& userdata);
|
||||
|
||||
const bool mReadOnly;
|
||||
|
||||
typedef std::list<LLToolBarButton*> toolbar_button_list;
|
||||
typedef std::map<LLUUID, LLToolBarButton*> command_id_map;
|
||||
toolbar_button_list mButtons;
|
||||
command_id_list_t mButtonCommands;
|
||||
typedef std::map<LLUUID, LLToolBarButton*> command_id_map;
|
||||
command_id_map mButtonMap;
|
||||
|
||||
LLToolBarEnums::ButtonType mButtonType;
|
||||
LLLayoutStack* mCenteringStack;
|
||||
LLLayoutStack* mWrapStack;
|
||||
LLPanel* mButtonPanel;
|
||||
LLToolBarEnums::SideType mSideType;
|
||||
|
||||
bool mWrap;
|
||||
bool mNeedsLayout;
|
||||
bool mModified;
|
||||
S32 mPadLeft,
|
||||
mPadRight,
|
||||
mPadTop,
|
||||
mPadBottom,
|
||||
mPadBetween,
|
||||
mMinGirth;
|
||||
|
||||
LLToolBarButton::Params mButtonParams[LLToolBarEnums::BTNTYPE_COUNT];
|
||||
|
||||
// related widgets
|
||||
LLLayoutStack* mCenteringStack;
|
||||
LLPanel* mButtonPanel;
|
||||
LLHandle<class LLContextMenu> mPopupMenuHandle;
|
||||
|
||||
bool mNeedsLayout;
|
||||
bool mModified;
|
||||
|
||||
button_signal_t* mButtonAddSignal;
|
||||
button_signal_t* mButtonEnterSignal;
|
||||
button_signal_t* mButtonLeaveSignal;
|
||||
|
|
|
|||
Loading…
Reference in New Issue