本文整理汇总了C++中wxWindow::ReleaseMouse方法的典型用法代码示例。如果您正苦于以下问题:C++ wxWindow::ReleaseMouse方法的具体用法?C++ wxWindow::ReleaseMouse怎么用?C++ wxWindow::ReleaseMouse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxWindow
的用法示例。
在下文中一共展示了wxWindow::ReleaseMouse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Mouse
void WindowTestCase::Mouse()
{
wxCursor cursor(wxCURSOR_CHAR);
m_window->SetCursor(cursor);
CPPUNIT_ASSERT(m_window->GetCursor().IsOk());
//A plain window doesn't have a caret
CPPUNIT_ASSERT(!m_window->GetCaret());
wxCaret* caret = new wxCaret(m_window, 16, 16);
m_window->SetCaret(caret);
CPPUNIT_ASSERT(m_window->GetCaret()->IsOk());
m_window->CaptureMouse();
CPPUNIT_ASSERT(m_window->HasCapture());
m_window->ReleaseMouse();
CPPUNIT_ASSERT(!m_window->HasCapture());
}
示例2: OnRelease
void wxDynamicSashWindowImpl::OnRelease(wxMouseEvent &event)
{
if ((m_dragging == DSR_CORNER) &&
(m_window->GetWindowStyle() & wxDS_DRAG_CORNER) != 0)
{
DrawSash(m_drag_x, m_drag_y);
m_container->ReleaseMouse();
Resize(event.m_x, event.m_y);
m_dragging = DSR_NONE;
}
else if (m_dragging)
{
DrawSash(m_drag_x, m_drag_y);
m_container->ReleaseMouse();
wxSize size = m_container->GetSize();
int px = (int)((event.m_x * 100) / size.GetWidth() + 0.5);
int py = (int)((event.m_y * 100) / size.GetHeight() + 0.5);
if ((m_dragging == DSR_HORIZONTAL_TAB && py >= 10 && py <= 90)
|| (m_dragging == DSR_VERTICAL_TAB && px >= 10 && px <= 90))
{
if (m_child[0] == NULL)
{
Split(px, py);
}
else
{
/* It would be nice if moving *this* sash didn't implicitly move
the sashes of our children (if any). But this will do. */
wxLayoutConstraints *layout = m_child[0]->m_container->GetConstraints();
if (m_split == DSR_HORIZONTAL_TAB)
{
layout->height.PercentOf(m_container, wxHeight, py);
}
else
{
layout->width.PercentOf(m_container, wxWidth, px);
}
m_container->Layout();
}
}
else
{
if (m_child[0] != NULL)
{
if ((m_dragging == DSR_HORIZONTAL_TAB && py <= 10)
|| (m_dragging == DSR_VERTICAL_TAB && px <= 10))
{
Unify(1);
}
else
{
Unify(0);
}
}
}
wxCursor cursor;
if (m_split == DSR_HORIZONTAL_TAB)
cursor = wxCursor(wxCURSOR_SIZENS);
else if (m_split == DSR_VERTICAL_TAB)
cursor = wxCursor(wxCURSOR_SIZEWE);
else
cursor = wxCursor(wxCURSOR_ARROW);
m_container->SetCursor(cursor);
m_dragging = DSR_NONE;
}
else if (m_leaf)
{
m_leaf->OnRelease(event);
}
}