summaryrefslogtreecommitdiff
path: root/indra/llui/llcombobox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llcombobox.cpp')
-rw-r--r--indra/llui/llcombobox.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 51ab3326fe..51f9d6bd18 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -33,8 +33,6 @@
// A control that displays the name of the chosen item, which when
// clicked shows a scrolling box of options.
-#define INSTANTIATE_GETCHILD_COMBOBOX
-
#include "linden_common.h"
// file includes
@@ -63,9 +61,7 @@ S32 LLCOMBOBOX_HEIGHT = 0;
S32 LLCOMBOBOX_WIDTH = 0;
S32 MAX_COMBO_WIDTH = 500;
-template LLComboBox* LLView::getChild<LLComboBox>( const std::string& name, BOOL recurse, BOOL create_if_missing ) const;
-
-static LLDefaultWidgetRegistry::Register<LLComboBox> register_combo_box("combo_box");
+static LLDefaultChildRegistry::Register<LLComboBox> register_combo_box("combo_box");
void LLComboBox::PreferredPositionValues::declareValues()
{
@@ -83,12 +79,12 @@ LLComboBox::Params::Params()
: allow_text_entry("allow_text_entry", false),
show_text_as_tentative("show_text_as_tentative", true),
max_chars("max_chars", 20),
- arrow_image("arrow_image"),
list_position("list_position", BELOW),
items("item"),
combo_button("combo_button"),
combo_list("combo_list"),
- combo_editor("combo_editor")
+ combo_editor("combo_editor"),
+ drop_down_button("drop_down_button")
{
addSynonym(items, "combo_item");
}
@@ -104,19 +100,29 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
mSelectionCallback(p.selection_callback()),
- mArrowImage(p.arrow_image),
mListPosition(p.list_position)
{
// Text label button
- LLButton::Params button_params = p.combo_button;
+ LLButton::Params button_params = (mAllowTextEntry ? p.combo_button : p.drop_down_button);
button_params.mouse_down_callback.function(boost::bind(&LLComboBox::onButtonDown, this));
button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT);
button_params.rect(p.rect);
- button_params.pad_right(2);
+
+ if(mAllowTextEntry)
+ {
+ button_params.pad_right(2);
+ }
+
+ mArrowImage = button_params.image_unselected;
mButton = LLUICtrlFactory::create<LLButton>(button_params);
- mButton->setRightHPad(2); //redo to compensate for button hack that leaves space for a character
+ if(mAllowTextEntry)
+ {
+ //redo to compensate for button hack that leaves space for a character
+ //unless it is a "minimal combobox"(drop down)
+ mButton->setRightHPad(2);
+ }
addChild(mButton);
LLScrollListCtrl::Params params = p.combo_list;
@@ -135,7 +141,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
LLScrollListItem::Params item_params = *it;
if (it->label.isProvided())
{
- item_params.cells.add().value(it->label());
+ item_params.columns.add().value(it->label());
}
mList->addRow(item_params);
@@ -732,12 +738,7 @@ BOOL LLComboBox::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_re
msg = tool_tip;
// Convert rect local to screen coordinates
- localPointToScreen(
- 0, 0,
- &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
- localPointToScreen(
- getRect().getWidth(), getRect().getHeight(),
- &(sticky_rect_screen->mRight), &(sticky_rect_screen->mTop) );
+ *sticky_rect_screen = calcScreenRect();
}
return TRUE;
}