diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llui/llfloater.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/llfloater.cpp | 242 |
1 files changed, 131 insertions, 111 deletions
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp index 759fae0..e795ad2 100644 --- a/linden/indra/llui/llfloater.cpp +++ b/linden/indra/llui/llfloater.cpp | |||
@@ -56,14 +56,12 @@ | |||
56 | #include "lltabcontainer.h" | 56 | #include "lltabcontainer.h" |
57 | #include "v2math.h" | 57 | #include "v2math.h" |
58 | 58 | ||
59 | extern BOOL gNoRender; | ||
60 | |||
61 | const S32 MINIMIZED_WIDTH = 160; | 59 | const S32 MINIMIZED_WIDTH = 160; |
62 | const S32 CLOSE_BOX_FROM_TOP = 1; | 60 | const S32 CLOSE_BOX_FROM_TOP = 1; |
63 | // use this to control "jumping" behavior when Ctrl-Tabbing | 61 | // use this to control "jumping" behavior when Ctrl-Tabbing |
64 | const S32 TABBED_FLOATER_OFFSET = 0; | 62 | const S32 TABBED_FLOATER_OFFSET = 0; |
65 | 63 | ||
66 | LLString LLFloater::sButtonActiveImageNames[BUTTON_COUNT] = | 64 | std::string LLFloater::sButtonActiveImageNames[BUTTON_COUNT] = |
67 | { | 65 | { |
68 | "UIImgBtnCloseActiveUUID", //BUTTON_CLOSE | 66 | "UIImgBtnCloseActiveUUID", //BUTTON_CLOSE |
69 | "UIImgBtnRestoreActiveUUID", //BUTTON_RESTORE | 67 | "UIImgBtnRestoreActiveUUID", //BUTTON_RESTORE |
@@ -72,7 +70,7 @@ LLString LLFloater::sButtonActiveImageNames[BUTTON_COUNT] = | |||
72 | "UIImgBtnCloseActiveUUID", //BUTTON_EDIT | 70 | "UIImgBtnCloseActiveUUID", //BUTTON_EDIT |
73 | }; | 71 | }; |
74 | 72 | ||
75 | LLString LLFloater::sButtonInactiveImageNames[BUTTON_COUNT] = | 73 | std::string LLFloater::sButtonInactiveImageNames[BUTTON_COUNT] = |
76 | { | 74 | { |
77 | "UIImgBtnCloseInactiveUUID", //BUTTON_CLOSE | 75 | "UIImgBtnCloseInactiveUUID", //BUTTON_CLOSE |
78 | "UIImgBtnRestoreInactiveUUID", //BUTTON_RESTORE | 76 | "UIImgBtnRestoreInactiveUUID", //BUTTON_RESTORE |
@@ -81,7 +79,7 @@ LLString LLFloater::sButtonInactiveImageNames[BUTTON_COUNT] = | |||
81 | "UIImgBtnCloseInactiveUUID", //BUTTON_EDIT | 79 | "UIImgBtnCloseInactiveUUID", //BUTTON_EDIT |
82 | }; | 80 | }; |
83 | 81 | ||
84 | LLString LLFloater::sButtonPressedImageNames[BUTTON_COUNT] = | 82 | std::string LLFloater::sButtonPressedImageNames[BUTTON_COUNT] = |
85 | { | 83 | { |
86 | "UIImgBtnClosePressedUUID", //BUTTON_CLOSE | 84 | "UIImgBtnClosePressedUUID", //BUTTON_CLOSE |
87 | "UIImgBtnRestorePressedUUID", //BUTTON_RESTORE | 85 | "UIImgBtnRestorePressedUUID", //BUTTON_RESTORE |
@@ -90,7 +88,7 @@ LLString LLFloater::sButtonPressedImageNames[BUTTON_COUNT] = | |||
90 | "UIImgBtnClosePressedUUID", //BUTTON_EDIT | 88 | "UIImgBtnClosePressedUUID", //BUTTON_EDIT |
91 | }; | 89 | }; |
92 | 90 | ||
93 | LLString LLFloater::sButtonNames[BUTTON_COUNT] = | 91 | std::string LLFloater::sButtonNames[BUTTON_COUNT] = |
94 | { | 92 | { |
95 | "llfloater_close_btn", //BUTTON_CLOSE | 93 | "llfloater_close_btn", //BUTTON_CLOSE |
96 | "llfloater_restore_btn", //BUTTON_RESTORE | 94 | "llfloater_restore_btn", //BUTTON_RESTORE |
@@ -99,7 +97,7 @@ LLString LLFloater::sButtonNames[BUTTON_COUNT] = | |||
99 | "llfloater_edit_btn", //BUTTON_EDIT | 97 | "llfloater_edit_btn", //BUTTON_EDIT |
100 | }; | 98 | }; |
101 | 99 | ||
102 | LLString LLFloater::sButtonToolTips[BUTTON_COUNT] = | 100 | std::string LLFloater::sButtonToolTips[BUTTON_COUNT] = |
103 | { | 101 | { |
104 | #ifdef LL_DARWIN | 102 | #ifdef LL_DARWIN |
105 | "Close (Cmd-W)", //BUTTON_CLOSE | 103 | "Close (Cmd-W)", //BUTTON_CLOSE |
@@ -145,7 +143,7 @@ LLFloater::LLFloater() : | |||
145 | mHandle.bind(this); | 143 | mHandle.bind(this); |
146 | } | 144 | } |
147 | 145 | ||
148 | LLFloater::LLFloater(const LLString& name) | 146 | LLFloater::LLFloater(const std::string& name) |
149 | : LLPanel(name), mAutoFocus(TRUE) // automatically take focus when opened | 147 | : LLPanel(name), mAutoFocus(TRUE) // automatically take focus when opened |
150 | { | 148 | { |
151 | for (S32 i = 0; i < BUTTON_COUNT; i++) | 149 | for (S32 i = 0; i < BUTTON_COUNT; i++) |
@@ -153,12 +151,12 @@ LLFloater::LLFloater(const LLString& name) | |||
153 | mButtonsEnabled[i] = FALSE; | 151 | mButtonsEnabled[i] = FALSE; |
154 | mButtons[i] = NULL; | 152 | mButtons[i] = NULL; |
155 | } | 153 | } |
156 | LLString title; // null string | 154 | std::string title; // null string |
157 | initFloater(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults | 155 | initFloater(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults |
158 | } | 156 | } |
159 | 157 | ||
160 | 158 | ||
161 | LLFloater::LLFloater(const LLString& name, const LLRect& rect, const LLString& title, | 159 | LLFloater::LLFloater(const std::string& name, const LLRect& rect, const std::string& title, |
162 | BOOL resizable, | 160 | BOOL resizable, |
163 | S32 min_width, | 161 | S32 min_width, |
164 | S32 min_height, | 162 | S32 min_height, |
@@ -176,7 +174,7 @@ LLFloater::LLFloater(const LLString& name, const LLRect& rect, const LLString& t | |||
176 | initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); | 174 | initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); |
177 | } | 175 | } |
178 | 176 | ||
179 | LLFloater::LLFloater(const LLString& name, const LLString& rect_control, const LLString& title, | 177 | LLFloater::LLFloater(const std::string& name, const std::string& rect_control, const std::string& title, |
180 | BOOL resizable, | 178 | BOOL resizable, |
181 | S32 min_width, | 179 | S32 min_width, |
182 | S32 min_height, | 180 | S32 min_height, |
@@ -196,7 +194,7 @@ LLFloater::LLFloater(const LLString& name, const LLString& rect_control, const L | |||
196 | 194 | ||
197 | 195 | ||
198 | // Note: Floaters constructed from XML call init() twice! | 196 | // Note: Floaters constructed from XML call init() twice! |
199 | void LLFloater::initFloater(const LLString& title, | 197 | void LLFloater::initFloater(const std::string& title, |
200 | BOOL resizable, S32 min_width, S32 min_height, | 198 | BOOL resizable, S32 min_width, S32 min_height, |
201 | BOOL drag_on_left, BOOL minimizable, BOOL close_btn) | 199 | BOOL drag_on_left, BOOL minimizable, BOOL close_btn) |
202 | { | 200 | { |
@@ -291,12 +289,12 @@ void LLFloater::initFloater(const LLString& title, | |||
291 | 0, 0, | 289 | 0, 0, |
292 | DRAG_HANDLE_WIDTH, | 290 | DRAG_HANDLE_WIDTH, |
293 | getRect().getHeight() - LLPANEL_BORDER_WIDTH - close_box_size); | 291 | getRect().getHeight() - LLPANEL_BORDER_WIDTH - close_box_size); |
294 | mDragHandle = new LLDragHandleLeft("drag", drag_handle_rect, title ); | 292 | mDragHandle = new LLDragHandleLeft(std::string("drag"), drag_handle_rect, title ); |
295 | } | 293 | } |
296 | else // drag on top | 294 | else // drag on top |
297 | { | 295 | { |
298 | LLRect drag_handle_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); | 296 | LLRect drag_handle_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); |
299 | mDragHandle = new LLDragHandleTop( "Drag Handle", drag_handle_rect, title ); | 297 | mDragHandle = new LLDragHandleTop( std::string("Drag Handle"), drag_handle_rect, title ); |
300 | } | 298 | } |
301 | addChild(mDragHandle); | 299 | addChild(mDragHandle); |
302 | 300 | ||
@@ -310,28 +308,28 @@ void LLFloater::initFloater(const LLString& title, | |||
310 | // Resize bars (sides) | 308 | // Resize bars (sides) |
311 | const S32 RESIZE_BAR_THICKNESS = 3; | 309 | const S32 RESIZE_BAR_THICKNESS = 3; |
312 | mResizeBar[LLResizeBar::LEFT] = new LLResizeBar( | 310 | mResizeBar[LLResizeBar::LEFT] = new LLResizeBar( |
313 | "resizebar_left", | 311 | std::string("resizebar_left"), |
314 | this, | 312 | this, |
315 | LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0), | 313 | LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0), |
316 | min_width, S32_MAX, LLResizeBar::LEFT ); | 314 | min_width, S32_MAX, LLResizeBar::LEFT ); |
317 | addChild( mResizeBar[0] ); | 315 | addChild( mResizeBar[0] ); |
318 | 316 | ||
319 | mResizeBar[LLResizeBar::TOP] = new LLResizeBar( | 317 | mResizeBar[LLResizeBar::TOP] = new LLResizeBar( |
320 | "resizebar_top", | 318 | std::string("resizebar_top"), |
321 | this, | 319 | this, |
322 | LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS), | 320 | LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS), |
323 | min_height, S32_MAX, LLResizeBar::TOP ); | 321 | min_height, S32_MAX, LLResizeBar::TOP ); |
324 | addChild( mResizeBar[1] ); | 322 | addChild( mResizeBar[1] ); |
325 | 323 | ||
326 | mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar( | 324 | mResizeBar[LLResizeBar::RIGHT] = new LLResizeBar( |
327 | "resizebar_right", | 325 | std::string("resizebar_right"), |
328 | this, | 326 | this, |
329 | LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), | 327 | LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), |
330 | min_width, S32_MAX, LLResizeBar::RIGHT ); | 328 | min_width, S32_MAX, LLResizeBar::RIGHT ); |
331 | addChild( mResizeBar[2] ); | 329 | addChild( mResizeBar[2] ); |
332 | 330 | ||
333 | mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar( | 331 | mResizeBar[LLResizeBar::BOTTOM] = new LLResizeBar( |
334 | "resizebar_bottom", | 332 | std::string("resizebar_bottom"), |
335 | this, | 333 | this, |
336 | LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0), | 334 | LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0), |
337 | min_height, S32_MAX, LLResizeBar::BOTTOM ); | 335 | min_height, S32_MAX, LLResizeBar::BOTTOM ); |
@@ -340,28 +338,29 @@ void LLFloater::initFloater(const LLString& title, | |||
340 | 338 | ||
341 | // Resize handles (corners) | 339 | // Resize handles (corners) |
342 | mResizeHandle[0] = new LLResizeHandle( | 340 | mResizeHandle[0] = new LLResizeHandle( |
343 | "Resize Handle", | 341 | std::string("Resize Handle"), |
344 | LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0), | 342 | LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0), |
345 | min_width, | 343 | min_width, |
346 | min_height, | 344 | min_height, |
347 | LLResizeHandle::RIGHT_BOTTOM); | 345 | LLResizeHandle::RIGHT_BOTTOM); |
348 | addChild(mResizeHandle[0]); | 346 | addChild(mResizeHandle[0]); |
349 | 347 | ||
350 | mResizeHandle[1] = new LLResizeHandle( "resize", | 348 | mResizeHandle[1] = new LLResizeHandle( |
349 | std::string("resize"), | ||
351 | LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT), | 350 | LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT), |
352 | min_width, | 351 | min_width, |
353 | min_height, | 352 | min_height, |
354 | LLResizeHandle::RIGHT_TOP ); | 353 | LLResizeHandle::RIGHT_TOP ); |
355 | addChild(mResizeHandle[1]); | 354 | addChild(mResizeHandle[1]); |
356 | 355 | ||
357 | mResizeHandle[2] = new LLResizeHandle( "resize", | 356 | mResizeHandle[2] = new LLResizeHandle( std::string("resize"), |
358 | LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), | 357 | LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), |
359 | min_width, | 358 | min_width, |
360 | min_height, | 359 | min_height, |
361 | LLResizeHandle::LEFT_BOTTOM ); | 360 | LLResizeHandle::LEFT_BOTTOM ); |
362 | addChild(mResizeHandle[2]); | 361 | addChild(mResizeHandle[2]); |
363 | 362 | ||
364 | mResizeHandle[3] = new LLResizeHandle( "resize", | 363 | mResizeHandle[3] = new LLResizeHandle( std::string("resize"), |
365 | LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ), | 364 | LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ), |
366 | min_width, | 365 | min_width, |
367 | min_height, | 366 | min_height, |
@@ -650,31 +649,62 @@ void LLFloater::applyRectControl() | |||
650 | } | 649 | } |
651 | } | 650 | } |
652 | 651 | ||
653 | void LLFloater::setTitle( const LLString& title ) | 652 | void LLFloater::applyTitle() |
654 | { | 653 | { |
655 | if (gNoRender) | 654 | if (gNoRender) |
656 | { | 655 | { |
657 | return; | 656 | return; |
658 | } | 657 | } |
659 | if (mDragHandle) | 658 | |
660 | mDragHandle->setTitle( title ); | 659 | if (!mDragHandle) |
660 | { | ||
661 | return; | ||
662 | } | ||
663 | |||
664 | if (isMinimized() && !mShortTitle.empty()) | ||
665 | { | ||
666 | mDragHandle->setTitle( mShortTitle ); | ||
667 | } | ||
668 | else | ||
669 | { | ||
670 | mDragHandle->setTitle ( mTitle ); | ||
671 | } | ||
672 | } | ||
673 | |||
674 | const std::string& LLFloater::getCurrentTitle() const | ||
675 | { | ||
676 | return mDragHandle ? mDragHandle->getTitle() : LLStringUtil::null; | ||
661 | } | 677 | } |
662 | 678 | ||
663 | const LLString& LLFloater::getTitle() const | 679 | void LLFloater::setTitle( const std::string& title ) |
664 | { | 680 | { |
665 | return mDragHandle ? mDragHandle->getTitle() : LLString::null; | 681 | mTitle = title; |
682 | applyTitle(); | ||
666 | } | 683 | } |
667 | 684 | ||
668 | void LLFloater::setShortTitle( const LLString& short_title ) | 685 | std::string LLFloater::getTitle() |
686 | { | ||
687 | if (mTitle.empty()) | ||
688 | { | ||
689 | return mDragHandle ? mDragHandle->getTitle() : LLStringUtil::null; | ||
690 | } | ||
691 | else | ||
692 | { | ||
693 | return mTitle; | ||
694 | } | ||
695 | } | ||
696 | |||
697 | void LLFloater::setShortTitle( const std::string& short_title ) | ||
669 | { | 698 | { |
670 | mShortTitle = short_title; | 699 | mShortTitle = short_title; |
700 | applyTitle(); | ||
671 | } | 701 | } |
672 | 702 | ||
673 | LLString LLFloater::getShortTitle() | 703 | std::string LLFloater::getShortTitle() |
674 | { | 704 | { |
675 | if (mShortTitle.empty()) | 705 | if (mShortTitle.empty()) |
676 | { | 706 | { |
677 | return mDragHandle ? mDragHandle->getTitle() : LLString::null; | 707 | return mDragHandle ? mDragHandle->getTitle() : LLStringUtil::null; |
678 | } | 708 | } |
679 | else | 709 | else |
680 | { | 710 | { |
@@ -841,7 +871,7 @@ void LLFloater::setMinimized(BOOL minimize) | |||
841 | mResizeHandle[i]->setEnabled(FALSE); | 871 | mResizeHandle[i]->setEnabled(FALSE); |
842 | } | 872 | } |
843 | } | 873 | } |
844 | 874 | ||
845 | mMinimized = TRUE; | 875 | mMinimized = TRUE; |
846 | 876 | ||
847 | // Reshape *after* setting mMinimized | 877 | // Reshape *after* setting mMinimized |
@@ -890,12 +920,15 @@ void LLFloater::setMinimized(BOOL minimize) | |||
890 | mResizeHandle[i]->setEnabled(isResizable()); | 920 | mResizeHandle[i]->setEnabled(isResizable()); |
891 | } | 921 | } |
892 | } | 922 | } |
893 | 923 | ||
894 | mMinimized = FALSE; | 924 | mMinimized = FALSE; |
895 | 925 | ||
896 | // Reshape *after* setting mMinimized | 926 | // Reshape *after* setting mMinimized |
897 | reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); | 927 | reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); |
898 | } | 928 | } |
929 | |||
930 | applyTitle (); | ||
931 | |||
899 | make_ui_sound("UISndWindowClose"); | 932 | make_ui_sound("UISndWindowClose"); |
900 | updateButtons(); | 933 | updateButtons(); |
901 | } | 934 | } |
@@ -1083,38 +1116,37 @@ void LLFloater::removeDependentFloater(LLFloater* floaterp) | |||
1083 | floaterp->mDependeeHandle = LLHandle<LLFloater>(); | 1116 | floaterp->mDependeeHandle = LLHandle<LLFloater>(); |
1084 | } | 1117 | } |
1085 | 1118 | ||
1086 | // virtual | 1119 | BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButtons index) |
1087 | BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) | ||
1088 | { | 1120 | { |
1089 | if( mMinimized ) | 1121 | if( mButtonsEnabled[index] ) |
1090 | { | 1122 | { |
1091 | // Offer the click to the close button. | 1123 | LLButton* my_butt = mButtons[index]; |
1092 | if( mButtonsEnabled[BUTTON_CLOSE] ) | 1124 | S32 local_x = x - my_butt->getRect().mLeft; |
1093 | { | 1125 | S32 local_y = y - my_butt->getRect().mBottom; |
1094 | S32 local_x = x - mButtons[BUTTON_CLOSE]->getRect().mLeft; | ||
1095 | S32 local_y = y - mButtons[BUTTON_CLOSE]->getRect().mBottom; | ||
1096 | |||
1097 | if (mButtons[BUTTON_CLOSE]->pointInView(local_x, local_y) | ||
1098 | && mButtons[BUTTON_CLOSE]->handleMouseDown(local_x, local_y, mask)) | ||
1099 | { | ||
1100 | // close button handled it, return | ||
1101 | return TRUE; | ||
1102 | } | ||
1103 | } | ||
1104 | 1126 | ||
1105 | // Offer the click to the restore button. | 1127 | if ( |
1106 | if( mButtonsEnabled[BUTTON_RESTORE] ) | 1128 | my_butt->pointInView(local_x, local_y) && |
1129 | my_butt->handleMouseDown(local_x, local_y, mask)) | ||
1107 | { | 1130 | { |
1108 | S32 local_x = x - mButtons[BUTTON_RESTORE]->getRect().mLeft; | 1131 | // the button handled it |
1109 | S32 local_y = y - mButtons[BUTTON_RESTORE]->getRect().mBottom; | 1132 | return TRUE; |
1110 | |||
1111 | if (mButtons[BUTTON_RESTORE]->pointInView(local_x, local_y) | ||
1112 | && mButtons[BUTTON_RESTORE]->handleMouseDown(local_x, local_y, mask)) | ||
1113 | { | ||
1114 | // restore button handled it, return | ||
1115 | return TRUE; | ||
1116 | } | ||
1117 | } | 1133 | } |
1134 | } | ||
1135 | return FALSE; | ||
1136 | } | ||
1137 | |||
1138 | // virtual | ||
1139 | BOOL LLFloater::handleMouseDown(S32 x, S32 y, MASK mask) | ||
1140 | { | ||
1141 | if( mMinimized ) | ||
1142 | { | ||
1143 | // Offer the click to titlebar buttons. | ||
1144 | // Note: this block and the offerClickToButton helper method can be removed | ||
1145 | // because the parent container will handle it for us but we'll keep it here | ||
1146 | // for safety until after reworking the panel code to manage hidden children. | ||
1147 | if(offerClickToButton(x, y, mask, BUTTON_CLOSE)) return TRUE; | ||
1148 | if(offerClickToButton(x, y, mask, BUTTON_RESTORE)) return TRUE; | ||
1149 | if(offerClickToButton(x, y, mask, BUTTON_TEAR_OFF)) return TRUE; | ||
1118 | 1150 | ||
1119 | // Otherwise pass to drag handle for movement | 1151 | // Otherwise pass to drag handle for movement |
1120 | return mDragHandle->handleMouseDown(x, y, mask); | 1152 | return mDragHandle->handleMouseDown(x, y, mask); |
@@ -1249,6 +1281,7 @@ void LLFloater::onClickTearOff(void *userdata) | |||
1249 | LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get(); | 1281 | LLMultiFloater* new_host = (LLMultiFloater*)self->mLastHostHandle.get(); |
1250 | if (new_host) | 1282 | if (new_host) |
1251 | { | 1283 | { |
1284 | self->setMinimized(FALSE); // to reenable minimize button if it was minimized | ||
1252 | new_host->showFloater(self); | 1285 | new_host->showFloater(self); |
1253 | // make sure host is visible | 1286 | // make sure host is visible |
1254 | new_host->open(); | 1287 | new_host->open(); |
@@ -1341,7 +1374,7 @@ void LLFloater::draw() | |||
1341 | gl_rect_2d( left, top, right, bottom, getTransparentColor() ); | 1374 | gl_rect_2d( left, top, right, bottom, getTransparentColor() ); |
1342 | } | 1375 | } |
1343 | 1376 | ||
1344 | if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty()) | 1377 | if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getCurrentTitle().empty()) |
1345 | { | 1378 | { |
1346 | // draw highlight on title bar to indicate focus. RDW | 1379 | // draw highlight on title bar to indicate focus. RDW |
1347 | const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); | 1380 | const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); |
@@ -1421,31 +1454,15 @@ void LLFloater::draw() | |||
1421 | 1454 | ||
1422 | void LLFloater::setCanMinimize(BOOL can_minimize) | 1455 | void LLFloater::setCanMinimize(BOOL can_minimize) |
1423 | { | 1456 | { |
1424 | // removing minimize/restore button programmatically, | 1457 | // if removing minimize/restore button programmatically, |
1425 | // go ahead and uniminimize floater | 1458 | // go ahead and unminimize floater |
1426 | if (!can_minimize) | 1459 | if (!can_minimize) |
1427 | { | 1460 | { |
1428 | setMinimized(FALSE); | 1461 | setMinimized(FALSE); |
1429 | } | 1462 | } |
1430 | 1463 | ||
1431 | if (can_minimize) | 1464 | mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized(); |
1432 | { | 1465 | mButtonsEnabled[BUTTON_RESTORE] = can_minimize && isMinimized(); |
1433 | if (isMinimized()) | ||
1434 | { | ||
1435 | mButtonsEnabled[BUTTON_MINIMIZE] = FALSE; | ||
1436 | mButtonsEnabled[BUTTON_RESTORE] = TRUE; | ||
1437 | } | ||
1438 | else | ||
1439 | { | ||
1440 | mButtonsEnabled[BUTTON_MINIMIZE] = TRUE; | ||
1441 | mButtonsEnabled[BUTTON_RESTORE] = FALSE; | ||
1442 | } | ||
1443 | } | ||
1444 | else | ||
1445 | { | ||
1446 | mButtonsEnabled[BUTTON_MINIMIZE] = FALSE; | ||
1447 | mButtonsEnabled[BUTTON_RESTORE] = FALSE; | ||
1448 | } | ||
1449 | 1466 | ||
1450 | updateButtons(); | 1467 | updateButtons(); |
1451 | } | 1468 | } |
@@ -1484,28 +1501,28 @@ void LLFloater::setCanResize(BOOL can_resize) | |||
1484 | // Resize bars (sides) | 1501 | // Resize bars (sides) |
1485 | const S32 RESIZE_BAR_THICKNESS = 3; | 1502 | const S32 RESIZE_BAR_THICKNESS = 3; |
1486 | mResizeBar[0] = new LLResizeBar( | 1503 | mResizeBar[0] = new LLResizeBar( |
1487 | "resizebar_left", | 1504 | std::string("resizebar_left"), |
1488 | this, | 1505 | this, |
1489 | LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0), | 1506 | LLRect( 0, getRect().getHeight(), RESIZE_BAR_THICKNESS, 0), |
1490 | mMinWidth, S32_MAX, LLResizeBar::LEFT ); | 1507 | mMinWidth, S32_MAX, LLResizeBar::LEFT ); |
1491 | addChild( mResizeBar[0] ); | 1508 | addChild( mResizeBar[0] ); |
1492 | 1509 | ||
1493 | mResizeBar[1] = new LLResizeBar( | 1510 | mResizeBar[1] = new LLResizeBar( |
1494 | "resizebar_top", | 1511 | std::string("resizebar_top"), |
1495 | this, | 1512 | this, |
1496 | LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS), | 1513 | LLRect( 0, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_BAR_THICKNESS), |
1497 | mMinHeight, S32_MAX, LLResizeBar::TOP ); | 1514 | mMinHeight, S32_MAX, LLResizeBar::TOP ); |
1498 | addChild( mResizeBar[1] ); | 1515 | addChild( mResizeBar[1] ); |
1499 | 1516 | ||
1500 | mResizeBar[2] = new LLResizeBar( | 1517 | mResizeBar[2] = new LLResizeBar( |
1501 | "resizebar_right", | 1518 | std::string("resizebar_right"), |
1502 | this, | 1519 | this, |
1503 | LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), | 1520 | LLRect( getRect().getWidth() - RESIZE_BAR_THICKNESS, getRect().getHeight(), getRect().getWidth(), 0), |
1504 | mMinWidth, S32_MAX, LLResizeBar::RIGHT ); | 1521 | mMinWidth, S32_MAX, LLResizeBar::RIGHT ); |
1505 | addChild( mResizeBar[2] ); | 1522 | addChild( mResizeBar[2] ); |
1506 | 1523 | ||
1507 | mResizeBar[3] = new LLResizeBar( | 1524 | mResizeBar[3] = new LLResizeBar( |
1508 | "resizebar_bottom", | 1525 | std::string("resizebar_bottom"), |
1509 | this, | 1526 | this, |
1510 | LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0), | 1527 | LLRect( 0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0), |
1511 | mMinHeight, S32_MAX, LLResizeBar::BOTTOM ); | 1528 | mMinHeight, S32_MAX, LLResizeBar::BOTTOM ); |
@@ -1514,28 +1531,28 @@ void LLFloater::setCanResize(BOOL can_resize) | |||
1514 | 1531 | ||
1515 | // Resize handles (corners) | 1532 | // Resize handles (corners) |
1516 | mResizeHandle[0] = new LLResizeHandle( | 1533 | mResizeHandle[0] = new LLResizeHandle( |
1517 | "Resize Handle", | 1534 | std::string("Resize Handle"), |
1518 | LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0), | 1535 | LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, RESIZE_HANDLE_HEIGHT, getRect().getWidth(), 0), |
1519 | mMinWidth, | 1536 | mMinWidth, |
1520 | mMinHeight, | 1537 | mMinHeight, |
1521 | LLResizeHandle::RIGHT_BOTTOM); | 1538 | LLResizeHandle::RIGHT_BOTTOM); |
1522 | addChild(mResizeHandle[0]); | 1539 | addChild(mResizeHandle[0]); |
1523 | 1540 | ||
1524 | mResizeHandle[1] = new LLResizeHandle( "resize", | 1541 | mResizeHandle[1] = new LLResizeHandle( std::string("resize"), |
1525 | LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT), | 1542 | LLRect( getRect().getWidth() - RESIZE_HANDLE_WIDTH, getRect().getHeight(), getRect().getWidth(), getRect().getHeight() - RESIZE_HANDLE_HEIGHT), |
1526 | mMinWidth, | 1543 | mMinWidth, |
1527 | mMinHeight, | 1544 | mMinHeight, |
1528 | LLResizeHandle::RIGHT_TOP ); | 1545 | LLResizeHandle::RIGHT_TOP ); |
1529 | addChild(mResizeHandle[1]); | 1546 | addChild(mResizeHandle[1]); |
1530 | 1547 | ||
1531 | mResizeHandle[2] = new LLResizeHandle( "resize", | 1548 | mResizeHandle[2] = new LLResizeHandle( std::string("resize"), |
1532 | LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), | 1549 | LLRect( 0, RESIZE_HANDLE_HEIGHT, RESIZE_HANDLE_WIDTH, 0 ), |
1533 | mMinWidth, | 1550 | mMinWidth, |
1534 | mMinHeight, | 1551 | mMinHeight, |
1535 | LLResizeHandle::LEFT_BOTTOM ); | 1552 | LLResizeHandle::LEFT_BOTTOM ); |
1536 | addChild(mResizeHandle[2]); | 1553 | addChild(mResizeHandle[2]); |
1537 | 1554 | ||
1538 | mResizeHandle[3] = new LLResizeHandle( "resize", | 1555 | mResizeHandle[3] = new LLResizeHandle( std::string("resize"), |
1539 | LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ), | 1556 | LLRect( 0, getRect().getHeight(), RESIZE_HANDLE_WIDTH, getRect().getHeight() - RESIZE_HANDLE_HEIGHT ), |
1540 | mMinWidth, | 1557 | mMinWidth, |
1541 | mMinHeight, | 1558 | mMinHeight, |
@@ -1633,7 +1650,7 @@ void LLFloater::buildButtons() | |||
1633 | btn_rect, | 1650 | btn_rect, |
1634 | sButtonActiveImageNames[i], | 1651 | sButtonActiveImageNames[i], |
1635 | sButtonPressedImageNames[i], | 1652 | sButtonPressedImageNames[i], |
1636 | "", | 1653 | LLStringUtil::null, |
1637 | sButtonCallbacks[i], | 1654 | sButtonCallbacks[i], |
1638 | this, | 1655 | this, |
1639 | LLFontGL::sSansSerif); | 1656 | LLFontGL::sSansSerif); |
@@ -1657,7 +1674,7 @@ void LLFloater::buildButtons() | |||
1657 | ///////////////////////////////////////////////////// | 1674 | ///////////////////////////////////////////////////// |
1658 | // LLFloaterView | 1675 | // LLFloaterView |
1659 | 1676 | ||
1660 | LLFloaterView::LLFloaterView( const LLString& name, const LLRect& rect ) | 1677 | LLFloaterView::LLFloaterView( const std::string& name, const LLRect& rect ) |
1661 | : LLUICtrl( name, rect, FALSE, NULL, NULL, FOLLOWS_ALL ), | 1678 | : LLUICtrl( name, rect, FALSE, NULL, NULL, FOLLOWS_ALL ), |
1662 | mFocusCycleMode(FALSE), | 1679 | mFocusCycleMode(FALSE), |
1663 | mSnapOffsetBottom(0) | 1680 | mSnapOffsetBottom(0) |
@@ -2377,7 +2394,7 @@ LLMultiFloater::LLMultiFloater(LLTabContainer::TabPosition tab_pos) : | |||
2377 | 2394 | ||
2378 | } | 2395 | } |
2379 | 2396 | ||
2380 | LLMultiFloater::LLMultiFloater(const LLString &name) : | 2397 | LLMultiFloater::LLMultiFloater(const std::string &name) : |
2381 | LLFloater(name), | 2398 | LLFloater(name), |
2382 | mTabContainer(NULL), | 2399 | mTabContainer(NULL), |
2383 | mTabPos(LLTabContainer::TOP), | 2400 | mTabPos(LLTabContainer::TOP), |
@@ -2388,7 +2405,7 @@ LLMultiFloater::LLMultiFloater(const LLString &name) : | |||
2388 | } | 2405 | } |
2389 | 2406 | ||
2390 | LLMultiFloater::LLMultiFloater( | 2407 | LLMultiFloater::LLMultiFloater( |
2391 | const LLString& name, | 2408 | const std::string& name, |
2392 | const LLRect& rect, | 2409 | const LLRect& rect, |
2393 | LLTabContainer::TabPosition tab_pos, | 2410 | LLTabContainer::TabPosition tab_pos, |
2394 | BOOL auto_resize) : | 2411 | BOOL auto_resize) : |
@@ -2399,7 +2416,7 @@ LLMultiFloater::LLMultiFloater( | |||
2399 | mOrigMinWidth(0), | 2416 | mOrigMinWidth(0), |
2400 | mOrigMinHeight(0) | 2417 | mOrigMinHeight(0) |
2401 | { | 2418 | { |
2402 | mTabContainer = new LLTabContainer("Preview Tabs", | 2419 | mTabContainer = new LLTabContainer(std::string("Preview Tabs"), |
2403 | LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), | 2420 | LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), |
2404 | mTabPos, | 2421 | mTabPos, |
2405 | FALSE, | 2422 | FALSE, |
@@ -2414,8 +2431,8 @@ LLMultiFloater::LLMultiFloater( | |||
2414 | } | 2431 | } |
2415 | 2432 | ||
2416 | LLMultiFloater::LLMultiFloater( | 2433 | LLMultiFloater::LLMultiFloater( |
2417 | const LLString& name, | 2434 | const std::string& name, |
2418 | const LLString& rect_control, | 2435 | const std::string& rect_control, |
2419 | LLTabContainer::TabPosition tab_pos, | 2436 | LLTabContainer::TabPosition tab_pos, |
2420 | BOOL auto_resize) : | 2437 | BOOL auto_resize) : |
2421 | LLFloater(name, rect_control, name), | 2438 | LLFloater(name, rect_control, name), |
@@ -2425,7 +2442,7 @@ LLMultiFloater::LLMultiFloater( | |||
2425 | mOrigMinWidth(0), | 2442 | mOrigMinWidth(0), |
2426 | mOrigMinHeight(0) | 2443 | mOrigMinHeight(0) |
2427 | { | 2444 | { |
2428 | mTabContainer = new LLTabContainer("Preview Tabs", | 2445 | mTabContainer = new LLTabContainer(std::string("Preview Tabs"), |
2429 | LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), | 2446 | LLRect(LLPANEL_BORDER_WIDTH, getRect().getHeight() - LLFLOATER_HEADER_SIZE, getRect().getWidth() - LLPANEL_BORDER_WIDTH, 0), |
2430 | mTabPos, | 2447 | mTabPos, |
2431 | FALSE, | 2448 | FALSE, |
@@ -2863,7 +2880,7 @@ LLXMLNodePtr LLFloater::getXML(bool save_children) const | |||
2863 | { | 2880 | { |
2864 | LLXMLNodePtr node = LLPanel::getXML(); | 2881 | LLXMLNodePtr node = LLPanel::getXML(); |
2865 | 2882 | ||
2866 | node->createChild("title", TRUE)->setStringValue(getTitle()); | 2883 | node->createChild("title", TRUE)->setStringValue(getCurrentTitle()); |
2867 | 2884 | ||
2868 | node->createChild("can_resize", TRUE)->setBoolValue(isResizable()); | 2885 | node->createChild("can_resize", TRUE)->setBoolValue(isResizable()); |
2869 | 2886 | ||
@@ -2885,12 +2902,12 @@ LLXMLNodePtr LLFloater::getXML(bool save_children) const | |||
2885 | // static | 2902 | // static |
2886 | LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) | 2903 | LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) |
2887 | { | 2904 | { |
2888 | LLString name("floater"); | 2905 | std::string name("floater"); |
2889 | node->getAttributeString("name", name); | 2906 | node->getAttributeString("name", name); |
2890 | 2907 | ||
2891 | LLFloater *floaterp = new LLFloater(name); | 2908 | LLFloater *floaterp = new LLFloater(name); |
2892 | 2909 | ||
2893 | LLString filename; | 2910 | std::string filename; |
2894 | node->getAttributeString("filename", filename); | 2911 | node->getAttributeString("filename", filename); |
2895 | 2912 | ||
2896 | if (filename.empty()) | 2913 | if (filename.empty()) |
@@ -2909,10 +2926,10 @@ LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f | |||
2909 | 2926 | ||
2910 | void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) /* Flawfinder: ignore */ | 2927 | void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) /* Flawfinder: ignore */ |
2911 | { | 2928 | { |
2912 | LLString name(getName()); | 2929 | std::string name(getName()); |
2913 | LLString title(getTitle()); | 2930 | std::string title(getCurrentTitle()); |
2914 | LLString short_title(getShortTitle()); | 2931 | std::string short_title(getShortTitle()); |
2915 | LLString rect_control(""); | 2932 | std::string rect_control(""); |
2916 | BOOL resizable = isResizable(); | 2933 | BOOL resizable = isResizable(); |
2917 | S32 min_width = getMinWidth(); | 2934 | S32 min_width = getMinWidth(); |
2918 | S32 min_height = getMinHeight(); | 2935 | S32 min_height = getMinHeight(); |
@@ -2950,6 +2967,9 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor | |||
2950 | minimizable, | 2967 | minimizable, |
2951 | close_btn); | 2968 | close_btn); |
2952 | 2969 | ||
2970 | setTitle(title); | ||
2971 | applyTitle (); | ||
2972 | |||
2953 | setShortTitle(short_title); | 2973 | setShortTitle(short_title); |
2954 | 2974 | ||
2955 | BOOL can_tear_off; | 2975 | BOOL can_tear_off; |