summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llfloaterreg.cpp2
-rw-r--r--indra/llui/lllineeditor.h2
-rw-r--r--indra/llui/llloadingindicator.cpp7
-rw-r--r--indra/llui/llloadingindicator.h4
-rw-r--r--indra/llui/llnotifications.h4
-rw-r--r--indra/llui/llnotificationtemplate.h4
-rw-r--r--indra/llui/llnotificationvisibilityrule.h2
-rw-r--r--indra/llui/llscrolllistcolumn.h4
-rw-r--r--indra/llui/llsdparam.cpp6
-rw-r--r--indra/llui/llsdparam.h4
-rw-r--r--indra/llui/lltextbase.h2
-rw-r--r--indra/llui/lltoolbar.cpp87
-rw-r--r--indra/llui/lltoolbar.h40
-rw-r--r--indra/llui/llui.cpp4
-rw-r--r--indra/llui/llui.h2
-rw-r--r--indra/llui/lluicolortable.h2
-rw-r--r--indra/llui/lluictrl.h4
-rw-r--r--indra/llui/lluictrlfactory.h6
-rw-r--r--indra/llui/llview.h16
19 files changed, 120 insertions, 82 deletions
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 8a0513f246..27e96856b3 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -483,7 +483,7 @@ void LLFloaterReg::toggleToolbarFloaterInstance(const LLSD& sdname)
{
showInstance(name, key, TRUE);
}
- else if (!instance->hasFocus())
+ else if (!instance->hasFocus() && !instance->getIsChrome())
{
instance->setFocus(TRUE);
}
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 583bde360a..2518dbe3c7 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -60,7 +60,7 @@ public:
typedef boost::function<void (LLLineEditor* caller)> keystroke_callback_t;
- struct MaxLength : public LLInitParam::Choice<MaxLength>
+ struct MaxLength : public LLInitParam::ChoiceBlock<MaxLength>
{
Alternative<S32> bytes, chars;
diff --git a/indra/llui/llloadingindicator.cpp b/indra/llui/llloadingindicator.cpp
index c4eec1835c..6ac38f5ad4 100644
--- a/indra/llui/llloadingindicator.cpp
+++ b/indra/llui/llloadingindicator.cpp
@@ -34,6 +34,7 @@
// Project includes
#include "lluictrlfactory.h"
#include "lluiimage.h"
+#include "boost/foreach.hpp"
// registered in llui.cpp to avoid being left out by MS linker
//static LLDefaultChildRegistry::Register<LLLoadingIndicator> r("loading_indicator");
@@ -51,11 +52,9 @@ LLLoadingIndicator::LLLoadingIndicator(const Params& p)
void LLLoadingIndicator::initFromParams(const Params& p)
{
- for (LLInitParam::ParamIterator<LLUIImage*>::const_iterator it = p.images().image.begin(), end_it = p.images().image.end();
- it != end_it;
- ++it)
+ BOOST_FOREACH(LLUIImage* image, p.images.image)
{
- mImages.push_back(it->getValue());
+ mImages.push_back(image);
}
// Start timer for switching images.
diff --git a/indra/llui/llloadingindicator.h b/indra/llui/llloadingindicator.h
index 7c44478848..c1f979c111 100644
--- a/indra/llui/llloadingindicator.h
+++ b/indra/llui/llloadingindicator.h
@@ -51,7 +51,7 @@ class LLLoadingIndicator
LOG_CLASS(LLLoadingIndicator);
public:
- struct Images : public LLInitParam::Block<Images>
+ struct Images : public LLInitParam::BatchBlock<Images>
{
Multiple<LLUIImage*> image;
@@ -63,7 +63,7 @@ public:
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<F32> images_per_sec;
- Batch<Images> images;
+ Optional<Images> images;
Params()
: images_per_sec("images_per_sec", 1.0f),
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 0c4d4fc897..462d69be2e 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -201,7 +201,7 @@ public:
FormInput();
};
- struct FormElement : public LLInitParam::Choice<FormElement>
+ struct FormElement : public LLInitParam::ChoiceBlock<FormElement>
{
Alternative<FormButton> button;
Alternative<FormInput> input;
@@ -312,7 +312,7 @@ public:
Optional<LLNotificationContext*> context;
Optional<void*> responder;
- struct Functor : public LLInitParam::Choice<Functor>
+ struct Functor : public LLInitParam::ChoiceBlock<Functor>
{
Alternative<std::string> name;
Alternative<LLNotificationFunctorRegistry::ResponseFunctor> function;
diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h
index ab777d37a5..fb50c9c123 100644
--- a/indra/llui/llnotificationtemplate.h
+++ b/indra/llui/llnotificationtemplate.h
@@ -91,7 +91,7 @@ struct LLNotificationTemplate
// <notification> <unique/> </notification>
// as well as
// <notification> <unique> <context></context> </unique>...
- Flag dummy_val;
+ Optional<LLInitParam::Flag> dummy_val;
public:
Multiple<UniquenessContext> contexts;
@@ -147,7 +147,7 @@ struct LLNotificationTemplate
{}
};
- struct FormRef : public LLInitParam::Choice<FormRef>
+ struct FormRef : public LLInitParam::ChoiceBlock<FormRef>
{
Alternative<LLNotificationForm::Params> form;
Alternative<TemplateRef> form_template;
diff --git a/indra/llui/llnotificationvisibilityrule.h b/indra/llui/llnotificationvisibilityrule.h
index 78bdec2a8f..78788a275c 100644
--- a/indra/llui/llnotificationvisibilityrule.h
+++ b/indra/llui/llnotificationvisibilityrule.h
@@ -59,7 +59,7 @@ struct LLNotificationVisibilityRule
{}
};
- struct Rule : public LLInitParam::Choice<Rule>
+ struct Rule : public LLInitParam::ChoiceBlock<Rule>
{
Alternative<Filter> show;
Alternative<Filter> hide;
diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h
index 12baea8e0c..b4d4a6d05e 100644
--- a/indra/llui/llscrolllistcolumn.h
+++ b/indra/llui/llscrolllistcolumn.h
@@ -95,7 +95,7 @@ public:
Optional<ESortDirection, SortNames> sort_direction;
Optional<bool> sort_ascending;
- struct Width : public LLInitParam::Choice<Width>
+ struct Width : public LLInitParam::ChoiceBlock<Width>
{
Alternative<bool> dynamic_width;
Alternative<S32> pixel_width;
@@ -112,7 +112,7 @@ public:
Optional<Width> width;
// either an image or label is used in column header
- struct Header : public LLInitParam::Choice<Header>
+ struct Header : public LLInitParam::ChoiceBlock<Header>
{
Alternative<std::string> label;
Alternative<LLUIImage*> image;
diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp
index 04919e6991..4b69360e33 100644
--- a/indra/llui/llsdparam.cpp
+++ b/indra/llui/llsdparam.cpp
@@ -45,7 +45,7 @@ LLParamSDParser::LLParamSDParser()
if (sReadFuncs.empty())
{
- registerParserFuncs<LLInitParam::NoParamValue>(readNoValue, &LLParamSDParser::writeNoValue);
+ registerParserFuncs<LLInitParam::Flag>(readFlag, &LLParamSDParser::writeFlag);
registerParserFuncs<S32>(readS32, &LLParamSDParser::writeTypedValue<S32>);
registerParserFuncs<U32>(readU32, &LLParamSDParser::writeU32Param);
registerParserFuncs<F32>(readF32, &LLParamSDParser::writeTypedValue<F32>);
@@ -72,7 +72,7 @@ bool LLParamSDParser::writeU32Param(LLParamSDParser::parser_t& parser, const voi
return true;
}
-bool LLParamSDParser::writeNoValue(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack)
+bool LLParamSDParser::writeFlag(LLParamSDParser::parser_t& parser, const void* val_ptr, const parser_t::name_stack_t& name_stack)
{
LLParamSDParser& sdparser = static_cast<LLParamSDParser&>(parser);
if (!sdparser.mWriteRootSD) return false;
@@ -226,7 +226,7 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack)
return sd_to_write;
}
-bool LLParamSDParser::readNoValue(Parser& parser, void* val_ptr)
+bool LLParamSDParser::readFlag(Parser& parser, void* val_ptr)
{
LLParamSDParser& self = static_cast<LLParamSDParser&>(parser);
return self.mCurReadSD == &NO_VALUE_MARKER;
diff --git a/indra/llui/llsdparam.h b/indra/llui/llsdparam.h
index f776c781b3..a371c28f68 100644
--- a/indra/llui/llsdparam.h
+++ b/indra/llui/llsdparam.h
@@ -63,9 +63,9 @@ private:
LLSD* getSDWriteNode(const parser_t::name_stack_t& name_stack);
static bool writeU32Param(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack);
- static bool writeNoValue(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack);
+ static bool writeFlag(Parser& parser, const void* value_ptr, const parser_t::name_stack_t& name_stack);
- static bool readNoValue(Parser& parser, void* val_ptr);
+ static bool readFlag(Parser& parser, void* val_ptr);
static bool readS32(Parser& parser, void* val_ptr);
static bool readU32(Parser& parser, void* val_ptr);
static bool readF32(Parser& parser, void* val_ptr);
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 7d545a1ba6..384d9116fc 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -237,7 +237,7 @@ public:
friend class LLNormalTextSegment;
friend class LLUICtrlFactory;
- struct LineSpacingParams : public LLInitParam::Choice<LineSpacingParams>
+ struct LineSpacingParams : public LLInitParam::ChoiceBlock<LineSpacingParams>
{
Alternative<F32> multiple;
Alternative<S32> pixels;
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 5300de38a0..762e738264 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -81,9 +81,6 @@ LLToolBar::Params::Params()
button_icon_and_text("button_icon_and_text"),
read_only("read_only", false),
wrap("wrap", true),
- min_button_width("min_button_width", 0),
- max_button_width("max_button_width", S32_MAX),
- button_height("button_height"),
pad_left("pad_left"),
pad_top("pad_top"),
pad_right("pad_right"),
@@ -101,9 +98,6 @@ LLToolBar::LLToolBar(const LLToolBar::Params& p)
mNeedsLayout(false),
mButtonPanel(NULL),
mCenteringStack(NULL),
- mMinButtonWidth(llmin(p.min_button_width(), p.max_button_width())),
- mMaxButtonWidth(llmax(p.max_button_width(), p.min_button_width())),
- mButtonHeight(p.button_height),
mPadLeft(p.pad_left),
mPadRight(p.pad_right),
mPadTop(p.pad_top),
@@ -202,16 +196,16 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)
bool LLToolBar::addCommand(const LLCommandId& commandId)
{
LLCommand * command = LLCommandManager::instance().getCommand(commandId);
+ if (!command) return false;
- bool add_command = (command != NULL);
-
- if (add_command)
- {
mButtonCommands.push_back(commandId);
- createButton(commandId);
- }
+ LLToolBarButton* button = createButton(commandId);
+ mButtons.push_back(button);
+ mButtonPanel->addChild(button);
+ mButtonMap.insert(std::make_pair(commandId, button));
+ mNeedsLayout = true;
- return add_command;
+ return true;
}
void LLToolBar::clearCommandsList()
@@ -224,21 +218,13 @@ void LLToolBar::clearCommandsList()
bool LLToolBar::hasCommand(const LLCommandId& commandId) const
{
- bool has_command = false;
-
if (commandId != LLCommandId::null)
{
- BOOST_FOREACH(LLCommandId cmd, mButtonCommands)
- {
- if (cmd == commandId)
- {
- has_command = true;
- break;
- }
- }
+ command_id_map::const_iterator it = mButtonMap.find(commandId);
+ return (it != mButtonMap.end());
}
- return has_command;
+ return false;
}
bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled)
@@ -247,11 +233,10 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled)
if (commandId != LLCommandId::null)
{
- command_button = mButtonPanel->findChild<LLButton>(commandId.name());
-
- if (command_button)
+ command_id_map::iterator it = mButtonMap.find(commandId);
+ if (it != mButtonMap.end())
{
- command_button->setEnabled(enabled);
+ it->second->setEnabled(enabled);
}
}
@@ -320,7 +305,7 @@ void LLToolBar::setButtonType(LLToolBarEnums::ButtonType button_type)
bool regenerate_buttons = (mButtonType != button_type);
mButtonType = button_type;
-
+
if (regenerate_buttons)
{
createButtons();
@@ -334,7 +319,7 @@ void LLToolBar::resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row
{
if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL)
{
- button->reshape(llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth), max_row_girth);
+ button->reshape(llclamp(button->getRect().getWidth(), button->mMinWidth, button->mMaxWidth), max_row_girth);
}
else // VERTICAL
{
@@ -393,10 +378,10 @@ void LLToolBar::updateLayoutAsNeeded()
BOOST_FOREACH(LLToolBarButton* button, mButtons)
{
- button->reshape(mMinButtonWidth, mButtonHeight);
+ button->reshape(button->mMinWidth, button->mDesiredHeight);
button->autoResize();
- S32 button_clamped_width = llclamp(button->getRect().getWidth(), mMinButtonWidth, mMaxButtonWidth);
+ S32 button_clamped_width = llclamp(button->getRect().getWidth(), button->mMinWidth, button->mMaxWidth);
S32 button_length = (orientation == LLLayoutStack::HORIZONTAL)
? button_clamped_width
: button->getRect().getHeight();
@@ -411,7 +396,7 @@ void LLToolBar::updateLayoutAsNeeded()
{
if (orientation == LLLayoutStack::VERTICAL)
{ // row girth (width in this case) is clamped to allowable button widths
- max_row_girth = llclamp(max_row_girth, mMinButtonWidth, mMaxButtonWidth);
+ max_row_girth = llclamp(max_row_girth, button->mMinWidth, button->mMaxWidth);
}
// make buttons in current row all same girth
@@ -512,14 +497,19 @@ void LLToolBar::createButtons()
BOOST_FOREACH(LLCommandId& command_id, mButtonCommands)
{
- createButton(command_id);
+ LLToolBarButton* button = createButton(command_id);
+ mButtons.push_back(button);
+ mButtonPanel->addChild(button);
+ mButtonMap.insert(std::make_pair(command_id, button));
}
+ mNeedsLayout = true;
+
}
-void LLToolBar::createButton(const LLCommandId& id)
+LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
{
LLCommand* commandp = LLCommandManager::instance().getCommand(id);
- if (!commandp) return;
+ if (!commandp) return NULL;
LLToolBarButton::Params button_p;
button_p.name = id.name();
@@ -539,10 +529,9 @@ void LLToolBar::createButton(const LLCommandId& id)
button->setHandleDragCallback(mHandleDragItemCallback);
}
- mButtons.push_back(button);
- mButtonPanel->addChild(button);
+ button->setCommandId(id);
+ return button;
- mNeedsLayout = true;
}
BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
@@ -570,11 +559,25 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
return handled;
}
-LLToolBarButton::LLToolBarButton(const Params& p) : LLButton(p)
+LLToolBarButton::LLToolBarButton(const Params& p)
+: LLButton(p),
+ mMouseDownX(0),
+ mMouseDownY(0),
+ mMinWidth(p.min_button_width),
+ mMaxWidth(p.max_button_width),
+ mDesiredHeight(p.desired_height),
+ mId("")
{
mUUID = LLUUID::LLUUID::generateNewID(p.name);
}
+BOOL LLToolBarButton::handleMouseDown(S32 x, S32 y, MASK mask)
+{
+ mMouseDownX = x;
+ mMouseDownY = y;
+ return LLButton::handleMouseDown(x, y, mask);
+}
+
BOOL LLToolBarButton::handleHover( S32 x, S32 y, MASK mask )
{
// llinfos << "Merov debug: handleHover, x = " << x << ", y = " << y << ", mouse = " << hasMouseCapture() << llendl;
@@ -593,6 +596,10 @@ BOOL LLToolBarButton::handleHover( S32 x, S32 y, MASK mask )
handled = mHandleDragItemCallback(x,y,mUUID,LLAssetType::AT_WIDGET);
}
}
+ else
+ {
+ handled = LLButton::handleHover(x, y, mask);
+ }
return handled;
}
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 6dcf620861..10e5f49c0f 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -41,18 +41,37 @@ typedef boost::function<BOOL (EDragAndDropType type, void* data, const LLUUID& u
class LLToolBarButton : public LLButton
{
+ friend class LLToolBar;
public:
struct Params : public LLInitParam::Block<Params, LLButton::Params>
{
+ Optional<S32> min_button_width,
+ max_button_width,
+ desired_height;
+
+ Params()
+ : min_button_width("min_button_width", 0),
+ max_button_width("max_button_width", S32_MAX),
+ desired_height("desired_height", 20)
+ {}
+
};
LLToolBarButton(const Params& p);
- virtual BOOL handleHover( S32 x, S32 y, MASK mask );
-
+ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ BOOL handleHover(S32 x, S32 y, MASK mask);
+ void setCommandId(const LLCommandId& id) { mId = id; }
+
void setStartDragCallback(startdrag_callback_t cb) { mStartDragItemCallback = cb; }
void setHandleDragCallback(handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
-protected:
+private:
+ LLCommandId mId;
+ S32 mMouseDownX;
+ S32 mMouseDownY;
+ S32 mMinWidth;
+ S32 mMaxWidth;
+ S32 mDesiredHeight;
bool mIsDragged;
startdrag_callback_t mStartDragItemCallback;
handledrag_callback_t mHandleDragItemCallback;
@@ -111,10 +130,6 @@ public:
Optional<bool> read_only,
wrap;
- Optional<S32> min_button_width,
- max_button_width,
- button_height;
-
Optional<S32> pad_left,
pad_top,
pad_right,
@@ -145,6 +160,8 @@ public:
void setHandleDragCallback(handledrag_callback_t cb) { mHandleDragItemCallback = cb; }
void setHandleDropCallback(handledrop_callback_t cb) { mHandleDropCallback = cb; }
+ LLToolBarButton* createButton(const LLCommandId& id);
+
protected:
friend class LLUICtrlFactory;
LLToolBar(const Params&);
@@ -167,7 +184,6 @@ private:
void createContextMenu();
void updateLayoutAsNeeded();
void createButtons();
- void createButton(const LLCommandId& id);
void resizeButtonsInRow(std::vector<LLToolBarButton*>& buttons_in_row, S32 max_row_girth);
BOOL isSettingChecked(const LLSD& userdata);
void onSettingEnable(const LLSD& userdata);
@@ -177,6 +193,9 @@ private:
std::list<LLToolBarButton*> mButtons;
command_id_list_t mButtonCommands;
+ typedef std::map<LLCommandId, LLToolBarButton*> command_id_map;
+ command_id_map mButtonMap;
+
LLToolBarEnums::ButtonType mButtonType;
LLLayoutStack* mCenteringStack;
LLLayoutStack* mWrapStack;
@@ -185,10 +204,7 @@ private:
bool mWrap;
bool mNeedsLayout;
- S32 mMinButtonWidth,
- mMaxButtonWidth,
- mButtonHeight,
- mPadLeft,
+ S32 mPadLeft,
mPadRight,
mPadTop,
mPadBottom,
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 4f129ccfba..76a12e649b 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -2107,7 +2107,7 @@ namespace LLInitParam
void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateValueFromBlock()
{
- if (control.isProvided())
+ if (control.isProvided() && !control().empty())
{
updateValue(LLUIColorTable::instance().getColor(control));
}
@@ -2264,9 +2264,11 @@ namespace LLInitParam
// in this case, that is left+width and bottom+height
LLRect& value = getValue();
+ right.set(value.mRight, false);
left.set(value.mLeft, make_block_authoritative);
width.set(value.getWidth(), make_block_authoritative);
+ top.set(value.mTop, false);
bottom.set(value.mBottom, make_block_authoritative);
height.set(value.getHeight(), make_block_authoritative);
}
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 7801a01ace..3afb7c65a9 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -365,7 +365,7 @@ template <typename T> LLRegisterWith<LLInitClassList> LLInitClass<T>::sRegister(
template <typename T> LLRegisterWith<LLDestroyClassList> LLDestroyClass<T>::sRegister(&T::destroyClass);
// useful parameter blocks
-struct TimeIntervalParam : public LLInitParam::Choice<TimeIntervalParam>
+struct TimeIntervalParam : public LLInitParam::ChoiceBlock<TimeIntervalParam>
{
Alternative<F32> seconds;
Alternative<S32> frames;
diff --git a/indra/llui/lluicolortable.h b/indra/llui/lluicolortable.h
index 76518789ec..6a7a681d57 100644
--- a/indra/llui/lluicolortable.h
+++ b/indra/llui/lluicolortable.h
@@ -44,7 +44,7 @@ LOG_CLASS(LLUIColorTable);
typedef std::map<std::string, LLUIColor> string_color_map_t;
public:
- struct ColorParams : LLInitParam::Choice<ColorParams>
+ struct ColorParams : LLInitParam::ChoiceBlock<ColorParams>
{
Alternative<LLColor4> value;
Alternative<std::string> reference;
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index fc56e5fc35..a8a4e3191d 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -76,14 +76,14 @@ public:
Optional<enable_callback_t> function;
};
- struct EnableControls : public LLInitParam::Choice<EnableControls>
+ struct EnableControls : public LLInitParam::ChoiceBlock<EnableControls>
{
Alternative<std::string> enabled;
Alternative<std::string> disabled;
EnableControls();
};
- struct ControlVisibility : public LLInitParam::Choice<ControlVisibility>
+ struct ControlVisibility : public LLInitParam::ChoiceBlock<ControlVisibility>
{
Alternative<std::string> visible;
Alternative<std::string> invisible;
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 71c38237c1..d612ad5005 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -125,12 +125,12 @@ private:
// base case for recursion, there are NO base classes of LLInitParam::BaseBlock
template<int DUMMY>
- class ParamDefaults<LLInitParam::BaseBlockWithFlags, DUMMY> : public LLSingleton<ParamDefaults<LLInitParam::BaseBlockWithFlags, DUMMY> >
+ class ParamDefaults<LLInitParam::BaseBlock, DUMMY> : public LLSingleton<ParamDefaults<LLInitParam::BaseBlock, DUMMY> >
{
public:
- const LLInitParam::BaseBlockWithFlags& get() { return mBaseBlock; }
+ const LLInitParam::BaseBlock& get() { return mBaseBlock; }
private:
- LLInitParam::BaseBlockWithFlags mBaseBlock;
+ LLInitParam::BaseBlock mBaseBlock;
};
public:
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 9039366e7e..a1c46f3bf3 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -98,7 +98,7 @@ private:
class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement
{
public:
- struct Follows : public LLInitParam::Choice<Follows>
+ struct Follows : public LLInitParam::ChoiceBlock<Follows>
{
Alternative<std::string> string;
Alternative<U32> flags;
@@ -465,6 +465,20 @@ public:
return dynamic_cast<T*>(widgetp);
}
+ template <class T> T* getParentByType() const
+ {
+ LLView* parent = getParent();
+ while(parent)
+ {
+ if (dynamic_cast<T*>(parent))
+ {
+ return static_cast<T*>(parent);
+ }
+ parent = parent->getParent();
+ }
+ return NULL;
+ }
+
//////////////////////////////////////////////
// statics
//////////////////////////////////////////////