diff options
Diffstat (limited to 'linden/indra/llui/llcheckboxctrl.cpp')
-rw-r--r-- | linden/indra/llui/llcheckboxctrl.cpp | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/linden/indra/llui/llcheckboxctrl.cpp b/linden/indra/llui/llcheckboxctrl.cpp index 33de4da..d383640 100644 --- a/linden/indra/llui/llcheckboxctrl.cpp +++ b/linden/indra/llui/llcheckboxctrl.cpp | |||
@@ -51,14 +51,14 @@ const U32 MAX_STRING_LENGTH = 10; | |||
51 | static LLRegisterWidget<LLCheckBoxCtrl> r("check_box"); | 51 | static LLRegisterWidget<LLCheckBoxCtrl> r("check_box"); |
52 | 52 | ||
53 | 53 | ||
54 | LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, | 54 | LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect, |
55 | const LLString& label, | 55 | const std::string& label, |
56 | const LLFontGL* font, | 56 | const LLFontGL* font, |
57 | void (*commit_callback)(LLUICtrl* ctrl, void* userdata), | 57 | void (*commit_callback)(LLUICtrl* ctrl, void* userdata), |
58 | void* callback_user_data, | 58 | void* callback_user_data, |
59 | BOOL initial_value, | 59 | BOOL initial_value, |
60 | BOOL use_radio_style, | 60 | BOOL use_radio_style, |
61 | const LLString& control_which) | 61 | const std::string& control_which) |
62 | : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP), | 62 | : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data, FOLLOWS_LEFT | FOLLOWS_TOP), |
63 | mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), | 63 | mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), |
64 | mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), | 64 | mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), |
@@ -93,13 +93,13 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, | |||
93 | 93 | ||
94 | // *HACK Get rid of this with SL-55508... | 94 | // *HACK Get rid of this with SL-55508... |
95 | // this allows blank check boxes and radio boxes for now | 95 | // this allows blank check boxes and radio boxes for now |
96 | LLString local_label = label; | 96 | std::string local_label = label; |
97 | if(local_label.empty()) | 97 | if(local_label.empty()) |
98 | { | 98 | { |
99 | local_label = " "; | 99 | local_label = " "; |
100 | } | 100 | } |
101 | 101 | ||
102 | mLabel = new LLTextBox( "CheckboxCtrl Label", label_rect, local_label.c_str(), mFont ); | 102 | mLabel = new LLTextBox( std::string("CheckboxCtrl Label"), label_rect, local_label, mFont ); |
103 | mLabel->setFollowsLeft(); | 103 | mLabel->setFollowsLeft(); |
104 | mLabel->setFollowsBottom(); | 104 | mLabel->setFollowsBottom(); |
105 | addChild(mLabel); | 105 | addChild(mLabel); |
@@ -112,18 +112,17 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, | |||
112 | LLCHECKBOXCTRL_VPAD, | 112 | LLCHECKBOXCTRL_VPAD, |
113 | LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING + text_width + LLCHECKBOXCTRL_HPAD, | 113 | LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING + text_width + LLCHECKBOXCTRL_HPAD, |
114 | llmax( text_height, LLCHECKBOXCTRL_BTN_SIZE ) + LLCHECKBOXCTRL_VPAD); | 114 | llmax( text_height, LLCHECKBOXCTRL_BTN_SIZE ) + LLCHECKBOXCTRL_VPAD); |
115 | LLString active_true_id, active_false_id; | 115 | std::string active_true_id, active_false_id; |
116 | LLString inactive_true_id, inactive_false_id; | 116 | std::string inactive_true_id, inactive_false_id; |
117 | if (mRadioStyle) | 117 | if (mRadioStyle) |
118 | { | 118 | { |
119 | active_true_id = "UIImgRadioActiveSelectedUUID"; | 119 | active_true_id = "UIImgRadioActiveSelectedUUID"; |
120 | active_false_id = "UIImgRadioActiveUUID"; | 120 | active_false_id = "UIImgRadioActiveUUID"; |
121 | inactive_true_id = "UIImgRadioInactiveSelectedUUID"; | 121 | inactive_true_id = "UIImgRadioInactiveSelectedUUID"; |
122 | inactive_false_id = "UIImgRadioInactiveUUID"; | 122 | inactive_false_id = "UIImgRadioInactiveUUID"; |
123 | mButton = new LLButton( | 123 | mButton = new LLButton(std::string("Radio control button"), btn_rect, |
124 | "Radio control button", btn_rect, | 124 | active_false_id, active_true_id, control_which, |
125 | active_false_id, active_true_id, control_which, | 125 | &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); |
126 | &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); | ||
127 | mButton->setDisabledImages( inactive_false_id, inactive_true_id ); | 126 | mButton->setDisabledImages( inactive_false_id, inactive_true_id ); |
128 | mButton->setHoverGlowStrength(0.35f); | 127 | mButton->setHoverGlowStrength(0.35f); |
129 | } | 128 | } |
@@ -133,10 +132,9 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect, | |||
133 | active_true_id = "UIImgCheckboxActiveSelectedUUID"; | 132 | active_true_id = "UIImgCheckboxActiveSelectedUUID"; |
134 | inactive_true_id = "UIImgCheckboxInactiveSelectedUUID"; | 133 | inactive_true_id = "UIImgCheckboxInactiveSelectedUUID"; |
135 | inactive_false_id = "UIImgCheckboxInactiveUUID"; | 134 | inactive_false_id = "UIImgCheckboxInactiveUUID"; |
136 | mButton = new LLButton( | 135 | mButton = new LLButton(std::string("Checkbox control button"), btn_rect, |
137 | "Checkbox control button", btn_rect, | 136 | active_false_id, active_true_id, control_which, |
138 | active_false_id, active_true_id, control_which, | 137 | &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); |
139 | &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::sSansSerif ); | ||
140 | mButton->setDisabledImages( inactive_false_id, inactive_true_id ); | 138 | mButton->setDisabledImages( inactive_false_id, inactive_true_id ); |
141 | mButton->setHoverGlowStrength(0.35f); | 139 | mButton->setHoverGlowStrength(0.35f); |
142 | } | 140 | } |
@@ -253,12 +251,12 @@ void LLCheckBoxCtrl::setLabel( const LLStringExplicit& label ) | |||
253 | reshape(getRect().getWidth(), getRect().getHeight(), FALSE); | 251 | reshape(getRect().getWidth(), getRect().getHeight(), FALSE); |
254 | } | 252 | } |
255 | 253 | ||
256 | LLString LLCheckBoxCtrl::getLabel() const | 254 | std::string LLCheckBoxCtrl::getLabel() const |
257 | { | 255 | { |
258 | return mLabel->getText(); | 256 | return mLabel->getText(); |
259 | } | 257 | } |
260 | 258 | ||
261 | BOOL LLCheckBoxCtrl::setLabelArg( const LLString& key, const LLStringExplicit& text ) | 259 | BOOL LLCheckBoxCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) |
262 | { | 260 | { |
263 | BOOL res = mLabel->setTextArg(key, text); | 261 | BOOL res = mLabel->setTextArg(key, text); |
264 | reshape(getRect().getWidth(), getRect().getHeight(), FALSE); | 262 | reshape(getRect().getWidth(), getRect().getHeight(), FALSE); |
@@ -266,13 +264,13 @@ BOOL LLCheckBoxCtrl::setLabelArg( const LLString& key, const LLStringExplicit& t | |||
266 | } | 264 | } |
267 | 265 | ||
268 | //virtual | 266 | //virtual |
269 | LLString LLCheckBoxCtrl::getControlName() const | 267 | std::string LLCheckBoxCtrl::getControlName() const |
270 | { | 268 | { |
271 | return mButton->getControlName(); | 269 | return mButton->getControlName(); |
272 | } | 270 | } |
273 | 271 | ||
274 | // virtual | 272 | // virtual |
275 | void LLCheckBoxCtrl::setControlName(const LLString& control_name, LLView* context) | 273 | void LLCheckBoxCtrl::setControlName(const std::string& control_name, LLView* context) |
276 | { | 274 | { |
277 | mButton->setControlName(control_name, context); | 275 | mButton->setControlName(control_name, context); |
278 | } | 276 | } |
@@ -307,7 +305,7 @@ LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const | |||
307 | 305 | ||
308 | node->createChild("label", TRUE)->setStringValue(mLabel->getText()); | 306 | node->createChild("label", TRUE)->setStringValue(mLabel->getText()); |
309 | 307 | ||
310 | LLString control_name = mButton->getControlName(); | 308 | std::string control_name = mButton->getControlName(); |
311 | 309 | ||
312 | node->createChild("initial_value", TRUE)->setBoolValue(mInitialValue); | 310 | node->createChild("initial_value", TRUE)->setBoolValue(mInitialValue); |
313 | 311 | ||
@@ -321,10 +319,10 @@ LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const | |||
321 | // static | 319 | // static |
322 | LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) | 320 | LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) |
323 | { | 321 | { |
324 | LLString name("checkbox"); | 322 | std::string name("checkbox"); |
325 | node->getAttributeString("name", name); | 323 | node->getAttributeString("name", name); |
326 | 324 | ||
327 | LLString label(""); | 325 | std::string label(""); |
328 | node->getAttributeString("label", label); | 326 | node->getAttributeString("label", label); |
329 | 327 | ||
330 | LLFontGL* font = LLView::selectFont(node); | 328 | LLFontGL* font = LLView::selectFont(node); |