void GwenUserInterface::init(int width, int height,struct sth_stash* stash,float retinaScale) { m_data->m_curYposition = 20; m_data->m_primRenderer = new GLPrimitiveRenderer(width,height); m_data->pRenderer = new GwenOpenGL3CoreRenderer(m_data->m_primRenderer,stash,width,height,retinaScale); m_data->skin.SetRender( m_data->pRenderer ); m_data->pCanvas= new Gwen::Controls::Canvas( &m_data->skin ); m_data->pCanvas->SetSize( width,height); m_data->pCanvas->SetDrawBackground( false); m_data->pCanvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) ); MyTestMenuBar* menubar = new MyTestMenuBar(m_data->pCanvas); Gwen::Controls::StatusBar* bar = new Gwen::Controls::StatusBar(m_data->pCanvas); m_data->m_rightStatusBar = new Gwen::Controls::Label( bar ); m_data->m_rightStatusBar->SetWidth(width/2); //m_data->m_rightStatusBar->SetText( L"Label Added to Right" ); bar->AddControl( m_data->m_rightStatusBar, true ); m_data->m_leftStatusBar = new Gwen::Controls::Label( bar ); //m_data->m_leftStatusBar->SetText( L"Label Added to Left" ); m_data->m_leftStatusBar->SetWidth(width/2); bar->AddControl( m_data->m_leftStatusBar,false); //Gwen::KeyboardFocus /*Gwen::Controls::GroupBox* box = new Gwen::Controls::GroupBox(m_data->pCanvas); box->SetText("text"); box->SetName("name"); box->SetHeight(500); */ Gwen::Controls::ScrollControl* windowRight= new Gwen::Controls::ScrollControl(m_data->pCanvas); windowRight->Dock(Gwen::Pos::Right); windowRight->SetWidth(150); windowRight->SetHeight(250); windowRight->SetScroll(false,true); //windowLeft->SetSkin( Gwen::Controls::TabControl* tab = new Gwen::Controls::TabControl(windowRight); //tab->SetHeight(300); tab->SetWidth(140); tab->SetHeight(250); //tab->Dock(Gwen::Pos::Left); tab->Dock( Gwen::Pos::Fill ); //tab->SetMargin( Gwen::Margin( 2, 2, 2, 2 ) ); Gwen::UnicodeString str1(L"Main"); m_data->m_demoPage = tab->AddPage(str1); // Gwen::UnicodeString str2(L"OpenCL"); // tab->AddPage(str2); //Gwen::UnicodeString str3(L"page3"); // tab->AddPage(str3); //but->onPress.Add(handler, &MyHander::onButtonA); //box->Dock(Gwen::Pos::Left); /*Gwen::Controls::WindowControl* windowBottom = new Gwen::Controls::WindowControl(m_data->pCanvas); windowBottom->SetHeight(100); windowBottom->Dock(Gwen::Pos::Bottom); windowBottom->SetTitle("bottom"); */ // Gwen::Controls::Property::Text* prop = new Gwen::Controls::Property::Text(m_data->pCanvas); //prop->Dock(Gwen::Pos::Bottom); /*Gwen::Controls::SplitterBar* split = new Gwen::Controls::SplitterBar(m_data->pCanvas); split->Dock(Gwen::Pos::Center); split->SetHeight(300); split->SetWidth(300); */ /* */ Gwen::Controls::ScrollControl* windowLeft = new Gwen::Controls::ScrollControl(m_data->pCanvas); windowLeft->Dock(Gwen::Pos::Left); // windowLeft->SetTitle("title"); windowLeft->SetScroll(false, false); windowLeft->SetWidth(250); windowLeft->SetPos(50, 50); windowLeft->SetHeight(500); //windowLeft->SetClosable(false); // windowLeft->SetShouldDrawBackground(true); windowLeft->SetTabable(true); Gwen::Controls::TabControl* explorerTab = new Gwen::Controls::TabControl(windowLeft); //tab->SetHeight(300); // explorerTab->SetWidth(230); explorerTab->SetHeight(250); //tab->Dock(Gwen::Pos::Left); explorerTab->Dock(Gwen::Pos::Fill); Gwen::UnicodeString explorerStr1(L"Explorer"); m_data->m_explorerPage = explorerTab->AddPage(explorerStr1); Gwen::UnicodeString shapesStr1(L"Shapes"); explorerTab->AddPage(shapesStr1); Gwen::UnicodeString testStr1(L"Test"); explorerTab->AddPage(testStr1); Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl(m_data->m_explorerPage->GetPage()); m_data->m_explorerTreeCtrl = ctrl; ctrl->SetKeyboardInputEnabled(true); ctrl->Focus(); ctrl->SetBounds(2, 10, 236, 400); }
void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* renderer,float retinaScale) { m_data->m_curYposition = 20; //m_data->m_primRenderer = new GLPrimitiveRenderer(width,height); m_data->pRenderer = renderer;//new GwenOpenGL3CoreRenderer(m_data->m_primRenderer,stash,width,height,retinaScale); m_data->skin.SetRender( m_data->pRenderer ); m_data->pCanvas= new Gwen::Controls::Canvas( &m_data->skin ); m_data->pCanvas->SetSize( width,height); m_data->pCanvas->SetDrawBackground( false); m_data->pCanvas->SetBackgroundColor( Gwen::Color( 150, 170, 170, 255 ) ); MyTestMenuBar* menubar = new MyTestMenuBar(m_data->pCanvas); m_data->m_viewMenu = menubar->m_viewMenu; m_data->m_menuItems = menubar->m_menuItems; m_data->m_menubar = menubar; Gwen::Controls::StatusBar* bar = new Gwen::Controls::StatusBar(m_data->pCanvas); m_data->m_bar = bar; m_data->m_rightStatusBar = new Gwen::Controls::Label( bar ); m_data->m_rightStatusBar->SetWidth(width/2); //m_data->m_rightStatusBar->SetText( L"Label Added to Right" ); bar->AddControl( m_data->m_rightStatusBar, true ); m_data->m_TextOutput = new Gwen::Controls::ListBox( m_data->pCanvas ); m_data->m_TextOutput->Dock( Gwen::Pos::Bottom ); m_data->m_TextOutput->SetHeight( 100 ); m_data->m_leftStatusBar = new Gwen::Controls::Label( bar ); //m_data->m_leftStatusBar->SetText( L"Label Added to Left" ); m_data->m_leftStatusBar->SetWidth(width/2); bar->AddControl( m_data->m_leftStatusBar,false); //Gwen::KeyboardFocus /*Gwen::Controls::GroupBox* box = new Gwen::Controls::GroupBox(m_data->pCanvas); box->SetText("text"); box->SetName("name"); box->SetHeight(500); */ Gwen::Controls::ScrollControl* windowRight= new Gwen::Controls::ScrollControl(m_data->pCanvas); windowRight->Dock(Gwen::Pos::Right); windowRight->SetWidth(250); windowRight->SetHeight(250); windowRight->SetScroll(false,true); m_data->m_windowRight = windowRight; //windowLeft->SetSkin( Gwen::Controls::TabControl* tab = new Gwen::Controls::TabControl(windowRight); m_data->m_tab = tab; //tab->SetHeight(300); tab->SetWidth(240); tab->SetHeight(1250); //tab->Dock(Gwen::Pos::Left); tab->Dock( Gwen::Pos::Fill ); //tab->SetMargin( Gwen::Margin( 2, 2, 2, 2 ) ); Gwen::UnicodeString str1(L"Params"); m_data->m_demoPage = tab->AddPage(str1); // Gwen::UnicodeString str2(L"OpenCL"); // tab->AddPage(str2); //Gwen::UnicodeString str3(L"page3"); // tab->AddPage(str3); //but->onPress.Add(handler, &MyHander::onButtonA); //box->Dock(Gwen::Pos::Left); /*Gwen::Controls::WindowControl* windowBottom = new Gwen::Controls::WindowControl(m_data->pCanvas); windowBottom->SetHeight(100); windowBottom->Dock(Gwen::Pos::Bottom); windowBottom->SetTitle("bottom"); */ // Gwen::Controls::Property::Text* prop = new Gwen::Controls::Property::Text(m_data->pCanvas); //prop->Dock(Gwen::Pos::Bottom); /*Gwen::Controls::SplitterBar* split = new Gwen::Controls::SplitterBar(m_data->pCanvas); split->Dock(Gwen::Pos::Center); split->SetHeight(300); split->SetWidth(300); */ /* */ Gwen::Controls::ScrollControl* windowLeft = new Gwen::Controls::ScrollControl(m_data->pCanvas); windowLeft->Dock(Gwen::Pos::Left); // windowLeft->SetTitle("title"); windowLeft->SetScroll(false, false); windowLeft->SetWidth(250); windowLeft->SetPos(50, 50); windowLeft->SetHeight(500); //windowLeft->SetClosable(false); // windowLeft->SetShouldDrawBackground(true); windowLeft->SetTabable(true); Gwen::Controls::TabControl* explorerTab = new Gwen::Controls::TabControl(windowLeft); //tab->SetHeight(300); // explorerTab->SetWidth(230); explorerTab->SetHeight(250); //tab->Dock(Gwen::Pos::Left); explorerTab->Dock(Gwen::Pos::Fill); //m_data->m_exampleInfoTextOutput->SetBounds(2, 10, 236, 400); //windowRight Gwen::UnicodeString explorerStr1(L"Explorer"); m_data->m_explorerPage = explorerTab->AddPage(explorerStr1); Gwen::UnicodeString shapesStr1(L"Test"); Gwen::Controls::TabButton* shapes = explorerTab->AddPage(shapesStr1); ///todo(erwincoumans) figure out why the HSV color picker is extremely slow //Gwen::Controls::HSVColorPicker* color = new Gwen::Controls::HSVColorPicker(shapes->GetPage()); Gwen::Controls::ColorPicker* color = new Gwen::Controls::ColorPicker(shapes->GetPage()); color->SetKeyboardInputEnabled(true); Gwen::Controls::TreeControl* ctrl = new Gwen::Controls::TreeControl(m_data->m_explorerPage->GetPage()); m_data->m_explorerTreeCtrl = ctrl; ctrl->SetKeyboardInputEnabled(true); ctrl->Focus(); ctrl->SetBounds(2, 10, 236, 300); m_data->m_exampleInfoGroupBox = new Gwen::Controls::Label( m_data->m_explorerPage->GetPage() ); m_data->m_exampleInfoGroupBox->SetPos(2, 314); m_data->m_exampleInfoGroupBox->SetHeight( 15 ); m_data->m_exampleInfoGroupBox->SetWidth(234); m_data->m_exampleInfoGroupBox->SetText("Example Description"); m_data->m_exampleInfoTextOutput = new Gwen::Controls::ListBox(m_data->m_explorerPage->GetPage()); //m_data->m_exampleInfoTextOutput->Dock( Gwen::Pos::Bottom ); m_data->m_exampleInfoTextOutput->SetPos(2, 332); m_data->m_exampleInfoTextOutput->SetHeight( 150 ); m_data->m_exampleInfoTextOutput->SetWidth(233); }
GWEN_CONTROL_INLINE( ScrollControl, GUnit ) { { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 10, 10, 100, 100 ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Twice As Big" ); pTestButton->SetBounds( 0, 0, 200, 200 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 110, 10, 100, 100 ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Same Size" ); pTestButton->SetBounds( 0, 0, 100, 100 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 210, 10, 100, 100 ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Wide" ); pTestButton->SetBounds( 0, 0, 200, 50 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 310, 10, 100, 100 ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Tall" ); pTestButton->SetBounds( 0, 0, 50, 200 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 410, 10, 100, 100 ); pCtrl->SetScroll( false, true ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Vertical" ); pTestButton->SetBounds( 0, 0, 200, 200 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 510, 10, 100, 100 ); pCtrl->SetScroll( true, false ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Horinzontal" ); pTestButton->SetBounds( 0, 0, 200, 200 ); } // Bottom Row { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 10, 110, 100, 100 ); pCtrl->SetAutoHideBars( true ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Twice As Big" ); pTestButton->SetBounds( 0, 0, 200, 200 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 110, 110, 100, 100 ); pCtrl->SetAutoHideBars( true ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Same Size" ); pTestButton->SetBounds( 0, 0, 100, 100 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 210, 110, 100, 100 ); pCtrl->SetAutoHideBars( true ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Wide" ); pTestButton->SetBounds( 0, 0, 200, 50 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 310, 110, 100, 100 ); pCtrl->SetAutoHideBars( true ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Tall" ); pTestButton->SetBounds( 0, 0, 50, 200 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 410, 110, 100, 100 ); pCtrl->SetAutoHideBars( true ); pCtrl->SetScroll( false, true ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Vertical" ); pTestButton->SetBounds( 0, 0, 200, 200 ); } { Gwen::Controls::ScrollControl* pCtrl = new Gwen::Controls::ScrollControl( this ); pCtrl->SetBounds( 510, 110, 100, 100 ); pCtrl->SetAutoHideBars( true ); pCtrl->SetScroll( true, false ); Controls::Button* pTestButton = new Controls::Button( pCtrl ); pTestButton->SetText( L"Horinzontal" ); pTestButton->SetBounds( 0, 0, 200, 200 ); } }