本文整理汇总了C++中wxWindow::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ wxWindow::GetSize方法的具体用法?C++ wxWindow::GetSize怎么用?C++ wxWindow::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxWindow
的用法示例。
在下文中一共展示了wxWindow::GetSize方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSizeLessThanMinSize
void SetSizeTestCase::SetSizeLessThanMinSize()
{
m_win->SetMinSize(wxSize(100, 100));
const wxSize size(200, 50);
m_win->SetSize(size);
CPPUNIT_ASSERT_EQUAL( size, m_win->GetSize() );
}
示例2: Restore
void Restore()
{
int x, y;
m_w->GetSize( &x, &y );
if( x != m_x || y != m_y )
m_w->SetSize( -1, -1, m_x, m_y );
}
示例3: OnReparent
void wxDynamicSashWindowLeaf::OnReparent(wxEvent &WXUNUSED(event))
{
if (m_child)
{
m_child->Reparent(m_viewport);
}
ResizeChild(m_viewport->GetSize());
}
示例4: pxIsValidWindowPosition
// Returns FALSE if the window position is considered invalid, which means that it's title
// bar is most likely not easily grabble. Such a window should be moved to a valid or
// default position.
bool pxIsValidWindowPosition( const wxWindow& window, const wxPoint& windowPos )
{
// The height of the window is only revlevant to the height of a title bar, which is
// all we need visible for the user to be able to drag the window into view. But
// there's no way to get that info from wx, so we'll just have to guesstimate...
wxSize sizeMatters( window.GetSize().GetWidth(), 32 ); // if some gui has 32 pixels of undraggable title bar, the user deserves to suffer.
return wxGetDisplayArea().Contains( wxRect( windowPos, sizeMatters ) );
}
示例5: OnSize
void SwitchView::OnSize(wxSizeEvent& WXUNUSED(event)) {
Layout();
wxScrollBar *hscroll = m_dyn_sash->GetHScrollBar(this);
wxScrollBar *vscroll = m_dyn_sash->GetVScrollBar(this);
if (hscroll && vscroll) {
int hpos = hscroll->GetThumbPosition();
int vpos = vscroll->GetThumbPosition();
wxSize size = m_view->GetSize();
if (hpos + size.GetWidth() > 300)
hpos = 300 - size.GetWidth();
if (vpos + size.GetHeight() > 300)
vpos = 300 - size.GetHeight();
hscroll->SetScrollbar(hpos, size.GetWidth(), 300, size.GetWidth());
vscroll->SetScrollbar(vpos, size.GetHeight(), 300, size.GetHeight());
}
}
示例6: 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);
}
}
示例7: 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)
//.........这里部分代码省略.........
示例8: Unify
void wxDynamicSashWindowImpl::Unify(int panel)
{
int other = panel == 0 ? 1 : 0;
if (m_child[panel]->m_leaf)
{
wxDynamicSashWindowImpl *child[2];
child[0] = m_child[0];
child[1] = m_child[1];
m_child[0] = m_child[1] = NULL;
m_leaf = new wxDynamicSashWindowLeaf(this);
m_leaf->Create();
m_leaf->m_child = child[panel]->m_leaf->m_child;
m_leaf->m_vscroll->SetScrollbar(child[panel]->m_leaf->m_vscroll->GetThumbPosition(),
child[panel]->m_leaf->m_vscroll->GetThumbSize(),
child[panel]->m_leaf->m_vscroll->GetRange(),
child[panel]->m_leaf->m_vscroll->GetPageSize());
m_leaf->m_hscroll->SetScrollbar(child[panel]->m_leaf->m_hscroll->GetThumbPosition(),
child[panel]->m_leaf->m_hscroll->GetThumbSize(),
child[panel]->m_leaf->m_hscroll->GetRange(),
child[panel]->m_leaf->m_hscroll->GetPageSize());
m_add_child_target = NULL;
wxDynamicSashReparentEvent event(m_leaf);
m_leaf->ProcessEvent(event);
delete child[0];
delete child[1];
m_split = DSR_NONE;
wxDynamicSashUnifyEvent unify(m_leaf->m_child);
m_leaf->m_child->ProcessEvent(unify);
}
else
{
m_split = m_child[panel]->m_split;
delete m_child[other];
wxDynamicSashWindowImpl *child_panel = m_child[panel];
m_child[0] = child_panel->m_child[0];
m_child[1] = child_panel->m_child[1];
m_child[0]->m_parent = this;
m_child[1]->m_parent = this;
m_add_child_target = NULL;
m_child[0]->m_container->Reparent(m_container);
m_child[1]->m_container->Reparent(m_container);
child_panel->m_child[0] = child_panel->m_child[1] = NULL;
delete child_panel;
wxSize size = m_container->GetSize();
wxSize child_size = m_child[0]->m_container->GetSize();
ConstrainChildren(child_size.GetWidth() * 100 / size.GetWidth(),
child_size.GetHeight() * 100 / size.GetHeight());
m_container->Layout();
}
}
示例9: OnViewSize
void wxDynamicSashWindowLeaf::OnViewSize(wxSizeEvent &WXUNUSED(event))
{
if ( m_viewport )
ResizeChild(m_viewport->GetSize());
}
示例10: SetSize
void SetSizeTestCase::SetSize()
{
const wxSize size(127, 35);
m_win->SetSize(size);
CPPUNIT_ASSERT_EQUAL( size, m_win->GetSize() );
}
示例11: wxSizeKeeper
wxSizeKeeper( wxWindow* w )
: m_w( w )
{
m_w->GetSize( &m_x, &m_y );
}