CHUI-105 WIP Added tear-off and return behavior for IM floater.

XUI changed for Converstions multifloater and IM floater.
meow-7.2.2
Seth ProductEngine 2012-05-07 22:40:56 +03:00
parent 7b8251fd2f
commit fac210075f
7 changed files with 281 additions and 65 deletions

View File

@ -1371,7 +1371,7 @@ void LLFloater::setHost(LLMultiFloater* host)
mButtonScale = 1.f;
//mButtonsEnabled[BUTTON_TEAR_OFF] = FALSE;
}
updateTitleButtons();
if (host)
{
mHostHandle = host->getHandle();
@ -1381,6 +1381,8 @@ void LLFloater::setHost(LLMultiFloater* host)
{
mHostHandle.markDead();
}
updateTitleButtons();
}
void LLFloater::moveResizeHandlesToFront()

View File

@ -28,6 +28,7 @@
#include "llimfloater.h"
#include "lldraghandle.h"
#include "llnotificationsutil.h"
#include "llagent.h"
@ -251,6 +252,12 @@ BOOL LLIMFloater::postBuild()
slide_right->setVisible(!mControlPanel->getParent()->getVisible());
slide_right->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this));
LLButton* return_btn = getChild<LLButton>("return_btn");
return_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this));
LLButton* tear_off_btn = getChild<LLButton>("tear_off_btn");
tear_off_btn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this));
mInputEditor = getChild<LLLineEditor>("chat_editor");
mInputEditor->setMaxTextLength(1023);
// enable line history support for instant message bar
@ -1194,3 +1201,42 @@ void LLIMFloater::onClickCloseBtn()
LLFloater::onClickCloseBtn();
}
// virtual
void LLIMFloater::updateTitleButtons()
{
if (!mDragHandle)
{
return;
}
LLMultiFloater* host_floater = getHost();
bool is_hosted = host_floater != NULL;
if (is_hosted) ///< floater is hosted
{
for (S32 i = 0; i < BUTTON_COUNT; i++)
{
if (!mButtons[i])
{
continue;
}
// Hide the standard header buttons in a docked IM floater.
mButtons[i]->setVisible(false);
}
}
else ///< floater is torn off
{
LLFloater::updateTitleButtons();
}
// toggle floater's drag handle and title visibility
mDragHandle->setVisible(!is_hosted);
LLButton* return_btn = getChild<LLButton>("return_btn");
return_btn->setVisible(!is_hosted);
LLButton* tear_off_btn = getChild<LLButton>("tear_off_btn");
tear_off_btn->setVisible(is_hosted);
}

View File

@ -120,6 +120,8 @@ protected:
/* virtual */
void onClickCloseBtn();
/*virtual*/ void updateTitleButtons();
private:
// process focus events to set a currently active session
/* virtual */ void onFocusLost();

View File

@ -56,6 +56,9 @@ BOOL LLIMFloaterContainer::postBuild()
mNewMessageConnection = LLIMModel::instance().mNewMsgSignal.connect(boost::bind(&LLIMFloaterContainer::onNewMessageReceived, this, _1));
// Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button
// mTabContainer will be initialized in LLMultiFloater::addChild()
setTabContainer(getChild<LLTabContainer>("im_box_tab_container"));
return TRUE;
}
@ -74,6 +77,7 @@ void LLIMFloaterContainer::onOpen(const LLSD& key)
*/
}
// virtual
void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
BOOL select_added_floater,
LLTabContainer::eInsertionPoint insertion_point)
@ -89,6 +93,12 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
LLView* floater_contents = floaterp->getChild<LLView>("contents_view");
// we don't show the header when the floater is hosted,
// so reshape floater contents to occupy the header space
floater_contents->setShape(floaterp->getRect());
LLUUID session_id = floaterp->getKey();
LLIconCtrl* icon = 0;
@ -116,6 +126,20 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
mTabContainer->setTabImage(floaterp, icon);
}
// virtual
void LLIMFloaterContainer::removeFloater(LLFloater* floaterp)
{
LLMultiFloater::removeFloater(floaterp);
LLRect contents_rect = floaterp->getRect();
// reduce the floater contents height by header height
contents_rect.mTop -= floaterp->getHeaderHeight();
LLView* floater_contents = floaterp->getChild<LLView>("contents_view");
floater_contents->setShape(contents_rect);
}
void LLIMFloaterContainer::onCloseFloater(LLUUID& id)
{
mSessions.erase(id);

View File

@ -50,6 +50,7 @@ public:
/*virtual*/ void addFloater(LLFloater* floaterp,
BOOL select_added_floater,
LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
/*virtual*/ void removeFloater(LLFloater* floaterp);
static LLFloater* getCurrentVoiceFloater();

View File

@ -3,47 +3,86 @@
can_close="false"
can_minimize="true"
can_resize="true"
height="390"
height="430"
layout="topleft"
min_width="510"
name="floater_im_box"
help_topic="floater_im_box"
save_rect="true"
save_visibility="true"
single_instance="true"
title="CONVERSATIONS"
width="396">
<tab_container
follows="left|right|top|bottom"
height="390"
layout="topleft"
left="1"
name="im_box_tab_container"
tab_position="bottom"
tab_width="64"
tab_max_width = "134"
tab_height="16"
use_custom_icon_ctrl="true"
tab_icon_ctrl_pad="2"
halign="left"
use_ellipses="true"
top="0"
width="394">
<first_tab
tab_bottom_image_flash="Toolbar_Left_Flash"/>
<middle_tab
tab_bottom_image_flash="Toolbar_Middle_Flash"/>
<last_tab
tab_bottom_image_flash="Toolbar_Right_Flash"/>
</tab_container>
<icon
color="DefaultShadowLight"
enabled="false"
follows="left|right|bottom"
height="17"
image_name="tabarea.tga"
layout="bottomleft"
left="1"
name="im_box_tab_container_icon"
bottom="10"
width="394" />
width="680">
<panel
border="true"
follows="top|bottom|left"
layout="topleft"
name="conversations_list"
opaque="true"
top="0"
left="5"
height="425"
width="263">
<menu_button
follows="top|left"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="OptionsMenu_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
left="5"
name="sort_btn"
top="5"
width="31" />
<button
follows="top|left"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="AddItem_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_pad="4"
name="add_btn"
tool_tip="Add button on the left panel"
width="31">
</button>
<button
follows="right|top"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="TabIcon_Open_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left="228"
name="slide_left_btn"
width="31" />
<button
follows="right|top"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="TabIcon_Close_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_delta="0"
name="slide_right_btn"
width="31" />
</panel>
<panel_container
follows="all"
layout="topleft"
name="im_box_tab_container"
opaque="true"
top="0"
left_pad="15"
height="430"
width="389"
min_width="290">
</panel_container>
</multi_floater>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
background_visible="true"
default_tab_group="1"
height="355"
@ -15,28 +14,147 @@
can_resize="true"
min_width="250"
min_height="190">
<view
follows="all"
layout="topleft"
name="contents_view"
top="0"
left="0"
height="355"
width="394">
<panel
follows="all"
layout="topleft"
name="toolbar_panel"
top="0"
left="0"
height="35"
width="394">
<menu_button
follows="top|left"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="OptionsMenu_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
left="5"
name="view_options_btn"
top="5"
width="31" />
<button
follows="top|left"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="AddItem_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_pad="4"
name="add_btn"
width="31">
<commit_callback
function="Chats.add" />
</button>
<button
follows="top|left"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="VoicePTT_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_pad="4"
name="call"
width="31">
<commit_callback
function="Chats.add" />
</button>
<button
follows="right|top"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="Icon_Close_Foreground"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left="283"
name="close_btn"
width="31" />
<button
follows="right|top"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="TabIcon_Open_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_pad="5"
name="slide_left_btn"
width="31" />
<button
follows="right|top"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="TabIcon_Close_Off"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_delta="0"
name="slide_right_btn"
width="31" />
<button
follows="right|top"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="tearoffbox.tga"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_pad="5"
name="tear_off_btn"
width="31" />
<button
follows="right|top"
height="25"
image_hover_unselected="Toolbar_Middle_Over"
image_overlay="Icon_Dock_Foreground"
image_selected="Toolbar_Middle_Selected"
image_unselected="Toolbar_Middle_Off"
layout="topleft"
top="5"
left_delta="0"
name="return_btn"
width="31" />
</panel>
<layout_stack
animate="true"
default_tab_group="2"
follows="all"
height="320"
height="310"
width="394"
layout="topleft"
orientation="horizontal"
name="im_panels"
tab_group="1"
top="20"
top_pad="0"
left="0">
<layout_panel
name="im_control_panel_holder"
min_width="115"
width="150"
height="320"
height="310"
auto_resize="false">
<panel
name="panel_im_control_panel"
layout="topleft"
height="320"
height="310"
width="150"
follows="all"/>
</layout_panel>
@ -46,39 +164,22 @@
tab_group="2"
top="0"
height="200"
width="254"
width="254"
user_resize="true">
<button
height="20"
follows="left|top"
top="0"
left="2"
image_overlay="TabIcon_Open_Off"
layout="topleft"
width="25"
name="slide_left_btn" />
<button
height="20"
follows="left|top"
top="0"
left="2"
image_overlay="TabIcon_Close_Off"
width="25"
name="slide_right_btn" />
<chat_history
font="SansSerifSmall"
follows="left|right|top|bottom"
height="150"
font="SansSerifSmall"
follows="all"
height="170"
name="chat_history"
parse_highlights="true"
parse_urls="true"
left="1"
left="1"
width="249">
</chat_history>
<line_editor
bottom="0"
follows="left|right|bottom"
font="SansSerifSmall"
font="SansSerifSmall"
height="20"
label="To"
layout="bottomleft"
@ -88,4 +189,5 @@
</line_editor>
</layout_panel>
</layout_stack>
</view>
</floater>