----------------------------------------------------------------------------- GuiInspectorDynamicGroup - add custom controls -----------------------------------------------------------------------------
| 43 | // GuiInspectorDynamicGroup - add custom controls |
| 44 | //----------------------------------------------------------------------------- |
| 45 | bool GuiInspectorDynamicGroup::createContent() |
| 46 | { |
| 47 | if(!Parent::createContent()) |
| 48 | return false; |
| 49 | |
| 50 | // encapsulate the button in a dummy control. |
| 51 | GuiControl* shell = new GuiControl(); |
| 52 | shell->setDataField( StringTable->insert("profile"), NULL, "GuiTransparentProfile" ); |
| 53 | if( !shell->registerObject() ) |
| 54 | { |
| 55 | delete shell; |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | // add a button that lets us add new dynamic fields. |
| 60 | GuiBitmapButtonCtrl* addFieldBtn = new GuiBitmapButtonCtrl(); |
| 61 | { |
| 62 | SimObject* profilePtr = Sim::findObject("InspectorDynamicFieldButton"); |
| 63 | if( profilePtr != NULL ) |
| 64 | addFieldBtn->setControlProfile( dynamic_cast<GuiControlProfile*>(profilePtr) ); |
| 65 | |
| 66 | // FIXME Hardcoded image |
| 67 | addFieldBtn->setBitmap("tools/gui/images/iconAdd.png"); |
| 68 | |
| 69 | char commandBuf[64]; |
| 70 | dSprintf(commandBuf, 64, "%d.addDynamicField();", this->getId()); |
| 71 | addFieldBtn->setField("command", commandBuf); |
| 72 | addFieldBtn->setSizing(horizResizeLeft,vertResizeCenter); |
| 73 | //addFieldBtn->setField("buttonMargin", "2 2"); |
| 74 | addFieldBtn->resize(Point2I(getWidth() - 20,2), Point2I(16, 16)); |
| 75 | addFieldBtn->registerObject("zAddButton"); |
| 76 | } |
| 77 | |
| 78 | shell->resize(Point2I(0,0), Point2I(getWidth(), 28)); |
| 79 | shell->addObject(addFieldBtn); |
| 80 | |
| 81 | // save off the shell control, so we can push it to the bottom of the stack in inspectGroup() |
| 82 | mAddCtrl = shell; |
| 83 | mStack->addObject(shell); |
| 84 | |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | struct FieldEntry |
| 89 | { |
nothing calls this directly
no test coverage detected