aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lluictrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/lluictrl.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/linden/indra/llui/lluictrl.cpp b/linden/indra/llui/lluictrl.cpp
index 0e6c155..66504b7 100644
--- a/linden/indra/llui/lluictrl.cpp
+++ b/linden/indra/llui/lluictrl.cpp
@@ -34,7 +34,9 @@
34#include "linden_common.h" 34#include "linden_common.h"
35#include "lluictrl.h" 35#include "lluictrl.h"
36#include "llfocusmgr.h" 36#include "llfocusmgr.h"
37#include "llpanel.h"
37 38
39static LLRegisterWidget<LLUICtrl> r("ui_ctrl");
38 40
39LLFocusableElement::LLFocusableElement() 41LLFocusableElement::LLFocusableElement()
40: mFocusLostCallback(NULL), 42: mFocusLostCallback(NULL),
@@ -473,7 +475,7 @@ BOOL LLUICtrl::focusPrevItem(BOOL text_fields_only)
473 return focusPrev(result); 475 return focusPrev(result);
474} 476}
475 477
476const LLUICtrl* LLUICtrl::findRootMostFocusRoot() const 478LLUICtrl* LLUICtrl::findRootMostFocusRoot() const
477{ 479{
478 const LLUICtrl* focus_root = NULL; 480 const LLUICtrl* focus_root = NULL;
479 const LLUICtrl* next_view = this; 481 const LLUICtrl* next_view = this;
@@ -485,7 +487,9 @@ const LLUICtrl* LLUICtrl::findRootMostFocusRoot() const
485 } 487 }
486 next_view = next_view->getParentUICtrl(); 488 next_view = next_view->getParentUICtrl();
487 } 489 }
488 return focus_root; 490 // since focus_root could be this, need to cast away const to return
491 // a non-const result
492 return const_cast<LLUICtrl*>(focus_root);
489} 493}
490 494
491 495
@@ -538,14 +542,22 @@ LLXMLNodePtr LLUICtrl::getXML(bool save_children) const
538 return node; 542 return node;
539} 543}
540 544
545//static
546LLView* LLUICtrl::fromXML(LLXMLNodePtr node, LLView* parent, class LLUICtrlFactory* factory)
547{
548 LLUICtrl* ctrl = new LLUICtrl();
549 ctrl->initFromXML(node, parent);
550 return ctrl;
551}
552
553
541// *NOTE: If other classes derive from LLPanel, they will need to be 554// *NOTE: If other classes derive from LLPanel, they will need to be
542// added to this function. 555// added to this function.
543LLPanel* LLUICtrl::getParentPanel() const 556LLPanel* LLUICtrl::getParentPanel() const
544{ 557{
545 LLView* parent = getParent(); 558 LLView* parent = getParent();
546 while (parent 559 LLPanel* parent_panel = dynamic_cast<LLPanel*>(parent);
547 && parent->getWidgetType() != WIDGET_TYPE_PANEL 560 while (!parent_panel)
548 && parent->getWidgetType() != WIDGET_TYPE_FLOATER)
549 { 561 {
550 parent = parent->getParent(); 562 parent = parent->getParent();
551 } 563 }