diff options
Diffstat (limited to 'indra/newview/llsidepanelinventory.cpp')
-rw-r--r-- | indra/newview/llsidepanelinventory.cpp | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 7f5a2e64bf..9247611257 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -134,38 +134,45 @@ BOOL LLSidepanelInventory::postBuild() } -void LLSidepanelInventory::onToggleInboxBtn() +void manageInboxOutboxPanels(LLLayoutStack * stack, + LLButton * pressedButton, LLLayoutPanel * pressedPanel, + LLButton * otherButton, LLLayoutPanel * otherPanel) { - LLLayoutStack* stack = getChild<LLLayoutStack>("inventory_layout_stack"); - bool collapse = !getChild<LLButton>("inbox_btn")->getToggleState(); + bool expand = pressedButton->getToggleState(); + bool otherExpanded = otherButton->getToggleState(); - if (stack) - { - stack->collapsePanel(getChild<LLLayoutPanel>("inbox_layout_panel"), collapse); - } - if (!collapse) + if (expand && otherExpanded) { - stack->collapsePanel(getChild<LLLayoutPanel>("outbox_layout_panel"), true); - getChild<LLButton>("outbox_btn")->setToggleState(false); + // Reshape pressedPanel to the otherPanel's height so we preserve the marketplace panel size + pressedPanel->reshape(pressedPanel->getRect().getWidth(), otherPanel->getRect().getHeight()); + + stack->collapsePanel(otherPanel, true); + otherButton->setToggleState(false); } + + stack->collapsePanel(pressedPanel, !expand); } -void LLSidepanelInventory::onToggleOutboxBtn() +void LLSidepanelInventory::onToggleInboxBtn() { LLLayoutStack* stack = getChild<LLLayoutStack>("inventory_layout_stack"); - bool collapse = !getChild<LLButton>("outbox_btn")->getToggleState(); + LLButton* pressedButton = getChild<LLButton>("inbox_btn"); + LLLayoutPanel* pressedPanel = getChild<LLLayoutPanel>("inbox_layout_panel"); + LLButton* otherButton = getChild<LLButton>("outbox_btn"); + LLLayoutPanel* otherPanel = getChild<LLLayoutPanel>("outbox_layout_panel"); - if (stack) - { - stack->collapsePanel(getChild<LLLayoutPanel>("outbox_layout_panel"), collapse); - } + manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel); +} - if (!collapse) - { - stack->collapsePanel(getChild<LLLayoutPanel>("inbox_layout_panel"), true); - getChild<LLButton>("inbox_btn")->setToggleState(false); - } +void LLSidepanelInventory::onToggleOutboxBtn() +{ + LLLayoutStack* stack = getChild<LLLayoutStack>("inventory_layout_stack"); + LLButton* pressedButton = getChild<LLButton>("outbox_btn"); + LLLayoutPanel* pressedPanel = getChild<LLLayoutPanel>("outbox_layout_panel"); + LLButton* otherButton = getChild<LLButton>("inbox_btn"); + LLLayoutPanel* otherPanel = getChild<LLLayoutPanel>("inbox_layout_panel"); + manageInboxOutboxPanels(stack, pressedButton, pressedPanel, otherButton, otherPanel); } |