diff options
Diffstat (limited to 'indra/llui')
45 files changed, 685 insertions, 622 deletions
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index b3b2f4ae56..0ab883cb70 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -112,6 +112,7 @@ set(llui_SOURCE_FILES llurlmatch.cpp llurlregistry.cpp llviewborder.cpp + llviewinject.cpp llviewmodel.cpp llview.cpp llviewquery.cpp @@ -216,6 +217,7 @@ set(llui_HEADER_FILES llurlmatch.h llurlregistry.h llviewborder.h + llviewinject.h llviewmodel.h llview.h llviewquery.h diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 6afe276379..4b0b7c561d 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -339,7 +339,7 @@ LLAccordionCtrlTab::Params::Params() ,fit_panel("fit_panel",true) ,selection_enabled("selection_enabled", false) { - mouse_opaque(false); + changeDefault(mouse_opaque, false); } LLAccordionCtrlTab::LLAccordionCtrlTab(const LLAccordionCtrlTab::Params&p) diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index fde3c53a65..8ede4e3468 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -27,11 +27,14 @@ #define LLBADGE_CPP #include "llbadge.h" +#include "llscrollcontainer.h" #include "lluictrlfactory.h" static LLDefaultChildRegistry::Register<LLBadge> r("badge"); +static const S32 BADGE_OFFSET_NOT_SPECIFIED = 0x7FFFFFFF; + // Compiler optimization, generate extern template template class LLBadge* LLView::getChild<class LLBadge>(const std::string& name, BOOL recurse) const; @@ -46,14 +49,13 @@ LLBadge::Params::Params() , label_offset_horiz("label_offset_horiz") , label_offset_vert("label_offset_vert") , location("location", LLRelPos::TOP_LEFT) + , location_offset_hcenter("location_offset_hcenter") + , location_offset_vcenter("location_offset_vcenter") , location_percent_hcenter("location_percent_hcenter") , location_percent_vcenter("location_percent_vcenter") , padding_horiz("padding_horiz") , padding_vert("padding_vert") -{ - // We set a name here so the name isn't necessary in any xml files that use badges - name = "badge"; -} +{} bool LLBadge::Params::equals(const Params& a) const { @@ -70,6 +72,8 @@ bool LLBadge::Params::equals(const Params& a) const comp &= (label_offset_horiz() == a.label_offset_horiz()); comp &= (label_offset_vert() == a.label_offset_vert()); comp &= (location() == a.location()); + comp &= (location_offset_hcenter() == a.location_offset_hcenter()); + comp &= (location_offset_vcenter() == a.location_offset_vcenter()); comp &= (location_percent_hcenter() == a.location_percent_hcenter()); comp &= (location_percent_vcenter() == a.location_percent_vcenter()); comp &= (padding_horiz() == a.padding_horiz()); @@ -91,16 +95,29 @@ LLBadge::LLBadge(const LLBadge::Params& p) , mLabelOffsetHoriz(p.label_offset_horiz) , mLabelOffsetVert(p.label_offset_vert) , mLocation(p.location) + , mLocationOffsetHCenter(BADGE_OFFSET_NOT_SPECIFIED) + , mLocationOffsetVCenter(BADGE_OFFSET_NOT_SPECIFIED) , mLocationPercentHCenter(0.5f) , mLocationPercentVCenter(0.5f) , mPaddingHoriz(p.padding_horiz) , mPaddingVert(p.padding_vert) + , mParentScroller(NULL) { if (mImage.isNull()) { llwarns << "Badge: " << getName() << " with no image!" << llendl; } + if (p.location_offset_hcenter.isProvided()) + { + mLocationOffsetHCenter = p.location_offset_hcenter(); + } + + if (p.location_offset_vcenter.isProvided()) + { + mLocationOffsetVCenter = p.location_offset_vcenter(); + } + // // The following logic is to set the mLocationPercentHCenter and mLocationPercentVCenter // based on the Location enum and our horizontal and vertical location percentages. The @@ -144,6 +161,15 @@ bool LLBadge::addToView(LLView * view) if (child_added) { setShape(view->getLocalRect()); + + // Find a parent scroll container, if there is one in case we need it for positioning + + LLView * parent = mOwner.get(); + + while ((parent != NULL) && ((mParentScroller = dynamic_cast<LLScrollContainer *>(parent)) == NULL)) + { + parent = parent->getParent(); + } } return child_added; @@ -201,21 +227,11 @@ void LLBadge::draw() if (owner_view) { // - // Calculate badge position based on owner - // - - LLRect owner_rect; - owner_view->localRectToOtherView(owner_view->getLocalRect(), & owner_rect, this); - - F32 badge_center_x = owner_rect.mLeft + owner_rect.getWidth() * mLocationPercentHCenter; - F32 badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; - - // // Calculate badge size based on label text // LLWString badge_label_wstring = mLabel; - + S32 badge_label_begin_offset = 0; S32 badge_char_length = S32_MAX; S32 badge_pixel_length = S32_MAX; @@ -228,6 +244,77 @@ void LLBadge::draw() F32 badge_height = (2.0f * mPaddingVert) + mGLFont->getLineHeight(); // + // Calculate badge position based on owner + // + + LLRect owner_rect; + owner_view->localRectToOtherView(owner_view->getLocalRect(), & owner_rect, this); + + S32 location_offset_horiz = mLocationOffsetHCenter; + S32 location_offset_vert = mLocationOffsetVCenter; + + // If we're in a scroll container, do some math to keep us in the same place on screen if applicable + if (mParentScroller != NULL) + { + LLRect visibleRect = mParentScroller->getVisibleContentRect(); + + if (mLocationOffsetHCenter != BADGE_OFFSET_NOT_SPECIFIED) + { + if (LLRelPos::IsRight(mLocation)) + { + location_offset_horiz += visibleRect.mRight; + } + else if (LLRelPos::IsLeft(mLocation)) + { + location_offset_horiz += visibleRect.mLeft; + } + else // center + { + location_offset_horiz += (visibleRect.mLeft + visibleRect.mRight) / 2; + } + } + + if (mLocationOffsetVCenter != BADGE_OFFSET_NOT_SPECIFIED) + { + if (LLRelPos::IsTop(mLocation)) + { + location_offset_vert += visibleRect.mTop; + } + else if (LLRelPos::IsBottom(mLocation)) + { + location_offset_vert += visibleRect.mBottom; + } + else // center + { + location_offset_vert += (visibleRect.mBottom + visibleRect.mTop) / 2; + } + } + } + + F32 badge_center_x; + F32 badge_center_y; + + // Compute x position + if (mLocationOffsetHCenter == BADGE_OFFSET_NOT_SPECIFIED) + { + badge_center_x = owner_rect.mLeft + owner_rect.getWidth() * mLocationPercentHCenter; + } + else + { + badge_center_x = location_offset_horiz; + } + + // Compute y position + if (mLocationOffsetVCenter == BADGE_OFFSET_NOT_SPECIFIED) + { + badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; + } + else + { + badge_center_y = location_offset_vert; + } + + // // Draw button image, if available. // Otherwise draw basic rectangular button. // diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index f81ccdf0cd..4b21a71aaa 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -39,8 +39,9 @@ // Declarations // -class LLUICtrlFactory; class LLFontGL; +class LLScrollContainer; +class LLUICtrlFactory; // // Relative Position Alignment @@ -108,6 +109,8 @@ public: Optional< S32 > label_offset_vert; Optional< LLRelPos::Location > location; + Optional< S32 > location_offset_hcenter; + Optional< S32 > location_offset_vcenter; Optional< U32 > location_percent_hcenter; Optional< U32 > location_percent_vcenter; @@ -150,6 +153,8 @@ private: S32 mLabelOffsetVert; LLRelPos::Location mLocation; + S32 mLocationOffsetHCenter; + S32 mLocationOffsetVCenter; F32 mLocationPercentHCenter; F32 mLocationPercentVCenter; @@ -157,6 +162,8 @@ private: F32 mPaddingHoriz; F32 mPaddingVert; + + LLScrollContainer* mParentScroller; }; // Build time optimization, generate once in .cpp file diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 7b015bd576..2459429f6e 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -101,11 +101,11 @@ LLButton::Params::Params() commit_on_return("commit_on_return", true), use_draw_context_alpha("use_draw_context_alpha", true), badge("badge"), - handle_right_mouse("handle_right_mouse") + handle_right_mouse("handle_right_mouse"), + held_down_delay("held_down_delay") { addSynonym(is_toggle, "toggle"); - held_down_delay.seconds = 0.5f; - initial_value.set(LLSD(false), false); + changeDefault(initial_value, LLSD(false)); } diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h index bb8ea50bed..f32f1dd74c 100644 --- a/indra/llui/llconsole.h +++ b/indra/llui/llconsole.h @@ -54,7 +54,7 @@ public: persist_time("persist_time", 0.f), // forever font_size_index("font_size_index") { - mouse_opaque(false); + changeDefault(mouse_opaque, false); } }; protected: diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h index 7d3d5cf787..e81600fd6c 100644 --- a/indra/llui/llcontainerview.h +++ b/indra/llui/llcontainerview.h @@ -50,7 +50,7 @@ public: show_label("show_label", FALSE), display_children("display_children", TRUE) { - mouse_opaque(false); + changeDefault(mouse_opaque, false); } }; diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index 7c56475e75..e095e577b1 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -51,8 +51,8 @@ public: drag_highlight_color("drag_highlight_color", LLUIColorTable::instance().getColor("DefaultHighlightLight")), drag_shadow_color("drag_shadow_color", LLUIColorTable::instance().getColor("DefaultShadowDark")) { - mouse_opaque(true); - follows.flags(FOLLOWS_ALL); + changeDefault(mouse_opaque, true); + changeDefault(follows.flags, FOLLOWS_ALL); } }; void initFromParams(const Params&); diff --git a/indra/llui/llfiltereditor.h b/indra/llui/llfiltereditor.h index 710699fdc1..3a05bc05a1 100644 --- a/indra/llui/llfiltereditor.h +++ b/indra/llui/llfiltereditor.h @@ -42,12 +42,7 @@ class LLFilterEditor : public LLSearchEditor { public: struct Params : public LLInitParam::Block<Params, LLSearchEditor::Params> - { - Params() - { - name = "filter_editor"; - } - }; + {}; protected: LLFilterEditor(const Params&); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 8917d5490c..bc494e97f5 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -182,7 +182,7 @@ LLFloater::Params::Params() open_callback("open_callback"), close_callback("close_callback") { - visible = false; + changeDefault(visible, false); } diff --git a/indra/llui/llflyoutbutton.h b/indra/llui/llflyoutbutton.h index 8d59380a00..36998eba2e 100644 --- a/indra/llui/llflyoutbutton.h +++ b/indra/llui/llflyoutbutton.h @@ -46,7 +46,7 @@ public: : action_button("action_button"), allow_text_entry("allow_text_entry") { - LLComboBox::Params::allow_text_entry = false; + changeDefault(LLComboBox::Params::allow_text_entry, false); } }; diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp index 47f2cfaf89..30b79b4d20 100644 --- a/indra/llui/lliconctrl.cpp +++ b/indra/llui/lliconctrl.cpp @@ -43,10 +43,7 @@ LLIconCtrl::Params::Params() color("color"), use_draw_context_alpha("use_draw_context_alpha", true), scale_image("scale_image") -{ - tab_stop = false; - mouse_opaque = false; -} +{} LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p) : LLUICtrl(p), diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index a59247ba09..a250404292 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -115,9 +115,7 @@ LLLayoutStack::Params::Params() open_time_constant("open_time_constant", 0.02f), close_time_constant("close_time_constant", 0.03f), border_size("border_size", LLCachedControl<S32>(*LLUI::sSettingGroups["config"], "UIResizeBarHeight", 0)) -{ - name="stack"; -} +{} LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) : LLView(p), diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 06fbc0f234..06dfc90d83 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -103,10 +103,11 @@ LLLineEditor::Params::Params() text_pad_right("text_pad_right"), default_text("default_text") { - mouse_opaque = true; + changeDefault(mouse_opaque, true); addSynonym(select_on_focus, "select_all_on_focus_received"); addSynonym(border, "border"); addSynonym(label, "watermark_text"); + addSynonym(max_length.chars, "max_length"); } LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) @@ -197,6 +198,7 @@ LLLineEditor::~LLLineEditor() void LLLineEditor::onFocusReceived() { + gEditMenuHandler = this; LLUICtrl::onFocusReceived(); updateAllowingLanguageInput(); } diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 8de9c769e2..6cac841cde 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -90,7 +90,6 @@ const S32 TEAROFF_SEPARATOR_HEIGHT_PIXELS = 10; const S32 MENU_ITEM_PADDING = 4; const std::string SEPARATOR_NAME("separator"); -const std::string SEPARATOR_LABEL( "-----------" ); const std::string VERTICAL_SEPARATOR_LABEL( "|" ); const std::string LLMenuGL::BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK @@ -149,7 +148,7 @@ LLMenuItemGL::Params::Params() highlight_bg_color("highlight_bg_color"), highlight_fg_color("highlight_fg_color") { - mouse_opaque = true; + changeDefault(mouse_opaque, true); } // Default constructor @@ -566,8 +565,6 @@ void LLMenuItemGL::handleVisibilityChange(BOOL new_visibility) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LLMenuItemSeparatorGL::Params::Params() { - name = "separator"; - label = SEPARATOR_LABEL; } LLMenuItemSeparatorGL::LLMenuItemSeparatorGL(const LLMenuItemSeparatorGL::Params& p) : @@ -755,30 +752,6 @@ U32 LLMenuItemTearOffGL::getNominalHeight( void ) const return TEAROFF_SEPARATOR_HEIGHT_PIXELS; } - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLMenuItemBlankGL -// -// This class represents a blank, non-functioning item. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLMenuItemBlankGL : public LLMenuItemGL -{ -public: - struct Params : public LLInitParam::Block<Params, LLMenuItemGL::Params> - { - Params() - { - name=""; - enabled = false; - } - }; - LLMenuItemBlankGL( const Params& p ) : LLMenuItemGL( p ) - {} - virtual void draw( void ) {} -}; - - ///============================================================================ /// Class LLMenuItemCallGL ///============================================================================ diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 7bde8e83ec..77db588390 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -372,17 +372,16 @@ public: drop_shadow("drop_shadow", true), bg_visible("bg_visible", true), create_jump_keys("create_jump_keys", false), + keep_fixed_size("keep_fixed_size", false), bg_color("bg_color", LLUIColorTable::instance().getColor( "MenuDefaultBgColor" )), scrollable("scrollable", false), max_scrollable_items("max_scrollable_items", U32_MAX), preferred_width("preferred_width", U32_MAX), shortcut_pad("shortcut_pad") - { addSynonym(bg_visible, "opaque"); addSynonym(bg_color, "color"); - - name = "menu"; + addSynonym(can_tear_off, "can_tear_off"); } }; @@ -650,7 +649,7 @@ public: { Params() { - visible = false; + changeDefault(visible, false); } }; @@ -698,16 +697,7 @@ class LLMenuBarGL : public LLMenuGL { public: struct Params : public LLInitParam::Block<Params, LLMenuGL::Params> - { - Params() - { - can_tear_off = false; - keep_fixed_size = true; - horizontal_layout = true; - visible = true; - drop_shadow = false; - } - }; + {}; LLMenuBarGL( const Params& p ); virtual ~LLMenuBarGL(); @@ -825,13 +815,7 @@ class LLMenuItemTearOffGL : public LLMenuItemGL { public: struct Params : public LLInitParam::Block<Params, LLMenuItemGL::Params> - { - Params() - { - name = "tear off"; - label = "~~~~~~~~~~~"; - } - }; + {}; LLMenuItemTearOffGL( const Params& ); diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 9052bc7d1d..70bcfb5b4f 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -66,11 +66,7 @@ LLMultiSlider::Params::Params() mouse_up_callback("mouse_up_callback"), thumb_width("thumb_width"), sliders("slider") -{ - name = "multi_slider_bar"; - mouse_opaque(true); - follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); -} +{} LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) : LLF32UICtrl(p), diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 6085c61f9a..ffe5908a9d 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -245,7 +245,6 @@ LLNotificationForm::LLNotificationForm(const std::string& name, const LLNotifica LLParamSDParser parser; parser.writeSD(mFormData, p.form_elements); - mFormData = mFormData[""]; if (!mFormData.isArray()) { // change existing contents to a one element array diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index eff572b553..ab777d37a5 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -88,10 +88,10 @@ struct LLNotificationTemplate { private: // this idiom allows - // <notification unique="true"> + // <notification> <unique/> </notification> // as well as // <notification> <unique> <context></context> </unique>... - Optional<bool> dummy_val; + Flag dummy_val; public: Multiple<UniquenessContext> contexts; diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index e3193bc352..a45b617c2e 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -90,7 +90,6 @@ LLPanel::Params::Params() visible_callback("visible_callback"), accepts_badge("accepts_badge") { - name = "panel"; addSynonym(background_visible, "bg_visible"); addSynonym(has_border, "border_visible"); addSynonym(label, "title"); diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 3a12debf7e..95a7d09382 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -74,9 +74,6 @@ LLRadioGroup::Params::Params() { addSynonym(items, "radio_item"); - name = "radio_group"; - mouse_opaque = true; - follows.flags = FOLLOWS_LEFT | FOLLOWS_TOP; // radio items are not tabbable until they are selected tab_stop = false; } @@ -96,7 +93,10 @@ void LLRadioGroup::initFromParams(const Params& p) { LLRadioGroup::ItemParams item_params(*it); - item_params.font.setIfNotProvided(mFont); // apply radio group font by default + if (!item_params.font.isProvided()) + { + item_params.font = mFont; // apply radio group font by default + } item_params.commit_callback.function = boost::bind(&LLRadioGroup::onClickButton, this, _1); item_params.from_xui = p.from_xui; if (p.from_xui) diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp index 3a867a10a7..5d3bf7a670 100644 --- a/indra/llui/llscrollbar.cpp +++ b/indra/llui/llscrollbar.cpp @@ -63,9 +63,7 @@ LLScrollbar::Params::Params() right_button("right_button"), bg_visible("bg_visible", false), bg_color("bg_color", LLColor4::black) -{ - tab_stop = false; -} +{} LLScrollbar::LLScrollbar(const Params & p) : LLUICtrl(p), diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index 380c477eb2..fe3f688fc5 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -74,11 +74,7 @@ LLScrollContainer::Params::Params() min_auto_scroll_rate("min_auto_scroll_rate", 100), max_auto_scroll_rate("max_auto_scroll_rate", 1000), reserve_scroll_corner("reserve_scroll_corner", false) -{ - name = "scroll_container"; - mouse_opaque(true); - tab_stop(false); -} +{} // Default constructor @@ -227,6 +223,15 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) return FALSE; } +BOOL LLScrollContainer::handleUnicodeCharHere(llwchar uni_char) +{ + if (mScrolledView && mScrolledView->handleUnicodeCharHere(uni_char)) + { + return TRUE; + } + return FALSE; +} + BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) { // Give event to my child views - they may have scroll bars diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index 46a71a7e30..3aa79cc255 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -103,6 +103,7 @@ public: // LLView functionality virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual BOOL handleUnicodeCharHere(llwchar uni_char); virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks ); virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h index 8f569c2a58..e8df176ec3 100644 --- a/indra/llui/llscrollingpanellist.h +++ b/indra/llui/llscrollingpanellist.h @@ -51,12 +51,7 @@ class LLScrollingPanelList : public LLUICtrl { public: struct Params : public LLInitParam::Block<Params, LLUICtrl::Params> - { - Params() - { - name = "scrolling_panel_list"; - } - }; + {}; LLScrollingPanelList(const Params& p) : LLUICtrl(p) {} diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp index 696e4a2bb1..07a6dfaa10 100644 --- a/indra/llui/llscrolllistcolumn.cpp +++ b/indra/llui/llscrolllistcolumn.cpp @@ -46,10 +46,7 @@ static LLWidgetNameRegistry::StaticRegistrar sRegisterColumnHeaderParams(&typeid //--------------------------------------------------------------------------- LLScrollColumnHeader::Params::Params() : column("column") -{ - name = "column_header"; - tab_stop(false); -} +{} LLScrollColumnHeader::LLScrollColumnHeader(const LLScrollColumnHeader::Params& p) diff --git a/indra/llui/llscrolllistcolumn.h b/indra/llui/llscrolllistcolumn.h index e2711ac75a..12baea8e0c 100644 --- a/indra/llui/llscrolllistcolumn.h +++ b/indra/llui/llscrolllistcolumn.h @@ -135,7 +135,7 @@ public: halign("halign", LLFontGL::LEFT) { // default choice to "dynamic_width" - width.dynamic_width = true; + changeDefault(width.dynamic_width, true); addSynonym(sort_column, "sort"); } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index b7848ec37c..622f3e215c 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -147,12 +147,9 @@ LLScrollListCtrl::Params::Params() highlighted_color("highlighted_color"), contents(""), scroll_bar_bg_visible("scroll_bar_bg_visible"), - scroll_bar_bg_color("scroll_bar_bg_color") - , border("border") -{ - name = "scroll_list"; - mouse_opaque = true; -} + scroll_bar_bg_color("scroll_bar_bg_color"), + border("border") +{} LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p) : LLUICtrl(p), @@ -2813,7 +2810,10 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS } S32 index = columnp->mIndex; - cell_p.width.setIfNotProvided(columnp->getWidth()); + if (!cell_p.width.isProvided()) + { + cell_p.width = columnp->getWidth(); + } LLScrollListCell* cell = LLScrollListCell::create(cell_p); diff --git a/indra/llui/llsdparam.cpp b/indra/llui/llsdparam.cpp index 9ad13054cb..04919e6991 100644 --- a/indra/llui/llsdparam.cpp +++ b/indra/llui/llsdparam.cpp @@ -183,7 +183,7 @@ LLSD* LLParamSDParser::getSDWriteNode(const parser_t::name_stack_t& name_stack) } } - LLSD* child_sd = &(*sd_to_write)[it->first]; + LLSD* child_sd = it->first.empty() ? sd_to_write : &(*sd_to_write)[it->first]; if (child_sd->isArray()) { diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index f5c3b532c4..c2d7916938 100644 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h @@ -55,9 +55,7 @@ public: search_button_visible("search_button_visible"), clear_button("clear_button"), clear_button_visible("clear_button_visible") - { - name = "search_editor"; - } + {} }; void setCommitOnFocusLost(BOOL b) { if (mSearchEditor) mSearchEditor->setCommitOnFocusLost(b); } diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index 013950a5ad..db72234f94 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -54,9 +54,7 @@ LLSlider::Params::Params() track_highlight_vertical_image("track_highlight_vertical_image"), mouse_down_callback("mouse_down_callback"), mouse_up_callback("mouse_up_callback") -{ - follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP); -} +{} LLSlider::LLSlider(const LLSlider::Params& p) : LLF32UICtrl(p), diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index d760178e35..583ed1ed2e 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -76,8 +76,14 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) } LLRect label_rect( left, top, label_width, bottom ); LLTextBox::Params params(p.slider_label); - params.rect.setIfNotProvided(label_rect); - params.font.setIfNotProvided(p.font); + if (!params.rect.isProvided()) + { + params.rect = label_rect; + } + if (!params.font.isProvided()) + { + params.font = p.font; + } params.initial_value(p.label()); mLabelBox = LLUICtrlFactory::create<LLTextBox> (params); addChild(mLabelBox); @@ -113,15 +119,33 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) S32 slider_left = label_width ? label_width + sliderctrl_spacing : 0; LLSlider::Params slider_p(p.slider_bar); slider_p.name("slider_bar"); - slider_p.rect.setIfNotProvided(LLRect(slider_left,top,slider_right,bottom)); - slider_p.initial_value.setIfNotProvided(p.initial_value().asReal()); - slider_p.min_value.setIfNotProvided(p.min_value); - slider_p.max_value.setIfNotProvided(p.max_value); - slider_p.increment.setIfNotProvided(p.increment); - slider_p.orientation.setIfNotProvided(p.orientation); + if (!slider_p.rect.isProvided()) + { + slider_p.rect = LLRect(slider_left,top,slider_right,bottom); + } + if (!slider_p.initial_value.isProvided()) + { + slider_p.initial_value = p.initial_value().asReal(); + } + if (!slider_p.min_value.isProvided()) + { + slider_p.min_value = p.min_value; + } + if (!slider_p.max_value.isProvided()) + { + slider_p.max_value = p.max_value; + } + if (!slider_p.increment.isProvided()) + { + slider_p.increment = p.increment; + } + if (!slider_p.orientation.isProvided()) + { + slider_p.orientation = p.orientation; + } - slider_p.commit_callback.function(&LLSliderCtrl::onSliderCommit); - slider_p.control_name(p.control_name); + slider_p.commit_callback.function = &LLSliderCtrl::onSliderCommit; + slider_p.control_name = p.control_name; slider_p.mouse_down_callback( p.mouse_down_callback ); slider_p.mouse_up_callback( p.mouse_up_callback ); mSlider = LLUICtrlFactory::create<LLSlider> (slider_p); @@ -134,8 +158,15 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) if( p.can_edit_text() ) { LLLineEditor::Params line_p(p.value_editor); - line_p.rect.setIfNotProvided(text_rect); - line_p.font.setIfNotProvided(p.font); + if (!line_p.rect.isProvided()) + { + line_p.rect = text_rect; + } + if (!line_p.font.isProvided()) + { + line_p.font = p.font; + } + line_p.commit_callback.function(&LLSliderCtrl::onEditorCommit); line_p.prevalidate_callback(&LLTextValidate::validateFloat); mEditor = LLUICtrlFactory::create<LLLineEditor>(line_p); @@ -149,8 +180,14 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) else { LLTextBox::Params text_p(p.value_text); - text_p.rect.setIfNotProvided(text_rect); - text_p.font.setIfNotProvided(p.font); + if (!text_p.rect.isProvided()) + { + text_p.rect = text_rect; + } + if (!text_p.font.isProvided()) + { + text_p.font = p.font; + } mTextBox = LLUICtrlFactory::create<LLTextBox>(text_p); addChild(mTextBox); } diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h index 62a9db82fe..513fff3234 100644 --- a/indra/llui/llstatbar.h +++ b/indra/llui/llstatbar.h @@ -65,7 +65,7 @@ public: show_mean("show_mean", TRUE), stat("stat") { - follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT); + changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); } }; LLStatBar(const Params&); diff --git a/indra/llui/llstatview.h b/indra/llui/llstatview.h index 22a9fcd672..5abdc42448 100644 --- a/indra/llui/llstatview.h +++ b/indra/llui/llstatview.h @@ -46,7 +46,7 @@ public: Params() : setting("setting") { - follows.flags(FOLLOWS_TOP | FOLLOWS_LEFT); + changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT); } }; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 7f0d650403..9c6a76822c 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -217,10 +217,7 @@ LLTabContainer::Params::Params() tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0), use_ellipses("use_ellipses"), font_halign("halign") -{ - name(std::string("tab_container")); - mouse_opaque = false; -} +{} LLTabContainer::LLTabContainer(const LLTabContainer::Params& p) : LLPanel(p), diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 6390039794..bc6461a0c2 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -55,7 +55,7 @@ static LLDefaultChildRegistry::Register<LLToolTipView> register_tooltip_view("to LLToolTipView::Params::Params() { - mouse_opaque = false; + changeDefault(mouse_opaque, false); } LLToolTipView::LLToolTipView(const LLToolTipView::Params& p) @@ -156,7 +156,7 @@ LLToolTip::Params::Params() web_based_media("web_based_media", false), media_playing("media_playing", false) { - chrome = true; + changeDefault(chrome, true); } LLToolTip::LLToolTip(const LLToolTip::Params& p) @@ -402,12 +402,12 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) LLToolTip::Params tooltip_params(params); // block mouse events if there is a click handler registered (specifically, hover) - if (params.click_callback.isProvided()) + if (params.click_callback.isProvided() && !params.mouse_opaque.isProvided()) { // set mouse_opaque to true if it wasn't already set to something else // this prevents mouse down from going "through" the tooltip and ultimately // causing the tooltip to disappear - tooltip_params.mouse_opaque.setIfNotProvided(true); + tooltip_params.mouse_opaque = true; } tooltip_params.rect = LLRect (0, 1, 1, 0); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index d58df5801b..9b9e2ddb55 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -1045,3 +1045,9 @@ boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t(); return mDoubleClickSignal->connect(cb); } + +void LLUICtrl::addInfo(LLSD & info) +{ + LLView::addInfo(info); + info["value"] = getValue(); +} diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 09bed9b958..8a8b589e9c 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -301,7 +301,9 @@ protected: static F32 sActiveControlTransparency; static F32 sInactiveControlTransparency; - + + virtual void addInfo(LLSD & info); + private: BOOL mIsChrome; diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 499b97f52d..d345ad4cd0 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -104,14 +104,17 @@ private: public: ParamDefaults() { - // recursively initialize from base class param block - ((typename PARAM_BLOCK::base_block_t&)mPrototype).fillFrom(ParamDefaults<typename PARAM_BLOCK::base_block_t, DUMMY>::instance().get()); - // after initializing base classes, look up template file for this param block + // look up template file for this param block... const std::string* param_block_tag = getWidgetTag(&typeid(PARAM_BLOCK)); if (param_block_tag) - { - LLUICtrlFactory::loadWidgetTemplate(*param_block_tag, mPrototype); + { // ...and if it exists, back fill values using the most specific template first + PARAM_BLOCK params; + LLUICtrlFactory::loadWidgetTemplate(*param_block_tag, params); + mPrototype.fillFrom(params); } + // recursively fill from base class param block + ((typename PARAM_BLOCK::base_block_t&)mPrototype).fillFrom(ParamDefaults<typename PARAM_BLOCK::base_block_t, DUMMY>::instance().get()); + } const PARAM_BLOCK& get() { return mPrototype; } @@ -122,12 +125,12 @@ private: // base case for recursion, there are NO base classes of LLInitParam::BaseBlock template<int DUMMY> - class ParamDefaults<LLInitParam::BaseBlock, DUMMY> : public LLSingleton<ParamDefaults<LLInitParam::BaseBlock, DUMMY> > + class ParamDefaults<LLInitParam::BaseBlockWithFlags, DUMMY> : public LLSingleton<ParamDefaults<LLInitParam::BaseBlockWithFlags, DUMMY> > { public: - const LLInitParam::BaseBlock& get() { return mBaseBlock; } + const LLInitParam::BaseBlockWithFlags& get() { return mBaseBlock; } private: - LLInitParam::BaseBlock mBaseBlock; + LLInitParam::BaseBlockWithFlags mBaseBlock; }; public: diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 659a54cc6e..3ddfb090c8 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -31,7 +31,10 @@ #include "llview.h" #include <cassert> +#include <sstream> #include <boost/tokenizer.hpp> +#include <boost/foreach.hpp> +#include <boost/bind.hpp> #include "llrender.h" #include "llevent.h" @@ -44,6 +47,7 @@ #include "v3color.h" #include "lluictrlfactory.h" #include "lltooltip.h" +#include "llsdutil.h" // for ui edit hack #include "llbutton.h" @@ -66,6 +70,8 @@ S32 LLView::sLastLeftXML = S32_MIN; S32 LLView::sLastBottomXML = S32_MIN; std::vector<LLViewDrawContext*> LLViewDrawContext::sDrawContextStack; +LLView::DrilldownFunc LLView::sDrilldown = + boost::bind(&LLView::pointInView, _1, _2, _3, HIT_TEST_USE_BOUNDING_RECT); //#if LL_DEBUG BOOL LLView::sIsDrawing = FALSE; @@ -346,13 +352,11 @@ void LLView::removeChild(LLView* child) LLView::ctrl_list_t LLView::getCtrlList() const { ctrl_list_t controls; - for(child_list_const_iter_t iter = mChildList.begin(); - iter != mChildList.end(); - iter++) + BOOST_FOREACH(LLView* viewp, mChildList) { - if((*iter)->isCtrl()) + if(viewp->isCtrl()) { - controls.push_back(static_cast<LLUICtrl*>(*iter)); + controls.push_back(static_cast<LLUICtrl*>(viewp)); } } return controls; @@ -428,6 +432,36 @@ BOOL LLView::isInEnabledChain() const return enabled; } +static void buildPathname(std::ostream& out, const LLView* view) +{ + if (! (view && view->getParent())) + { + return; // Don't include root in the path. + } + + buildPathname(out, view->getParent()); + + // Build pathname into ostream on the way back from recursion. + out << '/' << view->getName(); +} + +std::string LLView::getPathname() const +{ + std::ostringstream out; + buildPathname(out, this); + return out.str(); +} + +//static +std::string LLView::getPathname(const LLView* view) +{ + if (! view) + { + return "NULL"; + } + return view->getPathname(); +} + // virtual BOOL LLView::canFocusChildren() const { @@ -574,9 +608,8 @@ void LLView::deleteAllChildren() void LLView::setAllChildrenEnabled(BOOL b) { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; viewp->setEnabled(b); } } @@ -602,9 +635,8 @@ void LLView::setVisible(BOOL visible) // virtual void LLView::handleVisibilityChange ( BOOL new_visibility ) { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; // only views that are themselves visible will have their overall visibility affected by their ancestors if (viewp->getVisible()) { @@ -646,56 +678,178 @@ void LLView::onMouseLeave(S32 x, S32 y, MASK mask) //llinfos << "Mouse left " << getName() << llendl; } +bool LLView::visibleAndContains(S32 local_x, S32 local_y) +{ + return sDrilldown(this, local_x, local_y) + && getVisible(); +} + +bool LLView::visibleEnabledAndContains(S32 local_x, S32 local_y) +{ + return visibleAndContains(local_x, local_y) + && getEnabled(); +} + +void LLView::logMouseEvent() +{ + if (sDebugMouseHandling) + { + sMouseHandlerMessage = std::string("/") + mName + sMouseHandlerMessage; + } +} + +template <typename METHOD, typename CHARTYPE> +LLView* LLView::childrenHandleCharEvent(const std::string& desc, const METHOD& method, + CHARTYPE c, MASK mask) +{ + if ( getVisible() && getEnabled() ) + { + BOOST_FOREACH(LLView* viewp, mChildList) + { + if ((viewp->*method)(c, mask, TRUE)) + { + if (LLView::sDebugKeys) + { + llinfos << desc << " handled by " << viewp->getName() << llendl; + } + return viewp; + } + } + } + return NULL; +} + +// XDATA might be MASK, or S32 clicks +template <typename METHOD, typename XDATA> +LLView* LLView::childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra) +{ + BOOST_FOREACH(LLView* viewp, mChildList) + { + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + + if (!viewp->visibleEnabledAndContains(local_x, local_y)) + { + continue; + } + + if ((viewp->*method)( local_x, local_y, extra ) + || viewp->blockMouseEvent( local_x, local_y )) + { + viewp->logMouseEvent(); + return viewp; + } + } + return NULL; +} LLView* LLView::childrenHandleToolTip(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; - if(!viewp->pointInView(local_x, local_y) - || !viewp->getVisible()) + // Differs from childrenHandleMouseEvent() in that we want to offer + // tooltips even for disabled widgets. + if(!viewp->visibleAndContains(local_x, local_y)) { continue; } - if (viewp->handleToolTip(local_x, local_y, mask) ) + if (viewp->handleToolTip(local_x, local_y, mask) + || viewp->blockMouseEvent(local_x, local_y)) { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } + viewp->logMouseEvent(); + return viewp; + } + } + return NULL; +} - handled_view = viewp; - break; +LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, + BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + // default to not accepting drag and drop, will be overridden by handler + *accept = ACCEPT_NO; + + BOOST_FOREACH(LLView* viewp, mChildList) + { + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if( !viewp->visibleEnabledAndContains(local_x, local_y)) + { + continue; } - if (viewp->blockMouseEvent(local_x, local_y)) + // Differs from childrenHandleMouseEvent() simply in that this virtual + // method call diverges pretty radically from the usual (x, y, int). + if (viewp->handleDragAndDrop(local_x, local_y, mask, drop, + cargo_type, + cargo_data, + accept, + tooltip_msg) + || viewp->blockMouseEvent(local_x, local_y)) { - handled_view = viewp; - break; + return viewp; } } - return handled_view; + return NULL; } +LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) +{ + BOOST_FOREACH(LLView* viewp, mChildList) + { + S32 local_x = x - viewp->getRect().mLeft; + S32 local_y = y - viewp->getRect().mBottom; + if(!viewp->visibleEnabledAndContains(local_x, local_y)) + { + continue; + } + + // This call differentiates this method from childrenHandleMouseEvent(). + LLUI::sWindow->setCursor(viewp->getHoverCursor()); -LLView* LLView::childFromPoint(S32 x, S32 y) + if (viewp->handleHover(local_x, local_y, mask) + || viewp->blockMouseEvent(local_x, local_y)) + { + viewp->logMouseEvent(); + return viewp; + } + } + return NULL; +} + +LLView* LLView::childFromPoint(S32 x, S32 y, bool recur) { - if (!getVisible() ) + if (!getVisible()) return false; - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() ) + if (!viewp->visibleAndContains(local_x, local_y)) { continue; } + // Here we've found the first (frontmost) visible child at this level + // containing the specified point. Is the caller asking us to drill + // down and return the innermost leaf child at this point, or just the + // top-level child? + if (recur) + { + LLView* leaf(viewp->childFromPoint(local_x, local_y, recur)); + // Maybe viewp is already a leaf LLView, or maybe it has children + // but this particular (x, y) point falls between them. If the + // recursive call returns non-NULL, great, use that; else just use + // viewp. + return leaf? leaf : viewp; + } return viewp; } @@ -815,45 +969,6 @@ BOOL LLView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, return childrenHandleDragAndDrop( x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg) != NULL; } -LLView* LLView::childrenHandleDragAndDrop(S32 x, S32 y, MASK mask, - BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - LLView* handled_view = NULL; - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if( !viewp->pointInView(local_x, local_y) || - !viewp->getVisible() || - !viewp->getEnabled()) - { - continue; - } - if (viewp->handleDragAndDrop(local_x, local_y, mask, drop, - cargo_type, - cargo_data, - accept, - tooltip_msg)) - { - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(x, y)) - { - *accept = ACCEPT_NO; - handled_view = viewp; - break; - } - } - return handled_view; -} - void LLView::onMouseCaptureLost() { } @@ -903,391 +1018,57 @@ BOOL LLView::handleMiddleMouseUp(S32 x, S32 y, MASK mask) return childrenHandleMiddleMouseUp( x, y, mask ) != NULL; } - LLView* LLView::childrenHandleScrollWheel(S32 x, S32 y, S32 clicks) { - LLView* handled_view = NULL; - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleScrollWheel( local_x, local_y, clicks )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - - handled_view = viewp; - break; - } - } - } - return handled_view; -} - -LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask) -{ - LLView* handled_view = NULL; - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if(!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleHover(local_x, local_y, mask) ) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - LLUI::sWindow->setCursor(viewp->getHoverCursor()); - - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleScrollWheel, x, y, clicks); } // Called during downward traversal LLView* LLView::childrenHandleKey(KEY key, MASK mask) { - LLView* handled_view = NULL; - - if ( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - if (viewp->handleKey(key, mask, TRUE)) - { - if (LLView::sDebugKeys) - { - llinfos << "Key handled by " << viewp->getName() << llendl; - } - handled_view = viewp; - break; - } - } - } - - return handled_view; + return childrenHandleCharEvent("Key", &LLView::handleKey, key, mask); } // Called during downward traversal LLView* LLView::childrenHandleUnicodeChar(llwchar uni_char) { - LLView* handled_view = NULL; - - if ( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - if (viewp->handleUnicodeChar(uni_char, TRUE)) - { - if (LLView::sDebugKeys) - { - llinfos << "Unicode character handled by " << viewp->getName() << llendl; - } - handled_view = viewp; - break; - } - } - } - - return handled_view; + return childrenHandleCharEvent("Unicode character", &LLView::handleUnicodeCharWithDummyMask, + uni_char, MASK_NONE); } LLView* LLView::childrenHandleMouseDown(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if(viewp->handleMouseDown( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if(viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleMouseDown, x, y, mask); } LLView* LLView::childrenHandleRightMouseDown(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleRightMouseDown( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleRightMouseDown, x, y, mask); } LLView* LLView::childrenHandleMiddleMouseDown(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if(viewp->handleMiddleMouseDown( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleMiddleMouseDown, x, y, mask); } LLView* LLView::childrenHandleDoubleClick(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - - if (getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleDoubleClick( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleDoubleClick, x, y, mask); } LLView* LLView::childrenHandleMouseUp(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - if( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if (viewp->handleMouseUp( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleMouseUp, x, y, mask); } LLView* LLView::childrenHandleRightMouseUp(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - if( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled() ) - { - continue; - } - - if(viewp->handleRightMouseUp( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if(viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleRightMouseUp, x, y, mask); } LLView* LLView::childrenHandleMiddleMouseUp(S32 x, S32 y, MASK mask) { - LLView* handled_view = NULL; - if( getVisible() && getEnabled() ) - { - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) - { - LLView* viewp = *child_it; - S32 local_x = x - viewp->getRect().mLeft; - S32 local_y = y - viewp->getRect().mBottom; - if (!viewp->pointInView(local_x, local_y) - || !viewp->getVisible() - || !viewp->getEnabled()) - { - continue; - } - - if(viewp->handleMiddleMouseUp( local_x, local_y, mask )) - { - if (sDebugMouseHandling) - { - sMouseHandlerMessage = std::string("/") + viewp->mName + sMouseHandlerMessage; - } - handled_view = viewp; - break; - } - - if (viewp->blockMouseEvent(local_x, local_y)) - { - handled_view = viewp; - break; - } - } - } - return handled_view; + return childrenHandleMouseEvent(&LLView::handleMiddleMouseUp, x, y, mask); } void LLView::draw() @@ -1460,9 +1241,8 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent) mRect.mTop = getRect().mBottom + height; // move child views according to reshape flags - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* viewp, mChildList) { - LLView* viewp = *child_it; LLRect child_rect( viewp->mRect ); if (viewp->followsRight() && viewp->followsLeft()) @@ -1525,10 +1305,8 @@ LLRect LLView::calcBoundingRect() { LLRect local_bounding_rect = LLRect::null; - child_list_const_iter_t child_it; - for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* childp, mChildList) { - LLView* childp = *child_it; // ignore invisible and "top" children when calculating bounding rect // such as combobox popups if (!childp->getVisible() || childp == gFocusMgr.getTopCtrl()) @@ -1693,11 +1471,9 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const //richard: should we allow empty names? //if(name.empty()) // return NULL; - child_list_const_iter_t child_it; // Look for direct children *first* - for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* childp, mChildList) { - LLView* childp = *child_it; llassert(childp); if (childp->getName() == name) { @@ -1707,9 +1483,8 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const if (recurse) { // Look inside each child as well. - for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* childp, mChildList) { - LLView* childp = *child_it; llassert(childp); LLView* viewp = childp->findChildView(name, recurse); if ( viewp ) @@ -2485,7 +2260,7 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) { LLRect parent_rect = parent->getLocalRect(); // overwrite uninitialized rect params, using context - LLRect last_rect = parent->getLocalRect(); + LLRect default_rect = parent->getLocalRect(); bool layout_topleft = (p.layout() == "topleft"); @@ -2509,15 +2284,13 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) p.rect.height = MIN_WIDGET_HEIGHT; } - last_rect.translate(0, last_rect.getHeight()); + default_rect.translate(0, default_rect.getHeight()); // If there was a recently constructed child, use its rectangle - get_last_child_rect(parent, &last_rect); + get_last_child_rect(parent, &default_rect); if (layout_topleft) { - p.bottom_delta.setIfNotProvided(0, false); - // Invert the sense of bottom_delta for topleft layout if (p.bottom_delta.isProvided()) { @@ -2530,33 +2303,44 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) else if (p.top_delta.isProvided()) { p.bottom_delta = - -(p.top_delta + p.rect.height - last_rect.getHeight()); + -(p.top_delta + p.rect.height - default_rect.getHeight()); } - else if (!p.bottom_delta.isProvided() - && !p.left_delta.isProvided() - && !p.top_pad.isProvided() + else if (!p.left_delta.isProvided() && !p.left_pad.isProvided()) { // set default position is just below last rect p.bottom_delta.set(-(p.rect.height + VPAD), false); } + else + { + p.bottom_delta.set(0, false); + } // default to same left edge - p.left_delta.setIfNotProvided(0, false); + if (!p.left_delta.isProvided()) + { + p.left_delta.set(0, false); + } if (p.left_pad.isProvided()) { // left_pad is based on prior widget's right edge - p.left_delta.set(p.left_pad + last_rect.getWidth(), false); + p.left_delta.set(p.left_pad + default_rect.getWidth(), false); } - last_rect.translate(p.left_delta, p.bottom_delta); + default_rect.translate(p.left_delta, p.bottom_delta); } else { // set default position is just below last rect - p.bottom_delta.setIfNotProvided(-(p.rect.height + VPAD), false); - p.left_delta.setIfNotProvided(0, false); - last_rect.translate(p.left_delta, p.bottom_delta); + if (!p.bottom_delta.isProvided()) + { + p.bottom_delta.set(-(p.rect.height + VPAD), false); + } + if (!p.left_delta.isProvided()) + { + p.left_delta.set(0, false); + } + default_rect.translate(p.left_delta, p.bottom_delta); } // this handles case where *both* x and x_delta are provided @@ -2567,12 +2351,38 @@ void LLView::applyXUILayout(LLView::Params& p, LLView* parent) // selectively apply rectangle defaults, making sure that // params are not flagged as having been "provided" // as rect params are overconstrained and rely on provided flags - p.rect.left.setIfNotProvided(last_rect.mLeft, false); - p.rect.bottom.setIfNotProvided(last_rect.mBottom, false); - p.rect.top.setIfNotProvided(last_rect.mTop, false); - p.rect.right.setIfNotProvided(last_rect.mRight, false); - p.rect.width.setIfNotProvided(last_rect.getWidth(), false); - p.rect.height.setIfNotProvided(last_rect.getHeight(), false); + if (!p.rect.left.isProvided()) + { + p.rect.left.set(default_rect.mLeft, false); + //HACK: get around the fact that setting a rect param component value won't invalidate the existing rect object value + p.rect.paramChanged(p.rect.left, true); + } + if (!p.rect.bottom.isProvided()) + { + p.rect.bottom.set(default_rect.mBottom, false); + p.rect.paramChanged(p.rect.bottom, true); + } + if (!p.rect.top.isProvided()) + { + p.rect.top.set(default_rect.mTop, false); + p.rect.paramChanged(p.rect.top, true); + } + if (!p.rect.right.isProvided()) + { + p.rect.right.set(default_rect.mRight, false); + p.rect.paramChanged(p.rect.right, true); + + } + if (!p.rect.width.isProvided()) + { + p.rect.width.set(default_rect.getWidth(), false); + p.rect.paramChanged(p.rect.width, true); + } + if (!p.rect.height.isProvided()) + { + p.rect.height.set(default_rect.getHeight(), false); + p.rect.paramChanged(p.rect.height, true); + } } } @@ -2815,9 +2625,9 @@ S32 LLView::notifyParent(const LLSD& info) bool LLView::notifyChildren(const LLSD& info) { bool ret = false; - for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) + BOOST_FOREACH(LLView* childp, mChildList) { - ret |= (*child_it)->notifyChildren(info); + ret = ret || childp->notifyChildren(info); } return ret; } @@ -2837,3 +2647,24 @@ const LLViewDrawContext& LLViewDrawContext::getCurrentContext() return *sDrawContextStack.back(); } + +LLSD LLView::getInfo(void) +{ + LLSD info; + addInfo(info); + return info; +} + +void LLView::addInfo(LLSD & info) +{ + info["path"] = getPathname(); + info["class"] = typeid(*this).name(); + info["visible"] = getVisible(); + info["visible_chain"] = isInVisibleChain(); + info["enabled"] = getEnabled(); + info["enabled_chain"] = isInEnabledChain(); + info["available"] = isAvailable(); + LLRect rect(calcScreenRect()); + info["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop) + ("right", rect.mRight)("bottom", rect.mBottom); +} diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 594a5eec6b..fe15307a5d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -50,6 +50,8 @@ #include "llfocusmgr.h" #include <list> +#include <boost/function.hpp> +#include <boost/noncopyable.hpp> class LLSD; @@ -437,12 +439,15 @@ public: /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; - virtual LLView* childFromPoint(S32 x, S32 y); + virtual LLView* childFromPoint(S32 x, S32 y, bool recur=false); // view-specific handlers virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); + std::string getPathname() const; + // static method handles NULL pointer too + static std::string getPathname(const LLView*); template <class T> T* findChild(const std::string& name, BOOL recurse = TRUE) const { @@ -511,11 +516,17 @@ public: virtual S32 notify(const LLSD& info) { return 0;}; static const LLViewDrawContext& getDrawContext(); + + // Returns useful information about this ui widget. + LLSD getInfo(void); protected: void drawDebugRect(); void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE); void drawChildren(); + bool visibleAndContains(S32 local_x, S32 local_Y); + bool visibleEnabledAndContains(S32 local_x, S32 local_y); + void logMouseEvent(); LLView* childrenHandleKey(KEY key, MASK mask); LLView* childrenHandleUnicodeChar(llwchar uni_char); @@ -538,9 +549,24 @@ protected: LLView* childrenHandleToolTip(S32 x, S32 y, MASK mask); ECursorType mHoverCursor; - + + virtual void addInfo(LLSD & info); private: + template <typename METHOD, typename XDATA> + LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra); + + template <typename METHOD, typename CHARTYPE> + LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method, + CHARTYPE c, MASK mask); + + // adapter to blur distinction between handleKey() and handleUnicodeChar() + // for childrenHandleCharEvent() + BOOL handleUnicodeCharWithDummyMask(llwchar uni_char, MASK /* dummy */, BOOL from_parent) + { + return handleUnicodeChar(uni_char, from_parent); + } + LLView* mParentView; child_list_t mChildList; @@ -582,7 +608,35 @@ private: LLView& getDefaultWidgetContainer() const; + // This allows special mouse-event targeting logic for testing. + typedef boost::function<bool(const LLView*, S32 x, S32 y)> DrilldownFunc; + static DrilldownFunc sDrilldown; + public: + // This is the only public accessor to alter sDrilldown. This is not + // an accident. The intended usage pattern is like: + // { + // LLView::TemporaryDrilldownFunc scoped_func(myfunctor); + // // ... test with myfunctor ... + // } // exiting block restores original LLView::sDrilldown + class TemporaryDrilldownFunc: public boost::noncopyable + { + public: + TemporaryDrilldownFunc(const DrilldownFunc& func): + mOldDrilldown(sDrilldown) + { + sDrilldown = func; + } + + ~TemporaryDrilldownFunc() + { + sDrilldown = mOldDrilldown; + } + + private: + DrilldownFunc mOldDrilldown; + }; + // Depth in view hierarchy during rendering static S32 sDepth; diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index 32d7ea7c25..919267dcc6 100644 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp @@ -57,9 +57,6 @@ LLViewBorder::Params::Params() { addSynonym(border_thickness, "thickness"); addSynonym(render_style, "style"); - name = "view_border"; - mouse_opaque = false; - follows.flags = FOLLOWS_ALL; } diff --git a/indra/llui/llviewinject.cpp b/indra/llui/llviewinject.cpp new file mode 100644 index 0000000000..46c5839f8e --- /dev/null +++ b/indra/llui/llviewinject.cpp @@ -0,0 +1,49 @@ +/** + * @file llviewinject.cpp + * @author Nat Goodspeed + * @date 2011-08-16 + * @brief Implementation for llviewinject. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Copyright (c) 2011, Linden Research, Inc. + * $/LicenseInfo$ + */ + +// Precompiled header +#include "linden_common.h" +// associated header +#include "llviewinject.h" +// STL headers +// std headers +// external library headers +// other Linden headers + +llview::TargetEvent::TargetEvent(LLView* view) +{ + // Walk up the view tree from target LLView to the root (NULL). If + // passed NULL, iterate 0 times. + for (; view; view = view->getParent()) + { + // At each level, operator() is going to ask: for a particular parent + // LLView*, which of its children should I select? So for this view's + // parent, select this view. + mChildMap[view->getParent()] = view; + } +} + +bool llview::TargetEvent::operator()(const LLView* view, S32 /*x*/, S32 /*y*/) const +{ + // We are being called to decide whether to direct an incoming mouse event + // to this child view. (Normal LLView processing is to check whether the + // incoming (x, y) is within the view.) Look up the parent to decide + // whether, for that parent, this is the previously-selected child. + ChildMap::const_iterator found(mChildMap.find(view->getParent())); + // If we're looking at a child whose parent isn't even in the map, never + // mind. + if (found == mChildMap.end()) + { + return false; + } + // So, is this the predestined child for this parent? + return (view == found->second); +} diff --git a/indra/llui/llviewinject.h b/indra/llui/llviewinject.h new file mode 100644 index 0000000000..0de3d155c4 --- /dev/null +++ b/indra/llui/llviewinject.h @@ -0,0 +1,56 @@ +/** + * @file llviewinject.h + * @author Nat Goodspeed + * @date 2011-08-16 + * @brief Supplemental LLView functionality used for simulating UI events. + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Copyright (c) 2011, Linden Research, Inc. + * $/LicenseInfo$ + */ + +#if ! defined(LL_LLVIEWINJECT_H) +#define LL_LLVIEWINJECT_H + +#include "llview.h" +#include <map> + +namespace llview +{ + + /** + * TargetEvent is a callable with state, specifically intended for use as + * an LLView::TemporaryDrilldownFunc. Instantiate it with the desired + * target LLView*; pass it to a TemporaryDrilldownFunc instance; + * TargetEvent::operator() will then attempt to direct subsequent mouse + * events to the desired target LLView*. (This is an "attempt" because + * LLView will still balk unless the target LLView and every parent are + * visible and enabled.) + */ + class TargetEvent + { + public: + /** + * Construct TargetEvent with the desired target LLView*. (See + * LLUI::resolvePath() to obtain an LLView* given a string pathname.) + * This sets up for operator(). + */ + TargetEvent(LLView* view); + + /** + * This signature must match LLView::DrilldownFunc. When you install + * this TargetEvent instance using LLView::TemporaryDrilldownFunc, + * LLView will call this method to decide whether to propagate an + * incoming mouse event to the passed child LLView*. + */ + bool operator()(const LLView*, S32 x, S32 y) const; + + private: + // For a given parent LLView, identify which child to select. + typedef std::map<LLView*, LLView*> ChildMap; + ChildMap mChildMap; + }; + +} // llview namespace + +#endif /* ! defined(LL_LLVIEWINJECT_H) */ diff --git a/indra/llui/llwindowshade.cpp b/indra/llui/llwindowshade.cpp index 77e94385d4..cf76202215 100644 --- a/indra/llui/llwindowshade.cpp +++ b/indra/llui/llwindowshade.cpp @@ -43,7 +43,7 @@ LLWindowShade::Params::Params() text_color("text_color"), can_close("can_close", true) { - mouse_opaque = false; + changeDefault(mouse_opaque, false); } LLWindowShade::LLWindowShade(const LLWindowShade::Params& params) |