| 684 | //----------------------------------------------------------------------------- |
| 685 | |
| 686 | bool GuiControl::onAdd() |
| 687 | { |
| 688 | // Let Parent Do Work. |
| 689 | if ( !Parent::onAdd() ) |
| 690 | return false; |
| 691 | |
| 692 | // Grab the classname of this object |
| 693 | const char *cName = getClassName(); |
| 694 | |
| 695 | // if we're a pure GuiControl, then we're a container by default. |
| 696 | if ( String::compare( "GuiControl", cName ) == 0 ) |
| 697 | mIsContainer = true; |
| 698 | |
| 699 | // Add to root group. |
| 700 | if ( mAddGroup == NULL ) |
| 701 | mAddGroup = Sim::getGuiGroup(); |
| 702 | mAddGroup->addObject(this); |
| 703 | |
| 704 | // If we don't have a profile we must assign one now. |
| 705 | // Try assigning one based on the control's class name... |
| 706 | if ( !mProfile ) |
| 707 | { |
| 708 | String name = getClassName(); |
| 709 | |
| 710 | if ( name.isNotEmpty() ) |
| 711 | { |
| 712 | U32 pos = name.find( "Ctrl" ); |
| 713 | |
| 714 | if ( pos != -1 ) |
| 715 | name.replace( pos, 4, "Profile" ); |
| 716 | else |
| 717 | name += "Profile"; |
| 718 | |
| 719 | GuiControlProfile *profile = NULL; |
| 720 | if ( Sim::findObject( name, profile ) ) |
| 721 | setControlProfile( profile ); |
| 722 | } |
| 723 | } |
| 724 | |
| 725 | // Try assigning the default profile... |
| 726 | if ( !mProfile ) |
| 727 | { |
| 728 | GuiControlProfile *profile = NULL; |
| 729 | Sim::findObject( "GuiDefaultProfile", profile ); |
| 730 | |
| 731 | AssertISV( profile != NULL, avar("GuiControl::onAdd() unable to find specified profile and GuiDefaultProfile does not exist!") ); |
| 732 | |
| 733 | setControlProfile( profile ); |
| 734 | } |
| 735 | |
| 736 | // We must also assign a valid TooltipProfile... |
| 737 | if ( !mTooltipProfile ) |
| 738 | { |
| 739 | GuiControlProfile *profile = NULL; |
| 740 | Sim::findObject( "GuiTooltipProfile", profile ); |
| 741 | |
| 742 | AssertISV( profile != NULL, avar("GuiControl::onAdd() unable to find specified tooltip profile and GuiTooltipProfile does not exist!") ); |
| 743 |
nothing calls this directly
no test coverage detected