diff options
author | Richard Linden <none@none> | 2011-09-27 19:22:09 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2011-09-27 19:22:09 -0700 |
commit | 78eb989e50e7f91298294d34a743f8ac0e3dcce1 (patch) | |
tree | 9b8775166525ee36661f95025763826c37610bd3 /indra | |
parent | 68d5141fb3ccb5e898caa83e9eab84d76134e28c (diff) |
EXP-1258 FIX toggle buttons between icons and icons+text modes
fixed button layout for icon only buttons
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llbutton.cpp | 1 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 30 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 1 |
3 files changed, 20 insertions, 12 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index e1bea086b2..f259e8027e 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -1015,6 +1015,7 @@ void LLButton::resize(LLUIString label) min_width += overlay_width + mImgOverlayLabelSpace; break; case LLFontGL::HCENTER: + min_width = llmax(min_width, overlay_width + mLeftHPad + mRightHPad); break; default: // draw nothing diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 57a9151649..c5219b11e8 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -207,7 +207,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId) if (add_command) { mButtonCommands.push_back(commandId); - createButtons(); + createButton(commandId); } return add_command; @@ -498,19 +498,25 @@ void LLToolBar::createButtons() BOOST_FOREACH(LLCommandId& command_id, mButtonCommands) { - LLCommand* commandp = LLCommandManager::instance().getCommand(command_id); - if (!commandp) continue; + createButton(command_id); + } - LLToolBarButton::Params button_p; - button_p.label = LLTrans::getString(commandp->labelRef()); - button_p.image_overlay = LLUI::getUIImage(commandp->icon()); - button_p.overwriteFrom(mButtonParams[mButtonType]); - LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p); +} - mButtons.push_back(button); - mButtonPanel->addChild(button); - } +void LLToolBar::createButton(const LLCommandId& id) +{ + LLCommand* commandp = LLCommandManager::instance().getCommand(id); + if (!commandp) return; + + LLToolBarButton::Params button_p; + button_p.label = LLTrans::getString(commandp->labelRef()); + button_p.tool_tip = button_p.label(); + button_p.image_overlay = LLUI::getUIImage(commandp->icon()); + button_p.overwriteFrom(mButtonParams[mButtonType]); + LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p); + + mButtons.push_back(button); + mButtonPanel->addChild(button); mNeedsLayout = true; } - diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h index 75ae499a3d..02db58128c 100644 --- a/indra/llui/lltoolbar.h +++ b/indra/llui/lltoolbar.h @@ -135,6 +135,7 @@ private: void createContextMenu(); void updateLayoutAsNeeded(); void createButtons(); + void createButton(const LLCommandId& id); void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth); BOOL isSettingChecked(const LLSD& userdata); void onSettingEnable(const LLSD& userdata); |