Radar Improvements - New files to support scrolllistctrl style radar

Arrehn 2011-05-31 13:43:57 -04:00
parent 5f7fa9e264
commit 5062b2e73f
3 changed files with 182 additions and 0 deletions

View File

@ -79,6 +79,7 @@ set(viewer_SOURCE_FILES
fscontactsfloater.cpp
fsareasearch.cpp
fskeywords.cpp
fsradarlistctrl.cpp
llagent.cpp
llagentaccess.cpp
llagentcamera.cpp
@ -640,6 +641,7 @@ set(viewer_HEADER_FILES
kcwlinterface.h
floatermedialists.h
fscontactsfloater.h
fsradarlistctrl.h
fsareasearch.h
fskeywords.h
llagent.h

View File

@ -0,0 +1,85 @@
/**
* @file llradarlistctrl.cpp
* @brief A radar-specific implementation of scrolllist
*
* $LicenseInfo:firstyear=2003&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 "llviewerprecompiledheaders.h"
#include "fsradarlistctrl.h"
#include "lllistcontextmenu.h"
#include "rlvhandler.h"
#include <boost/tokenizer.hpp>
#include "llavatarnamecache.h"
#include "llcachename.h"
#include "llfloaterreg.h"
#include "llinventory.h"
#include "llscrolllistitem.h"
#include "llscrolllistcell.h"
#include "llscrolllistcolumn.h"
#include "llsdparam.h"
#include "lltooltip.h"
#include "lltrans.h"
static LLDefaultChildRegistry::Register<LLRadarListCtrl> r("radar_list");
LLRadarListCtrl::Params::Params()
{
name = "radar_list";
}
LLRadarListCtrl::LLRadarListCtrl(const LLRadarListCtrl::Params& p)
: LLScrollListCtrl(p),
mContextMenu(NULL)
{
}
BOOL LLRadarListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
llinfos << "handleRightMouseDown" << llendl;
BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
llinfos << "handled=" << handled << llendl;
if ( mContextMenu )
// if ( (mContextMenu) && ((!mRlvCheckShowNames) || (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))) ) //TODO, handle RLV
{
llinfos << "x= " << x << llendl;
LLScrollListItem* hit_item = hitItem(x, y);
if (hit_item)
{
llinfos << "got hit item" << llendl;
LLUUID av = hit_item->getColumn(5)->getValue().asUUID();
llinfos << "av = " << av << llendl;
uuid_vec_t selected_uuids;
llinfos << "about to make selected id" << llendl;
selected_uuids.push_back(av);
llinfos << "about to show menu" << llendl;
mContextMenu->show(this, selected_uuids, x, y);
}
}
return handled;
}

View File

@ -0,0 +1,95 @@
/**
* @file fs_radarlistctr.h
* @brief A radar-specific scrolllist implementation, so we can subclass custom methods.
*
* $LicenseInfo:firstyear=2003&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 LL_LLRADARLISTCTRL_H
#define LL_LLRADARLISTCTRL_H
#include <set>
#include "llscrolllistctrl.h"
#include "lllistcontextmenu.h"
class LLRadarListCtrl
: public LLScrollListCtrl, public LLInstanceTracker<LLRadarListCtrl>
{
public:
struct Params : public LLInitParam::Block<Params, LLScrollListCtrl::Params>
{
// behavioral flags
Optional<bool> multi_select,
commit_on_keyboard_movement,
mouse_wheel_opaque;
// display flags
Optional<bool> has_border,
draw_heading,
draw_stripes,
background_visible,
scroll_bar_bg_visible;
// layout
Optional<S32> column_padding,
page_lines,
heading_height;
// sort and search behavior
Optional<S32> search_column,
sort_column;
Optional<bool> sort_ascending;
// colors
Optional<LLUIColor> fg_unselected_color,
fg_selected_color,
bg_selected_color,
fg_disable_color,
bg_writeable_color,
bg_readonly_color,
bg_stripe_color,
hovered_color,
highlighted_color,
scroll_bar_bg_color;
Optional<Contents> contents;
Optional<LLViewBorder::Params> border;
Params();
};
void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; }
BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
protected:
LLRadarListCtrl(const Params&);
friend class LLUICtrlFactory;
private:
LLListContextMenu* mContextMenu;
};
#endif