コード例 #1
5
void GuiFormCtrl::onMouseDown(const GuiEvent &event)
{
   Point2I localClick = globalToLocalCoord(event.mousePoint);

   // If we're clicking in the header then resize
   if(localClick.y < mThumbSize.y)
   {
      mouseLock();
      mDepressed = true;
      mMouseMovingWin = mCanMove;

      //update
      setUpdate();
   }

   mOrigBounds = getBounds();

   mMouseDownPosition = event.mousePoint;

   if (mMouseMovingWin )
   {
      mouseLock();
   }
   else
   {
      GuiControl *ctrl = findHitControl(localClick);
      if (ctrl && ctrl != this)
         ctrl->onMouseDown(event);
   }
}
コード例 #2
0
ファイル: mountingGroup.cpp プロジェクト: 03050903/Torque3D
GuiControl* GuiInspectorMountingGroup::buildMenuCtrl()
{
	GuiControl* retCtrl = new GuiPopUpMenuCtrl();

   // If we couldn't construct the control, bail!
   if( retCtrl == NULL )
      return retCtrl;

   GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);

   // Let's make it look pretty.
   retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiPopUpMenuProfile" );
   //GuiInspectorTypeMenuBase::_registerEditControl( retCtrl );

	char szName[512];
   dSprintf( szName, 512, "IE_%s_%d_%s_Field", retCtrl->getClassName(), mParentInspector->getInspectObject()->getId(), mCaption.c_str());

   // Register the object
   retCtrl->registerObject( szName );

   // Configure it to update our value when the popup is closed
   char szBuffer[512];
   dSprintf( szBuffer, 512, "%d.apply( %d.getText() );", getId(), menu->getId() );
   menu->setField("Command", szBuffer );

	return menu;
}
コード例 #3
0
void GuiContainer::loadFromXml(string file) {
	controls.clear();
	ofxXmlSettings xml;
	res.init(file);
	xml.loadFile(file);
	loadBaseInfo("view", xml, 0);
	x = 0;
	y = 0;
	load();
	//movable = xml.getAttribute("view", "movable", 0, 0);
	xml.pushTag("view");
	
	int numControls = xml.getNumTags("control");
	for(int i = 0; i < numControls; i++) {
		GuiControl *c = instantiator(
				xml.getAttribute("control", "type", "", i), 
				xml.getAttribute("control", "name", "", i), 
									 xml.getAttribute("control", "id", "", i), &res, this);
		
		string valueStr = xml.getAttribute("control", "value", "", i);
		if(valueStr!="") {
			c->valueFromString(valueStr);
		}
		c->loadBaseInfo("control", xml, i);
		c->load();
		c->listeners = listeners;
		c->numListeners = numListeners;
		c->load(xml, i);
		
		add(c);
	}
}
コード例 #4
0
bool GuiRolloutCtrl::resize( const Point2I &newPosition, const Point2I &newExtent )
{
   if ( !Parent::resize( newPosition, newExtent ) )
      return false;

   // Recalculate Heights and resize ourself appropriately.
   calculateHeights();

   GuiControl *content = dynamic_cast<GuiControl*>( at(0) );
   
   // Size Content Properly?!
   if ( mNotifyChildrenResized && content != NULL )
   {
      S32 barHeight = ( mHideHeader ) ? 0 : 20;
      if( !mHideHeader && mHasTexture && mProfile && mProfile->mBitmapArrayRects.size() >= NumBitmaps )
      {
         barHeight = mProfile->mBitmapArrayRects[ TopLeftHeader ].extent.y;
      }

      mChildRect.set( mMargin.point.x, 
                      mHeader.extent.y + mMargin.point.y, 
                      getWidth() - ( mMargin.point.x + mMargin.extent.x ), 
                      getHeight() - ( barHeight + ( mMargin.point.y + mMargin.extent.y ) ) );

      if ( content->resize( mChildRect.point, mChildRect.extent ) )
         return true;
   }

   // Nothing sized
   return false;
}
コード例 #5
0
ファイル: guiPaneCtrl.cpp プロジェクト: 03050903/Torque3D
bool GuiPaneControl::resize(const Point2I &newPosition, const Point2I &newExtent)
{
   // CodeReview WTF is going on here that we need to bypass parent sanity?
   //  Investigate this [7/1/2007 justind]
   if( !Parent::resize( newPosition, newExtent ) )
      return false;

   mOriginalExtents.x = getWidth();

   /*
   GuiControl *parent = getParent();
   if (parent)
      parent->childResized(this);
   setUpdate();
   */

   // Resize the child control if we're not collapsed
   if(size() && !mCollapsed)
   {
      GuiControl *gc = dynamic_cast<GuiControl*>(operator[](0));

      if(gc)
      {
         Point2I offset(0, mThumbSize.y);

         gc->resize(offset, newExtent - offset);
      }
   }

   // For now.
   return true;
}
コード例 #6
0
ファイル: guiTabPageCtrl.cpp プロジェクト: 03050903/Torque3D
GuiControl *GuiTabPageCtrl::findPrevTabable(GuiControl *curResponder, bool firstCall)
{
   if (firstCall)
   {
      GuiControl::smPrevResponder = NULL;
   }

   //if the window does not already contain the first responder, return false
   //ie.  Can't tab into or out of a window
   if (! controlIsChild(curResponder))
   {
      return NULL;
   }

   //loop through, checking each child to see if it is the one that follows the firstResponder
   GuiControl *tabCtrl = NULL;
   iterator i;
   for (i = begin(); i != end(); i++)
   {
      GuiControl *ctrl = static_cast<GuiControl *>(*i);
      tabCtrl = ctrl->findPrevTabable(curResponder, false);
      if (tabCtrl) break;
   }

   //to ensure the tab cycles within the current window...
   if (! tabCtrl)
   {
      tabCtrl = findLastTabable();
   }

   mFirstResponder = tabCtrl;
   return tabCtrl;
}
コード例 #7
0
ファイル: guiPaneCtrl.cpp プロジェクト: 03050903/Torque3D
void GuiPaneControl::setCollapsed(bool isCollapsed)
{
   // Get the child
   if(size() == 0 || !mCollapsable) return;

   GuiControl *gc = dynamic_cast<GuiControl*>(operator[](0));

   if(mCollapsed && !isCollapsed)
   {
      resize(getPosition(), mOriginalExtents);
      mCollapsed = false;

      if(gc)
         gc->setVisible(true);
   }
   else if(!mCollapsed && isCollapsed)
   {
      mCollapsed = true;

      mOriginalExtents = getExtent();
      resize(getPosition(), Point2I(getExtent().x, mThumbSize.y));

      if(gc)
         gc->setVisible(false);
   }
}
コード例 #8
0
bool GuiTextEditSliderCtrl::onMouseWheelDown(const GuiEvent &event)
{
   if ( !mActive || !mAwake || !mVisible )
      return Parent::onMouseWheelDown(event);

   if ( !isFirstResponder() && !mFocusOnMouseWheel )
   {
      GuiControl *parent = getParent();
      if ( parent )
         return parent->onMouseWheelUp( event );

      return false;
   }   

   mValue -= mIncAmount;

   checkRange();
   setValue();

   setFirstResponder();
   mCursorPos = mBlockStart = mBlockEnd = 0;
   setUpdate();

   return true;
}
コード例 #9
0
ファイル: guiContainer.cpp プロジェクト: Adhdcrazzy/Torque3D
void GuiContainer::parentResized(const RectI &oldParentRect, const RectI &newParentRect)
{
	//if(!mCanResize)
	//	return;

   // If it's a control that specifies invalid docking, we'll just treat it as an old GuiControl
   if( getDocking() & Docking::dockInvalid || getDocking() & Docking::dockNone)
      return Parent::parentResized( oldParentRect, newParentRect );

   S32 deltaX = newParentRect.extent.x - oldParentRect.extent.x;
   S32 deltaY = newParentRect.extent.y - oldParentRect.extent.y;

   // Update Self
   RectI oldThisRect = getBounds();
   anchorControl( this, Point2I( deltaX, deltaY ) );
   RectI newThisRect = getBounds();

   // Update Deltas to pass on to children
   deltaX = newThisRect.extent.x - oldThisRect.extent.x;
   deltaY = newThisRect.extent.y - oldThisRect.extent.y;

   // Iterate over all children and update their anchors
   iterator nI = begin();
   for( ; nI != end(); nI++ )
   {
      // Sanity
      GuiControl *control = dynamic_cast<GuiControl*>( (*nI) );
      if( control )
         control->parentResized( oldThisRect, newThisRect );
   }
}
コード例 #10
0
void GuiDecoyCtrl::onMouseUp(const GuiEvent &event)
{
	mouseUnlock();
	setUpdate();  

	//this code is pretty hacky. right now there is no way that guiCanvas will allow sending more than
    //one signal to one gui control at a time. 
	if(mIsDecoy == true)
	{
		mVisible = false;

		GuiControl *parent = getParent();
		Point2I localPoint = parent->globalToLocalCoord(event.mousePoint);
		GuiControl *tempControl = parent->findHitControl(localPoint);

		//the decoy control has the responsibility of keeping track of the decoyed controls status
		if( mDecoyReference != NULL && tempControl == mDecoyReference)
			tempControl->onMouseUp(event);
		else if(mDecoyReference != NULL && tempControl != mDecoyReference)
		{
			//as explained earlier, this control was written in the mindset for buttons.
			//nothing bad should ever happen if not a button due to the checks in this function though.
			GuiButtonBaseCtrl *unCastCtrl = NULL;
			unCastCtrl = dynamic_cast<GuiButtonBaseCtrl *>( mDecoyReference );
			if(unCastCtrl != NULL)
				unCastCtrl->resetState();
		}
		mVisible = true;
	}
}
コード例 #11
0
void MenuBar::attachToCanvas(GuiCanvas *owner, S32 pos)
{
   if(owner == NULL || isAttachedToCanvas())
      return;

   // This is set for popup menus in the onAttachToMenuBar() callback
   mCanvas = owner;

   PlatformWindowSDL *pWindow = dynamic_cast<PlatformWindowSDL*>(owner->getPlatformWindow());
   if(pWindow == NULL) 
      return;

   // Setup the native menu bar
   GuiMenuBar *hWindowMenu = static_cast<GuiMenuBar*>( pWindow->getMenuHandle() );
	if( hWindowMenu == NULL && !Journal::IsPlaying() )
      hWindowMenu = _FindMenuBarCtrl();

   if(hWindowMenu)
   {
      pWindow->setMenuHandle( hWindowMenu );
      GuiControl *base = hWindowMenu->getParent();
         
      while( base->getParent() )
      {
         base = base->getParent();
      }         

      mCanvas->setMenuBar( base );
   }
   
}
コード例 #12
0
ファイル: postEffectVis.cpp プロジェクト: 03050903/Torque3D
void PostEffectVis::clear()
{
   GuiControl *content = _getContentControl(); 

   content->clear();   
   mWindows.clear();
}
コード例 #13
0
void GuiRolloutCtrl::calculateHeights()
{
   S32 barHeight = 20;

   if ( mHasTexture && mProfile && mProfile->mBitmapArrayRects.size() >= NumBitmaps )
   {
      // Store Header Rectangle
      mHeader.set( 0, 0, getWidth(), mProfile->mBitmapArrayRects[ CollapsedCenter ].extent.y );

      // Bottom Bar Max
      barHeight = mProfile->mBitmapArrayRects[ TopLeftHeader ].extent.y;
   }
   else
   {
      mHeader.set( 0, 0, getWidth(), barHeight );
   }
   
   if ( mHideHeader )
   {
      barHeight = 0;
      mHeader.extent.y = 0;
   }

   GuiControl *content = static_cast<GuiControl*>( at(0) );
   if ( content != NULL )
      mExpanded.set( 0, 0, getWidth(), barHeight + content->getHeight() + ( mMargin.point.y + mMargin.extent.y ) );
   else
      mExpanded.set( 0, 0, getWidth(), barHeight + mDefaultHeight );
}
コード例 #14
0
ファイル: guiTabPageCtrl.cpp プロジェクト: 03050903/Torque3D
void GuiTabPageCtrl::setText(const char *txt)
{
   Parent::setText( txt );

   GuiControl *parent = getParent();
   if( parent )
      parent->setUpdate();
};
コード例 #15
0
void GuiRolloutCtrl::onRender( Point2I offset, const RectI &updateRect )
{
   if( !mProfile || mProfile->mFont == NULL )
      return;

   // Calculate actual world bounds for rendering
   RectI worldBounds( offset, getExtent() );

   // if opaque, fill the update rect with the fill color
   if ( mProfile->mOpaque )
      GFX->getDrawUtil()->drawRectFill( worldBounds, mProfile->mFillColor );

   if ( mProfile->mBitmapArrayRects.size() >= NumBitmaps )
   {
      GFX->getDrawUtil()->clearBitmapModulation();

      // Draw Rollout From Skin
      if ( !mIsExpanded && !mIsAnimating )
         renderFixedBitmapBordersFilled( worldBounds, 1, mProfile );
      else if ( mHideHeader )
         renderSizableBitmapBordersFilledIndex( worldBounds, MidPageLeft, mProfile );
      else
         renderSizableBitmapBordersFilledIndex( worldBounds, TopLeftHeader, mProfile );
   }

   if ( !(mIsExpanded && mHideHeader ) )
   {
      // Draw Caption ( Vertically Centered )
      ColorI currColor;
      GFX->getDrawUtil()->getBitmapModulation( &currColor );
      Point2I textPosition = mHeader.point + offset + mProfile->mTextOffset;
      GFX->getDrawUtil()->setBitmapModulation( mProfile->mFontColor );
      renderJustifiedText( textPosition, mHeader.extent, mCaption );
      GFX->getDrawUtil()->setBitmapModulation( currColor );
   }

   // If we're collapsed we contain the first child as our content
   // thus we don't render it when collapsed.  but to support modified
   // rollouts with custom header buttons etc we still render our other
   // children. -JDD
   GuiControl *pChild = dynamic_cast<GuiControl*>( at(0) );
   if ( pChild )
   {
      if ( !mIsExpanded && !mIsAnimating && pChild->isVisible() )
	  {
         pChild->setVisible( false );
	  }
      else if ( (mIsExpanded || mIsAnimating) && !pChild->isVisible() )
	  {
         pChild->setVisible( true );
	  }
   }
   renderChildControls( offset, updateRect );

   // Render our border should we have it specified in our profile.
   renderBorder(worldBounds, mProfile);
}
コード例 #16
0
GuiControl *GuiContainer::add(string _type, string _name, string _controlId) {
	GuiControl *ctrl = instantiator(_type, _name, _controlId, &res, this);
	
	
	
	ctrl->load();
	add(ctrl);
	return ctrl;
}
コード例 #17
0
ファイル: guiTabPageCtrl.cpp プロジェクト: 03050903/Torque3D
void GuiTabPageCtrl::onMouseDown(const GuiEvent &event)
{
   setUpdate();
   Point2I localPoint = globalToLocalCoord( event.mousePoint );

   GuiControl *ctrl = findHitControl(localPoint);
   if (ctrl && ctrl != this)
   {
      ctrl->onMouseDown(event);
   }
}
コード例 #18
0
ファイル: guiTabPageCtrl.cpp プロジェクト: 03050903/Torque3D
void GuiTabPageCtrl::selectWindow(void)
{
   //first make sure this window is the front most of its siblings
   GuiControl *parent = getParent();
   if (parent)
   {
      parent->pushObjectToBack(this);
   }

   //also set the first responder to be the one within this window
   setFirstResponder(mFirstResponder);
}
コード例 #19
0
void GuiTextEditSliderCtrl::onMouseDragged(const GuiEvent &event)
{
   // If we're not active then skip out.
   if ( !mActive || !mAwake || !mVisible )
   {
      Parent::onMouseDragged(event);
      return;
   }

   if(mTextAreaHit == None || mTextAreaHit == Slider)
   {
      mTextAreaHit = Slider;
      GuiControl *parent = getParent();
      if(!parent)
         return;
      Point2I camPos = event.mousePoint;
      Point2I point = parent->localToGlobalCoord(getPosition());
      F32 maxDis = 100;
      F32 val;
      if(camPos.y < point.y)
      {
         if((F32)point.y < maxDis)
            maxDis = (F32)point.y;

         val = point.y - maxDis;
         
         if(point.y > 0)
            mMulInc= 1.0f-(((float)camPos.y - val) / maxDis);
         else
            mMulInc = 1.0f;
         
         checkIncValue();
         
         return;
      }
      else if(camPos.y > point.y + getExtent().y)
      {
         GuiCanvas *root = getRoot();
         val = (F32)(root->getHeight() - (point.y + getHeight()));
         if(val < maxDis)
            maxDis = val;
         if( val > 0)
            mMulInc= -(F32)(camPos.y - (point.y + getHeight()))/maxDis;
         else
            mMulInc = -1.0f;
         checkIncValue();
         return;
      }
      mTextAreaHit = None;
      Parent::onMouseDragged(event);
   }
}
コード例 #20
0
GuiPlatformGenericMenuBar* _FindMenuBarCtrl()
{
   GuiControl* control;
   Sim::findObject("PlatformGenericMenubar", control);
   AssertFatal(control, "");
   if( !control )      
      return NULL;   

   GuiPlatformGenericMenuBar* menuBar;
   menuBar = dynamic_cast<GuiPlatformGenericMenuBar*>( control->findObjectByInternalName(  StringTable->insert("menubar"), true) );
   AssertFatal(menuBar, "");
   return menuBar;
}
コード例 #21
0
bool GuiDecoyCtrl::onMouseWheelDown( const GuiEvent &event )
{
   //if this control is a dead end, make sure the event stops here
   if ( !mVisible || !mAwake )
      return true;

   //pass the event to the parent
   GuiControl *parent = getParent();
   if ( parent )
      return parent->onMouseWheelDown( event );
   else
      return false;
}
コード例 #22
0
void GuiTextEditSliderCtrl::onMouseDown(const GuiEvent &event)
{
   // If we're not active then skip out.
   if ( !mActive || !mAwake || !mVisible )
   {
      Parent::onMouseDown(event);
      return;
   }

   char txt[20];
   Parent::getText(txt);
   mValue = dAtof(txt);

   mMouseDownTime = Sim::getCurrentTime();
   GuiControl *parent = getParent();
   if(!parent)
      return;
   Point2I camPos  = event.mousePoint;
   Point2I point = parent->localToGlobalCoord(getPosition());

   if(camPos.x > point.x + getExtent().x - 14)
   {
      if(camPos.y > point.y + (getExtent().y/2))
      {
         mValue -=mIncAmount;
         mTextAreaHit = ArrowDown;
         mMulInc = -0.15f;
      }
      else
      {
         mValue +=mIncAmount;
         mTextAreaHit = ArrowUp;
         mMulInc = 0.15f;
      }

      checkRange();
      setValue();
      mouseLock();

      // We should get the focus and set the 
      // cursor to the start of the text to 
      // mimic the standard Windows behavior.
      setFirstResponder();
      mCursorPos = mBlockStart = mBlockEnd = 0;
      setUpdate();

      return;
   }

   Parent::onMouseDown(event);
}
コード例 #23
0
ファイル: GuiBasicControls.cpp プロジェクト: Crawping/GacUI
			bool GuiControl::IsAltEnabled()
			{
				GuiControl* control = this;
				while (control)
				{
					if (!control->GetVisible() || !control->GetEnabled())
					{
						return false;
					}
					control = control->GetParent();
				}

				return true;
			}
コード例 #24
0
GuiControl* GuiInspectorDatablockField::constructEditControl()
{
   GuiControl* retCtrl = new GuiPopUpMenuCtrl();

   // If we couldn't construct the control, bail!
   if( retCtrl == NULL )
      return retCtrl;

   GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);

   // Let's make it look pretty.
   retCtrl->setDataField( StringTable->insert("profile"), NULL, "InspectorTypeEnumProfile" );

   menu->setField("text", getData());

   _registerEditControl( retCtrl );

   // Configure it to update our value when the popup is closed
   char szBuffer[512];
   dSprintf( szBuffer, 512, "%d.apply(%d.getText());%d.inspect(%d);",getId(), retCtrl->getId(),mParent->mParent->getId(), mTarget->getId() );
   //dSprintf( szBuffer, 512, "%d.%s = %d.getText();%d.inspect(%d);",mTarget->getId(), getFieldName(), menu->getId(), mParent->mParent->getId(), mTarget->getId() );
   menu->setField("Command", szBuffer );

   Vector<StringTableEntry> entries;

   SimDataBlockGroup * grp = Sim::getDataBlockGroup();
   for(SimDataBlockGroup::iterator i = grp->begin(); i != grp->end(); i++)
   {
      SimDataBlock * datablock = dynamic_cast<SimDataBlock*>(*i);

      // Skip non-datablocks if we somehow encounter them.
      if(!datablock)
         continue;

      // Ok, now we have to figure inheritance info.
      if( datablock && datablock->getClassRep()->isClass(mDesiredClass) )
         entries.push_back(datablock->getName());
   }

   // sort the entries
   dQsort(entries.address(), entries.size(), sizeof(StringTableEntry), stringCompare);

   // add them to our enum
   for(U32 j = 0; j < entries.size(); j++)
      menu->addEntry(entries[j], 0);

   return retCtrl;
}
コード例 #25
0
ファイル: postEffectVis.cpp プロジェクト: 03050903/Torque3D
void PostEffectVis::setVisible( bool visible )
{
   GuiCanvas *canvas = NULL;
   if ( !Sim::findObject( "Canvas", canvas ) )
   {
      Con::errorf( "PostEffectVis::setVisible, Canvas was not found." );
      return;
   }

   GuiControl *content = _getContentControl();   
   
   if ( visible && !content->isAwake() )
      canvas->pushDialogControl( content, 100 );   
   
   if ( !visible && content->isAwake() )
      canvas->popDialogControl( content );
}
コード例 #26
0
ファイル: GuiControl.cpp プロジェクト: imclab/24HourMusic
void GuiControl::saveBaseInfo(string tag, ofxXmlSettings xml, int pos) {
	
	
	xml.addAttribute(tag, "type", type, pos);
	xml.addAttribute(tag, "width", width, pos);
	xml.addAttribute(tag, "height", height, pos);
	xml.addAttribute(tag, "x", x, pos);
	xml.addAttribute(tag, "y", y, pos);
	xml.addAttribute(tag, "id", controlId, pos);
	xml.addAttribute(tag, "name", name, pos);
	xml.addAttribute(tag, "value", this->valueToString(), pos);
	vector<ParameterInfo> params = this->getParameterInfo();
	for(int i = 0; i < params.size(); i++) {
		GuiControl *g = instantiator(params[i].type, "", "", resources, this);
		g->value = params[i].value;
		xml.addAttribute(tag, params[i].xmlName, g->valueToString(), pos);
	}
}
コード例 #27
0
/**
 * loads an xml file with the values specified
 * in the file. If the file doesn't exist, it just
 * returns.
 */
void GuiContainer::loadValues(string file) {
	
	
	if(!guiFileExists(ofToDataPath(file))) return;
	ofxXmlSettings xml;
	xml.loadFile(file);
	xml.pushTag("values");
	int numVals = xml.getNumTags("value");
	for(int i = 0; i < numVals; i++) {
		string controlId = xml.getAttribute("value", "controlId", "", i);
		if(controlId!="") {
			GuiControl *ctrl = getControlById(controlId);
			if(ctrl!=NULL) {
				ctrl->valueFromString(xml.getAttribute("value", "value", "", i));
			}
		}
	}
}
コード例 #28
0
//-----------------------------------------------------------------------------
// 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;
}
コード例 #29
0
ファイル: GuiControl.cpp プロジェクト: imclab/24HourMusic
void GuiControl::loadBaseInfo(string tag, ofxXmlSettings xml, int pos) {
	x = xml.getAttribute(tag, "x", 0.f, pos);
	y = xml.getAttribute(tag, "y", 0.f, pos);
	width = xml.getAttribute(tag, "width", 0.f, pos);
	height = xml.getAttribute(tag, "height", 0.f, pos);
	controlId = xml.getAttribute(tag, "id", "", pos);
	name = xml.getAttribute(tag, "name", "", pos);
	

	vector<ParameterInfo> params = this->getParameterInfo();

	for(int i = 0; i < params.size(); i++) {
		GuiControl *g = instantiator(params[i].type, "", "", resources, this);

		g->valueFromString(xml.getAttribute(tag, params[i].xmlName, "", pos));
		// this is re-pointing a pointer - what we actually want to do is copy
		memcpy(params[i].value, g->value, sizeof(void*));
		
	}
}
コード例 #30
0
ファイル: field.cpp プロジェクト: souxiaosou/OmniEngine.Net
GuiControl* GuiInspectorField::constructEditControl()
{
   GuiControl* retCtrl = new GuiTextEditCtrl();

   static StringTableEntry sProfile = StringTable->insert( "profile" );
   retCtrl->setDataField( sProfile, NULL, "GuiInspectorTextEditProfile" );

   _registerEditControl( retCtrl );

   char szBuffer[512];
   dSprintf( szBuffer, 512, "%d.apply(%d.getText());",getId(), retCtrl->getId() );
   
   // Suffices to hook on to "validate" as regardless of whether we lose
   // focus through the user pressing enter or clicking away on another
   // keyboard control, we will see a validate call.
   
   retCtrl->setField("validate", szBuffer );

   return retCtrl;
}