From 5062b2e73f5c5b8765ad383b31e8a4a13969f73e Mon Sep 17 00:00:00 2001 From: Arrehn Date: Tue, 31 May 2011 13:43:57 -0400 Subject: [PATCH] Radar Improvements - New files to support scrolllistctrl style radar --- indra/newview/CMakeLists.txt | 2 + indra/newview/fsradarlistctrl.cpp | 85 +++++++++++++++++++++++++++ indra/newview/fsradarlistctrl.h | 95 +++++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+) create mode 100644 indra/newview/fsradarlistctrl.cpp create mode 100644 indra/newview/fsradarlistctrl.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a6b75099bd..d1daed669b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -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 diff --git a/indra/newview/fsradarlistctrl.cpp b/indra/newview/fsradarlistctrl.cpp new file mode 100644 index 0000000000..1e3736867c --- /dev/null +++ b/indra/newview/fsradarlistctrl.cpp @@ -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 + +#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 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; +} diff --git a/indra/newview/fsradarlistctrl.h b/indra/newview/fsradarlistctrl.h new file mode 100644 index 0000000000..1b023678fb --- /dev/null +++ b/indra/newview/fsradarlistctrl.h @@ -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 +#include "llscrolllistctrl.h" +#include "lllistcontextmenu.h" + +class LLRadarListCtrl +: public LLScrollListCtrl, public LLInstanceTracker +{ +public: + + struct Params : public LLInitParam::Block + { + // behavioral flags + Optional multi_select, + commit_on_keyboard_movement, + mouse_wheel_opaque; + + // display flags + Optional has_border, + draw_heading, + draw_stripes, + background_visible, + scroll_bar_bg_visible; + + // layout + Optional column_padding, + page_lines, + heading_height; + + // sort and search behavior + Optional search_column, + sort_column; + Optional sort_ascending; + + // colors + Optional 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; + + Optional 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