//----------------------------------------------------------------------------- // GuiInspectorDynamicGroup - add custom controls //----------------------------------------------------------------------------- bool GuiInspectorDynamicGroup::createContent() { if(!Parent::createContent()) return false; // encapsulate the button in a dummy control. GuiControl* shell = new GuiControl(); shell->setDataField( StringTable->insert("profile"), NULL, "GuiTransparentProfile" ); if( !shell->registerObject() ) { delete shell; return false; } // add a button that lets us add new dynamic fields. GuiBitmapButtonCtrl* addFieldBtn = new GuiBitmapButtonCtrl(); { SimObject* profilePtr = Sim::findObject("InspectorDynamicFieldButton"); if( profilePtr != NULL ) addFieldBtn->setControlProfile( dynamic_cast<GuiControlProfile*>(profilePtr) ); // FIXME Hardcoded image addFieldBtn->setBitmap("tools/gui/images/iconAdd.png"); char commandBuf[64]; dSprintf(commandBuf, 64, "%d.addDynamicField();", this->getId()); addFieldBtn->setField("command", commandBuf); addFieldBtn->setSizing(horizResizeLeft,vertResizeCenter); //addFieldBtn->setField("buttonMargin", "2 2"); addFieldBtn->resize(Point2I(getWidth() - 20,2), Point2I(16, 16)); addFieldBtn->registerObject("zAddButton"); } shell->resize(Point2I(0,0), Point2I(getWidth(), 28)); shell->addObject(addFieldBtn); // save off the shell control, so we can push it to the bottom of the stack in inspectGroup() mAddCtrl = shell; mStack->addObject(shell); return true; }
bool GuiBitmapButtonCtrl::_setBitmap( void *object, const char *index, const char *data ) { GuiBitmapButtonCtrl* ctrl = reinterpret_cast< GuiBitmapButtonCtrl* >( object ); ctrl->setBitmap( data ); return false; }