本文整理汇总了C++中wxWindow::ClientToScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ wxWindow::ClientToScreen方法的具体用法?C++ wxWindow::ClientToScreen怎么用?C++ wxWindow::ClientToScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxWindow
的用法示例。
在下文中一共展示了wxWindow::ClientToScreen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Resize
/* This code is called when you finish resizing a view by dragging the
corner tab, but I think this implementation is lousy and will surprise
the user more often than it will do what they are trying to do. What
I really need to be doing here is do a rewrite such that *no* sashes
move except the ones immediately to the bottom and right of this window,
and handle the case where you resize a window larger than it's neighbors
by destroying the neighbors.
But this will do for now. */
void wxDynamicSashWindowImpl::Resize(int x, int y)
{
wxDynamicSashWindowImpl *h_parent = FindParent(DSR_BOTTOM_EDGE);
wxDynamicSashWindowImpl *v_parent = FindParent(DSR_RIGHT_EDGE);
int h_unify = -1;
int v_unify = -1;
wxWindow *frame = FindFrame();
if (x < 0)
x = 0;
if (y < 0)
y = 0;
if (h_parent)
{
m_container->ClientToScreen(NULL, &y);
h_parent->m_container->ScreenToClient(NULL, &y);
int py = (int)((y * 100) / h_parent->m_container->GetSize().GetHeight() + 0.5);
if (py < 10)
{
wxDynamicSashWindowImpl *ho_parent = FindParent(DSR_TOP_EDGE);
if (ho_parent)
{
if (FindUpperParent(h_parent, ho_parent) == ho_parent)
{
h_unify = 1;
}
else
{
py = (int)((ho_parent->m_child[0]->m_container->GetSize().GetHeight() * 100)
/ h_parent->m_container->GetSize().GetHeight() + 0.5);
h_parent->m_child[0]->m_container->GetConstraints()->height.PercentOf(
h_parent->m_container, wxHeight, py);
h_parent = ho_parent;
h_unify = 0;
}
}
else
{
h_unify = 1;
}
}
else if (py > 90)
{
h_unify = 0;
}
else
{
h_parent->m_child[0]->m_container->GetConstraints()->height.PercentOf(
h_parent->m_container, wxHeight, py);
h_parent->m_container->Layout();
}
}
else
{
int do_resize = 1;
h_parent = FindParent(DSR_TOP_EDGE);
if (h_parent)
{
int py = (int)((y * 100) /
(h_parent->m_container->GetSize().GetHeight() +
y - m_container->GetSize().GetHeight()) + 0.5);
if (py < 10)
h_unify = 0;
}
else if (y < 64)
{
do_resize = 0;
}
if (do_resize)
{
wxSize size = frame->GetSize();
frame->SetSize(size.GetWidth(), size.GetHeight() + y - m_container->GetSize().GetHeight());
}
}
if (v_parent)
{
m_container->ClientToScreen(&x, NULL);
v_parent->m_container->ScreenToClient(&x, NULL);
int px = (int)((x * 100) / v_parent->m_container->GetSize().GetWidth() + 0.5);
if (px < 10)
//.........这里部分代码省略.........
示例2: DrawSash
void wxDynamicSashWindowImpl::DrawSash(int x, int y) const
{
int i, j;
wxScreenDC dc;
dc.StartDrawingOnTop(m_container);
wxBitmap bmp(8, 8);
wxMemoryDC bdc;
bdc.SelectObject(bmp);
bdc.DrawRectangle(-1, -1, 10, 10);
for (i = 0; i < 8; i++)
{
for (j = 0; j < 8; j++)
{
if ((i + j) & 1)
bdc.DrawPoint(i, j);
}
}
wxBrush brush(bmp);
dc.SetBrush(brush);
dc.SetLogicalFunction(wxXOR);
if ((m_dragging == DSR_CORNER) &&
(m_window->GetWindowStyle() & wxDS_DRAG_CORNER) != 0)
{
int cx = 0;
int cy = 0;
m_container->ClientToScreen(&cx, &cy);
m_container->ClientToScreen(&x, &y);
if (cx < x && cy < y)
{
dc.DrawRectangle(cx - 2, cy - 2, x - cx + 4, 4);
dc.DrawRectangle(x - 2, cy + 2, 4, y - cy);
dc.DrawRectangle(cx - 2, cy + 2, 4, y - cy);
dc.DrawRectangle(cx + 2, y - 2, x - cx - 4, 4);
}
}
else
{
int body_w, body_h;
m_container->GetClientSize(&body_w, &body_h);
if (y < 0)
y = 0;
if (y > body_h)
y = body_h;
if (x < 0)
x = 0;
if (x > body_w)
x = body_w;
if (m_dragging == DSR_HORIZONTAL_TAB)
x = 0;
else
y = 0;
m_container->ClientToScreen(&x, &y);
int w, h;
w = body_w; h = body_h;
if (m_dragging == DSR_HORIZONTAL_TAB)
dc.DrawRectangle(x, y - 2, w, 4);
else
dc.DrawRectangle(x - 2, y, 4, h);
}
dc.EndDrawingOnTop();
}