Refactor LLScrollList* and relatives

Breaks out llscrolllistcolumn, llscrolllistcell, and llscrolllistitem from llscrolllistctrl and llflyoutbutton from llcombobox
This commit is contained in:
Lirusaito
2013-07-12 17:47:01 -04:00
parent 1398d8afbc
commit c77f0de9cf
54 changed files with 1974 additions and 1992 deletions

View File

@@ -35,6 +35,7 @@ set(llui_SOURCE_FILES
lleditmenuhandler.cpp
llfiltereditor.cpp
llfloater.cpp
llflyoutbutton.cpp
llfocusmgr.cpp
llfunctorregistry.cpp
lliconctrl.cpp
@@ -59,7 +60,10 @@ set(llui_SOURCE_FILES
llscrollbar.cpp
llscrollcontainer.cpp
llscrollingpanellist.cpp
llscrolllistcell.cpp
llscrolllistcolumn.cpp
llscrolllistctrl.cpp
llscrolllistitem.cpp
llsearcheditor.cpp
llslider.cpp
llsliderctrl.cpp
@@ -105,6 +109,7 @@ set(llui_HEADER_FILES
lleditmenuhandler.h
llfiltereditor.h
llfloater.h
llflyoutbutton.h
llfocusmgr.h
llfunctorregistry.h
llhtmlhelp.h
@@ -134,7 +139,10 @@ set(llui_HEADER_FILES
llscrollbar.h
llscrollcontainer.h
llscrollingpanellist.h
llscrolllistcell.h
llscrolllistcolumn.h
llscrolllistctrl.h
llscrolllistitem.h
llslider.h
llsliderctrl.h
llspinctrl.h

View File

@@ -2,31 +2,25 @@
* @file llcombobox.cpp
* @brief LLComboBox base class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -48,6 +42,8 @@
#include "llwindow.h"
#include "llfloater.h"
#include "llscrollbar.h"
#include "llscrolllistcell.h"
#include "llscrolllistitem.h"
#include "llcontrol.h"
#include "llfocusmgr.h"
#include "lllineeditor.h"
@@ -58,10 +54,9 @@ S32 LLCOMBOBOX_HEIGHT = 0;
S32 LLCOMBOBOX_WIDTH = 0;
S32 MAX_COMBO_WIDTH = 500;
static LLRegisterWidget<LLComboBox> r1("combo_box");
static LLRegisterWidget<LLComboBox> register_combo_box("combo_box");
LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::string& label,
commit_callback_t commit_callback)
LLComboBox::LLComboBox(const std::string& name, const LLRect& rect, const std::string& label, commit_callback_t commit_callback)
: LLUICtrl(name, rect, TRUE, commit_callback, FOLLOWS_LEFT | FOLLOWS_TOP),
mTextEntry(NULL),
mTextEntryTentative(TRUE),
@@ -81,9 +76,7 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
{
// Always use text box
// Text label button
mButton = new LLButton(mLabel,
LLRect(),
LLStringUtil::null);
mButton = new LLButton(mLabel, LLRect(), LLStringUtil::null);
mButton->setImageUnselected(LLUI::getUIImage("square_btn_32x128.tga"));
mButton->setImageSelected(LLUI::getUIImage("square_btn_selected_32x128.tga"));
mButton->setImageDisabled(LLUI::getUIImage("square_btn_32x128.tga"));
@@ -102,11 +95,11 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
addChild(mButton);
// disallow multiple selection
mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(),
mList = new LLScrollListCtrl(std::string("ComboBox"), LLRect(),
boost::bind(&LLComboBox::onItemSelected, this, _2), FALSE);
mList->setVisible(FALSE);
mList->setVisible(false);
mList->setBgWriteableColor(mListColor);
mList->setCommitOnKeyboardMovement(FALSE);
mList->setCommitOnKeyboardMovement(false);
addChild(mList);
// Mouse-down on button will transfer mouse focus to the list
@@ -117,12 +110,11 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
mButton->setImageOverlay("combobox_arrow.tga", LLFontGL::RIGHT);
updateLayout();
mTopLostSignalConnection = setTopLostCallback(boost::bind(&LLComboBox::hideList, this));
}
// virtual
LLXMLNodePtr LLComboBox::getXML(bool save_children) const
{
@@ -131,16 +123,12 @@ LLXMLNodePtr LLComboBox::getXML(bool save_children) const
node->setName(LL_COMBO_BOX_TAG);
// Attributes
node->createChild("allow_text_entry", TRUE)->setBoolValue(mAllowTextEntry);
node->createChild("max_chars", TRUE)->setIntValue(mMaxChars);
// Contents
std::vector<LLScrollListItem*> data_list = mList->getAllData();
std::vector<LLScrollListItem*>::iterator data_itor;
for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
for (std::vector<LLScrollListItem*>::iterator data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor)
{
LLScrollListItem* item = *data_itor;
LLScrollListCell* cell = item->getColumn(0);
@@ -172,9 +160,7 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *
S32 max_chars = 20;
node->getAttributeS32("max_chars", max_chars);
LLComboBox* combo_box = new LLComboBox("combo_box",
rect,
label);
LLComboBox* combo_box = new LLComboBox("combo_box", rect, label);
combo_box->setAllowTextEntry(allow_text_entry, max_chars);
const std::string& contents = node->getValue();
@@ -257,7 +243,6 @@ void LLComboBox::onCommit()
mTextEntry->setValue(getSimple());
mTextEntry->setTentative(FALSE);
}
setControlValue(getValue());
LLUICtrl::onCommit();
}
@@ -305,7 +290,6 @@ void LLComboBox::resetTextDirty()
}
}
// add item "name" to menu
LLScrollListItem* LLComboBox::add(const std::string& name, EAddPosition pos, BOOL enabled)
{
@@ -577,7 +561,7 @@ void LLComboBox::updateLayout()
if (!mTextEntry)
{
LLRect text_entry_rect(0, getRect().getHeight(), getRect().getWidth(), 0);
text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth()) + 2 * LLUI::sConfigGroup->getS32("DropShadowButton");
text_entry_rect.mRight -= llmax(8,mArrowImage->getWidth()) + 2 * shadow_size;
// clear label on button
std::string cur_label = mButton->getLabelSelected();
mTextEntry = new LLLineEditor(std::string("combo_text_entry"),
@@ -590,9 +574,9 @@ void LLComboBox::updateLayout()
mTextEntry->setSelectAllonFocusReceived(TRUE);
mTextEntry->setHandleEditKeysDirectly(TRUE);
mTextEntry->setCommitOnFocusLost(FALSE);
mTextEntry->setFollows(FOLLOWS_ALL);
mTextEntry->setText(cur_label);
mTextEntry->setIgnoreTab(TRUE);
mTextEntry->setFollowsAll();
addChild(mTextEntry);
}
else
@@ -617,7 +601,7 @@ void LLComboBox::updateLayout()
{
mTextEntry->setVisible(FALSE);
}
mButton->setFollowsAll();
mButton->setFollows(FOLLOWS_ALL);
}
}
@@ -755,10 +739,6 @@ void LLComboBox::hideList()
}
}
//------------------------------------------------------------------
// static functions
//------------------------------------------------------------------
void LLComboBox::onButtonMouseDown()
{
if (!mList->getVisible())
@@ -896,7 +876,10 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask)
return FALSE;
}
// if selection has changed, pop open list
else if (mList->getLastSelectedItem() != last_selected_item)
else if (mList->getLastSelectedItem() != last_selected_item
|| ((key == KEY_DOWN || key == KEY_UP)
&& mList->getCanSelect()
&& !mList->isEmpty()))
{
showList();
}
@@ -1026,7 +1009,7 @@ void LLComboBox::updateSelection()
if(mSuppressAutoComplete) {
return;
}
LLWString left_wstring = mTextEntry->getWText().substr(0, mTextEntry->getCursor());
// user-entered portion of string, based on assumption that any selected
// text was a result of auto-completion
@@ -1236,168 +1219,3 @@ BOOL LLComboBox::selectItemRange( S32 first, S32 last )
return mList->selectItemRange(first, last);
}
//
// LLFlyoutButton
//
static LLRegisterWidget<LLFlyoutButton> r2("flyout_button");
const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24;
LLFlyoutButton::LLFlyoutButton(
const std::string& name,
const LLRect &rect,
const std::string& label)
: LLComboBox(name, rect, LLStringUtil::null),
mToggleState(FALSE),
mActionButton(NULL)
{
// Always use text box
// Text label button
mActionButton = new LLButton(label,
LLRect(), LLStringUtil::null, boost::bind(&LLFlyoutButton::onActionButtonClick, this));
mActionButton->setScaleImage(TRUE);
mActionButton->setFollowsAll();
mActionButton->setHAlign( LLFontGL::HCENTER );
mActionButton->setLabel(label);
addChild(mActionButton);
mActionButtonImage = LLUI::getUIImage("flyout_btn_left.tga");
mExpanderButtonImage = LLUI::getUIImage("flyout_btn_right.tga");
mActionButtonImageSelected = LLUI::getUIImage("flyout_btn_left_selected.tga");
mExpanderButtonImageSelected = LLUI::getUIImage("flyout_btn_right_selected.tga");
mActionButtonImageDisabled = LLUI::getUIImage("flyout_btn_left_disabled.tga");
mExpanderButtonImageDisabled = LLUI::getUIImage("flyout_btn_right_disabled.tga");
mActionButton->setImageSelected(mActionButtonImageSelected);
mActionButton->setImageUnselected(mActionButtonImage);
mActionButton->setImageDisabled(mActionButtonImageDisabled);
mActionButton->setImageDisabledSelected(LLPointer<LLUIImage>(NULL));
mButton->setImageSelected(mExpanderButtonImageSelected);
mButton->setImageUnselected(mExpanderButtonImage);
mButton->setImageDisabled(mExpanderButtonImageDisabled);
mButton->setImageDisabledSelected(LLPointer<LLUIImage>(NULL));
mButton->setRightHPad(6);
updateLayout();
}
// virtual
LLXMLNodePtr LLFlyoutButton::getXML(bool save_children) const
{
LLXMLNodePtr node = LLComboBox::getXML();
node->setName(LL_FLYOUT_BUTTON_TAG);
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull();)
{
if (child->hasName("combo_item"))
{
child->setName(LL_FLYOUT_BUTTON_ITEM_TAG);
//setName does a delete and add, so we have to start over
child = node->getFirstChild();
}
else
{
child = child->getNextSibling();
}
}
return node;
}
//static
LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string label("");
node->getAttributeString("label", label);
LLRect rect;
createRect(node, rect, parent, LLRect());
LLFlyoutButton* flyout_button = new LLFlyoutButton("flyout_button",
rect,
label);
std::string list_position;
node->getAttributeString("list_position", list_position);
if (list_position == "below")
{
flyout_button->mListPosition = BELOW;
}
else if (list_position == "above")
{
flyout_button->mListPosition = ABOVE;
}
flyout_button->initFromXML(node, parent);
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
if (child->hasName("flyout_button_item"))
{
std::string label = child->getTextContents();
std::string value = label;
child->getAttributeString("value", value);
flyout_button->add(label, LLSD(value) );
}
}
flyout_button->updateLayout();
return flyout_button;
}
void LLFlyoutButton::updateLayout()
{
LLComboBox::updateLayout();
mButton->setOrigin(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, 0);
mButton->reshape(FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
mButton->setFollows(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
mButton->setTabStop(FALSE);
mButton->setImageOverlay(mListPosition == BELOW ? "down_arrow.tga" : "up_arrow.tga", LLFontGL::RIGHT);
mActionButton->setOrigin(0, 0);
mActionButton->reshape(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
}
void LLFlyoutButton::onActionButtonClick()
{
// remember last list selection?
mList->deselect();
onCommit();
}
void LLFlyoutButton::draw()
{
mActionButton->setToggleState(mToggleState);
mButton->setToggleState(mToggleState);
//FIXME: this should be an attribute of comboboxes, whether they have a distinct label or
// the label reflects the last selected item, for now we have to manually remove the label
mButton->setLabel(LLStringUtil::null);
LLComboBox::draw();
}
void LLFlyoutButton::setEnabled(BOOL enabled)
{
mActionButton->setEnabled(enabled);
LLComboBox::setEnabled(enabled);
}
void LLFlyoutButton::setToggleState(BOOL state)
{
mToggleState = state;
}

View File

@@ -2,31 +2,25 @@
* @file llcombobox.h
* @brief LLComboBox base class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,15 +33,12 @@
#include "llbutton.h"
#include "lluictrl.h"
#include "llctrlselectioninterface.h"
#include "llimagegl.h"
#include "llrect.h"
#include "llscrolllistctrl.h"
// Classes
class LLFontGL;
class LLButton;
class LLSquareButton;
class LLScrollListCtrl;
class LLLineEditor;
class LLViewBorder;
@@ -64,15 +55,12 @@ public:
BELOW
} EPreferredPosition;
LLComboBox(
const std::string& name,
const LLRect &rect,
const std::string& label,
commit_callback_t commit_callback = NULL
);
virtual ~LLComboBox();
protected:
void prearrangeList(std::string filter = "");
friend class LLFloaterTestImpl;
friend class LLUICtrlFactory;
LLComboBox(const std::string& name, const LLRect& rect, const std::string& label, commit_callback_t commit_callback = NULL);
void prearrangeList(std::string filter = "");
public:
// LLView interface
@@ -191,7 +179,6 @@ public:
void onButtonMouseDown();
void onListMouseUp();
void onItemSelected(const LLSD& data);
void onTextCommit(const LLSD& data);
void setSuppressTentative(bool suppress);
@@ -226,34 +213,4 @@ private:
S32 mLastSelectedIndex;
};
class LLFlyoutButton : public LLComboBox
{
public:
LLFlyoutButton(
const std::string& name,
const LLRect &rect,
const std::string& label);
virtual void updateLayout();
virtual void draw();
virtual void setEnabled(BOOL enabled);
void setToggleState(BOOL state);
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
void onActionButtonClick();
void onSelectAction(LLUICtrl* ctrl);
protected:
LLButton* mActionButton;
LLPointer<LLUIImage> mActionButtonImage;
LLPointer<LLUIImage> mExpanderButtonImage;
LLPointer<LLUIImage> mActionButtonImageSelected;
LLPointer<LLUIImage> mExpanderButtonImageSelected;
LLPointer<LLUIImage> mActionButtonImageDisabled;
LLPointer<LLUIImage> mExpanderButtonImageDisabled;
BOOL mToggleState;
};
#endif

View File

@@ -0,0 +1,172 @@
/**
* @file llflyoutbutton.cpp
* @brief LLFlyoutButton base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
// file includes
#include "llflyoutbutton.h"
static LLRegisterWidget<LLFlyoutButton> r2("flyout_button");
const S32 FLYOUT_BUTTON_ARROW_WIDTH = 24;
LLFlyoutButton::LLFlyoutButton(const std::string& name, const LLRect& rect, const std::string& label)
: LLComboBox(name, rect, LLStringUtil::null),
mToggleState(FALSE),
mActionButton(NULL)
{
// Always use text box
// Text label button
mActionButton = new LLButton(label, LLRect(), LLStringUtil::null, boost::bind(&LLFlyoutButton::onActionButtonClick, this, _2));
mActionButton->setScaleImage(true);
mActionButton->setFollowsAll();
mActionButton->setHAlign(LLFontGL::HCENTER);
mActionButton->setLabel(label);
addChild(mActionButton);
mActionButton->setImageSelected(LLUI::getUIImage("flyout_btn_left_selected.tga"));
mActionButton->setImageUnselected(LLUI::getUIImage("flyout_btn_left.tga"));
mActionButton->setImageDisabled(LLUI::getUIImage("flyout_btn_left_disabled.tga"));
mActionButton->setImageDisabledSelected(LLPointer<LLUIImage>(NULL));
mButton->setImageSelected(LLUI::getUIImage("flyout_btn_right_selected.tga"));
mButton->setImageUnselected(LLUI::getUIImage("flyout_btn_right.tga"));
mButton->setImageDisabled(LLUI::getUIImage("flyout_btn_right_disabled.tga"));
mButton->setImageDisabledSelected(LLPointer<LLUIImage>(NULL));
mButton->setRightHPad(6);
updateLayout();
}
// virtual
LLXMLNodePtr LLFlyoutButton::getXML(bool save_children) const
{
LLXMLNodePtr node = LLComboBox::getXML();
node->setName(LL_FLYOUT_BUTTON_TAG);
for (LLXMLNodePtr child = node->getFirstChild(); child.notNull();)
{
if (child->hasName("combo_item"))
{
child->setName(LL_FLYOUT_BUTTON_ITEM_TAG);
//setName does a delete and add, so we have to start over
child = node->getFirstChild();
}
else
{
child = child->getNextSibling();
}
}
return node;
}
//static
LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory* factory)
{
std::string label("");
node->getAttributeString("label", label);
LLRect rect;
createRect(node, rect, parent, LLRect());
LLFlyoutButton* flyout_button = new LLFlyoutButton("flyout_button", rect, label);
std::string list_position;
node->getAttributeString("list_position", list_position);
if (list_position == "below")
{
flyout_button->mListPosition = BELOW;
}
else if (list_position == "above")
{
flyout_button->mListPosition = ABOVE;
}
flyout_button->initFromXML(node, parent);
for (LLXMLNodePtr child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
if (child->hasName(LL_FLYOUT_BUTTON_ITEM_TAG))
{
std::string label(child->getTextContents());
std::string value(label);
child->getAttributeString("value", value);
flyout_button->add(label, LLSD(value));
}
}
flyout_button->updateLayout();
return flyout_button;
}
void LLFlyoutButton::updateLayout()
{
LLComboBox::updateLayout();
mButton->setOrigin(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, 0);
mButton->reshape(FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
mButton->setFollows(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM);
mButton->setTabStop(false);
mButton->setImageOverlay(mListPosition == BELOW ? "down_arrow.tga" : "up_arrow.tga", LLFontGL::RIGHT);
mActionButton->setOrigin(0, 0);
mActionButton->reshape(getRect().getWidth() - FLYOUT_BUTTON_ARROW_WIDTH, getRect().getHeight());
}
void LLFlyoutButton::onActionButtonClick(const LLSD& data)
{
// remember last list selection?
mList->deselect();
onCommit();
}
void LLFlyoutButton::draw()
{
mActionButton->setToggleState(mToggleState);
mButton->setToggleState(mToggleState);
//FIXME: this should be an attribute of comboboxes, whether they have a distinct label or
// the label reflects the last selected item, for now we have to manually remove the label
mButton->setLabel(LLStringUtil::null);
LLComboBox::draw();
}
void LLFlyoutButton::setEnabled(BOOL enabled)
{
mActionButton->setEnabled(enabled);
LLComboBox::setEnabled(enabled);
}
void LLFlyoutButton::setToggleState(BOOL state)
{
mToggleState = state;
}

View File

@@ -0,0 +1,59 @@
/**
* @file llflyoutbutton.h
* @brief LLFlyoutButton base class
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// A control that displays the name of the chosen item, which when clicked
// shows a scrolling box of choices.
#ifndef LL_LLFLYOUTBUTTON_H
#define LL_LLFLYOUTBUTTON_H
#include "llcombobox.h"
// Classes
class LLFlyoutButton : public LLComboBox
{
protected:
LLFlyoutButton(const std::string& name, const LLRect& rect, const std::string& label);
friend class LLUICtrlFactory;
public:
virtual void updateLayout();
virtual void draw();
virtual void setEnabled(BOOL enabled);
void setToggleState(BOOL state);
virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory* factory);
void onActionButtonClick(const LLSD& data);
void onSelectAction(LLUICtrl* ctrl);
protected:
LLButton* mActionButton;
BOOL mToggleState;
};
#endif // LL_LLFLYOUTBUTTON_H

View File

@@ -0,0 +1,364 @@
/**
* @file llscrolllistcell.cpp
* @brief Scroll lists are composed of rows (items), each of which
* contains columns (cells).
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llscrolllistcell.h"
#include "llcheckboxctrl.h"
LLScrollListCell::LLScrollListCell(S32 width)
: mWidth(width)
{}
// virtual
const LLSD LLScrollListCell::getValue() const
{
return LLStringUtil::null;
}
//
// LLScrollListIcon
//
LLScrollListIcon::LLScrollListIcon(const LLSD& value, S32 width)
: LLScrollListCell(width),
// <edit>
mCallback(NULL),
// </edit>
mColor(LLColor4::white)
{
setValue(value);
}
LLScrollListIcon::~LLScrollListIcon()
{
}
/*virtual*/
S32 LLScrollListIcon::getHeight() const
{ return mIcon ? mIcon->getHeight() : 0; }
/*virtual*/
const LLSD LLScrollListIcon::getValue() const
{ return mIcon.isNull() ? LLStringUtil::null : mIcon->getName(); }
void LLScrollListIcon::setValue(const LLSD& value)
{
if (value.isUUID())
{
// don't use default image specified by LLUUID::null, use no image in that case
LLUUID image_id = value.asUUID();
mIcon = image_id.notNull() ? LLUI::getUIImageByID(image_id) : LLUIImagePtr(NULL);
}
else
{
std::string value_string = value.asString();
if (LLUUID::validate(value_string))
{
setValue(LLUUID(value_string));
}
else if (!value_string.empty())
{
mIcon = LLUI::getUIImage(value.asString());
}
else
{
mIcon = NULL;
}
}
}
void LLScrollListIcon::setColor(const LLColor4& color)
{
mColor = color;
}
S32 LLScrollListIcon::getWidth() const
{
// if no specified fix width, use width of icon
if (LLScrollListCell::getWidth() == 0 && mIcon.notNull())
{
return mIcon->getWidth();
}
return LLScrollListCell::getWidth();
}
void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_color) const
{
if (mIcon)
{
mIcon->draw(0, 0, mColor);
}
}
//
// LLScrollListText
//
U32 LLScrollListText::sCount = 0;
LLScrollListText::LLScrollListText(const std::string& text, const LLFontGL* font, S32 width, U8 font_style, LLFontGL::HAlign font_alignment, LLColor4& color, BOOL use_color, BOOL visible)
: LLScrollListCell(width),
mText(text),
mFont(font),
mColor(color),
mUseColor(use_color),
mFontStyle(font_style),
mFontAlignment(font_alignment),
mVisible(visible),
mHighlightCount( 0 ),
mHighlightOffset( 0 )
{
sCount++;
mTextWidth = getWidth();
// initialize rounded rect image
if (!mRoundedRectImage)
{
mRoundedRectImage = LLUI::getUIImage("rounded_square.tga");
}
}
//virtual
void LLScrollListText::highlightText(S32 offset, S32 num_chars)
{
mHighlightOffset = offset;
mHighlightCount = num_chars;
}
//virtual
BOOL LLScrollListText::isText() const
{
return TRUE;
}
//virtual
BOOL LLScrollListText::getVisible() const
{
return mVisible;
}
//virtual
S32 LLScrollListText::getHeight() const
{
return llround(mFont->getLineHeight());
}
LLScrollListText::~LLScrollListText()
{
sCount--;
}
S32 LLScrollListText::getContentWidth() const
{
return mFont->getWidth(mText.getString());
}
void LLScrollListText::setColor(const LLColor4& color)
{
mColor = color;
mUseColor = TRUE;
}
void LLScrollListText::setText(const LLStringExplicit& text)
{
mText = text;
}
void LLScrollListText::setFontStyle(const U8 font_style)
{
mFontStyle = font_style;
}
//virtual
void LLScrollListText::setValue(const LLSD& text)
{
setText(text.asString());
}
//virtual
const LLSD LLScrollListText::getValue() const
{
return LLSD(mText.getString());
}
void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const
{
LLColor4 display_color;
if (mUseColor)
{
display_color = mColor;
}
else
{
display_color = color;
}
if (mHighlightCount > 0)
{
S32 left = 0;
switch(mFontAlignment)
{
case LLFontGL::LEFT:
left = mFont->getWidth(mText.getString(), 0, mHighlightOffset);
break;
case LLFontGL::RIGHT:
left = getWidth() - mFont->getWidth(mText.getString(), mHighlightOffset, S32_MAX);
break;
case LLFontGL::HCENTER:
left = (getWidth() - mFont->getWidth(mText.getString())) / 2;
break;
}
LLRect highlight_rect(left - 2,
llround(mFont->getLineHeight()) + 1,
left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1,
1);
mRoundedRectImage->draw(highlight_rect, highlight_color);
}
// Try to draw the entire string
F32 right_x;
U32 string_chars = mText.length();
F32 start_x = 0.f;
switch(mFontAlignment)
{
case LLFontGL::LEFT:
start_x = (mFontStyle & LLFontGL::ITALIC) ? 2.f : 0.f; //Italic text seems to need a little padding.
break;
case LLFontGL::RIGHT:
start_x = (F32)getWidth();
break;
case LLFontGL::HCENTER:
start_x = (F32)getWidth() * 0.5f;
break;
}
mFont->render(mText.getWString(), 0,
start_x, 2.f,
display_color,
mFontAlignment,
LLFontGL::BOTTOM,
mFontStyle,
LLFontGL::NO_SHADOW,
string_chars,
getTextWidth(),
&right_x,
FALSE,
TRUE);
}
//
// LLScrollListCheck
//
LLScrollListCheck::LLScrollListCheck(LLCheckBoxCtrl* check_box, S32 width)
: LLScrollListCell(width)
{
mCheckBox = check_box;
LLRect rect(mCheckBox->getRect());
if (width)
{
rect.mRight = rect.mLeft + width;
mCheckBox->setRect(rect);
setWidth(width);
}
else
{
setWidth(rect.getWidth()); //check_box->getWidth();
}
}
LLScrollListCheck::~LLScrollListCheck()
{
delete mCheckBox;
mCheckBox = NULL;
}
void LLScrollListCheck::draw(const LLColor4& color, const LLColor4& highlight_color) const
{
mCheckBox->draw();
}
BOOL LLScrollListCheck::handleClick()
{
if (mCheckBox->getEnabled())
{
mCheckBox->toggle();
}
// don't change selection when clicking on embedded checkbox
return TRUE;
}
/*virtual*/
const LLSD LLScrollListCheck::getValue() const
{
return mCheckBox->getValue();
}
/*virtual*/
void LLScrollListCheck::setValue(const LLSD& value)
{
mCheckBox->setValue(value);
}
/*virtual*/
void LLScrollListCheck::onCommit()
{
mCheckBox->onCommit();
}
/*virtual*/
void LLScrollListCheck::setEnabled(BOOL enable)
{
mCheckBox->setEnabled(enable);
}
//
// LLScrollListDate
//
LLScrollListDate::LLScrollListDate( const LLDate& date, const LLFontGL* font, S32 width, U8 font_style, LLFontGL::HAlign font_alignment, LLColor4& color, BOOL use_color, BOOL visible)
: LLScrollListText(date.asRFC1123(), font, width, font_style, font_alignment, color, use_color, visible),
mDate(date)
{}
void LLScrollListDate::setValue(const LLSD& value)
{
mDate = value.asDate();
LLScrollListText::setValue(mDate.asRFC1123());
}
const LLSD LLScrollListDate::getValue() const
{
return mDate;
}

View File

@@ -0,0 +1,180 @@
/**
* @file llscrolllistcell.h
* @brief Scroll lists are composed of rows (items), each of which
* contains columns (cells).
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LLSCROLLLISTCELL_H
#define LLSCROLLLISTCELL_H
#include "llfontgl.h" // HAlign
#include "llpointer.h" // LLPointer<>
#include "lluistring.h"
#include "v4color.h"
#include "llui.h"
class LLCheckBoxCtrl;
class LLSD;
/*
* Represents a cell in a scrollable table.
*
* Sub-classes must return height and other properties
* though width accessors are implemented by the base class.
* It is therefore important for sub-class constructors to call
* setWidth() with realistic values.
*/
class LLScrollListCell
{
public:
LLScrollListCell(S32 width = 0);
virtual ~LLScrollListCell() {};
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const {}; // truncate to given width, if possible
virtual S32 getWidth() const {return mWidth;}
virtual S32 getContentWidth() const { return 0; }
virtual S32 getHeight() const { return 0; }
virtual const LLSD getValue() const;
virtual void setValue(const LLSD& value) { }
virtual BOOL getVisible() const { return TRUE; }
virtual void setWidth(S32 width) { mWidth = width; }
virtual void highlightText(S32 offset, S32 num_chars) {}
virtual BOOL isText() const { return FALSE; }
virtual void setColor(const LLColor4&) {}
virtual void onCommit() {};
virtual BOOL handleClick() { return FALSE; }
virtual void setEnabled(BOOL enable) { }
private:
S32 mWidth;
};
/*
* Cell displaying a text label.
*/
class LLScrollListText : public LLScrollListCell
{
public:
LLScrollListText(const std::string& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
/*virtual*/ ~LLScrollListText();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
/*virtual*/ S32 getContentWidth() const;
/*virtual*/ S32 getHeight() const;
/*virtual*/ void setValue(const LLSD& value);
/*virtual*/ const LLSD getValue() const;
/*virtual*/ BOOL getVisible() const;
/*virtual*/ void highlightText(S32 offset, S32 num_chars);
/*virtual*/ void setColor(const LLColor4&);
/*virtual*/ BOOL isText() const;
S32 getTextWidth() const { return mTextWidth;}
void setTextWidth(S32 value) { mTextWidth = value;}
virtual void setWidth(S32 width) { LLScrollListCell::setWidth(width); mTextWidth = width; }
void setText(const LLStringExplicit& text);
void setFontStyle(const U8 font_style);
private:
LLUIString mText;
S32 mTextWidth;
const LLFontGL* mFont;
LLColor4 mColor;
U8 mUseColor;
U8 mFontStyle;
LLFontGL::HAlign mFontAlignment;
BOOL mVisible;
S32 mHighlightCount;
S32 mHighlightOffset;
LLPointer<LLUIImage> mRoundedRectImage;
static U32 sCount;
};
/*
* Cell displaying an image.
*/
class LLScrollListIcon : public LLScrollListCell
{
public:
LLScrollListIcon( LLUIImagePtr icon, S32 width = 0);
LLScrollListIcon(const LLSD& value, S32 width = 0);
/*virtual*/ ~LLScrollListIcon();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
/*virtual*/ S32 getWidth() const;
/*virtual*/ S32 getHeight() const;
/*virtual*/ const LLSD getValue() const;
/*virtual*/ void setColor(const LLColor4&);
/*virtual*/ void setValue(const LLSD& value);
// <edit>
void setClickCallback(boost::function<bool (void)> cb) { mCallback = cb; }
/*virtual*/ BOOL handleClick() { return mCallback ? mCallback() : false; }
// </edit>
private:
LLPointer<LLUIImage> mIcon;
LLColor4 mColor;
// <edit>
boost::function<bool (void)> mCallback;
// </edit>
};
/*
* An interactive cell containing a check box.
*/
class LLScrollListCheck : public LLScrollListCell
{
public:
LLScrollListCheck( LLCheckBoxCtrl* check_box, S32 width = 0);
/*virtual*/ ~LLScrollListCheck();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
/*virtual*/ S32 getHeight() const { return 0; }
/*virtual*/ const LLSD getValue() const;
/*virtual*/ void setValue(const LLSD& value);
/*virtual*/ void onCommit();
/*virtual*/ BOOL handleClick();
/*virtual*/ void setEnabled(BOOL enable);
LLCheckBoxCtrl* getCheckBox() { return mCheckBox; }
private:
LLCheckBoxCtrl* mCheckBox;
};
class LLScrollListDate : public LLScrollListText
{
public:
LLScrollListDate( const LLDate& date, const LLFontGL* font, S32 width=0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
virtual void setValue(const LLSD& value);
virtual const LLSD getValue() const;
private:
LLDate mDate;
};
#endif

View File

@@ -0,0 +1,484 @@
/**
* @file llscrollcolumnheader.cpp
* @brief Scroll lists are composed of rows (items), each of which
* contains columns (cells).
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llscrolllistcolumn.h"
#include "llbutton.h"
#include "llkeyboard.h" // For gKeyboard
#include "llresizebar.h"
#include "lluictrlfactory.h"
const S32 MIN_COLUMN_WIDTH = 20;
//---------------------------------------------------------------------------
// LLScrollColumnHeader
//---------------------------------------------------------------------------
LLScrollColumnHeader::LLScrollColumnHeader(const std::string& label, const LLRect& rect, LLScrollListColumn* column, const LLFontGL* fontp)
: LLComboBox(label, rect, label),
mColumn(column),
mOrigLabel(label),
mHasResizableElement(FALSE)
{
mListPosition = LLComboBox::ABOVE;
setCommitCallback(boost::bind(&LLScrollColumnHeader::onSelectSort, this));
mButton->setTabStop(FALSE);
mButton->setClickedCallback(boost::bind(&LLScrollColumnHeader::onClick, this, _2));
mButton->setToolTip(label);
mAscendingText = std::string("[LOW]...[HIGH](Ascending)"); // *TODO: Translate
mDescendingText = std::string("[HIGH]...[LOW](Descending)"); // *TODO: Translate
mList->reshape(llmax(mList->getRect().getWidth(), 110, getRect().getWidth()), mList->getRect().getHeight());
// resize handles on left and right
const S32 RESIZE_BAR_THICKNESS = 3;
LLResizeBar::Params resize_bar_p;
resize_bar_p.resizing_view(this);
resize_bar_p.rect(LLRect(getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0));
resize_bar_p.min_size(MIN_COLUMN_WIDTH);
resize_bar_p.side(LLResizeBar::RIGHT);
resize_bar_p.enabled(false);
mResizeBar = LLUICtrlFactory::create<LLResizeBar>(resize_bar_p);
addChild(mResizeBar);
mImageOverlayAlignment = LLFontGL::HCENTER;
mImageOverlayColor = LLColor4::white;
}
LLScrollColumnHeader::~LLScrollColumnHeader()
{}
void LLScrollColumnHeader::draw()
{
std::string sort_column = mColumn->mParentCtrl->getSortColumnName();
BOOL draw_arrow = !mColumn->mLabel.empty()
&& mColumn->mParentCtrl->isSorted()
// check for indirect sorting column as well as column's sorting name
&& (sort_column == mColumn->mSortingColumn || sort_column == mColumn->mName);
BOOL is_ascending = mColumn->mParentCtrl->getSortAscending();
if (draw_arrow)
{
mButton->setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, LLColor4::white);
}
else
{
mButton->setImageOverlay(LLUUID::null);
}
mArrowImage = mButton->getImageOverlay();
// Draw children
LLComboBox::draw();
if (mImageOverlay.notNull()) //Ugly dupe code from llbutton...
{
BOOL pressed_by_keyboard = FALSE;
if (mButton->hasFocus())
{
pressed_by_keyboard = gKeyboard->getKeyDown(' ') || (mButton->getCommitOnReturn() && gKeyboard->getKeyDown(KEY_RETURN));
}
// Unselected image assignments
S32 local_mouse_x;
S32 local_mouse_y;
LLUI::getMousePositionLocal(mButton, &local_mouse_x, &local_mouse_y);
BOOL pressed = pressed_by_keyboard
|| (mButton->hasMouseCapture() && mButton->pointInView(local_mouse_x, local_mouse_y))
|| mButton->getToggleState();
// Now draw special overlay..
// let overlay image and text play well together
S32 button_width = mButton->getRect().getWidth();
S32 button_height = mButton->getRect().getHeight();
S32 text_left = mButton->getLeftHPad();
S32 text_right = button_width - mButton->getRightHPad();
S32 text_width = text_right - text_left;
// draw overlay image
// get max width and height (discard level 0)
S32 overlay_width = mImageOverlay->getWidth();
S32 overlay_height = mImageOverlay->getHeight();
F32 scale_factor = llmin((F32)button_width / (F32)overlay_width, (F32)button_height / (F32)overlay_height, 1.f);
overlay_width = llround((F32)overlay_width * scale_factor);
overlay_height = llround((F32)overlay_height * scale_factor);
S32 center_x = mButton->getLocalRect().getCenterX();
S32 center_y = mButton->getLocalRect().getCenterY();
//FUGLY HACK FOR "DEPRESSED" BUTTONS
if (pressed)
{
center_y--;
center_x++;
}
// fade out overlay images on disabled buttons
LLColor4 overlay_color = mImageOverlayColor;
if (!mButton->getEnabled())
{
overlay_color.mV[VALPHA] = 0.5f;
}
switch(mImageOverlayAlignment)
{
case LLFontGL::LEFT:
text_left += overlay_width + 1;
text_width -= overlay_width + 1;
mImageOverlay->draw(
text_left,
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
overlay_color);
break;
case LLFontGL::HCENTER:
mImageOverlay->draw(
center_x - (overlay_width / 2),
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
overlay_color);
break;
case LLFontGL::RIGHT:
text_right -= overlay_width + 1;
text_width -= overlay_width + 1;
mImageOverlay->draw(
text_right - overlay_width,
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
overlay_color);
break;
default:
// draw nothing
break;
}
}
if (mList->getVisible())
{
// sync sort order with list selection every frame
mColumn->mParentCtrl->sortByColumn(mColumn->mSortingColumn, getCurrentIndex() == 0);
}
}
BOOL LLScrollColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask)
{
if (canResize() && mResizeBar->getRect().pointInRect(x, y))
{
// reshape column to max content width
mColumn->mParentCtrl->calcMaxContentWidth();
LLRect column_rect = getRect();
column_rect.mRight = column_rect.mLeft + mColumn->mMaxContentWidth;
setShape(column_rect, true);
}
else
{
onClick(LLSD());
}
return TRUE;
}
void LLScrollColumnHeader::setImage(const std::string& image_name)
{
if (mButton)
{
mButton->setImageSelected(LLUI::getUIImage(image_name));
mButton->setImageUnselected(LLUI::getUIImage(image_name));
}
}
void LLScrollColumnHeader::setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment, const LLColor4& color)
{
if (image_name.empty())
{
mImageOverlay = NULL;
}
else
{
mImageOverlay = LLUI::getUIImage(image_name);
mImageOverlayAlignment = alignment;
mImageOverlayColor = color;
}
}
void LLScrollColumnHeader::onClick(const LLSD& data)
{
if (mColumn)
{
if (mList->getVisible()) hideList();
LLScrollListCtrl::onClickColumn(mColumn);
// propagate new sort order to sort order list
mList->selectNthItem(mColumn->mParentCtrl->getSortAscending() ? 0 : 1);
mList->setFocus(true);
}
}
void LLScrollColumnHeader::onSelectSort()
{
if (!mColumn) return;
LLScrollListCtrl* parent = mColumn->mParentCtrl;
if (!parent) return;
parent->sortByColumn(mColumn->mSortingColumn, getCurrentIndex() == 0);
// restore original column header
setLabel(mOrigLabel);
}
LLView* LLScrollColumnHeader::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding)
{
// this logic assumes dragging on right
llassert(snap_edge == SNAP_RIGHT);
// use higher snap threshold for column headers
threshold = llmin(threshold, 10);
LLRect snap_rect = getSnapRect();
S32 snap_delta = mColumn->mMaxContentWidth - snap_rect.getWidth();
// x coord growing means column growing, so same signs mean we're going in right direction
if (llabs(snap_delta) <= threshold && mouse_dir.mX * snap_delta > 0 )
{
new_edge_val = snap_rect.mRight + snap_delta;
}
else
{
LLScrollListColumn* next_column = mColumn->mParentCtrl->getColumn(mColumn->mIndex + 1);
while (next_column)
{
if (next_column->mHeader)
{
snap_delta = (next_column->mHeader->getSnapRect().mRight - next_column->mMaxContentWidth) - snap_rect.mRight;
if (llabs(snap_delta) <= threshold && mouse_dir.mX * snap_delta > 0 )
{
new_edge_val = snap_rect.mRight + snap_delta;
}
break;
}
next_column = mColumn->mParentCtrl->getColumn(next_column->mIndex + 1);
}
}
return this;
}
void LLScrollColumnHeader::handleReshape(const LLRect& new_rect, bool by_user)
{
S32 new_width = new_rect.getWidth();
S32 delta_width = new_width - (getRect().getWidth() /*+ mColumn->mParentCtrl->getColumnPadding()*/);
if (delta_width != 0)
{
S32 remaining_width = -delta_width;
S32 col;
for (col = mColumn->mIndex + 1; col < mColumn->mParentCtrl->getNumColumns(); col++)
{
LLScrollListColumn* columnp = mColumn->mParentCtrl->getColumn(col);
if (!columnp) continue;
if (columnp->mHeader && columnp->mHeader->canResize())
{
// how many pixels in width can this column afford to give up?
S32 resize_buffer_amt = llmax(0, columnp->getWidth() - MIN_COLUMN_WIDTH);
// user shrinking column, need to add width to other columns
if (delta_width < 0)
{
if (columnp->getWidth() > 0)
{
// statically sized column, give all remaining width to this column
columnp->setWidth(columnp->getWidth() + remaining_width);
if (columnp->mRelWidth > 0.f)
{
columnp->mRelWidth = (F32)columnp->getWidth() / (F32)mColumn->mParentCtrl->getItemListRect().getWidth();
}
// all padding went to this widget, we're done
break;
}
}
else
{
// user growing column, need to take width from other columns
remaining_width += resize_buffer_amt;
if (columnp->getWidth() > 0)
{
columnp->setWidth(columnp->getWidth() - llmin(columnp->getWidth() - MIN_COLUMN_WIDTH, delta_width));
if (columnp->mRelWidth > 0.f)
{
columnp->mRelWidth = (F32)columnp->getWidth() / (F32)mColumn->mParentCtrl->getItemListRect().getWidth();
}
}
if (remaining_width >= 0)
{
// width sucked up from neighboring columns, done
break;
}
}
}
}
// clamp resize amount to maximum that can be absorbed by other columns
if (delta_width > 0)
{
delta_width += llmin(remaining_width, 0);
}
// propagate constrained delta_width to new width for this column
new_width = getRect().getWidth() + delta_width - mColumn->mParentCtrl->getColumnPadding();
// use requested width
mColumn->setWidth(new_width);
// update proportional spacing
if (mColumn->mRelWidth > 0.f)
{
mColumn->mRelWidth = (F32)new_width / (F32)mColumn->mParentCtrl->getItemListRect().getWidth();
}
// tell scroll list to layout columns again
// do immediate update to get proper feedback to resize handle
// which needs to know how far the resize actually went
mColumn->mParentCtrl->dirtyColumns(); //Must flag as dirty, else updateColumns will probably be a noop.
mColumn->mParentCtrl->updateColumns();
}
}
void LLScrollColumnHeader::setHasResizableElement(BOOL resizable)
{
if (mHasResizableElement != resizable)
{
mColumn->mParentCtrl->dirtyColumns();
mHasResizableElement = resizable;
}
}
void LLScrollColumnHeader::updateResizeBars()
{
S32 num_resizable_columns = 0;
S32 col;
for (col = 0; col < mColumn->mParentCtrl->getNumColumns(); col++)
{
LLScrollListColumn* columnp = mColumn->mParentCtrl->getColumn(col);
if (columnp->mHeader && columnp->mHeader->canResize())
{
num_resizable_columns++;
}
}
S32 num_resizers_enabled = 0;
// now enable/disable resize handles on resizable columns if we have at least two
for (col = 0; col < mColumn->mParentCtrl->getNumColumns(); col++)
{
LLScrollListColumn* columnp = mColumn->mParentCtrl->getColumn(col);
if (!columnp->mHeader) continue;
BOOL enable = num_resizable_columns >= 2 && num_resizers_enabled < (num_resizable_columns - 1) && columnp->mHeader->canResize();
columnp->mHeader->enableResizeBar(enable);
if (enable)
{
num_resizers_enabled++;
}
}
}
void LLScrollColumnHeader::enableResizeBar(BOOL enable)
{
mResizeBar->setEnabled(enable);
}
BOOL LLScrollColumnHeader::canResize()
{
return getVisible() && (mHasResizableElement || mColumn->mDynamicWidth);
}
//
// LLScrollListColumn
//
// Default constructor
LLScrollListColumn::LLScrollListColumn() : mName(), mSortingColumn(), mSortDirection(ASCENDING), mLabel(), mWidth(-1), mRelWidth(-1.0), mDynamicWidth(false), mMaxContentWidth(0), mIndex(-1), mParentCtrl(NULL), mHeader(NULL), mFontAlignment(LLFontGL::LEFT)
{
}
LLScrollListColumn::LLScrollListColumn(const LLSD& sd, LLScrollListCtrl* parent)
: mWidth(0),
mIndex (-1),
mParentCtrl(parent),
mName(sd.get("name").asString()),
mLabel(sd.get("label").asString()),
mHeader(NULL),
mMaxContentWidth(0),
mDynamicWidth(sd.has("dynamicwidth") && sd.get("dynamicwidth").asBoolean()),
mRelWidth(-1.f),
mFontAlignment(LLFontGL::LEFT),
mSortingColumn(sd.has("sort") ? sd.get("sort").asString() : mName)
{
if (sd.has("sort_ascending"))
{
mSortDirection = sd.get("sort_ascending").asBoolean() ? ASCENDING : DESCENDING;
}
else
{
mSortDirection = ASCENDING;
}
if (sd.has("relwidth") && sd.get("relwidth").asFloat() > 0)
{
mRelWidth = sd.get("relwidth").asFloat();
if (mRelWidth > 1) mRelWidth = 1;
mDynamicWidth = false;
}
else if (!mDynamicWidth)
{
setWidth(sd.get("width").asInteger());
}
if (sd.has("halign"))
{
mFontAlignment = (LLFontGL::HAlign)llclamp(sd.get("halign").asInteger(), (S32)LLFontGL::LEFT, (S32)LLFontGL::HCENTER);
}
}
void LLScrollListColumn::setWidth(S32 width)
{
if (!mDynamicWidth && mRelWidth <= 0.f)
{
mParentCtrl->updateStaticColumnWidth(this, width);
}
mWidth = width;
}

View File

@@ -0,0 +1,116 @@
/**
* @file llscrollcolumnheader.h
* @brief Scroll lists are composed of rows (items), each of which
* contains columns (cells).
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LLSCROLLLISTCOLUMN_H
#define LLSCROLLLISTCOLUMN_H
#include "llrect.h"
#include "lluistring.h"
#include "llcombobox.h"
class LLScrollListColumn;
class LLResizeBar;
class LLScrollListCtrl;
class LLScrollColumnHeader : public LLComboBox
{
public:
LLScrollColumnHeader(const std::string& label, const LLRect& rect, LLScrollListColumn* column, const LLFontGL* font = NULL);
~LLScrollColumnHeader();
/*virtual*/ void draw();
/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
/*virtual*/ void showList() {}; // block the normal showList() behavior
/*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding);
/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
void setImage(const std::string& image_name);
void setImageOverlay(const std::string& overlay_image, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
LLScrollListColumn* getColumn() { return mColumn; }
void setHasResizableElement(BOOL resizable);
void updateResizeBars();
BOOL canResize();
void enableResizeBar(BOOL enable);
std::string getLabel() { return mOrigLabel; }
void onSelectSort();
void onClick(const LLSD& data);
private:
LLScrollListColumn* mColumn;
LLResizeBar* mResizeBar;
std::string mOrigLabel;
LLUIString mAscendingText;
LLUIString mDescendingText;
BOOL mHasResizableElement;
LLPointer<LLUIImage> mImageOverlay;
LLFontGL::HAlign mImageOverlayAlignment;
LLColor4 mImageOverlayColor;
};
/*
* A simple data class describing a column within a scroll list.
*/
class LLScrollListColumn
{
public:
typedef enum e_sort_direction
{
DESCENDING,
ASCENDING
} ESortDirection;
//NOTE: this is default constructible so we can store it in a map.
LLScrollListColumn();
LLScrollListColumn(const LLSD& sd, LLScrollListCtrl* parent = NULL);
void setWidth(S32 width);
S32 getWidth() const { return mWidth; }
public:
// Public data is fine so long as this remains a simple struct-like data class.
// If it ever gets any smarter than that, these should all become private
// with protected or public accessor methods added as needed. -MG
std::string mName;
std::string mSortingColumn;
ESortDirection mSortDirection;
LLUIString mLabel;
F32 mRelWidth;
BOOL mDynamicWidth;
S32 mMaxContentWidth;
S32 mIndex;
LLScrollListCtrl* mParentCtrl;
LLScrollColumnHeader* mHeader;
LLFontGL::HAlign mFontAlignment;
private:
S32 mWidth;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,31 +1,28 @@
/**
* @file llscrolllistctrl.h
* @brief A scrolling list of items. This is the one you want to use
* in UI code. LLScrollListCell, LLScrollListItem, etc. are utility
* classes.
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2009, Linden Research, Inc.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
* Copyright (C) 2010, Linden Research, Inc.
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -37,293 +34,16 @@
#include "lluictrl.h"
#include "llctrlselectioninterface.h"
#include "lldarray.h"
//#include "lldarray.h"
#include "llfontgl.h"
#include "llui.h"
#include "llstring.h"
#include "llimagegl.h"
#include "llstring.h" // LLWString
#include "lleditmenuhandler.h"
#include "llframetimer.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "llscrollbar.h"
#include "llresizebar.h"
#include "lldate.h"
// <edit>
#include <boost/function.hpp>
// </edit>
/*
* Represents a cell in a scrollable table.
*
* Sub-classes must return height and other properties
* though width accessors are implemented by the base class.
* It is therefore important for sub-class constructors to call
* setWidth() with realistic values.
*/
class LLScrollListCell
{
public:
LLScrollListCell(S32 width = 0) : mWidth(width) {};
virtual ~LLScrollListCell() {};
virtual void draw(const LLColor4& color, const LLColor4& highlight_color) const = 0; // truncate to given width, if possible
virtual S32 getWidth() const {return mWidth;}
virtual S32 getContentWidth() const { return 0; }
virtual S32 getHeight() const { return 0; }
virtual const LLSD getValue() const { return LLStringUtil::null; }
virtual void setValue(const LLSD& value) { }
virtual BOOL getVisible() const { return TRUE; }
virtual void setWidth(S32 width) { mWidth = width; }
virtual void highlightText(S32 offset, S32 num_chars) {}
virtual BOOL isText() const { return FALSE; }
virtual void setColor(const LLColor4&) {}
virtual void onCommit() {};
virtual BOOL handleClick() { return FALSE; }
virtual void setEnabled(BOOL enable) { }
private:
S32 mWidth;
};
/*
* Cell displaying a text label.
*/
class LLScrollListText : public LLScrollListCell
{
public:
LLScrollListText( const std::string& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
/*virtual*/ ~LLScrollListText();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
/*virtual*/ S32 getContentWidth() const;
/*virtual*/ S32 getHeight() const;
/*virtual*/ void setValue(const LLSD& value);
/*virtual*/ const LLSD getValue() const;
/*virtual*/ BOOL getVisible() const;
/*virtual*/ void highlightText(S32 offset, S32 num_chars);
/*virtual*/ void setColor(const LLColor4&);
/*virtual*/ BOOL isText() const;
S32 getTextWidth() const { return mTextWidth;}
void setTextWidth(S32 value) { mTextWidth = value;}
virtual void setWidth(S32 width) { LLScrollListCell::setWidth(width); mTextWidth = width; }
void setText(const LLStringExplicit& text);
void setFontStyle(const U8 font_style);
private:
LLUIString mText;
S32 mTextWidth;
const LLFontGL* mFont;
LLColor4 mColor;
U8 mUseColor;
U8 mFontStyle;
LLFontGL::HAlign mFontAlignment;
BOOL mVisible;
S32 mHighlightCount;
S32 mHighlightOffset;
LLPointer<LLUIImage> mRoundedRectImage;
static U32 sCount;
};
/*
* Cell displaying an image.
*/
class LLScrollListIcon : public LLScrollListCell
{
public:
LLScrollListIcon(const LLSD& value, S32 width = 0);
/*virtual*/ ~LLScrollListIcon();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
/*virtual*/ S32 getWidth() const;
/*virtual*/ S32 getHeight() const;
/*virtual*/ const LLSD getValue() const;
/*virtual*/ void setColor(const LLColor4&);
/*virtual*/ void setValue(const LLSD& value);
// <edit>
void setClickCallback(boost::function<bool (void)> cb);
virtual BOOL handleClick();
// </edit>
private:
LLPointer<LLUIImage> mIcon;
LLColor4 mColor;
// <edit>
boost::function<bool (void)> mCallback;
// </edit>
};
/*
* An interactive cell containing a check box.
*/
class LLScrollListCheck : public LLScrollListCell
{
public:
LLScrollListCheck( LLCheckBoxCtrl* check_box, S32 width = 0);
/*virtual*/ ~LLScrollListCheck();
/*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
/*virtual*/ S32 getHeight() const { return 0; }
/*virtual*/ const LLSD getValue() const;
/*virtual*/ void setValue(const LLSD& value);
/*virtual*/ void onCommit();
/*virtual*/ BOOL handleClick();
/*virtual*/ void setEnabled(BOOL enable);
LLCheckBoxCtrl* getCheckBox() { return mCheckBox; }
private:
LLCheckBoxCtrl* mCheckBox;
};
class LLScrollListDate : public LLScrollListText
{
public:
LLScrollListDate( const LLDate& date, const LLFontGL* font, S32 width=0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, LLColor4& color = LLColor4::black, BOOL use_color = FALSE, BOOL visible = TRUE);
virtual void setValue(const LLSD& value);
virtual const LLSD getValue() const;
private:
LLDate mDate;
};
class LLScrollListColumn;
class LLScrollColumnHeader : public LLComboBox
{
public:
LLScrollColumnHeader(const std::string& label, const LLRect &rect, LLScrollListColumn* column, const LLFontGL *font = NULL);
~LLScrollColumnHeader();
/*virtual*/ void draw();
/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
/*virtual*/ void showList();
/*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding);
/*virtual*/ void handleReshape(const LLRect& new_rect, bool by_user = false);
void setImage(const std::string &image_name);
void setImageOverlay(const std::string &overlay_image, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
LLScrollListColumn* getColumn() { return mColumn; }
void setHasResizableElement(BOOL resizable);
void updateResizeBars();
BOOL canResize();
void enableResizeBar(BOOL enable);
std::string getLabel() { return mOrigLabel; }
void onSelectSort();
void onClick();
void onMouseDown();
private:
LLScrollListColumn* mColumn;
LLResizeBar* mResizeBar;
std::string mOrigLabel;
LLUIString mAscendingText;
LLUIString mDescendingText;
BOOL mShowSortOptions;
BOOL mHasResizableElement;
LLPointer<LLUIImage> mImageOverlay;
LLFontGL::HAlign mImageOverlayAlignment;
LLColor4 mImageOverlayColor;
};
/*
* A simple data class describing a column within a scroll list.
*/
class LLScrollListColumn
{
public:
typedef enum e_sort_direction
{
DESCENDING,
ASCENDING
} ESortDirection;
LLScrollListColumn();
LLScrollListColumn(const LLSD &sd, LLScrollListCtrl* parent);
void setWidth(S32 width);
S32 getWidth() const { return mWidth; }
// Public data is fine so long as this remains a simple struct-like data class.
// If it ever gets any smarter than that, these should all become private
// with protected or public accessor methods added as needed. -MG
std::string mName;
std::string mSortingColumn;
ESortDirection mSortDirection;
std::string mLabel;
F32 mRelWidth;
BOOL mDynamicWidth;
S32 mMaxContentWidth;
S32 mIndex;
LLScrollListCtrl* mParentCtrl;
LLScrollColumnHeader* mHeader;
LLFontGL::HAlign mFontAlignment;
private:
S32 mWidth;
};
class LLScrollListItem : public LLHandleProvider<LLScrollListItem>
{
public:
LLScrollListItem( BOOL enabled = TRUE, void* userdata = NULL, const LLUUID& uuid = LLUUID::null )
: mSelected(FALSE), mEnabled( enabled ), mUserdata( userdata ), mItemValue( uuid ), mColumns() {}
LLScrollListItem( LLSD item_value, void* userdata = NULL )
: mSelected(FALSE), mEnabled( TRUE ), mUserdata( userdata ), mItemValue( item_value ), mColumns() {}
virtual ~LLScrollListItem();
void setSelected( BOOL b ) { mSelected = b; }
BOOL getSelected() const { return mSelected; }
void setEnabled( BOOL b ) { mEnabled = b; }
BOOL getEnabled() const { return mEnabled; }
void setUserdata( void* userdata ) { mUserdata = userdata; }
void* getUserdata() const { return mUserdata; }
void setToolTip(const std::string tool_tip) { mToolTip=tool_tip; }
std::string getToolTip() { return mToolTip; }
virtual LLUUID getUUID() const { return mItemValue.asUUID(); }
LLSD getValue() const { return mItemValue; }
void setRect(LLRect rect) { mRectangle = rect; }
LLRect getRect() const { return mRectangle; }
// If width = 0, just use the width of the text. Otherwise override with
// specified width in pixels.
void addColumn( const std::string& text, const LLFontGL* font, S32 width = 0 , U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, BOOL visible = TRUE)
{ mColumns.push_back( new LLScrollListText(text, font, width, font_style, font_alignment, LLColor4::black, FALSE, visible) ); }
void setNumColumns(S32 columns);
void setColumn( S32 column, LLScrollListCell *cell );
S32 getNumColumns() const;
LLScrollListCell *getColumn(const S32 i) const;
std::string getContentsCSV() const;
virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);
private:
BOOL mSelected;
BOOL mEnabled;
void* mUserdata;
LLSD mItemValue;
std::string mToolTip;
std::vector<LLScrollListCell *> mColumns;
LLRect mRectangle;
};
class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
public LLCtrlListInterface, public LLCtrlScrollInterface
@@ -354,13 +74,10 @@ public:
typedef boost::signals2::signal<S32 (S32,const LLScrollListItem*,const LLScrollListItem*),maximum<S32> > sort_signal_t;
LLScrollListCtrl(
const std::string& name,
const LLRect& rect,
commit_callback_t commit_callback,
BOOL allow_multiple_selection,
BOOL draw_border = TRUE, bool draw_heading = false);
LLScrollListCtrl(const std::string& name, const LLRect& rect, commit_callback_t commit_callback, bool multi_select, bool has_border = true, bool draw_heading = false);
public:
virtual ~LLScrollListCtrl();
virtual LLXMLNodePtr getXML(bool save_children = true) const;
@@ -372,7 +89,7 @@ public:
void deleteAllItems() { clearRows(); }
// Sets an array of column descriptors
void setColumnHeadings(LLSD headings);
void setColumnHeadings(const LLSD& headings);
void sortByColumnIndex(U32 column, BOOL ascending);
// LLCtrlListInterface functions
@@ -381,7 +98,6 @@ public:
virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM);
virtual void clearColumns();
virtual void setColumnLabel(const std::string& column, const std::string& label);
virtual LLScrollListColumn* getColumn(S32 index);
virtual LLScrollListColumn* getColumn(const std::string& name);
virtual S32 getNumColumns() const { return mColumnsIndexed.size(); }
@@ -389,7 +105,7 @@ public:
// Adds a single element, from an array of:
// "columns" => [ "column" => column name, "value" => value, "type" => type, "font" => font, "font-style" => style ], "id" => uuid
// Creates missing columns automatically.
virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
virtual LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
// Simple add element. Takes a single array of:
// [ "value" => value, "font" => font, "font-style" => style ]
virtual void clearRows(); // clears all elements
@@ -441,8 +157,8 @@ public:
S32 getHighlightedItemInx() const { return mHighlightedItem; }
void setDoubleClickCallback( callback_t cb ) { mOnDoubleClickCallback = cb; }
void setMaximumSelectCallback( callback_t cb ) { mOnMaximumSelectCallback = cb; }
void setSortChangedCallback( callback_t cb ) { mOnSortChangedCallback = cb; }
void setMaximumSelectCallback( callback_t cb) { mOnMaximumSelectCallback = cb; }
void setSortChangedCallback( callback_t cb) { mOnSortChangedCallback = cb; }
// Convenience function; *TODO: replace with setter above + boost::bind() in calling code
void setDoubleClickCallback( boost::function<void (void* userdata)> cb, void* userdata) { mOnDoubleClickCallback = boost::bind(cb, userdata); }
@@ -463,7 +179,6 @@ public:
// one of which can be selected at a time.
virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos = ADD_BOTTOM, const LLSD& id = LLSD());
BOOL selectItemByLabel( const std::string& item, BOOL case_sensitive = TRUE ); // FALSE if item not found
BOOL selectItemByPrefix(const std::string& target, BOOL case_sensitive = TRUE);
BOOL selectItemByPrefix(const LLWString& target, BOOL case_sensitive = TRUE);
@@ -499,7 +214,7 @@ public:
void setBgStripeColor(const LLColor4& c) { mBgStripeColor = c; }
void setFgSelectedColor(const LLColor4 &c) { mFgSelectedColor = c; }
void setFgUnselectedColor(const LLColor4 &c){ mFgUnselectedColor = c; }
void setHighlightedColor(const LLColor4 &c) { mHighlightedColor = c; }
void setHighlightedColor(const LLColor4 &c) { mHighlightedColor = c; }
void setFgDisableColor(const LLColor4 &c) { mFgDisabledColor = c; }
void setBackgroundVisible(BOOL b) { mBackgroundVisible = b; }
@@ -516,11 +231,11 @@ public:
virtual S32 getScrollPos() const;
virtual void setScrollPos( S32 pos );
// <edit>
S32 getPageLines() { return mPageLines; }
// </edit>
S32 getSearchColumn();
void setSearchColumn(S32 column) { mSearchColumn = column; }
S32 getColumnIndexFromOffset(S32 x);
@@ -560,7 +275,7 @@ public:
LLRect getCellRect(S32 row_index, S32 column_index);
// Used "internally" by the scroll bar.
void onScrollChange( S32 new_pos, LLScrollbar* src);
void onScrollChange( S32 new_pos, LLScrollbar* src );
static void onClickColumn(void *userdata);
@@ -628,6 +343,7 @@ public:
return mSortCallback->connect(cb);
}
protected:
// "Full" interface: use this when you're creating a list that has one or more of the following:
// * contains icons
@@ -741,5 +457,4 @@ private:
sort_signal_t* mSortCallback;
}; // end class LLScrollListCtrl
#endif // LL_SCROLLLISTCTRL_H

View File

@@ -0,0 +1,147 @@
/**
* @file llscrolllistitem.cpp
* @brief Scroll lists are composed of rows (items), each of which
* contains columns (cells).
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llscrolllistitem.h"
//---------------------------------------------------------------------------
// LLScrollListItem
//---------------------------------------------------------------------------
LLScrollListItem::LLScrollListItem( bool enabled, const LLSD& value, void* userdata )
: mSelected(FALSE),
mEnabled(enabled),
mUserdata(userdata),
mItemValue(value),
mColumns()
{
}
LLScrollListItem::~LLScrollListItem()
{
std::for_each(mColumns.begin(), mColumns.end(), DeletePointer());
}
void LLScrollListItem::addColumn(const std::string& text, const LLFontGL* font, S32 width, U8 font_style, LLFontGL::HAlign font_alignment, bool visible)
{
mColumns.push_back(new LLScrollListText(text, font, width, font_style, font_alignment, LLColor4::black, false, visible));
}
void LLScrollListItem::setNumColumns(S32 columns)
{
S32 prev_columns = mColumns.size();
if (columns < prev_columns)
{
std::for_each(mColumns.begin()+columns, mColumns.end(), DeletePointer());
}
mColumns.resize(columns);
for (S32 col = prev_columns; col < columns; ++col)
{
mColumns[col] = NULL;
}
}
void LLScrollListItem::setColumn( S32 column, LLScrollListCell *cell )
{
if (column < (S32)mColumns.size())
{
delete mColumns[column];
mColumns[column] = cell;
}
else
{
llerrs << "LLScrollListItem::setColumn: bad column: " << column << llendl;
}
}
S32 LLScrollListItem::getNumColumns() const
{
return mColumns.size();
}
LLScrollListCell* LLScrollListItem::getColumn(const S32 i) const
{
if (0 <= i && i < (S32)mColumns.size())
{
return mColumns[i];
}
return NULL;
}
std::string LLScrollListItem::getContentsCSV() const
{
std::string ret;
S32 count = getNumColumns();
for (S32 i=0; i<count; ++i)
{
ret += getColumn(i)->getValue().asString();
if (i < count-1)
{
ret += ", ";
}
}
return ret;
}
void LLScrollListItem::draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding)
{
// draw background rect
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLRect bg_rect = rect;
gl_rect_2d( bg_rect, bg_color );
S32 cur_x = rect.mLeft;
S32 num_cols = getNumColumns();
S32 cur_col = 0;
for (LLScrollListCell* cell = getColumn(0); cur_col < num_cols; cell = getColumn(++cur_col))
{
// Two ways a cell could be hidden
if (cell->getWidth() < 0
|| !cell->getVisible()) continue;
LLUI::pushMatrix();
{
LLUI::translate((F32) cur_x, (F32) rect.mBottom);
cell->draw( fg_color, highlight_color );
}
LLUI::popMatrix();
cur_x += cell->getWidth() + column_padding;
}
}

View File

@@ -0,0 +1,92 @@
/**
* @file llscrolllistitem.h
* @brief Scroll lists are composed of rows (items), each of which
* contains columns (cells).
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LLSCROLLLISTITEM_H
#define LLSCROLLLISTITEM_H
#include "llrefcount.h"
#include "llhandle.h"
#include "llsd.h"
#include "llscrolllistcell.h"
//---------------------------------------------------------------------------
// LLScrollListItem
//---------------------------------------------------------------------------
class LLScrollListItem
: public LLHandleProvider<LLScrollListItem> // Singu TODO: Break out into LLNameListItem
{
friend class LLScrollListCtrl;
public:
virtual ~LLScrollListItem();
void setSelected( BOOL b ) { mSelected = b; }
BOOL getSelected() const { return mSelected; }
void setEnabled( BOOL b ) { mEnabled = b; }
BOOL getEnabled() const { return mEnabled; }
void setUserdata( void* userdata ) { mUserdata = userdata; }
void* getUserdata() const { return mUserdata; }
void setToolTip(const std::string tool_tip) { mToolTip=tool_tip; }
std::string getToolTip() { return mToolTip; }
virtual LLUUID getUUID() const { return mItemValue.asUUID(); }
LLSD getValue() const { return mItemValue; }
void setRect(LLRect rect) { mRectangle = rect; }
LLRect getRect() const { return mRectangle; }
void addColumn( const std::string& text, const LLFontGL* font, S32 width = 0, U8 font_style = LLFontGL::NORMAL, LLFontGL::HAlign font_alignment = LLFontGL::LEFT, bool visible = true );
void setNumColumns(S32 columns);
void setColumn( S32 column, LLScrollListCell *cell );
S32 getNumColumns() const;
LLScrollListCell *getColumn(const S32 i) const;
std::string getContentsCSV() const;
virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);
protected:
LLScrollListItem( bool enabled = true, const LLSD& value = LLSD(), void* userdata = NULL );
private:
BOOL mSelected;
BOOL mEnabled;
void* mUserdata;
LLSD mItemValue;
std::string mToolTip;
std::vector<LLScrollListCell *> mColumns;
LLRect mRectangle;
};
#endif

View File

@@ -4326,17 +4326,6 @@ This should be as low as possible, but too low may break functionality</string>
<real>1.0</real>
</array>
</map>
<key>ColumnHeaderDropDownDelay</key>
<map>
<key>Comment</key>
<string>Time in seconds of mouse click before column header shows sort options list</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>0.300000011921</real>
</map>
<key>CompileOutputRect</key>
<map>
<key>Comment</key>

View File

@@ -38,7 +38,6 @@ this feature is still a work in progress.
/* basic headers */
#include "llviewerprecompiledheaders.h"
#include "lluictrlfactory.h"
/* own class header && upload floater header */
#include "floaterlocalassetbrowse.h"
@@ -50,6 +49,12 @@ this feature is still a work in progress.
#include "llimagejpeg.h"
#include "llimagepng.h"
/* llui headers */
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
/* misc headers */
#include <time.h>
#include <ctime>
@@ -60,13 +65,7 @@ this feature is still a work in progress.
#include "llfloaterimagepreview.h"
#include "llfile.h"
/* repeated in header */
#include "lltexturectrl.h"
#include "llscrolllistctrl.h"
#include "llviewercontrol.h"
/* including to force rebakes when needed */
#include "llagent.h"
#include "llvoavatarself.h"
/* sculpt refresh */

View File

@@ -44,6 +44,8 @@ tag: vaa emerald local_asset_browser
#include "lldrawable.h"
#include "lleventtimer.h"
class LLCheckBoxCtrl;
class LLComboBox;
/*=======================================*/
/* Global structs / enums / defines */

View File

@@ -41,8 +41,8 @@
#include "llagent.h"
#include "llgroupactions.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
#include "llviewercontrol.h"
// static variable
HBFloaterGroupTitles* HBFloaterGroupTitles::sInstance = NULL;

View File

@@ -33,16 +33,16 @@
#include "llviewerprecompiledheaders.h"
#include "lluuid.h"
#include "lluictrlfactory.h"
#include "jcfloaterareasearch.h"
#include "llfiltereditor.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
#include "llagent.h"
#include "llfiltereditor.h"
#include "lltracker.h"
#include "llviewerobjectlist.h"
#include "llviewercontrol.h"
#include "jcfloaterareasearch.h"
const std::string request_string = "JCFloaterAreaSearch::Requested_\xF8\xA7\xB5";
const F32 min_refresh_interval = 0.25f; // Minimum interval between list refreshes in seconds.

View File

@@ -158,6 +158,7 @@
// Included so that constants/settings might be initialized
// in save_settings_to_globals()
#include "llbutton.h"
#include "llcombobox.h"
#include "llstatusbar.h"
#include "llsurface.h"
#include "llvosky.h"

View File

@@ -20,12 +20,14 @@
#include "llavatarnamecache.h"
#include "llfloateravatarlist.h"
#include "llnotificationsutil.h"
#include "llradiogroup.h"
#include "llscrolllistcolumn.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
#include "llviewerwindow.h"
#include "llwindow.h"
#include "llscrolllistctrl.h"
#include "llradiogroup.h"
#include "llnotificationsutil.h"
#include "llvoavatar.h"
#include "llimview.h"

View File

@@ -43,6 +43,7 @@
#include "llcachename.h"
#include "lllineeditor.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lltabcontainer.h"
#include "lluictrlfactory.h"
#include "message.h"

View File

@@ -1,19 +1,22 @@
// <edit>
#include "llviewerprecompiledheaders.h"
#include "llfloaterblacklist.h"
#include "llaudioengine.h"
#include "llvfs.h"
#include "lluictrlfactory.h"
#include "llsdserialize.h"
#include "llscrolllistctrl.h"
#include "llcheckboxctrl.h"
#include "statemachine/aifilepicker.h"
#include "llviewerwindow.h"
#include "llwindow.h"
#include "llviewercontrol.h"
#include "llviewerobjectlist.h"
#include "llcombobox.h"
#include "lldate.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llsdserialize.h"
#include "lluictrlfactory.h"
#include "llvfs.h"
#include "llwindow.h"
#include "llagent.h"
#include "llviewerobjectlist.h"
#include "llviewerwindow.h"
#include "statemachine/aifilepicker.h"
LLFloaterBlacklist* LLFloaterBlacklist::sInstance;

View File

@@ -53,6 +53,7 @@
#include "llviewerstats.h"
#include "lluictrlfactory.h"
#include "llselectmgr.h"
#include "llcheckboxctrl.h"
#include "llnotificationsutil.h"
#include "roles_constants.h" // for GP_OBJECT_MANIPULATE

View File

@@ -3,15 +3,16 @@
#include "llviewerprecompiledheaders.h"
#include "llfloaterexploresounds.h"
#include "lluictrlfactory.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "llviewerwindow.h"
#include "llfloaterblacklist.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "llfloaterchat.h"
#include "llfloaterblacklist.h"
static const size_t num_collision_sounds = 29;
const LLUUID collision_sounds[num_collision_sounds] =

View File

@@ -46,8 +46,10 @@
#include "lleventtimer.h"
#include "llfiltereditor.h"
#include "llfloateravatarpicker.h"
#include "llnamelistctrl.h"
#include "llnotificationsutil.h"
#include "llscrolllistcolumn.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llsdserialize.h"
#include "lltextbox.h"
#include "lluictrlfactory.h"

View File

@@ -54,6 +54,7 @@
#include "llgroupactions.h"
#include "llselectmgr.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llnotificationsutil.h"
#include "lltextbox.h"
#include "lluictrlfactory.h"

View File

@@ -37,6 +37,7 @@
#include "llfloatertools.h"
#include "llcachename.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llselectmgr.h"
#include "lltoolcomp.h"
#include "lltoolmgr.h"

View File

@@ -66,6 +66,7 @@
#include "llpanellandmedia.h"
#include "llradiogroup.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llselectmgr.h"
#include "llspinctrl.h"
#include "lltabcontainer.h"

View File

@@ -1,19 +1,22 @@
// <edit>
#include "llviewerprecompiledheaders.h"
#include "llfloatermessagelog.h"
#include "lluictrlfactory.h"
#include "llworld.h"
#include "llnotificationsutil.h"
#include "llviewerregion.h"
#include "llscrolllistctrl.h"
#include "lltexteditor.h"
#include "llviewerwindow.h" // alertXml
#include "llmessagetemplate.h"
#include <boost/tokenizer.hpp>
#include "llmenugl.h"
#include "lleventtimer.h"
#include "llmenugl.h"
#include "llmessagetemplate.h"
#include "llnotificationsutil.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lltexteditor.h"
#include "lluictrlfactory.h"
#include "llagent.h"
#include "llviewerregion.h"
#include "llworld.h"
#include <boost/tokenizer.hpp>
////////////////////////////////
@@ -826,7 +829,7 @@ BOOL LLFloaterMessageLog::onClickCloseCircuit(void* user_data)
// static
bool LLFloaterMessageLog::onConfirmCloseCircuit(const LLSD& notification, const LLSD& response )
{
S32 option = LLNotification::getSelectedOption(notification, response);
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLCircuitData* cdp = gMessageSystem->mCircuitInfo.findCircuit(LLHost(notification["payload"]["circuittoclose"].asString()));
if(!cdp) return false;
LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(cdp->getHost());
@@ -861,7 +864,7 @@ bool LLFloaterMessageLog::onConfirmCloseCircuit(const LLSD& notification, const
// static
bool LLFloaterMessageLog::onConfirmRemoveRegion(const LLSD& notification, const LLSD& response )
{
S32 option = LLNotification::getSelectedOption(notification, response);
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if(option == 0) // yes
LLWorld::getInstance()->removeRegion(LLHost(notification["payload"]["regionhost"].asString()));
return false;

View File

@@ -34,27 +34,15 @@
#include "llfloatermute.h"
#include "llfontgl.h"
#include "llrect.h"
#include "llerror.h"
#include "llstring.h"
#include "message.h"
#include "llavatarname.h"
#include "llnotificationsutil.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
// project include
#include "llagent.h"
#include "llavatarnamecache.h"
#include "llfloateravatarpicker.h"
#include "llbutton.h"
#include "lllineeditor.h"
#include "llmutelist.h"
#include "llnamelistctrl.h"
#include "llresizehandle.h"
#include "lltextbox.h"
#include "llviewertexteditor.h"
#include "llviewerwindow.h"
#include "lluictrlfactory.h"
#include "llfocusmgr.h"
#include <boost/lexical_cast.hpp>

View File

@@ -36,6 +36,7 @@
#include "lluictrlfactory.h"
#include "llbutton.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llpanel.h"
#include "llcombobox.h"
#include "llviewertexteditor.h"

View File

@@ -43,7 +43,7 @@
#include "llpathfindinglinkset.h"
#include "llpathfindinglinksetlist.h"
#include "llpathfindingmanager.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llsd.h"
#include "lltextbox.h"
#include "llui.h"

View File

@@ -49,6 +49,7 @@
#include "llpathfindingmanager.h"
#include "llresmgr.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llselectmgr.h"
#include "llsd.h"
#include "llstring.h"

View File

@@ -37,7 +37,6 @@
#include <algorithm>
#include <functional>
#include "llcachename.h"
#include "lldir.h"
#include "lldispatcher.h"
#include "llglheaders.h"
@@ -69,6 +68,7 @@
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llregioninfomodel.h"
#include "llscrolllistitem.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
#include "lltabcontainer.h"

View File

@@ -26,7 +26,6 @@
*/
#include "llviewerprecompiledheaders.h"
#include "llhttpclient.h"
#include "llfloaterscriptlimits.h"
// library includes
@@ -39,7 +38,9 @@
#include "llfloateravatarpicker.h"
#include "llfloaterland.h"
#include "llregionhandle.h"
#include "llscrolllistcolumn.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llparcel.h"
#include "lltabcontainer.h"
#include "lltracker.h"
@@ -223,7 +224,7 @@ void fetchScriptLimitsRegionInfoResponder::result(const LLSD& content)
void fetchScriptLimitsRegionInfoResponder::error(U32 status, const std::string& reason)
{
llwarns << "Error from responder " << reason << llendl;
llwarns << "fetchScriptLimitsRegionInfoResponder error [status:" << status << "]: " << reason << llendl;
}
void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref)
@@ -310,7 +311,7 @@ void fetchScriptLimitsRegionSummaryResponder::result(const LLSD& content_ref)
void fetchScriptLimitsRegionSummaryResponder::error(U32 status, const std::string& reason)
{
llwarns << "Error from responder " << reason << llendl;
llwarns << "fetchScriptLimitsRegionSummaryResponder error [status:" << status << "]: " << reason << llendl;
}
void fetchScriptLimitsRegionDetailsResponder::result(const LLSD& content_ref)
@@ -419,7 +420,7 @@ result (map)
void fetchScriptLimitsRegionDetailsResponder::error(U32 status, const std::string& reason)
{
llwarns << "Error from responder " << reason << llendl;
llwarns << "fetchScriptLimitsRegionDetailsResponder error [status:" << status << "]: " << reason << llendl;
}
void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref)
@@ -515,7 +516,7 @@ void fetchScriptLimitsAttachmentInfoResponder::result(const LLSD& content_ref)
void fetchScriptLimitsAttachmentInfoResponder::error(U32 status, const std::string& reason)
{
llwarns << "Error from responder " << reason << llendl;
llwarns << "fetchScriptLimitsAttachmentInfoResponder error [status:" << status << "]: " << reason << llendl;
}
///----------------------------------------------------------------------------
@@ -603,14 +604,7 @@ void LLPanelScriptLimitsRegionMemory::onNameCache(
}
std::string name;
if (LLAvatarNameCache::useDisplayNames())
{
name = LLCacheName::buildUsername(full_name);
}
else
{
name = full_name;
}
LLAvatarNameCache::getPNSName(id, name);
std::vector<LLSD>::iterator id_itor;
for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)

View File

@@ -39,6 +39,7 @@
#include "llfloater.h"
#include "llfiltereditor.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llspinctrl.h"
#include "lltexteditor.h"
#include "lluictrlfactory.h"

View File

@@ -32,28 +32,19 @@
#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
#include <algorithm>
//MK
#include "llworld.h"
#include "lleventpoll.h"
#include "llagent.h"
//mk
#include "llappviewer.h"
#include "llfloaterteleporthistory.h"
#include "llappviewer.h"
#include "llfloaterworldmap.h"
#include "llscrolllistcolumn.h"
#include "llscrolllistitem.h"
#include "llsdserialize.h"
#include "llslurl.h"
#include "lltimer.h"
#include "lluictrlfactory.h"
#include "llurldispatcher.h"
#include "llviewercontrol.h"
#include "llurlaction.h"
#include "llviewerwindow.h"
#include "llwindow.h"
#include "llweb.h"
#include "llsdserialize.h"
#include "llurlaction.h"
// [RLVa:KB]
#include "rlvhandler.h"

View File

@@ -44,6 +44,7 @@
#include "llnotificationsutil.h"
#include "llparcel.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lllineeditor.h"
#include "lltextbox.h"
#include "lltracker.h"

View File

@@ -30,6 +30,7 @@
#include "llfloatervoiceeffect.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lltexteditor.h" // For linked text hack
#include "lltrans.h"
#include "lluictrlfactory.h"

View File

@@ -37,10 +37,11 @@
#include <boost/tokenizer.hpp>
#include "llavatarnamecache.h"
#include "llcachename.h"
#include "llagent.h"
#include "llinventory.h"
#include "llscrolllistitem.h"
#include "llscrolllistcolumn.h"
#include "lltrans.h"
static LLRegisterWidget<LLNameListCtrl> r("name_list");

View File

@@ -60,6 +60,7 @@
#include "llpreviewtexture.h"
#include "llpluginclassmedia.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lltabcontainer.h"
#include "lluictrlfactory.h"
#include "llviewerwindow.h"

View File

@@ -46,6 +46,7 @@
#include "llcombobox.h"
#include "lllineeditor.h"
#include "llnotificationsutil.h"
#include "llscrolllistcolumn.h"
#include "llscrolllistctrl.h"
#include "llstatusbar.h"
#include "lluiconstants.h"

View File

@@ -43,6 +43,7 @@
#include "llgroupmgr.h"
#include "llnamelistctrl.h"
#include "llnotificationsutil.h"
#include "llscrolllistitem.h"
#include "llspinctrl.h"
#include "lltextbox.h"
#include "llviewerobject.h"

View File

@@ -45,6 +45,7 @@
#include "lllineeditor.h"
#include "llproductinforequest.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lltextbox.h"
#include "lltabcontainer.h"
#include "lltexteditor.h"

View File

@@ -41,10 +41,9 @@
#include "llviewerinventory.h"
#include "llinventorydefines.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
#include "llinventoryicon.h"
#include "llinventorymodel.h"
#include "llagent.h"
#include "lltooldraganddrop.h"
#include "lllineeditor.h"
#include "lltexteditor.h"
@@ -52,11 +51,11 @@
#include "lliconctrl.h"
#include "llcheckboxctrl.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lltextbox.h"
#include "roles_constants.h"
#include "llviewerwindow.h"
#include "llviewercontrol.h"
#include "llviewermessage.h"
#include "llnotificationsutil.h"
#include "llgiveinventory.h"
@@ -86,16 +85,15 @@ public:
EAcceptance* accept,
std::string& tooltip_msg);
static LLView* fromXML(LLXMLNodePtr node, LLView* parent, class LLUICtrlFactory* factory);
void setPanel(LLPanelGroupNotices* panel) { mGroupNoticesPanel = panel; }
void setGroupNoticesPanel(LLPanelGroupNotices* panel) { mGroupNoticesPanel = panel; }
protected:
LLPanelGroupNotices* mGroupNoticesPanel;
};
LLGroupDropTarget::LLGroupDropTarget(const LLDropTarget::Params& p)
: LLDropTarget(p)
{
}
{}
// static
LLView* LLGroupDropTarget::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory* factory)
@@ -144,6 +142,7 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
case DAD_BODYPART:
case DAD_ANIMATION:
case DAD_GESTURE:
case DAD_CALLINGCARD:
{
LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
if(gInventory.getItem(inv_item->getUUID())
@@ -167,7 +166,6 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
break;
}
case DAD_CATEGORY:
case DAD_CALLINGCARD:
default:
*accept = ACCEPT_NO;
break;
@@ -269,9 +267,9 @@ BOOL LLPanelGroupNotices::postBuild()
mPanelCreateNotice = getChild<LLPanel>("panel_create_new_notice",recurse);
mPanelViewNotice = getChild<LLPanel>("panel_view_past_notice",recurse);
LLGroupDropTarget* group_drop_target = getChild<LLGroupDropTarget>("drop_target",recurse);
group_drop_target->setEntityID(mGroupID);
group_drop_target->setGroupNoticesPanel(this);
LLGroupDropTarget* target = getChild<LLGroupDropTarget>("drop_target",recurse);
target->setPanel(this);
target->setEntityID(mGroupID);
arrangeNoticeView(VIEW_PAST_NOTICE);
@@ -538,8 +536,7 @@ void LLPanelGroupNotices::showNotice(const std::string& subject,
mInventoryOffer = inventory_offer;
std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType,
LLInventoryType::IT_TEXTURE,
0, FALSE);
LLInventoryType::IT_TEXTURE);
mViewInventoryIcon->setImage(icon_name);
mViewInventoryIcon->setVisible(TRUE);

View File

@@ -46,6 +46,7 @@
#include "llnotificationsutil.h"
#include "llpanelgrouproles.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lltabcontainer.h"
#include "lltextbox.h"
#include "lltexteditor.h"
@@ -503,13 +504,11 @@ void LLPanelGroupSubTab::setSearchFilter(const std::string& filter)
void LLPanelGroupSubTab::activate()
{
lldebugs << "LLPanelGroupSubTab::activate()" << llendl;
setOthersVisible(TRUE);
}
void LLPanelGroupSubTab::deactivate()
{
lldebugs << "LLPanelGroupSubTab::deactivate()" << llendl;
setOthersVisible(FALSE);
}
@@ -519,19 +518,11 @@ void LLPanelGroupSubTab::setOthersVisible(BOOL b)
{
mHeader->setVisible( b );
}
else
{
llwarns << "LLPanelGroupSubTab missing header!" << llendl;
}
if (mFooter)
{
mFooter->setVisible( b );
}
else
{
llwarns << "LLPanelGroupSubTab missing footer!" << llendl;
}
}
bool LLPanelGroupSubTab::matchesActionSearchFilter(std::string action)
@@ -1068,7 +1059,7 @@ void LLPanelGroupMembersSubTab::onEjectMembers(void *userdata)
void LLPanelGroupMembersSubTab::handleEjectMembers()
{
//send down an eject message
std::vector<LLUUID> selected_members;
uuid_vec_t selected_members;
std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
if (selection.empty()) return;
@@ -1111,6 +1102,7 @@ void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id,
for (std::vector<LLScrollListItem*>::iterator itor = selection.begin() ;
itor != selection.end(); ++itor)
{
member_id = (*itor)->getUUID();
//see if we requested a change for this member before
@@ -1403,7 +1395,7 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag
if ( role_change_datap )
{
std::vector<LLUUID> roles_to_be_removed;
uuid_vec_t roles_to_be_removed;
for (role_change_data_map_t::iterator role = role_change_datap->begin();
role != role_change_datap->end(); ++ role)
@@ -1678,6 +1670,7 @@ LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab(const std::string& name, const
mMemberVisibleCheck(NULL),
mDeleteRoleButton(NULL),
mCreateRoleButton(NULL),
mHasRoleChange(FALSE)
{
}
@@ -2084,8 +2077,8 @@ void LLPanelGroupRolesSubTab::buildMembersList()
LLGroupRoleData* rdatap = (*rit).second;
if (rdatap)
{
std::vector<LLUUID>::const_iterator mit = rdatap->getMembersBegin();
std::vector<LLUUID>::const_iterator end = rdatap->getMembersEnd();
uuid_vec_t::const_iterator mit = rdatap->getMembersBegin();
uuid_vec_t::const_iterator end = rdatap->getMembersEnd();
for ( ; mit != end; ++mit)
{
mAssignedMembersList->addNameItem((*mit));
@@ -2423,9 +2416,7 @@ BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root)
void LLPanelGroupActionsSubTab::activate()
{
LLPanelGroupSubTab::activate();
lldebugs << "LLPanelGroupActionsSubTab::activate()" << llendl;
update(GC_ALL);
}

View File

@@ -32,24 +32,19 @@
#include "llviewerprecompiledheaders.h"
#include "roles_constants.h"
#include "llpanelgroupvoting.h"
#include "lllineeditor.h"
#include "llbutton.h"
#include "llnotificationsutil.h"
#include "llradiogroup.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llspinctrl.h"
#include "lltextbox.h"
#include "lltexteditor.h"
#include "llscrolllistctrl.h"
#include "llradiogroup.h"
#include "llspinctrl.h"
#include "llpanelgroupvoting.h"
#include "llnamelistctrl.h"
#include "llbutton.h"
#include "llnotify.h"
#include "llagent.h"
#include "llfocusmgr.h"
#include "llviewercontrol.h"
#include "llviewerwindow.h"
#include "llviewerregion.h"
class AIHTTPTimeoutPolicy;

View File

@@ -32,6 +32,7 @@
#include "llcheckboxctrl.h"
#include "llnotificationsutil.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
#include "llwindow.h"
#include "llviewerwindow.h"

View File

@@ -33,10 +33,12 @@
#include "llpanelmsgs.h"
#include "llscrolllistctrl.h"
#include "lluictrlfactory.h"
#include "llfirstuse.h"
#include "llnotificationtemplate.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lluictrlfactory.h"
#include "llfirstuse.h"
LLPanelMsgs::LLPanelMsgs()
{

View File

@@ -33,7 +33,9 @@
#include "llcombobox.h"
#include "llresizebar.h"
#include "llresizehandle.h"
#include "llscrolllistcolumn.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llslider.h"
#include "llsliderctrl.h"
#include "llagent.h"

View File

@@ -31,6 +31,7 @@
#include "llmutelist.h"
#include "llparticipantlist.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llspeakers.h"
#include "llviewerwindow.h"
#include "llvoiceclient.h"

View File

@@ -31,49 +31,38 @@
*/
#include "llviewerprecompiledheaders.h"
#include <algorithm>
#include "llpreviewgesture.h"
// libraries
#include "lldatapacker.h"
#include "lldarray.h"
#include "llinventorydefines.h"
#include "llstring.h"
#include "lldir.h"
#include "llmultigesture.h"
#include "llvfile.h"
#include "lltrans.h"
// newview
#include "llagent.h" // todo: remove
#include "llagent.h"
#include "llanimstatelabels.h"
#include "llanimationstates.h"
#include "llappviewer.h" // gVFS
#include "llassetuploadresponders.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "lldatapacker.h"
#include "lldelayedgestureerror.h"
#include "llfloatergesture.h" // for some label constants
#include "llgesturemgr.h"
#include "llinventorydefines.h"
#include "llinventoryfunctions.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
#include "llmultigesture.h"
#include "llnotificationsutil.h"
#include "llradiogroup.h"
#include "llresmgr.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "lltextbox.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
#include "llviewerinventory.h"
#include "llviewerobject.h"
#include "llvfile.h"
#include "llviewerobjectlist.h"
#include "llviewerregion.h"
#include "llviewerstats.h"
#include "llviewerwindow.h" // busycount
#include "llappviewer.h" // gVFS
#include "llanimstatelabels.h"
#include "llresmgr.h"
// *TODO: Translate?
@@ -98,7 +87,7 @@ void LLInventoryGestureAvailable::done()
{
for(uuid_vec_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it)
{
LLPreview *preview = LLPreview::find((*it));
LLPreview* preview = LLPreview::find((*it));
if(preview)
{
preview->refresh();
@@ -557,6 +546,7 @@ static const std::string valid_key_to_string(KEY key)
void LLPreviewGesture::addKeys()
{
LLComboBox* combo = mKeyCombo;
combo->add( NONE_LABEL );
for (KEY key = ' '; key < KEY_NONE; key++)
{
@@ -686,7 +676,7 @@ void LLPreviewGesture::refresh()
if (mPreviewGesture || !is_complete)
{
childSetEnabled("desc", FALSE);
getChildView("desc")->setEnabled(FALSE);
//mDescEditor->setEnabled(FALSE);
mTriggerEditor->setEnabled(FALSE);
mReplaceText->setEnabled(FALSE);
@@ -720,7 +710,7 @@ void LLPreviewGesture::refresh()
BOOL modifiable = item->getPermissions().allowModifyBy(gAgent.getID());
childSetEnabled("desc", modifiable);
getChildView("desc")->setEnabled(modifiable);
mTriggerEditor->setEnabled(TRUE);
mLibraryList->setEnabled(modifiable);
mStepList->setEnabled(modifiable);

View File

@@ -40,28 +40,28 @@
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "lldir.h"
#include "llexternaleditor.h"
#include "statemachine/aifilepicker.h"
#include "llinventorydefines.h"
#include "llinventorymodel.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
#include "lllivefile.h"
#include "llexternaleditor.h"
#include "llnotificationsutil.h"
#include "llresmgr.h"
#include "llscrollbar.h"
#include "llscrollcontainer.h"
#include "llscrolllistctrl.h"
#include "llscrolllistitem.h"
#include "llslider.h"
//#include "lscript_rt_interface.h"
//#include "lscript_library.h"
//#include "lscript_export.h"
#include "lltextbox.h"
#include "lltooldraganddrop.h"
#include "llvfile.h"
#include "statemachine/aifilepicker.h"
#include "llagent.h"
#include "llnotify.h"
#include "llmenugl.h"
#include "roles_constants.h"
#include "llselectmgr.h"
@@ -80,7 +80,6 @@
#include "llslider.h"
#include "lldir.h"
#include "llcombobox.h"
//#include "llfloaterchat.h"
#include "llfloatersearchreplace.h"
#include "llviewerstats.h"
#include "llviewertexteditor.h"
@@ -91,7 +90,6 @@
#include "lltrans.h"
#include "llviewercontrol.h"
#include "llappviewer.h"
#include "llpanelobjectinventory.h"
#include "llsdserialize.h"
@@ -750,7 +748,7 @@ BOOL LLScriptEdCore::canClose()
bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLSD& response )
{
S32 option = LLNotification::getSelectedOption(notification, response);
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch( option )
{
case 0: // "Yes"
@@ -782,7 +780,7 @@ bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLS
// static
bool LLScriptEdCore::onHelpWebDialog(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch(option)
{
@@ -1142,8 +1140,7 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data)
LLScrollListItem* item = self->mErrorList->getFirstSelected();
if(item)
{
// *FIX: This fucked up little hack is here because we don't
// have a grep library. This is very brittle code.
// *FIX: replace with boost grep
S32 row = 0;
S32 column = 0;
const LLScrollListCell* cell = item->getColumn(0);
@@ -1161,7 +1158,7 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data)
bool LLScriptEdCore::handleReloadFromServerDialog(const LLSD& notification, const LLSD& response )
{
S32 option = LLNotification::getSelectedOption(notification, response);
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
switch( option )
{
case 0: // "Yes"
@@ -1454,8 +1451,7 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save)
// Save needs to compile the text in the buffer. If the compile
// succeeds, then save both assets out to the database. If the compile
// fails, go ahead and save the text anyway so that the user doesn't
// get too fucked.
// fails, go ahead and save the text anyway.
void LLPreviewLSL::saveIfNeeded()
{
// llinfos << "LLPreviewLSL::saveIfNeeded()" << llendl;

View File

@@ -35,41 +35,30 @@
#include "lltoolbar.h"
#include "imageids.h"
#include "llfontgl.h"
#include "llrect.h"
#include "llparcel.h"
#include "llbutton.h"
#include "llflyoutbutton.h"
#include "llscrolllistitem.h"
#include "llui.h"
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llbutton.h"
#include "llfocusmgr.h"
#include "llviewercontrol.h"
#include "llmenucommands.h"
#include "llimview.h"
#include "lluiconstants.h"
#include "llvoavatarself.h"
#include "lltooldraganddrop.h"
#include "llfloaterchatterbox.h"
#include "llfloaterfriends.h"
#include "llfloaterinventory.h"
#include "llfloatersnapshot.h"
#include "llfloateravatarlist.h"
#include "lltoolmgr.h"
#include "llui.h"
#include "llviewermenu.h"
#include "llfirstuse.h"
#include "llviewerparcelmgr.h"
#include "lluictrlfactory.h"
#include "llviewerwindow.h"
#include "lltoolgrab.h"
#include "llcombobox.h"
#include "llfloateravatarlist.h"
#include "llfloaterchat.h"
#include "llfloatermute.h"
#include "llimpanel.h"
#include "llscrolllistctrl.h"
#include "llfloaterchatterbox.h"
#include "llfloatercustomize.h"
#include "llfloaterfriends.h"
#include "llfloaterinventory.h"
#include "llfloatermute.h"
#include "llfloatersnapshot.h"
#include "llimpanel.h"
#include "llimview.h"
#include "llmenucommands.h"
#include "lltoolmgr.h"
#include "lltoolgrab.h"
#include "llvoavatarself.h"
// [RLVa:KB]
#include "rlvhandler.h"
@@ -78,6 +67,7 @@
#if LL_DARWIN
#include "llresizehandle.h"
#include "llviewerwindow.h"
// This class draws like an LLResizeHandle but has no interactivity.
// It's just there to provide a cue to the user that the lower right corner of the window functions as a resize handle.
@@ -343,7 +333,7 @@ void LLToolBar::refresh()
mBuildBtn->setEnabled(!(gRlvHandler.hasBehaviour(RLV_BHVR_REZ) && gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)));
mMapBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWWORLDMAP));
mRadarBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP));
mRadarBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP) && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES));
mInventoryBtn->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV));
}
// [/RLVa:KB]