aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llpanel.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llui/llpanel.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llpanel.cpp231
1 files changed, 99 insertions, 132 deletions
diff --git a/linden/indra/llui/llpanel.cpp b/linden/indra/llui/llpanel.cpp
index b72e104..9a3f1a2 100644
--- a/linden/indra/llui/llpanel.cpp
+++ b/linden/indra/llui/llpanel.cpp
@@ -60,10 +60,10 @@
60#include "llresizebar.h" 60#include "llresizebar.h"
61#include "llcriticaldamp.h" 61#include "llcriticaldamp.h"
62 62
63LLPanel::panel_map_t LLPanel::sPanelMap;
64LLPanel::alert_queue_t LLPanel::sAlertQueue; 63LLPanel::alert_queue_t LLPanel::sAlertQueue;
65 64
66const S32 RESIZE_BAR_OVERLAP = 1; 65const S32 RESIZE_BAR_OVERLAP = 1;
66const S32 RESIZE_BAR_HEIGHT = 3;
67 67
68void LLPanel::init() 68void LLPanel::init()
69{ 69{
@@ -78,8 +78,7 @@ void LLPanel::init()
78 setIsChrome(FALSE); //is this a decorator to a live window or a form? 78 setIsChrome(FALSE); //is this a decorator to a live window or a form?
79 mLastTabGroup = 0; 79 mLastTabGroup = 0;
80 80
81 // add self to handle->panel map 81 mPanelHandle.bind(this);
82 sPanelMap[mViewHandle] = this;
83 setTabStop(FALSE); 82 setTabStop(FALSE);
84} 83}
85 84
@@ -121,31 +120,11 @@ LLPanel::LLPanel(const LLString& name, const LLString& rect_control, BOOL border
121 } 120 }
122} 121}
123 122
124void LLPanel::addBorder(LLViewBorder::EBevel border_bevel,
125 LLViewBorder::EStyle border_style, S32 border_thickness)
126{
127 removeBorder();
128 mBorder = new LLViewBorder( "panel border",
129 LLRect(0, mRect.getHeight(), mRect.getWidth(), 0),
130 border_bevel, border_style, border_thickness );
131 mBorder->setSaveToXML(false);
132 addChild( mBorder );
133}
134
135void LLPanel::removeBorder()
136{
137 delete mBorder;
138 mBorder = NULL;
139}
140
141
142LLPanel::~LLPanel() 123LLPanel::~LLPanel()
143{ 124{
144 storeRectControl(); 125 storeRectControl();
145 sPanelMap.erase(mViewHandle);
146} 126}
147 127
148
149// virtual 128// virtual
150EWidgetType LLPanel::getWidgetType() const 129EWidgetType LLPanel::getWidgetType() const
151{ 130{
@@ -159,7 +138,7 @@ LLString LLPanel::getWidgetTag() const
159} 138}
160 139
161// virtual 140// virtual
162BOOL LLPanel::isPanel() 141BOOL LLPanel::isPanel() const
163{ 142{
164 return TRUE; 143 return TRUE;
165} 144}
@@ -170,6 +149,24 @@ BOOL LLPanel::postBuild()
170 return TRUE; 149 return TRUE;
171} 150}
172 151
152void LLPanel::addBorder(LLViewBorder::EBevel border_bevel,
153 LLViewBorder::EStyle border_style, S32 border_thickness)
154{
155 removeBorder();
156 mBorder = new LLViewBorder( "panel border",
157 LLRect(0, getRect().getHeight(), getRect().getWidth(), 0),
158 border_bevel, border_style, border_thickness );
159 mBorder->setSaveToXML(false);
160 addChild( mBorder );
161}
162
163void LLPanel::removeBorder()
164{
165 delete mBorder;
166 mBorder = NULL;
167}
168
169
173// virtual 170// virtual
174void LLPanel::clearCtrls() 171void LLPanel::clearCtrls()
175{ 172{
@@ -200,8 +197,8 @@ void LLPanel::draw()
200 { 197 {
201 //RN: I don't see the point of this 198 //RN: I don't see the point of this
202 S32 left = 0;//LLPANEL_BORDER_WIDTH; 199 S32 left = 0;//LLPANEL_BORDER_WIDTH;
203 S32 top = mRect.getHeight();// - LLPANEL_BORDER_WIDTH; 200 S32 top = getRect().getHeight();// - LLPANEL_BORDER_WIDTH;
204 S32 right = mRect.getWidth();// - LLPANEL_BORDER_WIDTH; 201 S32 right = getRect().getWidth();// - LLPANEL_BORDER_WIDTH;
205 S32 bottom = 0;//LLPANEL_BORDER_WIDTH; 202 S32 bottom = 0;//LLPANEL_BORDER_WIDTH;
206 203
207 if (mBgOpaque ) 204 if (mBgOpaque )
@@ -281,13 +278,13 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
281 if( (mask == MASK_SHIFT) && (KEY_TAB == key)) 278 if( (mask == MASK_SHIFT) && (KEY_TAB == key))
282 { 279 {
283 //SHIFT-TAB 280 //SHIFT-TAB
284 LLView* cur_focus = gFocusMgr.getKeyboardFocus(); 281 LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
285 if (cur_focus && gFocusMgr.childHasKeyboardFocus(this)) 282 if (cur_focus && gFocusMgr.childHasKeyboardFocus(this))
286 { 283 {
287 LLView* focus_root = cur_focus; 284 LLUICtrl* focus_root = cur_focus;
288 while(cur_focus->getParent()) 285 while(cur_focus->getParentUICtrl())
289 { 286 {
290 cur_focus = cur_focus->getParent(); 287 cur_focus = cur_focus->getParentUICtrl();
291 if (cur_focus->isFocusRoot()) 288 if (cur_focus->isFocusRoot())
292 { 289 {
293 // this is the root-most focus root found so far 290 // this is the root-most focus root found so far
@@ -296,7 +293,7 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
296 } 293 }
297 handled = focus_root->focusPrevItem(FALSE); 294 handled = focus_root->focusPrevItem(FALSE);
298 } 295 }
299 else if (!cur_focus && mIsFocusRoot) 296 else if (!cur_focus && isFocusRoot())
300 { 297 {
301 handled = focusLastItem(); 298 handled = focusLastItem();
302 if (!handled) 299 if (!handled)
@@ -310,13 +307,13 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
310 if( (mask == MASK_NONE ) && (KEY_TAB == key)) 307 if( (mask == MASK_NONE ) && (KEY_TAB == key))
311 { 308 {
312 //TAB 309 //TAB
313 LLView* cur_focus = gFocusMgr.getKeyboardFocus(); 310 LLUICtrl* cur_focus = gFocusMgr.getKeyboardFocus();
314 if (cur_focus && gFocusMgr.childHasKeyboardFocus(this)) 311 if (cur_focus && gFocusMgr.childHasKeyboardFocus(this))
315 { 312 {
316 LLView* focus_root = cur_focus; 313 LLUICtrl* focus_root = cur_focus;
317 while(cur_focus->getParent()) 314 while(cur_focus->getParentUICtrl())
318 { 315 {
319 cur_focus = cur_focus->getParent(); 316 cur_focus = cur_focus->getParentUICtrl();
320 if (cur_focus->isFocusRoot()) 317 if (cur_focus->isFocusRoot())
321 { 318 {
322 focus_root = cur_focus; 319 focus_root = cur_focus;
@@ -324,7 +321,7 @@ BOOL LLPanel::handleKey(KEY key, MASK mask, BOOL called_from_parent)
324 } 321 }
325 handled = focus_root->focusNextItem(FALSE); 322 handled = focus_root->focusNextItem(FALSE);
326 } 323 }
327 else if (!cur_focus && mIsFocusRoot) 324 else if (!cur_focus && isFocusRoot())
328 { 325 {
329 handled = focusFirstItem(); 326 handled = focusFirstItem();
330 if (!handled) 327 if (!handled)
@@ -408,12 +405,12 @@ void LLPanel::requires(LLString name, EWidgetType type)
408 mRequirements[name] = type; 405 mRequirements[name] = type;
409} 406}
410 407
411BOOL LLPanel::checkRequirements() 408BOOL LLPanel::checkRequirements() const
412{ 409{
413 BOOL retval = TRUE; 410 BOOL retval = TRUE;
414 LLString message; 411 LLString message;
415 412
416 for (requirements_map_t::iterator i = mRequirements.begin(); i != mRequirements.end(); ++i) 413 for (requirements_map_t::const_iterator i = mRequirements.begin(); i != mRequirements.end(); ++i)
417 { 414 {
418 if (!this->getCtrlByNameAndType(i->first, i->second)) 415 if (!this->getCtrlByNameAndType(i->first, i->second))
419 { 416 {
@@ -489,21 +486,6 @@ void LLPanel::setFocus(BOOL b)
489 } 486 }
490} 487}
491 488
492void LLPanel::setBackgroundColor(const LLColor4& color)
493{
494 mBgColorOpaque = color;
495}
496
497LLColor4 LLPanel::getBackgroundColor()
498{
499 return mBgColorOpaque;
500}
501
502void LLPanel::setTransparentColor(const LLColor4& color)
503{
504 mBgColorAlpha = color;
505}
506
507void LLPanel::setBorderVisible(BOOL b) 489void LLPanel::setBorderVisible(BOOL b)
508{ 490{
509 if (mBorder) 491 if (mBorder)
@@ -512,18 +494,18 @@ void LLPanel::setBorderVisible(BOOL b)
512 } 494 }
513} 495}
514 496
515LLView* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type) 497LLUICtrl* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type) const
516{ 498{
517 LLView* view = getChildByName(name, TRUE); 499 LLView* view = getChildByName(name, TRUE);
518 if (view) 500 if (view && view->isCtrl())
519 { 501 {
520 if (type == WIDGET_TYPE_DONTCARE || view->getWidgetType() == type) 502 if (type == WIDGET_TYPE_DONTCARE || view->getWidgetType() == type)
521 { 503 {
522 return view; 504 return (LLUICtrl*)view;
523 } 505 }
524 else 506 else
525 { 507 {
526 llwarns << "Widget " << name << " has improper type in panel " << mName << "\n" 508 llwarns << "Widget " << name << " has improper type in panel " << getName() << "\n"
527 << "Is: \t\t" << view->getWidgetType() << "\n" 509 << "Is: \t\t" << view->getWidgetType() << "\n"
528 << "Should be: \t" << type 510 << "Should be: \t" << type
529 << llendl; 511 << llendl;
@@ -536,17 +518,6 @@ LLView* LLPanel::getCtrlByNameAndType(const LLString& name, EWidgetType type)
536 return NULL; 518 return NULL;
537} 519}
538 520
539// static
540LLPanel* LLPanel::getPanelByHandle(LLViewHandle handle)
541{
542 if (!sPanelMap.count(handle))
543 {
544 return NULL;
545 }
546
547 return sPanelMap[handle];
548}
549
550// virtual 521// virtual
551LLXMLNodePtr LLPanel::getXML(bool save_children) const 522LLXMLNodePtr LLPanel::getXML(bool save_children) const
552{ 523{
@@ -734,7 +705,7 @@ void LLPanel::setPanelParameters(LLXMLNodePtr node, LLView* parent)
734 setLabel(label); 705 setLabel(label);
735} 706}
736 707
737LLString LLPanel::getFormattedUIString(const LLString& name, const LLString::format_map_t& args) const 708LLString LLPanel::getString(const LLString& name, const LLString::format_map_t& args) const
738{ 709{
739 ui_string_map_t::const_iterator found_it = mUIStrings.find(name); 710 ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
740 if (found_it != mUIStrings.end()) 711 if (found_it != mUIStrings.end())
@@ -744,6 +715,7 @@ LLString LLPanel::getFormattedUIString(const LLString& name, const LLString::for
744 formatted_string.setArgList(args); 715 formatted_string.setArgList(args);
745 return formatted_string.getString(); 716 return formatted_string.getString();
746 } 717 }
718 llerrs << "Failed to find string " << name << " in panel " << getName() << llendl;
747 return LLString::null; 719 return LLString::null;
748} 720}
749 721
@@ -754,13 +726,14 @@ LLUIString LLPanel::getUIString(const LLString& name) const
754 { 726 {
755 return found_it->second; 727 return found_it->second;
756 } 728 }
729 llerrs << "Failed to find string " << name << " in panel " << getName() << llendl;
757 return LLUIString(LLString::null); 730 return LLUIString(LLString::null);
758} 731}
759 732
760 733
761void LLPanel::childSetVisible(const LLString& id, bool visible) 734void LLPanel::childSetVisible(const LLString& id, bool visible)
762{ 735{
763 LLView* child = getChildByName(id, true); 736 LLView* child = getChild<LLView>(id);
764 if (child) 737 if (child)
765 { 738 {
766 child->setVisible(visible); 739 child->setVisible(visible);
@@ -769,7 +742,7 @@ void LLPanel::childSetVisible(const LLString& id, bool visible)
769 742
770bool LLPanel::childIsVisible(const LLString& id) const 743bool LLPanel::childIsVisible(const LLString& id) const
771{ 744{
772 LLView* child = getChildByName(id, true); 745 LLView* child = getChild<LLView>(id);
773 if (child) 746 if (child)
774 { 747 {
775 return (bool)child->getVisible(); 748 return (bool)child->getVisible();
@@ -779,7 +752,7 @@ bool LLPanel::childIsVisible(const LLString& id) const
779 752
780void LLPanel::childSetEnabled(const LLString& id, bool enabled) 753void LLPanel::childSetEnabled(const LLString& id, bool enabled)
781{ 754{
782 LLView* child = getChildByName(id, true); 755 LLView* child = getChild<LLView>(id);
783 if (child) 756 if (child)
784 { 757 {
785 child->setEnabled(enabled); 758 child->setEnabled(enabled);
@@ -788,7 +761,7 @@ void LLPanel::childSetEnabled(const LLString& id, bool enabled)
788 761
789void LLPanel::childSetTentative(const LLString& id, bool tentative) 762void LLPanel::childSetTentative(const LLString& id, bool tentative)
790{ 763{
791 LLView* child = getChildByName(id, true); 764 LLView* child = getChild<LLView>(id);
792 if (child) 765 if (child)
793 { 766 {
794 child->setTentative(tentative); 767 child->setTentative(tentative);
@@ -797,7 +770,7 @@ void LLPanel::childSetTentative(const LLString& id, bool tentative)
797 770
798bool LLPanel::childIsEnabled(const LLString& id) const 771bool LLPanel::childIsEnabled(const LLString& id) const
799{ 772{
800 LLView* child = getChildByName(id, true); 773 LLView* child = getChild<LLView>(id);
801 if (child) 774 if (child)
802 { 775 {
803 return (bool)child->getEnabled(); 776 return (bool)child->getEnabled();
@@ -808,7 +781,7 @@ bool LLPanel::childIsEnabled(const LLString& id) const
808 781
809void LLPanel::childSetToolTip(const LLString& id, const LLString& msg) 782void LLPanel::childSetToolTip(const LLString& id, const LLString& msg)
810{ 783{
811 LLView* child = getChildByName(id, true); 784 LLView* child = getChild<LLView>(id);
812 if (child) 785 if (child)
813 { 786 {
814 child->setToolTip(msg); 787 child->setToolTip(msg);
@@ -817,7 +790,7 @@ void LLPanel::childSetToolTip(const LLString& id, const LLString& msg)
817 790
818void LLPanel::childSetRect(const LLString& id, const LLRect& rect) 791void LLPanel::childSetRect(const LLString& id, const LLRect& rect)
819{ 792{
820 LLView* child = getChildByName(id, true); 793 LLView* child = getChild<LLView>(id);
821 if (child) 794 if (child)
822 { 795 {
823 child->setRect(rect); 796 child->setRect(rect);
@@ -826,7 +799,7 @@ void LLPanel::childSetRect(const LLString& id, const LLRect& rect)
826 799
827bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const 800bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const
828{ 801{
829 LLView* child = getChildByName(id, true); 802 LLView* child = getChild<LLView>(id);
830 if (child) 803 if (child)
831 { 804 {
832 rect = child->getRect(); 805 rect = child->getRect();
@@ -837,7 +810,7 @@ bool LLPanel::childGetRect(const LLString& id, LLRect& rect) const
837 810
838void LLPanel::childSetFocus(const LLString& id, BOOL focus) 811void LLPanel::childSetFocus(const LLString& id, BOOL focus)
839{ 812{
840 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 813 LLUICtrl* child = getChild<LLUICtrl>(id, true);
841 if (child) 814 if (child)
842 { 815 {
843 child->setFocus(focus); 816 child->setFocus(focus);
@@ -846,7 +819,7 @@ void LLPanel::childSetFocus(const LLString& id, BOOL focus)
846 819
847BOOL LLPanel::childHasFocus(const LLString& id) 820BOOL LLPanel::childHasFocus(const LLString& id)
848{ 821{
849 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 822 LLUICtrl* child = getChild<LLUICtrl>(id, true);
850 if (child) 823 if (child)
851 { 824 {
852 return child->hasFocus(); 825 return child->hasFocus();
@@ -861,7 +834,7 @@ BOOL LLPanel::childHasFocus(const LLString& id)
861 834
862void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocusableElement*, void*), void* user_data) 835void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocusableElement*, void*), void* user_data)
863{ 836{
864 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 837 LLUICtrl* child = getChild<LLUICtrl>(id, true);
865 if (child) 838 if (child)
866 { 839 {
867 child->setFocusChangedCallback(cb, user_data); 840 child->setFocusChangedCallback(cb, user_data);
@@ -870,7 +843,7 @@ void LLPanel::childSetFocusChangedCallback(const LLString& id, void (*cb)(LLFocu
870 843
871void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, void*), void *userdata ) 844void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, void*), void *userdata )
872{ 845{
873 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 846 LLUICtrl* child = getChild<LLUICtrl>(id, true);
874 if (child) 847 if (child)
875 { 848 {
876 child->setCommitCallback(cb); 849 child->setCommitCallback(cb);
@@ -880,7 +853,7 @@ void LLPanel::childSetCommitCallback(const LLString& id, void (*cb)(LLUICtrl*, v
880 853
881void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), void *userdata ) 854void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*), void *userdata )
882{ 855{
883 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 856 LLUICtrl* child = getChild<LLUICtrl>(id, true);
884 if (child) 857 if (child)
885 { 858 {
886 child->setDoubleClickCallback(cb); 859 child->setDoubleClickCallback(cb);
@@ -893,7 +866,7 @@ void LLPanel::childSetDoubleClickCallback(const LLString& id, void (*cb)(void*),
893 866
894void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*)) 867void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*))
895{ 868{
896 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 869 LLUICtrl* child = getChild<LLUICtrl>(id, true);
897 if (child) 870 if (child)
898 { 871 {
899 child->setValidateBeforeCommit(cb); 872 child->setValidateBeforeCommit(cb);
@@ -902,7 +875,7 @@ void LLPanel::childSetValidate(const LLString& id, BOOL (*cb)(LLUICtrl*, void*))
902 875
903void LLPanel::childSetUserData(const LLString& id, void* userdata) 876void LLPanel::childSetUserData(const LLString& id, void* userdata)
904{ 877{
905 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 878 LLUICtrl* child = getChild<LLUICtrl>(id, true);
906 if (child) 879 if (child)
907 { 880 {
908 child->setCallbackUserData(userdata); 881 child->setCallbackUserData(userdata);
@@ -911,16 +884,16 @@ void LLPanel::childSetUserData(const LLString& id, void* userdata)
911 884
912void LLPanel::childSetColor(const LLString& id, const LLColor4& color) 885void LLPanel::childSetColor(const LLString& id, const LLColor4& color)
913{ 886{
914 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 887 LLUICtrl* child = getChild<LLUICtrl>(id, true);
915 if (child) 888 if (child)
916 { 889 {
917 child->setColor(color); 890 child->setColor(color);
918 } 891 }
919} 892}
920 893
921LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id) 894LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id) const
922{ 895{
923 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 896 LLUICtrl* child = getChild<LLUICtrl>(id, true);
924 if (child) 897 if (child)
925 { 898 {
926 return child->getSelectionInterface(); 899 return child->getSelectionInterface();
@@ -928,9 +901,9 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const LLString& id
928 return NULL; 901 return NULL;
929} 902}
930 903
931LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id) 904LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id) const
932{ 905{
933 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 906 LLUICtrl* child = getChild<LLUICtrl>(id, true);
934 if (child) 907 if (child)
935 { 908 {
936 return child->getListInterface(); 909 return child->getListInterface();
@@ -938,9 +911,9 @@ LLCtrlListInterface* LLPanel::childGetListInterface(const LLString& id)
938 return NULL; 911 return NULL;
939} 912}
940 913
941LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id) 914LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id) const
942{ 915{
943 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 916 LLUICtrl* child = getChild<LLUICtrl>(id, true);
944 if (child) 917 if (child)
945 { 918 {
946 return child->getScrollInterface(); 919 return child->getScrollInterface();
@@ -950,7 +923,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const LLString& id)
950 923
951void LLPanel::childSetValue(const LLString& id, LLSD value) 924void LLPanel::childSetValue(const LLString& id, LLSD value)
952{ 925{
953 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 926 LLView* child = getChild<LLView>(id, true);
954 if (child) 927 if (child)
955 { 928 {
956 child->setValue(value); 929 child->setValue(value);
@@ -959,7 +932,7 @@ void LLPanel::childSetValue(const LLString& id, LLSD value)
959 932
960LLSD LLPanel::childGetValue(const LLString& id) const 933LLSD LLPanel::childGetValue(const LLString& id) const
961{ 934{
962 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 935 LLView* child = getChild<LLView>(id, true);
963 if (child) 936 if (child)
964 { 937 {
965 return child->getValue(); 938 return child->getValue();
@@ -970,7 +943,7 @@ LLSD LLPanel::childGetValue(const LLString& id) const
970 943
971BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text) 944BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
972{ 945{
973 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 946 LLUICtrl* child = getChild<LLUICtrl>(id, true);
974 if (child) 947 if (child)
975 { 948 {
976 return child->setTextArg(key, text); 949 return child->setTextArg(key, text);
@@ -980,7 +953,7 @@ BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLS
980 953
981BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text) 954BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
982{ 955{
983 LLView* child = getChildByName(id, true); 956 LLView* child = getChild<LLView>(id);
984 if (child) 957 if (child)
985 { 958 {
986 return child->setLabelArg(key, text); 959 return child->setLabelArg(key, text);
@@ -1000,7 +973,7 @@ BOOL LLPanel::childSetToolTipArg(const LLString& id, const LLString& key, const
1000 973
1001void LLPanel::childSetMinValue(const LLString& id, LLSD min_value) 974void LLPanel::childSetMinValue(const LLString& id, LLSD min_value)
1002{ 975{
1003 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 976 LLUICtrl* child = getChild<LLUICtrl>(id, true);
1004 if (child) 977 if (child)
1005 { 978 {
1006 child->setMinValue(min_value); 979 child->setMinValue(min_value);
@@ -1009,7 +982,7 @@ void LLPanel::childSetMinValue(const LLString& id, LLSD min_value)
1009 982
1010void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value) 983void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value)
1011{ 984{
1012 LLUICtrl* child = (LLUICtrl*)getChildByName(id, true); 985 LLUICtrl* child = getChild<LLUICtrl>(id, true);
1013 if (child) 986 if (child)
1014 { 987 {
1015 child->setMaxValue(max_value); 988 child->setMaxValue(max_value);
@@ -1018,16 +991,16 @@ void LLPanel::childSetMaxValue(const LLString& id, LLSD max_value)
1018 991
1019void LLPanel::childShowTab(const LLString& id, const LLString& tabname, bool visible) 992void LLPanel::childShowTab(const LLString& id, const LLString& tabname, bool visible)
1020{ 993{
1021 LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id); 994 LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
1022 if (child) 995 if (child)
1023 { 996 {
1024 child->selectTabByName(tabname); 997 child->selectTabByName(tabname);
1025 } 998 }
1026} 999}
1027 1000
1028LLPanel *LLPanel::childGetVisibleTab(const LLString& id) 1001LLPanel *LLPanel::childGetVisibleTab(const LLString& id) const
1029{ 1002{
1030 LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id); 1003 LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
1031 if (child) 1004 if (child)
1032 { 1005 {
1033 return child->getCurrentPanel(); 1006 return child->getCurrentPanel();
@@ -1037,7 +1010,7 @@ LLPanel *LLPanel::childGetVisibleTab(const LLString& id)
1037 1010
1038void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata) 1011void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabname, void (*on_tab_clicked)(void*, bool), void *userdata)
1039{ 1012{
1040 LLTabContainerCommon* child = LLUICtrlFactory::getTabContainerByName(this, id); 1013 LLTabContainer* child = LLUICtrlFactory::getTabContainerByName(this, id);
1041 if (child) 1014 if (child)
1042 { 1015 {
1043 LLPanel *panel = child->getPanelByName(tabname); 1016 LLPanel *panel = child->getPanelByName(tabname);
@@ -1049,11 +1022,6 @@ void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabn
1049 } 1022 }
1050} 1023}
1051 1024
1052void LLPanel::childSetText(const LLString& id, const LLStringExplicit& text)
1053{
1054 childSetValue(id, LLSD(text));
1055}
1056
1057void LLPanel::childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data) 1025void LLPanel::childSetKeystrokeCallback(const LLString& id, void (*keystroke_callback)(LLLineEditor* caller, void* user_data), void *user_data)
1058{ 1026{
1059 LLLineEditor* child = LLUICtrlFactory::getLineEditorByName(this, id); 1027 LLLineEditor* child = LLUICtrlFactory::getLineEditorByName(this, id);
@@ -1076,11 +1044,6 @@ void LLPanel::childSetPrevalidate(const LLString& id, BOOL (*func)(const LLWStri
1076 } 1044 }
1077} 1045}
1078 1046
1079LLString LLPanel::childGetText(const LLString& id)
1080{
1081 return childGetValue(id).asString();
1082}
1083
1084void LLPanel::childSetWrappedText(const LLString& id, const LLString& text, bool visible) 1047void LLPanel::childSetWrappedText(const LLString& id, const LLString& text, bool visible)
1085{ 1048{
1086 LLTextBox* child = (LLTextBox*)getCtrlByNameAndType(id, WIDGET_TYPE_TEXT_BOX); 1049 LLTextBox* child = (LLTextBox*)getCtrlByNameAndType(id, WIDGET_TYPE_TEXT_BOX);
@@ -1111,7 +1074,7 @@ void LLPanel::childSetActionTextbox(const LLString& id, void(*function)(void*))
1111 1074
1112void LLPanel::childSetControlName(const LLString& id, const LLString& control_name) 1075void LLPanel::childSetControlName(const LLString& id, const LLString& control_name)
1113{ 1076{
1114 LLView* view = getChildByName(id, TRUE); 1077 LLView* view = getChild<LLView>(id);
1115 if (view) 1078 if (view)
1116 { 1079 {
1117 view->setControlName(control_name, NULL); 1080 view->setControlName(control_name, NULL);
@@ -1161,7 +1124,7 @@ void LLPanel::storeRectControl()
1161{ 1124{
1162 if( !mRectControl.empty() ) 1125 if( !mRectControl.empty() )
1163 { 1126 {
1164 LLUI::sConfigGroup->setRect( mRectControl, mRect ); 1127 LLUI::sConfigGroup->setRect( mRectControl, getRect() );
1165 } 1128 }
1166} 1129}
1167 1130
@@ -1231,6 +1194,19 @@ LLLayoutStack::~LLLayoutStack()
1231 std::for_each(mPanels.begin(), mPanels.end(), DeletePointer()); 1194 std::for_each(mPanels.begin(), mPanels.end(), DeletePointer());
1232} 1195}
1233 1196
1197// virtual
1198EWidgetType LLLayoutStack::getWidgetType() const
1199{
1200 return WIDGET_TYPE_LAYOUT_STACK;
1201}
1202
1203// virtual
1204LLString LLLayoutStack::getWidgetTag() const
1205{
1206 return LL_LAYOUT_STACK_TAG;
1207}
1208
1209
1234void LLLayoutStack::draw() 1210void LLLayoutStack::draw()
1235{ 1211{
1236 updateLayout(); 1212 updateLayout();
@@ -1343,23 +1319,13 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor
1343 return layout_stackp; 1319 return layout_stackp;
1344} 1320}
1345 1321
1346S32 LLLayoutStack::getMinWidth()
1347{
1348 return mMinWidth;
1349}
1350
1351S32 LLLayoutStack::getMinHeight()
1352{
1353 return mMinHeight;
1354}
1355
1356S32 LLLayoutStack::getDefaultHeight(S32 cur_height) 1322S32 LLLayoutStack::getDefaultHeight(S32 cur_height)
1357{ 1323{
1358 // if we are spanning our children (crude upward propagation of size) 1324 // if we are spanning our children (crude upward propagation of size)
1359 // then don't enforce our size on our children 1325 // then don't enforce our size on our children
1360 if (mOrientation == HORIZONTAL) 1326 if (mOrientation == HORIZONTAL)
1361 { 1327 {
1362 cur_height = llmax(mMinHeight, mRect.getHeight()); 1328 cur_height = llmax(mMinHeight, getRect().getHeight());
1363 } 1329 }
1364 1330
1365 return cur_height; 1331 return cur_height;
@@ -1371,7 +1337,7 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width)
1371 // then don't enforce our size on our children 1337 // then don't enforce our size on our children
1372 if (mOrientation == VERTICAL) 1338 if (mOrientation == VERTICAL)
1373 { 1339 {
1374 cur_width = llmax(mMinWidth, mRect.getWidth()); 1340 cur_width = llmax(mMinWidth, getRect().getWidth());
1375 } 1341 }
1376 1342
1377 return cur_width; 1343 return cur_width;
@@ -1497,15 +1463,15 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
1497 S32 pixels_to_distribute; 1463 S32 pixels_to_distribute;
1498 if (mOrientation == HORIZONTAL) 1464 if (mOrientation == HORIZONTAL)
1499 { 1465 {
1500 pixels_to_distribute = mRect.getWidth() - total_width; 1466 pixels_to_distribute = getRect().getWidth() - total_width;
1501 } 1467 }
1502 else //VERTICAL 1468 else //VERTICAL
1503 { 1469 {
1504 pixels_to_distribute = mRect.getHeight() - total_height; 1470 pixels_to_distribute = getRect().getHeight() - total_height;
1505 } 1471 }
1506 1472
1507 S32 cur_x = 0; 1473 S32 cur_x = 0;
1508 S32 cur_y = mRect.getHeight(); 1474 S32 cur_y = getRect().getHeight();
1509 1475
1510 for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) 1476 for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
1511 { 1477 {
@@ -1643,18 +1609,19 @@ void LLLayoutStack::updateLayout(BOOL force_resize)
1643 if (force_resize == FALSE 1609 if (force_resize == FALSE
1644 // layout did not complete by reaching target position 1610 // layout did not complete by reaching target position
1645 && ((mOrientation == VERTICAL && cur_y != -mPanelSpacing) 1611 && ((mOrientation == VERTICAL && cur_y != -mPanelSpacing)
1646 || (mOrientation == HORIZONTAL && cur_x != mRect.getWidth() + mPanelSpacing))) 1612 || (mOrientation == HORIZONTAL && cur_x != getRect().getWidth() + mPanelSpacing)))
1647 { 1613 {
1648 // do another layout pass with all stacked elements contributing 1614 // do another layout pass with all stacked elements contributing
1649 // even those that don't usually resize 1615 // even those that don't usually resize
1650 llassert_always(force_resize == FALSE); 1616 llassert_always(force_resize == FALSE);
1651 updateLayout(TRUE); 1617 updateLayout(TRUE);
1652 } 1618 }
1653} 1619} // end LLLayoutStack::updateLayout
1654 1620
1655LLLayoutStack::LLEmbeddedPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) 1621
1622LLLayoutStack::LLEmbeddedPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
1656{ 1623{
1657 e_panel_list_t::iterator panel_it; 1624 e_panel_list_t::const_iterator panel_it;
1658 for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it) 1625 for (panel_it = mPanels.begin(); panel_it != mPanels.end(); ++panel_it)
1659 { 1626 {
1660 if ((*panel_it)->mPanel == panelp) 1627 if ((*panel_it)->mPanel == panelp)