diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 734d972802..19771fc08a 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -189,6 +189,7 @@ set(viewer_SOURCE_FILES fsradarlistctrl.cpp fsradarmenu.cpp fsscriptlibrary.cpp + fsscrolllistctrl.cpp fsslurlcommand.cpp fswsassetblacklist.cpp groupchatlistener.cpp @@ -895,6 +896,7 @@ set(viewer_HEADER_FILES fsradarlistctrl.h fsradarmenu.h fsscriptlibrary.h + fsscrolllistctrl.h fsslurl.h fsslurlcommand.h fswsassetblacklist.h diff --git a/indra/newview/fsareasearchlistctrl.cpp b/indra/newview/fsareasearchlistctrl.cpp index e93c069504..ffe7fe0449 100644 --- a/indra/newview/fsareasearchlistctrl.cpp +++ b/indra/newview/fsareasearchlistctrl.cpp @@ -28,19 +28,12 @@ #include "llviewerprecompiledheaders.h" #include "fsareasearchlistctrl.h" -#include "lllistcontextmenu.h" #include "llscrolllistitem.h" static LLDefaultChildRegistry::Register r("area_search_list"); -FSAreaSearchListCtrl::Params::Params() -{ - name = "area_search_list"; -} - -FSAreaSearchListCtrl::FSAreaSearchListCtrl(const FSAreaSearchListCtrl::Params& p) -: LLScrollListCtrl(p), -mContextMenu(NULL) +FSAreaSearchListCtrl::FSAreaSearchListCtrl(const Params& p) +: FSScrollListCtrl(p) { } diff --git a/indra/newview/fsareasearchlistctrl.h b/indra/newview/fsareasearchlistctrl.h index 7215ae805d..fdbe329d49 100644 --- a/indra/newview/fsareasearchlistctrl.h +++ b/indra/newview/fsareasearchlistctrl.h @@ -28,29 +28,26 @@ #ifndef FS_AREASEARCHLISTCTRL_H #define FS_AREASEARCHLISTCTRL_H -#include "llscrolllistctrl.h" - -class LLListContextMenu; +#include "fsscrolllistctrl.h" class FSAreaSearchListCtrl - : public LLScrollListCtrl, public LLInstanceTracker + : public FSScrollListCtrl, public LLInstanceTracker { public: - struct Params : public LLInitParam::Block + struct Params : public LLInitParam::Block { - Params(); + Params() + { + name = "area_search_list"; + } }; - void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; } BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); protected: FSAreaSearchListCtrl(const Params&); friend class LLUICtrlFactory; - -private: - LLListContextMenu* mContextMenu; }; #endif // FS_AREASEARCHLISTCTRL_H diff --git a/indra/newview/fscontactsfriendsctrl.cpp b/indra/newview/fscontactsfriendsctrl.cpp index bf14de28db..f7f8880c21 100644 --- a/indra/newview/fscontactsfriendsctrl.cpp +++ b/indra/newview/fscontactsfriendsctrl.cpp @@ -28,19 +28,12 @@ #include "llviewerprecompiledheaders.h" #include "fscontactsfriendsctrl.h" -#include "lllistcontextmenu.h" #include "llscrolllistitem.h" static LLDefaultChildRegistry::Register r("friend_list"); -FSContactsFriendsCtrl::Params::Params() -{ - name = "friend_list"; -} - FSContactsFriendsCtrl::FSContactsFriendsCtrl(const Params& p) -: LLScrollListCtrl(p), -mContextMenu(NULL) +: FSScrollListCtrl(p) { } diff --git a/indra/newview/fscontactsfriendsctrl.h b/indra/newview/fscontactsfriendsctrl.h index f4d97507a9..476ce81a22 100644 --- a/indra/newview/fscontactsfriendsctrl.h +++ b/indra/newview/fscontactsfriendsctrl.h @@ -28,29 +28,26 @@ #ifndef FS_CONTACTSFRIENDSTCTRL_H #define FS_CONTACTSFRIENDSTCTRL_H -#include "llscrolllistctrl.h" - -class LLListContextMenu; +#include "fsscrolllistctrl.h" class FSContactsFriendsCtrl -: public LLScrollListCtrl, public LLInstanceTracker +: public FSScrollListCtrl, public LLInstanceTracker { public: - struct Params : public LLInitParam::Block + struct Params : public LLInitParam::Block { - Params(); + Params() + { + name = "friend_list"; + } }; - void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; } BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); protected: FSContactsFriendsCtrl(const Params&); friend class LLUICtrlFactory; - -private: - LLListContextMenu* mContextMenu; }; #endif // FS_CONTACTSFRIENDSTCTRL_H diff --git a/indra/newview/fsradarlistctrl.cpp b/indra/newview/fsradarlistctrl.cpp index 209e362058..57e1d5a9c9 100644 --- a/indra/newview/fsradarlistctrl.cpp +++ b/indra/newview/fsradarlistctrl.cpp @@ -28,20 +28,13 @@ #include "llviewerprecompiledheaders.h" #include "fsradarlistctrl.h" -#include "lllistcontextmenu.h" #include "llscrolllistitem.h" #include "rlvhandler.h" static LLDefaultChildRegistry::Register r("radar_list"); -FSRadarListCtrl::Params::Params() -{ - name = "radar_list"; -} - -FSRadarListCtrl::FSRadarListCtrl(const FSRadarListCtrl::Params& p) -: LLScrollListCtrl(p), -mContextMenu(NULL) +FSRadarListCtrl::FSRadarListCtrl(const Params& p) +: FSScrollListCtrl(p) { } diff --git a/indra/newview/fsradarlistctrl.h b/indra/newview/fsradarlistctrl.h index 1e2cf11000..a9530af583 100644 --- a/indra/newview/fsradarlistctrl.h +++ b/indra/newview/fsradarlistctrl.h @@ -28,16 +28,14 @@ #ifndef FS_RADARLISTCTRL_H #define FS_RADARLISTCTRL_H -#include "llscrolllistctrl.h" - -class LLListContextMenu; +#include "fsscrolllistctrl.h" class FSRadarListCtrl -: public LLScrollListCtrl, public LLInstanceTracker +: public FSScrollListCtrl, public LLInstanceTracker { public: - struct Params : public LLInitParam::Block + struct Params : public LLInitParam::Block { // behavioral flags Optional multi_select, @@ -77,20 +75,18 @@ public: Optional border; - Params(); + Params() + { + name = "radar_list"; + } }; - void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; } BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); protected: FSRadarListCtrl(const Params&); friend class LLUICtrlFactory; - -private: - LLListContextMenu* mContextMenu; - }; #endif // FS_RADARLISTCTRL_H diff --git a/indra/newview/fsscrolllistctrl.cpp b/indra/newview/fsscrolllistctrl.cpp new file mode 100644 index 0000000000..02f98303ae --- /dev/null +++ b/indra/newview/fsscrolllistctrl.cpp @@ -0,0 +1,50 @@ +/** + * @file fsscrolllistctrl.cpp + * @brief A Firestorm specific implementation of scrolllist + * + * $LicenseInfo:firstyear=2014&license=viewerlgpl$ + * Phoenix Firestorm Viewer Source Code + * Copyright (c) 2014 Ansariel Hiller @ Second Life + * + * 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 + * + * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA + * http://www.firestormviewer.org + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "fsscrolllistctrl.h" + +FSScrollListCtrl::FSScrollListCtrl(const Params& p) +: LLScrollListCtrl(p), + mContextMenu(NULL), + mDesiredLineHeight(p.desired_line_height) +{ +} + +void FSScrollListCtrl::refreshLineHeight() +{ + if (mDesiredLineHeight > -1) + { + setLineHeight(mDesiredLineHeight); + } + else + { + updateLineHeight(); + } + updateLayout(); +} diff --git a/indra/newview/fsscrolllistctrl.h b/indra/newview/fsscrolllistctrl.h new file mode 100644 index 0000000000..9603db4bc9 --- /dev/null +++ b/indra/newview/fsscrolllistctrl.h @@ -0,0 +1,64 @@ +/** + * @file fsscrolllistctrl.h + * @brief A Firestorm specific implementation of scrolllist + * + * $LicenseInfo:firstyear=2014&license=viewerlgpl$ + * Phoenix Firestorm Viewer Source Code + * Copyright (c) 2014 Ansariel Hiller @ Second Life + * + * 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 + * + * The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA + * http://www.firestormviewer.org + * $/LicenseInfo$ + */ + +#ifndef FS_SCROLLLISTCTRL_H +#define FS_SCROLLLISTCTRL_H + +#include "lllistcontextmenu.h" +#include "llscrolllistctrl.h" + +class LLListContextMenu; + +class FSScrollListCtrl +: public LLScrollListCtrl +{ +public: + + struct Params : public LLInitParam::Block + { + Optional desired_line_height; + + Params() + : desired_line_height("desired_line_height", -1) + { + } + }; + + void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; } + + void refreshLineHeight(); + +protected: + FSScrollListCtrl(const Params&); + friend class LLUICtrlFactory; + + LLListContextMenu* mContextMenu; + + S32 mDesiredLineHeight; +}; + +#endif // FS_SCROLLLISTCTRL_H