当前位置: 首页>>代码示例>>C++>>正文


C++ GuiControl类代码示例

本文整理汇总了C++中GuiControl的典型用法代码示例。如果您正苦于以下问题:C++ GuiControl类的具体用法?C++ GuiControl怎么用?C++ GuiControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GuiControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GuiPopUpMenuCtrl

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;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:27,代码来源:mountingGroup.cpp

示例2: loadBaseInfo

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);
	}
}
开发者ID:danielmorena,项目名称:ofxmarek,代码行数:32,代码来源:GuiContainer.cpp

示例3: globalToLocalCoord

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);
   }
}
开发者ID:Dwarf-King,项目名称:OmniEngine.Net,代码行数:30,代码来源:guiFormCtrl.cpp

示例4: calculateHeights

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;
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:31,代码来源:guiRolloutCtrl.cpp

示例5: getWidth

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;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:32,代码来源:guiPaneCtrl.cpp

示例6: findLastTabable

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;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:33,代码来源:guiTabPageCtrl.cpp

示例7: setCollapsed

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);
   }
}
开发者ID:03050903,项目名称:Torque3D,代码行数:26,代码来源:guiPaneCtrl.cpp

示例8: getParent

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;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:25,代码来源:guiTextEditSliderCtrl.cpp

示例9: getBounds

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 );
   }
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:31,代码来源:guiContainer.cpp

示例10: mouseUnlock

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;
	}
}
开发者ID:Adrellias,项目名称:Torque3D-DaveWork,代码行数:30,代码来源:guiDecoyCtrl.cpp

示例11: _FindMenuBarCtrl

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 );
   }
   
}
开发者ID:fr1tz,项目名称:terminal-overload,代码行数:31,代码来源:menuBarSDL.cpp

示例12: _getContentControl

void PostEffectVis::clear()
{
   GuiControl *content = _getContentControl(); 

   content->clear();   
   mWindows.clear();
}
开发者ID:03050903,项目名称:Torque3D,代码行数:7,代码来源:postEffectVis.cpp

示例13: getWidth

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 );
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:29,代码来源:guiRolloutCtrl.cpp

示例14: getParent

void GuiTabPageCtrl::setText(const char *txt)
{
   Parent::setText( txt );

   GuiControl *parent = getParent();
   if( parent )
      parent->setUpdate();
};
开发者ID:03050903,项目名称:Torque3D,代码行数:8,代码来源:guiTabPageCtrl.cpp

示例15: worldBounds

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);
}
开发者ID:Adhdcrazzy,项目名称:Torque3D,代码行数:57,代码来源:guiRolloutCtrl.cpp


注:本文中的GuiControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。