Introduce FSScrollListCtrl as base class for the Firestorm-specific scroll list controls

Ansariel 2014-09-03 12:54:56 +02:00
parent c7240ae02f
commit 6c22affa8e
9 changed files with 142 additions and 57 deletions

View File

@ -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

View File

@ -28,19 +28,12 @@
#include "llviewerprecompiledheaders.h"
#include "fsareasearchlistctrl.h"
#include "lllistcontextmenu.h"
#include "llscrolllistitem.h"
static LLDefaultChildRegistry::Register<FSAreaSearchListCtrl> 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)
{
}

View File

@ -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<FSAreaSearchListCtrl>
: public FSScrollListCtrl, public LLInstanceTracker<FSAreaSearchListCtrl>
{
public:
struct Params : public LLInitParam::Block<Params, LLScrollListCtrl::Params>
struct Params : public LLInitParam::Block<Params, FSScrollListCtrl::Params>
{
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

View File

@ -28,19 +28,12 @@
#include "llviewerprecompiledheaders.h"
#include "fscontactsfriendsctrl.h"
#include "lllistcontextmenu.h"
#include "llscrolllistitem.h"
static LLDefaultChildRegistry::Register<FSContactsFriendsCtrl> r("friend_list");
FSContactsFriendsCtrl::Params::Params()
{
name = "friend_list";
}
FSContactsFriendsCtrl::FSContactsFriendsCtrl(const Params& p)
: LLScrollListCtrl(p),
mContextMenu(NULL)
: FSScrollListCtrl(p)
{
}

View File

@ -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<FSContactsFriendsCtrl>
: public FSScrollListCtrl, public LLInstanceTracker<FSContactsFriendsCtrl>
{
public:
struct Params : public LLInitParam::Block<Params, LLScrollListCtrl::Params>
struct Params : public LLInitParam::Block<Params, FSScrollListCtrl::Params>
{
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

View File

@ -28,20 +28,13 @@
#include "llviewerprecompiledheaders.h"
#include "fsradarlistctrl.h"
#include "lllistcontextmenu.h"
#include "llscrolllistitem.h"
#include "rlvhandler.h"
static LLDefaultChildRegistry::Register<FSRadarListCtrl> 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)
{
}

View File

@ -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<FSRadarListCtrl>
: public FSScrollListCtrl, public LLInstanceTracker<FSRadarListCtrl>
{
public:
struct Params : public LLInitParam::Block<Params, LLScrollListCtrl::Params>
struct Params : public LLInitParam::Block<Params, FSScrollListCtrl::Params>
{
// behavioral flags
Optional<bool> multi_select,
@ -77,20 +75,18 @@ public:
Optional<LLViewBorder::Params> 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

View File

@ -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();
}

View File

@ -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<Params, LLScrollListCtrl::Params>
{
Optional<S32> 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