本文整理汇总了C++中wxWindow::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ wxWindow::Create方法的具体用法?C++ wxWindow::Create怎么用?C++ wxWindow::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxWindow
的用法示例。
在下文中一共展示了wxWindow::Create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
bool wxDynamicSashWindowLeaf::Create()
{
m_hscroll = new wxScrollBar();
m_vscroll = new wxScrollBar();
m_viewport = new wxWindow();
wxDynamicSashWindowImpl *add_child_target = m_impl->m_add_child_target;
m_impl->m_add_child_target = NULL;
bool success = m_hscroll->Create(m_impl->m_container, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxSB_HORIZONTAL);
if ( success )
success = m_vscroll->Create(m_impl->m_container, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxSB_VERTICAL);
if ( success )
success = m_viewport->Create(m_impl->m_container, wxID_ANY);
if ( !success )
return false;
m_impl->m_add_child_target = add_child_target;
wxCursor cursor(wxCURSOR_ARROW);
m_hscroll->SetCursor(cursor);
m_vscroll->SetCursor(cursor);
m_viewport->SetCursor(cursor);
// the viewport must resize its child when it is itself resized, but it's
// more convenient to do it in our own method instead of deriving a new
// class just for this: this is why we pass this as last Connect() argument
m_viewport->Connect(wxEVT_SIZE,
wxSizeEventHandler(wxDynamicSashWindowLeaf::OnViewSize),
NULL, this);
Connect(wxEVT_DYNAMIC_SASH_REPARENT,
wxEventHandler(wxDynamicSashWindowLeaf::OnReparent));
if (m_impl->m_window->GetWindowStyle() & wxDS_MANAGE_SCROLLBARS)
{
m_hscroll->SetEventHandler(this);
m_vscroll->SetEventHandler(this);
Connect(wxEVT_SET_FOCUS,
wxFocusEventHandler(wxDynamicSashWindowLeaf::OnFocus));
Connect(wxEVT_SCROLL_TOP,
wxScrollEventHandler(wxDynamicSashWindowLeaf::OnScroll));
Connect(wxEVT_SCROLL_BOTTOM,
wxScrollEventHandler(wxDynamicSashWindowLeaf::OnScroll));
Connect(wxEVT_SCROLL_LINEUP,
wxScrollEventHandler(wxDynamicSashWindowLeaf::OnScroll));
Connect(wxEVT_SCROLL_LINEDOWN,
wxScrollEventHandler(wxDynamicSashWindowLeaf::OnScroll));
Connect(wxEVT_SCROLL_PAGEUP,
wxScrollEventHandler(wxDynamicSashWindowLeaf::OnScroll));
Connect(wxEVT_SCROLL_PAGEDOWN,
wxScrollEventHandler(wxDynamicSashWindowLeaf::OnScroll));
Connect(wxEVT_SCROLL_THUMBTRACK,
wxScrollEventHandler(wxDynamicSashWindowLeaf::OnScroll));
Connect(wxEVT_SCROLL_THUMBRELEASE,
wxScrollEventHandler(wxDynamicSashWindowLeaf::OnScroll));
}
wxLayoutConstraints *layout = new wxLayoutConstraints();
if (!layout)
return false;
wxSize size = m_hscroll->GetBestSize();
layout->left.SameAs(m_impl->m_container, wxLeft, 10);
layout->right.LeftOf(m_vscroll);
layout->bottom.SameAs(m_impl->m_container, wxBottom, 3);
layout->height.Absolute(size.GetHeight());
m_hscroll->SetConstraints(layout);
layout = new wxLayoutConstraints();
if (!layout)
return false;
size = m_vscroll->GetBestSize();
layout->top.SameAs(m_impl->m_container, wxTop, 10);
layout->bottom.Above(m_hscroll);
layout->right.SameAs(m_impl->m_container, wxRight, 3);
layout->width.Absolute(size.GetWidth());
m_vscroll->SetConstraints(layout);
layout = new wxLayoutConstraints();
if (!layout)
return false;
layout->left.SameAs(m_impl->m_container, wxLeft, 3);
layout->right.LeftOf(m_vscroll);
layout->top.SameAs(m_impl->m_container, wxTop, 3);
layout->bottom.Above(m_hscroll);
m_viewport->SetConstraints(layout);
m_impl->m_container->Layout();
return true;
}