Example #1
0
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;
}
Example #2
0
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;
}
Example #3
0
	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;
	}
Example #4
0
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();
}
Example #5
0
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;
}
Example #6
0
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);
}
Example #7
0
	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();
		}
	}
Example #8
0
// 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;
}
Example #9
0
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;
	}
}
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());
  }
}
Example #11
0
	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 );
	}
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));
    }
}
Example #13
0
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);
    }
}
Example #14
0
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();
}
Example #15
0
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;
}
Example #16
0
void MainScene::updateMotionList(CCObject *sender)
{
    motionlist->removeAllItems();
    
    for (int i = 0; i < xSkill->getMotionCount(); ++i)
    {
        motionlist->pushBackDefaultItem();
    }
    
    CCArray* items = motionlist->getItems();
    for (int i = 0; i < items->count(); i++) {
        Layout * bg = (Layout*)items->objectAtIndex(i);
        bg->addTouchEventListener(this, toucheventselector(MainScene::touchEvent));
        bg->setTag(LIST_MOTION + i);
        Label *label = (Label*)UIHelper::seekWidgetByTag(bg, 22);
        label->setText(xSkill->getMotionName(i));
    }
    
    makeAFocusOfListForMotion();
}
Example #17
0
bool 
RenderExtension::isInUse(SBMLDocument *doc) const
{  

  if (doc == NULL || doc->getModel() == NULL) return false;
  LayoutModelPlugin* plugin = (LayoutModelPlugin*)doc->getModel()->getPlugin("layout");
  if (plugin == NULL || plugin->getNumLayouts() == 0) return false;

  RenderListOfLayoutsPlugin* lolPlugin = (RenderListOfLayoutsPlugin*) plugin->getListOfLayouts()->getPlugin("render");
  if (lolPlugin != NULL && lolPlugin->getNumGlobalRenderInformationObjects() > 0) return true;

  for(int i = 0; i < plugin->getNumLayouts(); i++)
  {
    Layout* layout = plugin->getLayout(i);
    RenderLayoutPlugin* rPlugin = (RenderLayoutPlugin*)layout->getPlugin("render");
    if (rPlugin != NULL && rPlugin->getNumLocalRenderInformationObjects() > 0) return true;
  }

  return false;
}
Example #18
0
void view_destroyed(tw_handle view)
{
	debug_log("starting destroy view\n");
	tw_handle output, pview;
	Layout *layout;
	//routine:
	//0): find out the most previous view, I think i3 has a stack that stores all the views you have
	output = wlc_view_get_output(view);
	layout = tw_output_get_current_layout(output);

	//TODO: we need to come up with a constant value for next view
	pview = layout->getViewOffset(view, 1);//get next view that may comes avaliable

	layout->destroyView(view);
	
	//call update view here so we don't need to call in every subclass
	layout->update_views();
	wlc_view_focus(pview);
	relayout(wlc_view_get_output(view));
}
Example #19
0
Layout* LayoutDB::getOrLoadLayout(const QString& name, QWidget* dialogParent)
{
	Layouts::iterator it = layouts.find(name);
	if (it == layouts.end())
		return NULL;
	
	if (*it)
		return *it;

	// Scoring not loaded yet
	Layout* loadedLayout = new Layout(name);
	if (!loadedLayout->loadFromFile())
	{
		delete loadedLayout;
		return NULL;
	}
	layouts.insert(name, loadedLayout);
	
	return loadedLayout;
}
Example #20
0
void XournalView::pageInserted(size_t page)
{
	XOJ_CHECK_TYPE(XournalView);

	XojPageView** lastViewPages = this->viewPages;

	this->viewPages = new XojPageView *[this->viewPagesLen + 1];

	for (size_t i = 0; i < page; i++)
	{
		this->viewPages[i] = lastViewPages[i];

		// unselect to prevent problems...
		this->viewPages[i]->setSelected(false);
	}

	for (size_t i = page; i < this->viewPagesLen; i++)
	{
		this->viewPages[i + 1] = lastViewPages[i];

		// unselect to prevent problems...
		this->viewPages[i + 1]->setSelected(false);
	}

	this->lastSelectedPage = -1;

	this->viewPagesLen++;

	delete[] lastViewPages;

	Document* doc = control->getDocument();
	doc->lock();
	XojPageView* pageView = new XojPageView(this, doc->getPage(page));
	doc->unlock();

	this->viewPages[page] = pageView;

	Layout* layout = gtk_xournal_get_layout(this->widget);
	layout->layoutPages();
	layout->updateVisibility();
}
Example #21
0
void StandardObject::set_slot_value(Value arg1, Value arg2)
{
  if (!symbolp(arg1))
    {
      signal_type_error(arg1, S_symbol);
      return;
    }
  Layout * layout = this->layout();
  if (!layout)
    {
      signal_lisp_error("No layout for instance.");
      return;
    }
  if (layout->is_invalid())
    {
      // Update instance.
      layout = update_layout();
    }
  long index = layout->slot_index(arg1);
  if (index >= 0)
    {
      iset(index, arg2);
    }
  else
    {
      // not an instance slot
      Value location = layout->shared_slot_location(arg1);
      if (location != NIL)
        SYS_setcdr(location, arg2);
      else
        {
          // slot-missing
          current_thread()->execute(the_symbol(S_slot_missing)->function(),
                                    class_of(),
                                    make_value(this),
                                    arg1,
                                    S_setf,
                                    arg2);
        }
    }
}
Example #22
0
bool Widget::isClippingParentContainsPoint(const Vec2 &pt)
{
    _affectByClipping = false;
    Widget* parent = getWidgetParent();
    Widget* clippingParent = nullptr;
    while (parent)
    {
        Layout* layoutParent = dynamic_cast<Layout*>(parent);
        if (layoutParent)
        {
            if (layoutParent->isClippingEnabled())
            {
                _affectByClipping = true;
                clippingParent = layoutParent;
                break;
            }
        }
        parent = parent->getWidgetParent();
    }

    if (!_affectByClipping)
    {
        return true;
    }


    if (clippingParent)
    {
        bool bRet = false;
        if (clippingParent->hitTest(pt, _hittedByCamera, nullptr))
        {
            bRet = true;
        }
        if (bRet)
        {
            return clippingParent->isClippingParentContainsPoint(pt);
        }
        return false;
    }
    return true;
}
Example #23
0
bool UIWidget::clippingParentAreaContainPoint(const CCPoint &pt)
{
    m_bAffectByClipping = false;
    UIWidget* parent = getParent();
    UIWidget* clippingParent = NULL;
    while (parent)
    {
        Layout* layoutParent = dynamic_cast<Layout*>(parent);
        if (layoutParent)
        {
            if (layoutParent->isClippingEnabled())
            {
                m_bAffectByClipping = true;
                clippingParent = layoutParent;
                break;
            }
        }
        parent = parent->getParent();
    }
    
    if (!m_bAffectByClipping)
    {
        return true;
    }
    
    
    if (clippingParent)
    {
        bool bRet = false;
        if (clippingParent->hitTest(pt))
        {
            bRet = true;
        }
        if (bRet)
        {
            return clippingParent->clippingParentAreaContainPoint(pt);
        }
        return false;
    }
    return true;
}
Example #24
0
	FoldersHistoryDlg( NCDialogParent* parent, PathList& dataList )
	 : PathListDlg( parent, m_historyWin, _LT( "Folders History" ), 0 )
	 , m_historyWin( this, dataList )
	 , m_lo( 10, 10 )
	{
		m_ListWin.Show();
		m_ListWin.Enable();

		m_lo.AddWin( &m_ListWin, 0, 0, 9, 0 );
		m_lo.SetLineGrowth( 9 );
		AddLayout( &m_lo );

		SetPosition();
		m_ListWin.SetFocus();

		if ( dataList.GetCount() > 0 )
		{
			// select the last item and make it visible
			m_ListWin.MoveCurrent( dataList.GetCount() - 1 );
		}
	}
Example #25
0
void Canvas::_switchLayout(const uint32_t oldIndex, const uint32_t newIndex)
{
    if (oldIndex == newIndex)
        return;

    const Layouts& layouts = getLayouts();
    const size_t nLayouts = layouts.size();
    Layout* oldLayout = (oldIndex >= nLayouts) ? 0 : layouts[oldIndex];
    Layout* newLayout = (newIndex >= nLayouts) ? 0 : layouts[newIndex];

    if (oldLayout)
        oldLayout->trigger(this, false);

    if (newIndex == LB_UNDEFINED_UINT32)
        return;

    Super::activateLayout(newIndex);

    if (newLayout)
        newLayout->trigger(this, true);
}
Example #26
0
TEST(Frozen, SchemaSaving) {
  // calculate a layout
  Layout<example2::EveryLayout> stressLayoutCalculated;
  CHECK(LayoutRoot::layout(stressValue, stressLayoutCalculated));

  // save it
  schema::Schema schemaSaved;
  stressLayoutCalculated.saveRoot(schemaSaved);

  // reload it
  Layout<example2::EveryLayout> stressLayoutLoaded;
  stressLayoutLoaded.loadRoot(schemaSaved);

  // make sure the two layouts are identical (via printing)
  EXPECT_PRINTED_EQ(stressLayoutCalculated, stressLayoutLoaded);

  // make sure layouts round-trip
  schema::Schema schemaLoaded;
  stressLayoutLoaded.saveRoot(schemaLoaded);
  EXPECT_EQ(schemaSaved, schemaLoaded);
}
Example #27
0
void SelectHeroLayer::setHeros( Vector<HeroModel*> heros)
{
	lstHero->removeAllItems();

	Node* rootNode = CSLoader::createNode("SelectHeroItem.csb");
	Layout* itemRoot = static_cast<Layout*> (rootNode->getChildByName("root"));

	itemRoot->setTouchEnabled(true);
	itemRoot->addTouchEventListener(CC_CALLBACK_2(SelectHeroLayer::selectTouchEvent, this));

	for(HeroModel* hero:heros)
	{
		Layout* item = (static_cast<Layout*>(itemRoot->clone()));
		lstHero->pushBackCustomItem(item);

		item->setUserObject(hero);
		Text* txtServerName = static_cast<Text*>(Helper::seekWidgetByName(item, "txtHeroName"));
		txtServerName->setString(hero->m_heroName);

		ImageView* imgState = static_cast<ImageView*>(Helper::seekWidgetByName(item, "imgHero"));
		imgState->loadTexture(hero->getHeroImage());


	}
}
Example #28
0
void Cache::delete_nodes(vector<Node*>& nodes)
{
    LOG_TRACE("delete " << nodes.size() << " nodes");

    for (size_t i = 0; i < nodes.size(); i++) {
        Node* node = nodes[i];
        bid_t nid = node->nid();

        delete node;

        // TODO: check node is stored to layout

        TableSettings tbs;
        if (!get_table_settings(node->table_name(), tbs)) {
            assert(false);
        }
        Layout *layout = tbs.layout;
        assert(layout);
       
        layout->delete_block(nid);
    }
}
Example #29
0
	clCreateDirDialog( NCDialogParent* Parent, bool IsMultipleFolders, const unicode_t* Str )
		: clInputStrDialogBase( Parent, utf8_to_unicode( _LT( "Create new directory" ) ).data() )
		, m_Layout( 2, 9 )
		, m_FieldEdit( EDIT_FIELD_MAKE_FOLDER, 0, (Win*)this, 0, 100, 7 )
		, m_MultipleButton( 1, this, utf8_to_unicode( _LT( "Process multiple folders" ) ).data(), 0, IsMultipleFolders )
	{
		m_Layout.AddWinAndEnable( &m_FieldEdit, 0, 0, 0, 2 );
		order.append( &m_FieldEdit );
		
		m_Layout.AddWinAndEnable( &m_MultipleButton, 1, 0, 1, 2 );
		order.append( &m_MultipleButton );
		
		AddLayout( &m_Layout );
		
		if ( Str )
		{
			m_FieldEdit.SetText( Str, true );
		}
		
		m_FieldEdit.SetFocus();
		SetPosition();
	}
void XournalView::zoomChanged(double lastZoom)
{
	XOJ_CHECK_TYPE(XournalView);

	Layout* layout = gtk_xournal_get_layout(this->widget);
	int currentPage = this->getCurrentPage();
	//double pageTop = layout->getVisiblePageTop(currentPage);
	double pageTop = 0.0;

	layout->layoutPages();

	this->scrollTo(currentPage, pageTop);

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

	control->getMetadataManager()->setDouble(file, "zoom", getZoom());

	this->control->getScheduler()->blockRerenderZoom();
}