| 629 | } |
| 630 | |
| 631 | void SampleApp::OnAddButtonVClick() { |
| 632 | auto button = sfg::Button::Create( L"<- New" ); |
| 633 | |
| 634 | auto ouchy = std::make_shared<Ouchy>( button ); |
| 635 | Ouchy::m_ouchies.push_back( ouchy ); |
| 636 | |
| 637 | std::weak_ptr<Ouchy> weak_ouchy = ouchy; |
| 638 | |
| 639 | button->GetSignal( sfg::Widget::OnLeftClick ).Connect( [weak_ouchy] { |
| 640 | auto strong_ouchy = weak_ouchy.lock(); |
| 641 | |
| 642 | if( strong_ouchy ) { |
| 643 | strong_ouchy->DoOuch(); |
| 644 | } |
| 645 | } ); |
| 646 | |
| 647 | m_boxbuttonsv->Pack( button, false ); |
| 648 | } |
| 649 | |
| 650 | void SampleApp::OnToggleTitlebarClick() { |
| 651 | m_wndmain->SetStyle( m_wndmain->GetStyle() ^ sfg::Window::TITLEBAR ); |