![[]](/images/special/trans.gif)
LibN2L-4 Library Code ReferenceClassesCompounds Files Members Method Index Full Reference cGuiSButtonSelectBox.cppGo to the documentation of this file.00001 /************************************************************************ 00002 Nova-2 Library (libN2L, or simply n2l) Game development C++ Library 00003 Copyright (C) 2002 Aaron Cameron 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 A copy of the GNU Lesser General Public License has been provided with 00020 this library in the file 'COPYING'. 00021 00022 Contact information for the author of this library has been provided 00023 with this library in the file 'AUTHOR'. 00024 ************************************************************************/ 00025 #include "gui/cGuiSButtonSelectBox.h" 00026 00027 #include "n2l/vfs.h" 00028 #include "n2l/dynVars.h" 00029 #include "n2l/resourceManagement.h" 00030 00031 #include "gui/cGuiCanvas.h" 00032 #include "gui/cGuiSlider.h" 00033 #include "gui/cGuiSButton.h" 00034 #include "gui/cGuiSimpleCallbackAction.h" 00035 #include "gui/cGuiSEInt.h" 00036 00037 #include "gui/cGuiFactory.h" 00038 00039 /******************************************************************************/ 00040 namespace n2l 00041 { 00042 00043 # ifdef N2L_PASSIVE_GUI_REG 00044 tBool cGuiSButtonSelectBox::smRegistered = 00045 cGuiFactory::current().registerLoader( "n2l::cGuiSButtonSelectBox", 00046 cGuiElement::loadNew<cGuiSButtonSelectBox> ); 00047 # endif 00048 00049 const tUint cGuiSButtonSelectBox::NoSelection( tUint(-1) ); 00050 00051 /**************************************************************************/ 00052 cGuiSButtonSelectBox::cGuiSButtonSelectBox() 00053 { 00054 reset(); 00055 } 00056 00057 /**************************************************************************/ 00058 cGuiSButtonSelectBox::cGuiSButtonSelectBox( const cVfsNodeInterface &iNode ) 00059 { 00060 reset(); 00061 load( iNode ); 00062 } 00063 00064 /**************************************************************************/ 00065 cGuiSButtonSelectBox::cGuiSButtonSelectBox( const cDynVar &iDefinition ) 00066 { 00067 reset(); 00068 load( iDefinition ); 00069 } 00070 00071 /**************************************************************************/ 00072 cGuiSButtonSelectBox::~cGuiSButtonSelectBox() 00073 { 00074 } 00075 00076 /**************************************************************************/ 00077 void cGuiSButtonSelectBox::load( const cVfsNodeInterface &iNode ) 00078 { 00079 cDynVar def; 00080 validateAndDecode( def, iNode, "n2l::cGuiSButtonSelectBox" ); 00081 load( def ); 00082 } 00083 00084 /**************************************************************************/ 00085 void cGuiSButtonSelectBox::load( const cDynVar &iDefinition ) 00086 { 00087 // Parent definitions 00088 cGuiInteractive::load( iDefinition ); 00089 00090 // Our definitions 00091 if (iDefinition.keyExists("multiple")) 00092 multiple( tSint(iDefinition["multiple"]) ); 00093 00094 // Get a template for the slider 00095 if (iDefinition.keyExists("slider")) { 00096 if (iDefinition["slider"].isArray()) 00097 slider( cGuiSlider(iDefinition["slider"]) ); 00098 else { 00099 // Cleanly catch bad casts so we can show an error, instead 00100 // of just exploding anonymously. 00101 try { 00102 const cAutoPtr<const cGuiSlider> Slider( 00103 cResourceManager::getGuiElement(iDefinition["slider"])); 00104 slider( *Slider ); 00105 } 00106 catch (const cBadCastException & iException) { 00107 throw cParsingException( "cGuiSButtonSelectBox::load", 00108 "Provided slider template file didn\'t " 00109 "define a slider"); 00110 } 00111 } 00112 } // slider was an array 00113 00114 // Check for buttons (This is super inefficient right now, 00115 // about 60% of these lookups could be removed) 00116 if (iDefinition.keyExists("buttons")) { 00117 const cDynVar::tConstIterator BEnd = iDefinition["buttons"].end(); 00118 for (cDynVar::tConstIterator b=iDefinition["buttons"].begin(); 00119 b!=BEnd; ++b) 00120 { 00121 cAutoPtr<const cGuiSButton> Template; 00122 if (b->second["button"].isArray()) 00123 Template = new cGuiSButton( b->second["button"] ); 00124 else { 00125 try { 00126 Template = cResourceManager::getGuiElement( 00127 b->second["button"]); 00128 } 00129 catch (const cBadCastException & iException) 00130 { 00131 throw cParsingException( "cGuiSButtonSelectBox::load", 00132 "Provided slider template file didn\'t " 00133 "define a slider"); 00134 } 00135 } 00136 addButton( b->second["value"], b->second["label"], *Template ); 00137 } 00138 } 00139 00140 if (iDefinition.keyExists("selected")) 00141 selected( iDefinition["selected"] ); 00142 00143 if (iDefinition.keyExists("noUnselect")) 00144 noUnselect( iDefinition["noUnselect"] ); 00145 00146 } 00147 00148 /**************************************************************************/ 00149 void cGuiSButtonSelectBox::draw() const 00150 { 00151 // Set the clipped canvas offset position if we should, 00152 // and draw the slider 00153 if (mSlider.isSet()) { 00154 mButtonsCanvas->innerOffset( tGuiPos(0.0f,-mSlider->value()) ); 00155 mSlider->draw(); 00156 } else { 00157 mButtonsCanvas->innerOffset( tGuiPos(0.0f,-mAltOffset) ); 00158 } 00159 00160 // Draw the clipped canvas 00161 mButtonsCanvas->draw(); 00162 } 00163 00164 /**************************************************************************/ 00165 void cGuiSButtonSelectBox::slider( const cGuiSlider &iSliderTemplate ) 00166 { 00167 mSlider = iSliderTemplate.clone(); 00168 // Down on the wheel and kp should go deeper into the list 00169 mSlider->swapWheel( true ); 00170 dimensionChanged(); 00171 } 00172 00173 /**************************************************************************/ 00174 const cAutoPtr<cGuiSButton> cGuiSButtonSelectBox::addButton( 00175 const cDynVar & iValue, const tString &iLabel, 00176 const cGuiSButton &iButtonTemplate ) 00177 { 00178 // Create the button from the template 00179 cAutoPtr<cGuiSButton> newButton( iButtonTemplate.clone() ); 00180 00181 if (!iLabel.empty()) 00182 newButton->label( iLabel ); 00183 newButton->type( cGuiSButton::Type_Toggle ); 00184 newButton->toggledOn( false ); 00185 newButton->pos(mNextButtonPos); 00186 newButton->bindAction( GuiActionType_Clicked, 00187 new cGuiSButtonSelectBox::cItemSelectedAction( this, iValue ), 00188 false ); 00189 mNextButtonPos.y() += newButton->size().y(); 00190 00191 // Add the value and buttons to our local containers 00192 mButtons.push_back( newButton ); 00193 mValues.push_back( iValue ); 00194 // We should have a more intelligent way of naming this. 00195 mButtonsCanvas->add( iLabel, newButton ); 00196 00197 // Update the slider to contain the correct number of values 00198 if (mSlider.isSet()) { 00199 mSlider->min(0.0f); 00200 mSlider->max(mNextButtonPos.y()); 00201 } 00202 return newButton; 00203 } 00204 00205 /**************************************************************************/ 00206 void cGuiSButtonSelectBox::multiple( const tBool iMultiple ) 00207 { 00208 mMultiple = iMultiple; 00209 } 00210 00211 /**************************************************************************/ 00212 const tBool cGuiSButtonSelectBox::multiple() const 00213 { 00214 return mMultiple; 00215 } 00216 00217 /**************************************************************************/ 00218 void cGuiSButtonSelectBox::noUnselect( const tBool iNoUnselect ) 00219 { 00220 mNoUnselect = iNoUnselect; 00221 } 00222 00223 /**************************************************************************/ 00224 const tBool cGuiSButtonSelectBox::noUnselect() const 00225 { 00226 return mNoUnselect; 00227 } 00228 00229 /**************************************************************************/ 00230 const tUint cGuiSButtonSelectBox::numButtons() const 00231 { 00232 return mButtons.size(); 00233 } 00234 00235 /**************************************************************************/ 00236 void cGuiSButtonSelectBox::systemEvent( 00237 const cAutoPtr<const cEventInterface> &i_iEvent ) 00238 { 00239 cGuiInteractive::systemEvent( i_iEvent ); 00240 00241 if (i_iEvent->type()==EventType_MouseButton) 00242 { 00243 const cAutoPtr<const cMouseButtonEvent> Click( i_iEvent ); 00244 if (Click->pressed() && isOver()) focus(true); 00245 // Intercept up and down clicks and send them to the 00246 // slider instead of the canvas so that the wheel works 00247 // anywhere on the widget, rather than just on the 00248 // slide bar 00249 if ((Click->button()==MouseButton_Up || 00250 Click->button()==MouseButton_Down) && 00251 collides( Click->pos() ) ) 00252 { 00253 if (mSlider.isSet()) { 00254 cAutoPtr<cMouseButtonEvent> fakeClick( 00255 new cMouseButtonEvent(*Click) ); 00256 fakeClick->pos( mSlider->pos() ); 00257 mSlider->systemEvent( fakeClick ); 00258 } 00259 } else { 00260 // Slider is in here so we don't double send to it if 00261 // the up or down wheel is used. 00262 if (mSlider.isSet()) mSlider->systemEvent( i_iEvent ); 00263 mButtonsCanvas->systemEvent( i_iEvent ); 00264 } 00265 } else {// if this is a mouse button. 00266 if (mSlider.isSet()) mSlider->systemEvent( i_iEvent ); 00267 mButtonsCanvas->systemEvent( i_iEvent ); 00268 } 00269 00270 } 00271 00272 /**************************************************************************/ 00273 void cGuiSButtonSelectBox::systemEventOutside( 00274 const cAutoPtr<const cEventInterface> &i_iEvent ) 00275 { 00276 cGuiInteractive::systemEventOutside( i_iEvent ); 00277 mButtonsCanvas->systemEventOutside( i_iEvent ); 00278 if (mSlider.isSet()) mSlider->systemEventOutside( i_iEvent ); 00279 } 00280 00281 /**************************************************************************/ 00282 void cGuiSButtonSelectBox::update( const tUint iTimePassed ) 00283 { 00284 cGuiInteractive::update( iTimePassed ); 00285 00286 const tButtonContainer::iterator Last = mButtons.end(); 00287 for (tButtonContainer::iterator i = mButtons.begin(); i!=Last; ++i) 00288 (*i)->update( iTimePassed ); 00289 } 00290 00291 /**************************************************************************/ 00292 void cGuiSButtonSelectBox::clearSelections() 00293 { 00294 if (mMultiple) { 00295 for (tUint i=0; i!=mButtons.size(); ++i) 00296 if (mButtons[i]->toggledOn()) { 00297 mButtons[i]->toggledOn( false ); 00298 broadcastUnselected(i); 00299 } 00300 } else { 00301 if (mButtons.size() > mSelected) { 00302 mButtons[mSelected]->toggledOn( false ); 00303 broadcastUnselected(mSelected); 00304 } 00305 mSelected = NoSelection; 00306 } 00307 } 00308 00309 /**************************************************************************/ 00310 void cGuiSButtonSelectBox::clearButtons() 00311 { 00312 mSelected = NoSelection; 00313 mNextButtonPos.set(0.0f,0.0f); 00314 mValues.clear(); 00315 mButtons.clear(); 00316 mButtonsCanvas->clear(); 00317 if (mSlider.isSet()) mSlider->value(0); 00318 mAltOffset = 0.0f; 00319 } 00320 00321 /**************************************************************************/ 00322 void cGuiSButtonSelectBox::selected( const cDynVar &iValue ) 00323 { 00324 for (tUint i=0; i!=mValues.size(); ++i) 00325 if (mValues[i]==iValue) { 00326 selectedByIndex(i); 00327 return; 00328 } 00329 } 00330 00331 /**************************************************************************/ 00332 void cGuiSButtonSelectBox::selectedByLabel( const cDynVar &iValue ) 00333 { 00334 for (tUint i=0; i!=mButtons.size(); ++i) 00335 if (mButtons[i]->label()==iValue) { 00336 selectedByIndex(i); 00337 return; 00338 } 00339 } 00340 00341 /**************************************************************************/ 00342 void cGuiSButtonSelectBox::selectedByIndex( const tUint &iIndex ) 00343 { 00344 if (iIndex>=mButtons.size()) 00345 throw cOutOfBoundsException( 00346 "cGuiSButtonSelectBox::selectedByIndex", 00347 "Selected index does not exist in this list" ); 00348 00349 if (multiple()) { 00350 if (mButtons[iIndex]->toggledOn()) 00351 broadcastSelected(iIndex); 00352 else 00353 broadcastUnselected(iIndex); 00354 00355 } else { 00356 if (iIndex==mSelected && noUnselect()) { 00357 mButtons[mSelected]->toggledOn(true); 00358 return; 00359 } 00360 00361 if (mSelected != NoSelection) { 00362 mButtons[mSelected]->toggledOn(false); 00363 broadcastUnselected(mSelected); 00364 } 00365 00366 if (iIndex!=mSelected) { 00367 mButtons[iIndex]->toggledOn(true); 00368 mSelected = iIndex; 00369 broadcastSelected(iIndex); 00370 } else 00371 mSelected = NoSelection; 00372 } 00373 00374 // Do stuff. 00375 } 00376 00377 /**************************************************************************/ 00378 void cGuiSButtonSelectBox::selectNext() 00379 { 00380 if (mButtons.empty()) return; 00381 tUint s = mSelected; 00382 if (s==NoSelection) { 00383 tUint b = 0; 00384 while (b != mButtons.size() && !mButtons[b]->enabled()) ++b; 00385 if (b==mButtons.size()) clearSelections(); 00386 else selected( mValues[b] ); 00387 return; 00388 } 00389 do { 00390 ++s; 00391 } while (s!=mButtons.size() && !mButtons[s]->enabled()); 00392 00393 if (s==mButtons.size()) { 00394 clearSelections(); 00395 selectNext(); 00396 } else 00397 selected( mValues[s] ); 00398 } 00399 00400 /**************************************************************************/ 00401 void cGuiSButtonSelectBox::selectPrev() 00402 { 00403 if (mButtons.empty()) return; 00404 tSint s = mSelected; 00405 if (tUint(s)==NoSelection) { 00406 tSint b = mButtons.size()-1; 00407 while (b != -1 && !mButtons[b]->enabled()) --b; 00408 if (b==-1) clearSelections(); 00409 else selected( mValues[tUint(b)] ); 00410 return; 00411 } 00412 do { 00413 --s; 00414 } while (s!=-1 && !mButtons[s]->enabled()); 00415 if (s==-1) { 00416 if (!mButtons[mButtons.size()-1]->enabled()) { 00417 clearSelections(); 00418 selectPrev(); 00419 } else 00420 selected( mValues[mButtons.size()-1] ); 00421 } else 00422 selected( mValues[s] ); 00423 } 00424 00425 /**************************************************************************/ 00426 const cAutoPtr<cGuiSButton> &cGuiSButtonSelectBox::getButton( 00427 const cDynVar &iValue ) 00428 { 00429 static const cAutoPtr<cGuiSButton> NoValue = 0; 00430 for (tUint i=0; i!=mValues.size(); ++i) 00431 if (mValues[i]==iValue) { 00432 return getButtonByIndex(i); 00433 } 00434 return NoValue; 00435 } 00436 00437 /**************************************************************************/ 00438 const cAutoPtr<cGuiSButton> &cGuiSButtonSelectBox::getButtonByLabel( 00439 const cDynVar &iLabel ) 00440 { 00441 static const cAutoPtr<cGuiSButton> NoValue = 0; 00442 for (tUint i=0; i!=mButtons.size(); ++i) 00443 if (mButtons[i]->label()==iLabel) { 00444 return getButtonByIndex(i); 00445 } 00446 return NoValue; 00447 } 00448 00449 /**************************************************************************/ 00450 const cAutoPtr<cGuiSButton> &cGuiSButtonSelectBox::getButtonByIndex( 00451 const tUint &iIndex ) 00452 { 00453 if (iIndex>=mButtons.size()) 00454 throw cOutOfBoundsException( 00455 "cGuiSButtonSelectBox::getButtonByIndex", 00456 "Selected index does not exist in this list" ); 00457 00458 return mButtons[iIndex]; 00459 } 00460 00461 /**************************************************************************/ 00462 const cDynVar &cGuiSButtonSelectBox::selected() const 00463 { 00464 if (multiple()) { 00465 mTmpValueList = cDynVar::Array; 00466 for (tUint i=0; i!=mButtons.size(); ++i) 00467 if (mButtons[i]->toggledOn()) 00468 mTmpValueList.insert( mValues[i] ); 00469 return mTmpValueList; 00470 } 00471 if (mSelected==NoSelection) 00472 return cDynVar::Null; 00473 return mValues[mSelected]; 00474 } 00475 00476 /**************************************************************************/ 00477 const cDynVar &cGuiSButtonSelectBox::getValueByLabel( 00478 const cDynVar &iValue ) 00479 { 00480 for (tUint i=0; i!=mButtons.size(); ++i) 00481 if (mButtons[i]->label()==iValue) 00482 return mValues[i]; 00483 return cDynVar::Null; 00484 } 00485 00486 /**************************************************************************/ 00487 const cDynVar &cGuiSButtonSelectBox::getValueByIndex( 00488 const tUint &iIndex ) const 00489 { 00490 if (iIndex>=mValues.size()) 00491 throw cOutOfBoundsException( "cGuiSButton::getValueByIndex", 00492 "Provided index is out of range", asString(iIndex) ); 00493 return mValues[iIndex]; 00494 } 00495 00496 /**************************************************************************/ 00497 const tBool cGuiSButtonSelectBox::wantsFocus() const 00498 { 00499 return true; 00500 } 00501 00502 /**************************************************************************/ 00503 const cAutoPtr<cGuiElement> cGuiSButtonSelectBox::clone() const 00504 { 00505 cAutoPtr<cGuiElement> newElement( new cGuiSButtonSelectBox ); 00506 cloneInto( newElement ); 00507 return newElement; 00508 } 00509 00510 /**************************************************************************/ 00511 void cGuiSButtonSelectBox::cloneInto( 00512 const cAutoPtr<cGuiSButtonSelectBox> &i_ioElement ) const 00513 { 00514 // Parent Properties first 00515 cGuiInteractive::cloneInto( i_ioElement ); 00516 00517 // Now our properties. 00518 if (mSlider) i_ioElement->slider( *mSlider ); 00519 i_ioElement->multiple( mMultiple ); 00520 00521 // Add our children 00522 const tUint NumButtons( mValues.size() ); 00523 for (tUint i=0; i<NumButtons; ++i) 00524 i_ioElement->addButton( mValues[i], mButtons[i]->label(), 00525 *(mButtons[i]) ); 00526 00527 if (mSelected!=NoSelection) 00528 i_ioElement->selected( mValues[mSelected] ); 00529 00530 i_ioElement->noUnselect( noUnselect() ); 00531 00532 i_ioElement->mAltOffset = mAltOffset; 00533 } 00534 00535 /**************************************************************************/ 00536 void cGuiSButtonSelectBox::dimensionChanged() 00537 { 00538 // Make sure our parents have a chance to react to this 00539 cGuiInteractive::dimensionChanged(); 00540 00541 // Remap our children to fit in our new dimensions 00542 tFloat sliderSpace( 0.0f ); 00543 if (mSlider.isSet()) { 00544 sliderSpace = mSlider->size().x(); 00545 mSlider->pos( tGuiPos(innerPos().x()+innerSize().x()-sliderSpace, 00546 innerPos().y()) ); 00547 mSlider->size( tGuiPos(sliderSpace, innerSize().y()) ); 00548 mSlider->range(size().y()); 00549 mSlider->max(size().y()); 00550 } 00551 00552 mButtonsCanvas->pos( innerPos() ); 00553 mButtonsCanvas->size( tGuiPos(innerSize().x()-sliderSpace, 00554 innerSize().y()) ); 00555 00556 // We could and should have an option to keep button sizes 00557 // fixed, or automatically scale them to the size allocated. 00558 // When that option is added, we'd go through our buttons here 00559 // and set the size to match the buttons canvas size. 00560 } 00561 00562 /**************************************************************************/ 00563 void cGuiSButtonSelectBox::processKey( const tKey &iKey, 00564 const tKeyMods &iMods ) 00565 { 00566 switch (iKey) { 00567 case Key_Down: 00568 case Key_KP2: 00569 selectNext(); 00570 break; 00571 case Key_Up: 00572 case Key_KP8: 00573 selectPrev(); 00574 break; 00575 default: 00576 break; 00577 } 00578 } 00579 00580 /**************************************************************************/ 00581 void cGuiSButtonSelectBox::keystrokeCallback( cGuiElement *const i_ioElement, 00582 const tGuiActionType iType, const tActionData &iData ) 00583 { 00584 if (!tBool(iData["pressed"])) return; 00585 dynamic_cast<cGuiSButtonSelectBox*>(i_ioElement)->processKey( 00586 tKey(tSint(iData["key"])), tKeyMods(tSint(iData["mods"])) ); 00587 } 00588 00589 /**************************************************************************/ 00590 void cGuiSButtonSelectBox::broadcastUnselected( const tUint &iIndex ) 00591 { 00592 cDynVar actionData( cDynVar::Array ); 00593 actionData["name"] = name(); 00594 actionData["value"] = mValues[iIndex]; 00595 actionData["index"] = tSint(iIndex); 00596 broadcastAction( GuiActionType_Unselected, actionData ); 00597 00598 actionData["name"] = mButtons[iIndex]->name(); 00599 actionData["selectBoxName"] = name(); 00600 actionData["enabled"] = mButtons[iIndex]->enabled(); 00601 mButtons[iIndex]->broadcastAction( GuiActionType_Unselected, 00602 actionData ); 00603 } 00604 00605 /**************************************************************************/ 00606 void cGuiSButtonSelectBox::broadcastSelected( const tUint &iIndex ) 00607 { 00608 cDynVar actionData( cDynVar::Array ); 00609 actionData["name"] = name(); 00610 actionData["selectedValue"] = mValues[iIndex]; // Compat 00611 actionData["value"] = mValues[iIndex]; 00612 actionData["index"] = tSint(iIndex); 00613 broadcastAction( GuiActionType_Selected, actionData ); 00614 00615 actionData["name"] = mButtons[iIndex]->name(); 00616 actionData["selectBoxName"] = name(); 00617 actionData["enabled"] = mButtons[iIndex]->enabled(); 00618 mButtons[iIndex]->broadcastAction( GuiActionType_Selected, 00619 actionData ); 00620 } 00621 00622 /**************************************************************************/ 00623 void cGuiSButtonSelectBox::reset() 00624 { 00625 // Set up an empty canvas 00626 mButtonsCanvas = new cGuiCanvas; 00627 mButtonsCanvas->clipping( true ); 00628 00629 // We have no slider 00630 mSlider = 0; 00631 mAltOffset = 0.0f; 00632 00633 // Make this a single select box 00634 mMultiple = false; 00635 mNoUnselect = false; 00636 mSelected = NoSelection; 00637 00638 // Start the button placement over. 00639 mNextButtonPos.set(0.0f,0.0f); 00640 00641 bindAction( GuiActionType_Keystroke, 00642 new cGuiSimpleCallbackAction<cGuiSButtonSelectBox::keystrokeCallback>, 00643 false ); 00644 } 00645 00646 /**************************************************************************/ 00647 cGuiSButtonSelectBox::cItemSelectedAction::cItemSelectedAction( 00648 cGuiSButtonSelectBox *const iParent, const cDynVar &iValue ) : 00649 mParent( iParent ), 00650 mValue( iValue ) 00651 { 00652 } 00653 00654 /**************************************************************************/ 00655 cGuiSButtonSelectBox::cItemSelectedAction::~cItemSelectedAction() 00656 { 00657 } 00658 00659 /**************************************************************************/ 00660 void cGuiSButtonSelectBox::cItemSelectedAction::execute( 00661 cGuiElement *const i_ioElement, const tGuiActionType iType, 00662 const tActionData &iData ) 00663 { 00664 if (iData["enabled"]) 00665 mParent->selected( mValue ); 00666 } 00667 00668 /**************************************************************************/ 00669 const cAutoPtr<cGuiACInt> 00670 cGuiSButtonSelectBox::cItemSelectedAction::clone() const 00671 { 00672 throw cUnsupportedMethodException( 00673 "cGuiSButtonSelectBox::cItemSelectedAction::clone", 00674 "This class may not be cloned." ); 00675 /* cAutoPtr<cGuiSButtonSelectBox::cItemSelectedAction> action = 00676 new cGuiSButtonSelectBox::cItemSelectedAction(); 00677 00678 cloneInto( action ); 00679 return action; 00680 */ 00681 } 00682 00683 /**************************************************************************/ 00684 void cGuiSButtonSelectBox::cItemSelectedAction::cloneInto( 00685 const cAutoPtr<cItemSelectedAction> &ioElement ) const 00686 { 00687 throw cUnsupportedMethodException( 00688 "cGuiSButtonSelectBox::cItemSelectedAction::cloneInto", 00689 "This class may not be cloned." ); 00690 } 00691 00692 } // namespace n2l |