MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / createContent

Method createContent

Engine/source/gui/editor/inspector/dynamicGroup.cpp:45–86  ·  view source on GitHub ↗

----------------------------------------------------------------------------- GuiInspectorDynamicGroup - add custom controls -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

43// GuiInspectorDynamicGroup - add custom controls
44//-----------------------------------------------------------------------------
45bool 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
88struct FieldEntry
89{

Callers

nothing calls this directly

Calls 14

dSprintfFunction · 0.85
getWidthFunction · 0.85
setControlProfileMethod · 0.80
setFieldMethod · 0.80
setSizingMethod · 0.80
findObjectFunction · 0.50
Point2IClass · 0.50
setDataFieldMethod · 0.45
insertMethod · 0.45
registerObjectMethod · 0.45
setBitmapMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected