コード例 #1
0
ファイル: TuiManager.cpp プロジェクト: zh0ub1n/Tui-x
CScrollView *TuiManager::createScrollView(float tag, Color4B color, int direction, int innerWidth, int innerHeight, float x, float y, float w, float h, float rotation){
	CScrollView *pView = CScrollView::create(Size(w,h));
	if (color.a != 0) pView->setBackgroundColor(color);
	pView->setPosition(Vec2(x,-y));
	pView->setContainerSize(Size(innerWidth, innerHeight));
	pView->setDirection((CScrollViewDirection)direction);
	pView->setRotation(rotation);
	pView->setTag(tag);
	return pView;
}
コード例 #2
0
ファイル: pdrawtesteditor.cpp プロジェクト: DaniM/lyngo
void DrawTestEditor::setTabView (CFrame* frame, const CRect& r, long position)
{
	frame->removeAll ();
	CBitmap* tabButtonBitmap = new CBitmap (kTabButtonBitmap);
	CTabView* tabView = new MyTabView (r, frame, tabButtonBitmap, NULL, position, this);
	tabView->setTransparency (true);
	frame->addView (tabView);
	CRect tabSize = tabView->getTabViewSize (tabSize);
//	tabSize.inset (1, 1);
	// add tabs
	CView* testView;
	CBitmap* testBitmap = new CBitmap (kTestBitmap);
	CRect containerSize;
	containerSize.right = testBitmap->getWidth () + 1000;
	containerSize.bottom = testBitmap->getHeight () + 1000;
	// the first tab is a scroll view with a movie bitmap
	CScrollView* scrollview = new CScrollView (tabSize, containerSize, frame, CScrollView::kHorizontalScrollbar|CScrollView::kVerticalScrollbar/*|CScrollView::kDontDrawFrame*/);
	scrollview->setBackgroundColor (kWhiteCColor);
//	scrollview->setTransparency (true);
	CPoint p (0,0);
	CRect mbSize (containerSize);
	mbSize.setWidth (testBitmap->getWidth ());
	mbSize.setHeight (testBitmap->getHeight ());
	testView = new CMovieBitmap (mbSize, NULL, 0, 1, testBitmap->getHeight (), testBitmap, p);
	testBitmap->forget ();
	scrollview->addView (testView);
	CRect controlsGUISize2 (0, 0, 420, 210);
	controlsGUISize2.offset (mbSize.right, 5);
	testView = new ControlsGUI (controlsGUISize2, frame);
	scrollview->addView (testView);
	tabView->addTab (scrollview, "Scroll View");

	testView = new PLinesView (tabSize);
	tabView->addTab (testView, "Lines");

	testView = new PRectsView (tabSize);
	tabView->addTab (testView, "Rects");

	testView = new PMiscView (tabSize);
	tabView->addTab (testView, "Misc");

	// the third tab is the old controlsgui view embeded into a container view
	CRect controlsGUISize (0, 0, 420, 210);
	controlsGUISize.offset (5, 5);
	testView = new ControlsGUI (controlsGUISize, frame);

	CViewContainer* controlContainer = new CViewContainer (tabSize, frame);
	controlContainer->setTransparency (true);
	controlContainer->addView (testView);
	
	tabView->addTab (controlContainer, "Controls");

	CColor redColor = {255, 0, 0, 150};
	CColor greenColor = {0, 255, 0, 150};
	CColor blueColor = {0, 0, 255, 150};

	CViewContainer* clipView = new CViewContainer (tabSize, frame);
	clipView->setTransparency (true);
	CRect clipViewSize (0, 0, tabSize.getWidth () / 4, tabSize.getHeight () / 2);
	MyColoredView* cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (redColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (greenColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (blueColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (redColor);
	clipView->addView (cv);
	clipViewSize (0, tabSize.getHeight () / 2, tabSize.getWidth () / 4, tabSize.getHeight ());
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (greenColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (blueColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (redColor);
	clipView->addView (cv);
	clipViewSize.offset (clipViewSize.getWidth (), 0);
	cv = new MyColoredView (clipViewSize);
	cv->setBackgroundColor (greenColor);
	clipView->addView (cv);
	
	tabView->addTab (clipView, "Clip Test");
	tabView->alignTabs (CTabView::kAlignCenter);

	tabButtonBitmap->forget ();
	frame->setDirty ();
}