本文整理汇总了C++中gwen::controls::Button类的典型用法代码示例。如果您正苦于以下问题:C++ Button类的具体用法?C++ Button怎么用?C++ Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Button类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: scrolling
GWEN_CONTROL_INLINE(PageControl, GUnit)
{
Gwen::Controls::PageControl* control = new Gwen::Controls::PageControl(this);
control->SetSize(500, 300);
control->SetPageCount(5);
control->onPageChanged.Add(this, &ThisClass::OnPageChanged);
control->onFinish.Add(this, &ThisClass::OnFinish);
// Page 0
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button(control->GetPage(0));
pButton->Dock(Pos::Fill);
pButton->SetText("This button is fill docked on page 0");
}
// Page 1
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button(control->GetPage(1));
pButton->Dock(Pos::Top);
pButton->SetText("This button is top docked on page 1");
}
// Page 2
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button(control->GetPage(2));
pButton->SetSize(400, 1000);
pButton->SetPos(50, 50);
pButton->SetText("This button is long to test scrolling (page 2)");
}
}
开发者ID:craley,项目名称:Poky,代码行数:27,代码来源:PageControl.cpp
示例2: addControls
void CustomControlWindowApp::addControls()
{
Gwen::Controls::Button *btn = new Gwen::Controls::Button( mCanvas );
btn->SetBounds( getWindowCenter().x - 40, getWindowCenter().y - 20, 80, 40 );
btn->SetText( "Click Me" );
btn->onPress.Add( this, &CustomControlWindowApp::buttonPressed );
btn->AddAccelerator( "x" );
}
开发者ID:simongeilfus,项目名称:Cinder-Gwen-1,代码行数:8,代码来源:CustomControlWindowApp.cpp
示例3: onButtonA
void onButtonA( Gwen::Controls::Base* pControl )
{
Gwen::Controls::Button* but = (Gwen::Controls::Button*) pControl;
// int dep = but->IsDepressed();
int tog = but->GetToggleState();
if (m_data->m_toggleButtonCallback)
(*m_data->m_toggleButtonCallback)(m_buttonId,tog);
}
开发者ID:AndrewMeadows,项目名称:bullet3,代码行数:8,代码来源:gwenUserInterface.cpp
示例4: onButtonPress
void onButtonPress( Gwen::Controls::Base* pControl )
{
if (m_callback)
{
bool buttonState = true;
if (m_buttonControl->IsToggle())
{
buttonState = m_buttonControl->GetToggleState();
}
( *m_callback )( m_buttonId, buttonState, m_userPointer );
}
}
开发者ID:Ochakko,项目名称:MameBake3D,代码行数:12,代码来源:GwenParameterInterface.cpp
示例5: AddButton
AngelUIHandle UserInterface::AddButton(const String& label, Vec2i position, void (*callback)(), bool center, const String& font, Vec2i padding)
{
Gwen::Controls::Button* button = new Gwen::Controls::Button(AngelCanvas);
if (font != "")
{
button->SetFont(Gwen::Utility::StringToUnicode(font), 20, false);
}
button->SetText(label);
button->SetPadding(Gwen::Padding(padding.X, padding.Y, padding.X, padding.Y));
button->SizeToContents();
if (center)
{
Gwen::Point size = button->GetSize();
button->SetPos(position.X - (size.x / 2), position.Y - (size.y / 2));
}
else
{
button->SetPos(position.X, position.Y);
}
button->onPress.Add(&handler, &EventHandler::OnPress);
handler.AddButtonCallback(button, callback);
_elements.insert(button);
return button;
}
开发者ID:CmPons,项目名称:angel2d,代码行数:27,代码来源:UserInterface.cpp
示例6: registerButtonParameter
void GwenParameterInterface::registerButtonParameter(ButtonParams& params)
{
Gwen::Controls::Button* button = new Gwen::Controls::Button(m_gwenInternalData->m_demoPage->GetPage());
MyButtonEventHandler* handler = new MyButtonEventHandler(params.m_callback,params.m_buttonId,params.m_userPointer);
button->SetText(params.m_name);
button->onPress.Add( handler, &MyButtonEventHandler::onButtonPress );
m_paramInternalData->m_buttons.push_back(button);
m_paramInternalData->m_buttonEventHandlers.push_back(handler);
button->SetPos( 5, m_gwenInternalData->m_curYposition );
button->SetWidth(220);
m_gwenInternalData->m_curYposition+=22;
}
开发者ID:AndresTraks,项目名称:bullet3,代码行数:17,代码来源:GwenParameterInterface.cpp
示例7: Begin
void CLoadState::Begin()
{
// Load References
SingletonPointer<CMainState> MainState;
SingletonPointer<CMainMenuState> MenuState;
Canvas = GUIManager->GetCanvas();
// Init Canvas
Canvas->SetBackgroundColor(Gwen::Color(32, 48, 48));
Canvas->SetDrawBackground(true);
// Top Label
Gwen::Controls::Label * BigLabel = new Gwen::Controls::Label(Canvas);
BigLabel->SetFont(GUIManager->GetLargeFont());
BigLabel->SetText(L"Loading...");
BigLabel->SetBounds(10, 10, 1590, 300);
BigLabel->SetTextColor(Gwen::Color(255, 255, 255, 84));
GUIManager->Draw(0, true);
Context->Window->SwapBuffers();
AddLabel(L"Initializing System...");
CGUIEventManager * Forwarder = new CGUIEventManager(GUIManager->GetCanvas(), Context->Window);
AddLabel(L"Loading Scene Shaders...");
LoadShaders();
AddLabel(L"Loading Scene Objects...");
LoadScene();
AddLabel(L"Menu is Starting...");
if (GetConfirmation)
{
Gwen::Controls::Button * Button = new Gwen::Controls::Button(GUIManager->GetCanvas());
Button->SetBounds(250, 650, 250, 35);
Button->SetText(L"Continue");
Button->onPress.Add(& Handler, & CLoadStateEventHandler::OnFinish);
}
else
{
OnFinish();
}
}
开发者ID:iondune,项目名称:Aqueous,代码行数:45,代码来源:CLoadState.cpp
示例8:
GWEN_CONTROL_INLINE( PanelListPanel, GUnit )
{
m_PLP = new Gwen::Controls::PanelListPanel( this );
m_PLP->Dock( Pos::Fill );
m_PLP->SetPadding( Gwen::Padding( 10, 10 ));
m_PLP->SetVertical();
m_PLP->SetSizeToChildren( false );
for ( int i = 0; i < 16; i++)
{
Gwen::String testName = "TEST" + Utility::ToString( i );
Gwen::Controls::Button* testButton = new Gwen::Controls::Button( m_PLP );
testButton->SetText( testName );
}
Gwen::Controls::StatusBar* pStatus = new Gwen::Controls::StatusBar( this );
pStatus->Dock( Pos::Bottom );
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button( pStatus );
pButton->SetText( "Horizontal" );
pButton->onPress.Add( this, &PanelListPanel::GoHorizontal );
pStatus->AddControl( pButton, false );
}
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button( pStatus );
pButton->SetText( "Vertical" );
pButton->onPress.Add( this, &PanelListPanel::GoVertical );
pStatus->AddControl( pButton, true );
}
}
开发者ID:Azon099,项目名称:networked-iv,代码行数:32,代码来源:PanelListPanel.cpp
示例9: ShowChoiceBox
AngelUIHandle UserInterface::ShowChoiceBox(const String& choiceLabel, const StringList& labels, void (*callback)(int), const String& font, Vec2i padding, bool modal)
{
Gwen::Controls::WindowControl* box = new Gwen::Controls::WindowControl(AngelCanvas);
box->SetTitle(choiceLabel);
Gwen::TextObject fontTextObject = Gwen::Utility::StringToUnicode(font);
Vec2i maxSize;
std::vector<Gwen::Controls::Button*> buttons;
for (unsigned int i=0; i < labels.size(); i++)
{
Gwen::Controls::Button* button = new Gwen::Controls::Button(box);
buttons.push_back(button);
if (font != "")
{
button->SetFont(fontTextObject, 20, false);
}
button->SetText(labels[i]);
button->SetPadding(Gwen::Padding(padding.X, padding.Y, padding.X, padding.Y));
button->SizeToContents();
Gwen::Point size = button->GetSize();
if (maxSize.X < size.x)
{
maxSize.X = size.x;
}
if (maxSize.Y < size.y)
{
maxSize.Y = size.y;
}
button->onPress.Add(&handler, &EventHandler::OnPress);
}
for (unsigned int i=0; i < buttons.size(); i++)
{
buttons[i]->SetPos(maxSize.X / 2 - (buttons[i]->GetSize().x / 2), i * (maxSize.Y + padding.Y));
}
box->SetSize(maxSize.X + (padding.X * 2), buttons.size() * (maxSize.Y + padding.Y) + (padding.Y * 3));
box->SetPos((AngelCanvas->GetSize().x / 2) - (box->GetSize().x / 2), (AngelCanvas->GetSize().y / 2) - (box->GetSize().y / 2));
if (modal)
{
box->MakeModal();
}
box->SetDeleteOnClose(true);
box->SetClosable(false);
handler.AddChoiceCallback(box, callback);
_elements.insert(box);
return box;
}
开发者ID:CmPons,项目名称:angel2d,代码行数:56,代码来源:UserInterface.cpp
示例10: MyButtonHander
void GwenUserInterface::registerToggleButton(int buttonId, const char* name)
{
assert(m_data);
assert(m_data->m_demoPage);
Gwen::Controls::Button* but = new Gwen::Controls::Button(m_data->m_demoPage->GetPage());
///some heuristic to find the button location
int ypos = m_data->m_handlers.size()*20;
but->SetPos(10, ypos );
but->SetWidth( 100 );
//but->SetBounds( 200, 30, 300, 200 );
MyButtonHander* handler = new MyButtonHander(m_data, buttonId);
m_data->m_handlers.push_back(handler);
but->onToggle.Add(handler, &MyButtonHander::onButtonA);
but->SetIsToggle(true);
but->SetToggleState(false);
but->SetText(name);
}
开发者ID:LiamYao,项目名称:experiments,代码行数:21,代码来源:gwenUserInterface.cpp
示例11:
MyWindow ( Gwen::Controls::Base* pParent)
: Gwen::Controls::WindowControl( pParent )
{
SetTitle( L"FEM Settings" );
SetSize( 200, 300 );
this->Dock( Gwen::Pos::Left );
m_TextOutput = new Gwen::Controls::ListBox( this );
m_TextOutput->Dock( Gwen::Pos::Bottom );
m_TextOutput->SetHeight( 100 );
{
Gwen::Controls::GroupBox* pGroup = new Gwen::Controls::GroupBox( this );
pGroup->SetPos(5, 5);
pGroup->SetSize(170, 45);
// pGroup->Dock( Gwen::Pos::Fill );
pGroup->SetText( "Young modulus" );
Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( pGroup );
pSlider->SetPos( 5, 10 );
pSlider->SetSize( 130, 20 );
pSlider->SetRange( 0, 100 );
pSlider->SetValue( 25 );
pSlider->onValueChanged.Add( this, &MyWindow::SliderMoved);
}
Gwen::Controls::CheckBoxWithLabel* labeled = new Gwen::Controls::CheckBoxWithLabel( this );
labeled->SetPos( 10, 55);
labeled->Checkbox()->SetChecked(true);
labeled->Label()->SetText( "Stifness warping" );
// labeled->Checkbox()->onChecked.Add( handler, &MyHander::OnCheckedStiffnessWarping );
// labeled->Checkbox()->onUnChecked.Add( handler, &MyHander::OnUncheckedStiffnessWarping );
labeled->Checkbox()->onCheckChanged.Add( this, &MyWindow::OnCheckChangedStiffnessWarping );
// Gwen::Align::PlaceBelow( labeled, check, 10 );
if (0)
{
Gwen::Controls::GroupBox* pGroup = new Gwen::Controls::GroupBox( this );
pGroup->SetPos(5, 55);
pGroup->SetSize(170, 45);
// pGroup->Dock( Gwen::Pos::Fill );
pGroup->SetText( "Gravity" );
Gwen::Controls::HorizontalSlider* pSlider = new Gwen::Controls::HorizontalSlider( pGroup);
pSlider->SetPos( 5, 10 );
pSlider->SetSize( 130, 20 );
pSlider->SetRange( 0, 100 );
pSlider->SetValue( 25 );
pSlider->SetNotchCount( 10 );
pSlider->SetClampToNotches( true );
// pSlider->onValueChanged.Add( this, &Slider::SliderMoved );
}
Gwen::Controls::Button* pButton = new Gwen::Controls::Button( this );
pButton->onPress.Add(this, &MyWindow::onButtonA);
pButton->SetBounds( 5, 110, 170, 45);
pButton->SetText( "Toggle simulation" );
}
开发者ID:Kelloggs,项目名称:experiments,代码行数:67,代码来源:AntTweakBar.cpp
示例12:
CGUIControlPanelWidget::CGUIControlPanelWidget()
{
Window = new Gwen::Controls::WindowControl(GUIManager->GetCanvas());
Window->SetDeleteOnClose(false);
Window->SetBounds(30, 600, 660 + 30 + 165 + 165, 85);
Window->SetTitle("Control Panel");
Window->SetClosable(false);
Gwen::Controls::Button * EnableButton = new Gwen::Controls::Button(Window);
EnableButton->SetBounds(15, 10, 150, 35);
EnableButton->SetText("Volume Controls");
EnableButton->onPress.Add(this, & CGUIControlPanelWidget::OnToggleVolume);
EnableButton = new Gwen::Controls::Button(Window);
EnableButton->SetBounds(180, 10, 150, 35);
EnableButton->SetText("Terrain Controls");
EnableButton->onPress.Add(this, & CGUIControlPanelWidget::OnToggleTerrain);
EnableButton = new Gwen::Controls::Button(Window);
EnableButton->SetBounds(345, 10, 150, 35);
EnableButton->SetText("Glyph Controls");
EnableButton->onPress.Add(this, & CGUIControlPanelWidget::OnToggleGlyph);
EnableButton = new Gwen::Controls::Button(Window);
EnableButton->SetBounds(510, 10, 150, 35);
EnableButton->SetText("Scene Controls");
EnableButton->onPress.Add(this, & CGUIControlPanelWidget::OnToggleScene);
EnableButton = new Gwen::Controls::Button(Window);
EnableButton->SetBounds(675, 10, 150, 35);
EnableButton->SetText("Shark Controls");
EnableButton->onPress.Add(this, &CGUIControlPanelWidget::OnToggleShark);
EnableButton = new Gwen::Controls::Button(Window);
EnableButton->SetBounds(840, 10, 150, 35);
EnableButton->SetText("Graph Display");
EnableButton->onPress.Add(this, &CGUIControlPanelWidget::OnToggleGraph);
}
开发者ID:Mikegrann,项目名称:Aqueous,代码行数:39,代码来源:CGUIControlPanelWidget.cpp
示例13:
GWEN_CONTROL_INLINE( CrossSplitter, GUnit )
{
m_bSplittersVisible = false;
m_iCurZoom = 0;
m_Splitter = new Gwen::Controls::CrossSplitter( this );
m_Splitter->SetPos(0, 0);
m_Splitter->Dock( Pos::Fill );
{
Gwen::Controls::Button* testButton = new Gwen::Controls::Button( m_Splitter );
testButton->SetText( "TOPLEFT");
m_Splitter->SetPanel( 0, testButton );
}
{
Gwen::Controls::Button* testButton = new Gwen::Controls::Button( m_Splitter );
testButton->SetText( "TOPRIGHT");
m_Splitter->SetPanel( 1, testButton );
}
{
Gwen::Controls::Button* testButton = new Gwen::Controls::Button( m_Splitter );
testButton->SetText( "BOTTOMRIGHT");
m_Splitter->SetPanel( 2, testButton );
}
{
Gwen::Controls::Button* testButton = new Gwen::Controls::Button( m_Splitter );
testButton->SetText( "BOTTOMLEFT");
m_Splitter->SetPanel( 3, testButton );
}
//Status bar to hold unit testing buttons
Gwen::Controls::StatusBar* pStatus = new Gwen::Controls::StatusBar( this );
pStatus->Dock( Pos::Bottom );
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button( pStatus );
pButton->SetText( "Zoom" );
pButton->onPress.Add( this, &CrossSplitter::ZoomTest );
pStatus->AddControl( pButton, false );
}
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button( pStatus );
pButton->SetText( "UnZoom" );
pButton->onPress.Add( this, &CrossSplitter::UnZoomTest );
pStatus->AddControl( pButton, false );
}
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button( pStatus );
pButton->SetText( "CenterPanels" );
pButton->onPress.Add( this, &CrossSplitter::CenterPanels );
pStatus->AddControl( pButton, true );
}
{
Gwen::Controls::Button* pButton = new Gwen::Controls::Button( pStatus );
pButton->SetText( "Splitters" );
pButton->onPress.Add( this, &CrossSplitter::ToggleSplitters );
pStatus->AddControl( pButton, true );
}
}
开发者ID:dabroz,项目名称:gwen-mirror,代码行数:68,代码来源:CrossSplitter.cpp
注:本文中的gwen::controls::Button类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论