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


C++ Layout类代码示例

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


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

示例1: signal_type_error

Value StandardObject::slot_value(Value arg)
{
  if (!symbolp(arg))
    return signal_type_error(arg, S_symbol);
  Layout * layout = this->layout();
  if (!layout)
    return signal_lisp_error("No layout for instance.");
  if (layout->is_invalid())
    {
      // Update instance.
      layout = update_layout();
    }
  Value value;
  long index = layout->slot_index(arg);
  if (index >= 0)
    {
      value = iref(index);
    }
  else
    {
      // not an instance slot
      Value location = layout->shared_slot_location(arg);
      if (location == NIL)
        {
          // slot-missing
          return current_thread()->execute(the_symbol(S_slot_missing)->function(),
                                           class_of(),
                                           make_value(this),
                                           arg,
                                           S_slot_value);
        }
      value = cdr(location);
    }
  if (value == UNBOUND_VALUE)
    {
      Thread * const thread = current_thread();
      value = thread->execute(the_symbol(S_slot_unbound)->function(),
                              class_of(),
                              make_value(this),
                              arg);
      thread->clear_values();
    }
  return value;
}
开发者ID:bsmr-common-lisp,项目名称:xcl,代码行数:44,代码来源:StandardObject.cpp

示例2: init

bool UIScrollViewTest_ScrollToPercentBothDirection::init()
{
    if (UIScene::init())
    {
        Size widgetSize = _widget->getContentSize();
        
        // Add a label in which the dragpanel events will be displayed
        _displayValueLabel = Text::create("No Event", "fonts/Marker Felt.ttf",30);
        _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
        _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f));
        _uiLayer->addChild(_displayValueLabel);
        
        // Add the alert
        Text* alert = Text::create("ScrollView scroll to percent both direction without scroll bar","fonts/Marker Felt.ttf",20);
        alert->setColor(Color3B(159, 168, 176));
        alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 4.5));
        _uiLayer->addChild(alert);
        
        Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
        
        Layout* background = static_cast<Layout*>(root->getChildByName("background_Panel"));
        
        ui::ScrollView* sc = ui::ScrollView::create();
        sc->setBackGroundColor(Color3B::GREEN);
        sc->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
        sc->setDirection(ui::ScrollView::Direction::BOTH);
        sc->setInnerContainerSize(Size(480, 320));
        sc->setContentSize(Size(100,100));
		sc->setScrollBarEnabled(false);
        Size backgroundSize = background->getContentSize();
        sc->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
                              (backgroundSize.width - sc->getContentSize().width) / 2.0f,
                              (widgetSize.height - backgroundSize.height) / 2.0f +
                              (backgroundSize.height - sc->getContentSize().height) / 2.0f));
        sc->scrollToPercentBothDirection(Vec2(50, 50), 1, true);
        ImageView* iv = ImageView::create("cocosui/Hello.png");
        iv->setPosition(Vec2(240, 160));
        sc->addChild(iv);
        _uiLayer->addChild(sc);
        
        return true;
    }
    return false;
}
开发者ID:anilgulgor,项目名称:myGame,代码行数:44,代码来源:UIScrollViewTest.cpp

示例3: write

	int Client::write(const std::string & varname, int32_t iteration, const void* data)
	{
		/* check that the variable is know in the configuration */
		Variable* variable = metadataManager->getVariable(varname);

        	if(variable == NULL) {
			return -1;
        	}

		Layout* layout = variable->getLayout();

		if(layout->isUnlimited()) {
			ERROR("Trying to write a variable" 
				<< " with an unlimited layout (use chunk_write instead)");
			return -3;
		}

		std::vector<int> si(layout->getDimensions()),ei(layout->getDimensions());
                for(unsigned int i=0; i < layout->getDimensions(); i++) {
                        ei[i] = layout->getExtentAlongDimension(i)-1;
                        si[i] = 0;
                }

		ShmChunk* chunk = NULL;
                try {
                        chunk = new ShmChunk(segment,layout->getType(),
						layout->getDimensions(),si,ei);
                        chunk->setSource(env->getID());
                        chunk->setIteration(iteration);
                } catch (...) {
                        ERROR("While writing \"" << varname << "\", allocation failed");
                	return -2;
		}

		// copy data
		size_t size = chunk->getDataMemoryLength();
		memcpy(chunk->data(),data,size);
		
		// create message
		Message message;
		
		message.source = env->getID();
		message.iteration = iteration;
		message.object = variable->getID();
		message.type = MSG_VAR;
		message.handle = chunk->getHandle();
		
		// send message
		msgQueue->send(&message,sizeof(Message),0);
		DBG("Variable \"" << varname << "\" has been written");
	
		delete chunk;
		return size;
	}
开发者ID:digideskio,项目名称:damaris,代码行数:54,代码来源:Client.cpp

示例4: if

void ThreeButtonDlg::Init(const std::string& msg, const boost::shared_ptr<Font>& font, std::size_t buttons,
                          const std::string& zero/* = ""*/, const std::string& one/* = ""*/,
                          const std::string& two/* = ""*/)
{
    if (buttons < 1)
        buttons = 1;
    else if (3 < buttons)
        buttons = 3;

    const int SPACING = 10;
    const Y BUTTON_HEIGHT = font->Height() + 10;

    Layout* layout = new Layout(X0, Y0, X1, Y1, 2, 1, 10);
    Layout* button_layout = new Layout(X0, Y0, X1, Y1, 1, buttons, 0, 10);

    boost::shared_ptr<StyleFactory> style = GetStyleFactory();

    TextControl* message_text = style->NewTextControl(X0, Y0, ClientWidth() - 2 * SPACING, Height(), msg, font, m_text_color,
                                                      FORMAT_CENTER | FORMAT_VCENTER | FORMAT_WORDBREAK);
    message_text->SetMinSize(true);
    layout->Add(message_text, 0, 0);
    layout->SetRowStretch(0, 1);
    layout->SetMinimumRowHeight(1, BUTTON_HEIGHT);

    m_button_0 = style->NewButton(X0, Y0, X1, Y1, (zero == "" ? (buttons < 3 ? "Ok" : "Yes") : zero),
                                  font, m_button_color, m_text_color);
    button_layout->Add(m_button_0, 0, 0);

    if (2 <= buttons) {
        m_button_1 = style->NewButton(X0, Y0, X1, Y1, (one == "" ? (buttons < 3 ? "Cancel" : "No") : one),
                                      font, m_button_color, m_text_color);
        button_layout->Add(m_button_1, 0, 1);
    }
    if (3 <= buttons) {
        m_button_2 = style->NewButton(X0, Y0, X1, Y1, (two == "" ? "Cancel" : two),
                                      font, m_button_color, m_text_color);
        button_layout->Add(m_button_2, 0, 2);
    }
    layout->Add(button_layout, 1, 0);

    SetLayout(layout);

    ConnectSignals();
}
开发者ID:e-h-j,项目名称:freeorion,代码行数:44,代码来源:ThreeButtonDlg.cpp

示例5: init

bool UIFocusTestBase::init()
{
    if (UIScene::init()) {
        Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));

        Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
        background->removeFromParentAndCleanup(true);

        _dpadMenu = Menu::create();

        auto winSize = Director::getInstance()->getVisibleSize();
        auto leftItem = MenuItemFont::create("Left", CC_CALLBACK_0(UIFocusTestBase::onLeftKeyPressed, this));
        leftItem->setPosition(Vec2(winSize.width - 100, winSize.height/2));
        _dpadMenu->addChild(leftItem);


        auto rightItem = MenuItemFont::create("Right", CC_CALLBACK_0(UIFocusTestBase::onRightKeyPressed, this));
        rightItem->setPosition(Vec2(winSize.width - 30, winSize.height/2));
        _dpadMenu->addChild(rightItem);

        auto upItem = MenuItemFont::create("Up", CC_CALLBACK_0(UIFocusTestBase::onUpKeyPressed, this));
        upItem->setPosition(Vec2(winSize.width - 60, winSize.height/2 + 50));
        _dpadMenu->addChild(upItem);

        auto downItem = MenuItemFont::create("Down", CC_CALLBACK_0(UIFocusTestBase::onDownKeyPressed, this));
        downItem->setPosition(Vec2(winSize.width - 60, winSize.height/2 - 50));
        _dpadMenu->addChild(downItem);

        _dpadMenu->setPosition(Vec2::ZERO);
        _uiLayer->addChild(_dpadMenu);

        //call this method to enable Dpad focus navigation
        Widget::enableDpadNavigation(true);

        _eventListener = EventListenerFocus::create();
        _eventListener->onFocusChanged = CC_CALLBACK_2(UIFocusTestBase::onFocusChanged, this);

        _eventDispatcher->addEventListenerWithFixedPriority(_eventListener, 1);

        return true;
    }

    return false;
}
开发者ID:AomXD,项目名称:workspace,代码行数:44,代码来源:UIFocusTest.cpp

示例6: assert

inline void Layout::Children::add(Layout* layout)
{
    assert(!has(layout->name()));

    if (!hasMany_) {
        if (!single_) {
            single_ = layout;
            return;
        }

        Layout* current = single_;
        hasMany_ = true;
        many_ = new Map();
        many_->emplace(current->name(), current);
    }

    assert(many_);
    many_->emplace(layout->name(), layout);
}
开发者ID:jonco3,项目名称:dynamic,代码行数:19,代码来源:layout.cpp

示例7: profile_code

	void Engine::Render()
	{
		profile_code();

		Viewport vp;
		vp.w = (int)mRootLayout->GetRect().w;
		vp.h = (int)mRootLayout->GetRect().h;
		RenderSystem::Instance()->SetViewport(vp);

		Float4 tm;
		tm.x = mInvSize.x * 2;
		tm.y = mInvSize.y * 2;
		tm.z = 0;
		tm.w = 1;

		mShaderFX->GetPass(0)->SetConst("u_Transform", tm);

		RenderSystem::Instance()->SetRenderState(eFillMode::SOLID, eCullMode::NONE, eDepthMode::NONE, eBlendMode::ALPHA_BLEND, eColorMode::ALL);
		RenderSystem::Instance()->SetShaderPass(mShaderFX->GetPass(0), false);

		if (!mRootLayout->IsVisible())
			return ;

		mRootLayout->UpdateRenderItem(NULL);

		for (int i = 0; i < mRootLayout->GetChildCount(); ++i)
		{
			d_assert (KIND_OF(Layout, mRootLayout->GetChild(i)));

			Layout * pLayout = (Layout *)mRootLayout->GetChild(i);

			pLayout->UpdateRenderItem();
		}

		for (int i = 0; i < mRootLayout->GetChildCount(); ++i)
		{
			d_assert (KIND_OF(Layout, mRootLayout->GetChild(i)));

			Layout * pLayout = (Layout *)mRootLayout->GetChild(i);

			pLayout->DoRender();
		}
	}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:43,代码来源:MGUI_Engine.cpp

示例8: createMainLayout

// first child is listbox
Layout* createMainLayout(const char *left, const char *right) {
	Layout *mainLayout = new Layout(0, 0, scrWidth, scrHeight, NULL, 1, 2);

	Widget *softKeys = createSoftKeyBar(30, left, right);
	ListBox* listBox = new ListBox(0, 0, scrWidth, scrHeight-softKeys->getHeight(), mainLayout, ListBox::LBO_VERTICAL, ListBox::LBA_LINEAR, true);
	listBox->setSkin(gSkin);
	listBox->setPaddingLeft(5);
	listBox->setPaddingRight(5);
	listBox->setPaddingTop(15);
	listBox->setPaddingBottom(15);

	mainLayout->add(softKeys);

	mainLayout->setSkin(NULL);
	mainLayout->setDrawBackground(true);
	mainLayout->setBackgroundColor(0);

	return mainLayout;
}
开发者ID:bjornlalin,项目名称:MoSync,代码行数:20,代码来源:Util.cpp

示例9: getImageIndex

int TfrmMove::getImageIndex( TTreeNode *node )
{
	if( node == NULL ) {
		return Util::UNASSIGNED;
	}
	IPart* data = (IPart*)(node -> Data);
	if( data == NULL ) {
		return Util::UNASSIGNED;
	}
	Layout* lay = dynamic_cast<Layout*>( data );
	if( lay != NULL && lay->availability() == IPart::UNAVAILABLE ) {
		return Util::OFF_LINE;
	}
	int image = getImageIndex( data );
	if( image == Util::ASSIGNED ) {
		return image;
	}

	float fill = -1;
	AvlRack * ar = dynamic_cast< AvlRack *>( data );
	if( ar ) {
		fill = ar -> getFillFactor();
	} else {
		AvlSection * as = dynamic_cast< AvlSection *>( data );
		if( as ) {
			fill = as -> getFillFactor();
		} else {
			AvlTank * at = dynamic_cast< AvlTank *>( data );
			if( at ) {
				fill = at -> getFillFactor();
			}
		}
	}
	if( fill < 0 ) {
		return image;
	} else if( fill < 0.01 ) {
		return Util::NO_CHILDREN;
	} else if( fill > 0.98 ) {
		return Util::ALL_FILLED;
	} else {
		return Util::PART_FILLED;
	}
}
开发者ID:drkvogel,项目名称:retrasst,代码行数:43,代码来源:SampleMove.cpp

示例10: updateAddend

void ARMGNULDBackend::updateAddend(Relocation& pReloc,
                                   const LDSymbol& pInputSym,
                                   const Layout& pLayout) const
{
  // Update value keep in addend if we meet a section symbol
  if(pReloc.symInfo()->type() == ResolveInfo::Section) {
    pReloc.setAddend(pLayout.getOutputOffset(
                     *pInputSym.fragRef()) + pReloc.addend());
  }
}
开发者ID:TeamNyx,项目名称:frameworks_compile_mclinker,代码行数:10,代码来源:ARMLDBackend.cpp

示例11: clFileAssociationsWin

	clFileAssociationsWin( NCDialogParent* parent, std::vector<clNCFileAssociation>* Associations )
		: NCDialog( ::createDialogAsChild, 0, parent, utf8_to_unicode( _LT( "File associations" ) ).data(), bListOkCancel )
		, m_ListWin( this, Associations )
		, m_Layout( 10, 10 )
		, m_AddCurrentButton( 0, this, utf8_to_unicode( "+ (&Ins)" ).data(), CMD_PLUS )
		, m_DelButton( 0, this, utf8_to_unicode( "- (&Del)" ).data(), CMD_MINUS )
		, m_EditButton( 0, this, utf8_to_unicode( _LT( "&Edit" ) ).data(), CMD_EDIT )
		, m_Saved( true )
	{
		m_AddCurrentButton.Enable();
		m_AddCurrentButton.Show();
		m_DelButton.Enable();
		m_DelButton.Show();
		m_EditButton.Enable();
		m_EditButton.Show();

		LSize lsize = m_AddCurrentButton.GetLSize();
		LSize lsize2 = m_DelButton.GetLSize();
		LSize lsize3 = m_EditButton.GetLSize();

		if ( lsize.x.minimal < lsize2.x.minimal ) { lsize.x.minimal = lsize2.x.minimal; }

		if ( lsize.x.minimal < lsize3.x.minimal ) { lsize.x.minimal = lsize3.x.minimal; }

		if ( lsize.x.maximal < lsize.x.minimal ) { lsize.x.maximal = lsize.x.minimal; }

		m_AddCurrentButton.SetLSize( lsize );
		m_DelButton.SetLSize( lsize );
		m_EditButton.SetLSize( lsize );

		m_Layout.AddWinAndEnable( &m_ListWin, 0, 0, 9, 0 );
		m_Layout.AddWin( &m_AddCurrentButton, 0, 1 );
		m_Layout.AddWin( &m_DelButton, 1, 1 );
		m_Layout.AddWin( &m_EditButton, 2, 1 );
		m_Layout.SetLineGrowth( 9 );

		this->AddLayout( &m_Layout );

		SetPosition();

		m_ListWin.SetFocus();
		this->SetEnterCmd( CMD_OK );
	}
开发者ID:0-wiz-0,项目名称:WCMCommander,代码行数:43,代码来源:fileassociations.cpp

示例12: getSize

void PageView::updateChildrenPosition()
{
    ssize_t pageCount = _pages.size();
    if (pageCount <= 0)
    {
        _curPageIdx = 0;
        return;
    }
    if (_curPageIdx >= pageCount)
    {
        _curPageIdx = pageCount-1;
    }
    float pageWidth = getSize().width;
    for (int i=0; i<pageCount; i++)
    {
        Layout* page = _pages.at(i);
        page->setPosition(Point((i-_curPageIdx)*pageWidth, 0));
    }
}
开发者ID:darling0825,项目名称:cocos2dx_tz_lib,代码行数:19,代码来源:UIPageView.cpp

示例13: isWidgetAncestorSupportLoopFocus

bool  Layout::isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection direction)const
{
    Layout* parent = dynamic_cast<Layout*>(widget->getParent());
    if (parent == nullptr)
    {
        return false;
    }
    if (parent->isLoopFocus())
    {
        auto layoutType = parent->getLayoutType();
        if (layoutType == Type::HORIZONTAL)
        {
            if (direction == FocusDirection::LEFT || direction == FocusDirection::RIGHT)
            {
                return true;
            }
            else
            {
                return isWidgetAncestorSupportLoopFocus(parent, direction);
            }
        }
        if (layoutType == Type::VERTICAL)
        {
            if (direction == FocusDirection::DOWN || direction == FocusDirection::UP)
            {
                return true;
            }
            else
            {
                return isWidgetAncestorSupportLoopFocus(parent, direction);
            }
        }
        else
        {
            CCASSERT(0, "invalid layout type");
            return false;
        }
    }
    else
    {
        return isWidgetAncestorSupportLoopFocus(parent, direction);
    }
}
开发者ID:HeavenWesker,项目名称:ContraGame,代码行数:43,代码来源:UILayout.cpp

示例14: XOJ_CHECK_TYPE

void XournalView::zoomChanged()
{
	XOJ_CHECK_TYPE(XournalView);

	Layout* layout = gtk_xournal_get_layout(this->widget);
	int currentPage = this->getCurrentPage();
	XojPageView* view = getViewFor(currentPage);
	ZoomControl* zoom = control->getZoomControl();

	if (!view)
	{
		return;
	}

	// move this somewhere else maybe
	layout->layoutPages();

	if(zoom->isZoomPresentationMode() || zoom->isZoomFitMode())
	{
		scrollTo(currentPage);
	}
	else
	{
		std::tuple<double, double> pos = zoom->getScrollPositionAfterZoom();
		if(std::get<0>(pos) != -1 && std::get<1>(pos) != -1)
		{
			layout->scrollAbs(std::get<0>(pos), std::get<1>(pos));
		}
	}

	Document* doc = control->getDocument();
	doc->lock();
	Path file = doc->getEvMetadataFilename();
	doc->unlock();

	control->getMetadataManager()->storeMetadata(file.str(), getCurrentPage(), zoom->getZoomReal());

	// Updates the Eraser's cursor icon in order to make it as big as the erasing area
	control->getCursor()->updateCursor();

	this->control->getScheduler()->blockRerenderZoom();
}
开发者ID:xournalpp,项目名称:xournalpp,代码行数:42,代码来源:XournalView.cpp

示例15: assert

void Cache::write_complete(WriteCompleteContext* context, bool succ)
{
    Node *node = context->node;
    assert(node);
    Layout *layout = context->layout;
    assert(layout);
    Block *block = context->block;
    assert(block);

    if (succ) {
        LOG_TRACE("write node table " << node->table_name() << ", nid " << node->nid() << " ok" );
    } else {
        LOG_ERROR("write node table " << node->table_name() << ", nid " << node->nid() << " error");
        // TODO: handle the error
    }

    node->set_flushing(false);
    layout->destroy(block);
    delete context;
}
开发者ID:MissGentoo,项目名称:cascadb,代码行数:20,代码来源:cache.cpp


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