summaryrefslogtreecommitdiff
path: root/indra/newview/llnavigationbar.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-12-08 15:20:41 -0800
committerJames Cook <james@lindenlab.com>2009-12-08 15:20:41 -0800
commit0bfee2e4e064d25f902934a7fed48eb06aa236ba (patch)
tree7d9c317b76f2b849c33ad2e8a86e1e866da3d0ed /indra/newview/llnavigationbar.cpp
parent4b2e892c59ccba1ef607bff9c61765d5d2c160a3 (diff)
EXT-2980 Made location history menu items XML-configurable
Reviewed with Leyla
Diffstat (limited to 'indra/newview/llnavigationbar.cpp')
-rw-r--r--indra/newview/llnavigationbar.cpp46
1 files changed, 33 insertions, 13 deletions
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index e65b7d8a0c..9797c01371 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -82,9 +82,24 @@ public:
struct Params : public LLInitParam::Block<Params, LLMenuItemCallGL::Params>
{
- Mandatory<EType> item_type;
-
- Params() {}
+ Mandatory<EType> item_type;
+ Optional<const LLFontGL*> back_item_font,
+ current_item_font,
+ forward_item_font;
+ Optional<std::string> back_item_image,
+ forward_item_image;
+ Optional<S32> image_hpad,
+ image_vpad;
+ Params()
+ : item_type(),
+ back_item_font("back_item_font"),
+ current_item_font("current_item_font"),
+ forward_item_font("forward_item_font"),
+ back_item_image("back_item_image"),
+ forward_item_image("forward_item_image"),
+ image_hpad("image_hpad"),
+ image_vpad("image_vpad")
+ {}
};
/*virtual*/ void draw();
@@ -97,33 +112,38 @@ private:
static const S32 ICON_WIDTH = 16;
static const S32 ICON_HEIGHT = 16;
- static const std::string ICON_IMG_BACKWARD;
- static const std::string ICON_IMG_FORWARD;
LLIconCtrl* mArrowIcon;
};
-const std::string LLTeleportHistoryMenuItem::ICON_IMG_BACKWARD("teleport_history_backward.tga");
-const std::string LLTeleportHistoryMenuItem::ICON_IMG_FORWARD("teleport_history_forward.tga");
+static LLDefaultChildRegistry::Register<LLTeleportHistoryMenuItem> r("teleport_history_menu_item");
+
LLTeleportHistoryMenuItem::LLTeleportHistoryMenuItem(const Params& p)
: LLMenuItemCallGL(p),
mArrowIcon(NULL)
{
// Set appearance depending on the item type.
- if (p.item_type == TYPE_CURRENT)
+ if (p.item_type == TYPE_BACKWARD)
+ {
+ setFont( p.back_item_font );
+ setLabel(std::string(" ") + std::string(p.label));
+ }
+ else if (p.item_type == TYPE_CURRENT)
{
- setFont(LLFontGL::getFontSansSerifBold());
+ setFont( p.current_item_font );
}
else
{
- setFont(LLFontGL::getFontSansSerif());
+ setFont( p.forward_item_font );
setLabel(std::string(" ") + std::string(p.label));
}
LLIconCtrl::Params icon_params;
icon_params.name("icon");
- icon_params.rect(LLRect(0, ICON_HEIGHT, ICON_WIDTH, 0));
+ LLRect rect(0, ICON_HEIGHT, ICON_WIDTH, 0);
+ rect.translate( p.image_hpad, p.image_vpad );
+ icon_params.rect( rect );
icon_params.mouse_opaque(false);
icon_params.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP);
icon_params.visible(false);
@@ -132,9 +152,9 @@ LLTeleportHistoryMenuItem::LLTeleportHistoryMenuItem(const Params& p)
// no image for the current item
if (p.item_type == TYPE_BACKWARD)
- mArrowIcon->setValue(ICON_IMG_BACKWARD);
+ mArrowIcon->setValue( p.back_item_image() );
else if (p.item_type == TYPE_FORWARD)
- mArrowIcon->setValue(ICON_IMG_FORWARD);
+ mArrowIcon->setValue( p.forward_item_image() );
addChild(mArrowIcon);
}