本文整理汇总了C++中wxSize::IncTo方法的典型用法代码示例。如果您正苦于以下问题:C++ wxSize::IncTo方法的具体用法?C++ wxSize::IncTo怎么用?C++ wxSize::IncTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxSize
的用法示例。
在下文中一共展示了wxSize::IncTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
static void
wxGetBestTreeSize(const wxTreeCtrlBase* treeCtrl, wxTreeItemId id, wxSize& size)
{
wxRect rect;
if ( treeCtrl->GetBoundingRect(id, rect, true /* just the item */) )
{
// Translate to logical position so we get the full extent
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
rect.x += treeCtrl->GetScrollPos(wxHORIZONTAL);
rect.y += treeCtrl->GetScrollPos(wxVERTICAL);
#endif
size.IncTo(wxSize(rect.GetRight(), rect.GetBottom()));
}
wxTreeItemIdValue cookie;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( wxTreeItemId item = treeCtrl->GetFirstChild(id, cookie);
item.IsOk();
item = treeCtrl->GetNextChild(id, cookie) )
{
wxGetBestTreeSize(treeCtrl, item, size);
}
}
示例2: addPresets
void addPresets(const vector<Game::SpecialPreset>& presets, wxSize& textsize, wxClientDC& dc)
{
for (auto& preset : presets)
{
auto item = AppendItem(getGroup(preset.group), preset.name);
SetItemData(item, new SpecialPresetData(preset));
textsize.IncTo(dc.GetTextExtent(preset.name));
}
}
示例3: defined
static void
wxGetBestTreeSize(const wxTreeCtrlBase* treeCtrl, wxTreeItemId id, wxSize& size)
{
wxRect rect;
if ( treeCtrl->GetBoundingRect(id, rect, true /* just the item */) )
{
// Translate to logical position so we get the full extent
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
rect.x += treeCtrl->GetScrollPos(wxHORIZONTAL);
rect.y += treeCtrl->GetScrollPos(wxVERTICAL);
#endif
size.IncTo(wxSize(rect.GetRight(), rect.GetBottom()));
}
wxTreeItemIdValue cookie;
for ( wxTreeItemId item = treeCtrl->GetFirstChild(id, cookie);
item.IsOk();
item = treeCtrl->GetNextChild(id, cookie) )
{
wxGetBestTreeSize(treeCtrl, item, size);
}
}
示例4: AdjustForBitmapSize
void wxAnyButton::AdjustForBitmapSize(wxSize &size) const
{
wxCHECK_RET( m_imageData, wxT("shouldn't be called if no image") );
// account for the bitmap size, including the user-specified margins
const wxSize sizeBmp = m_imageData->GetBitmap(State_Normal).GetSize()
+ 2*m_imageData->GetBitmapMargins();
const wxDirection dirBmp = m_imageData->GetBitmapPosition();
if ( dirBmp == wxLEFT || dirBmp == wxRIGHT )
{
size.x += sizeBmp.x;
if ( sizeBmp.y > size.y )
size.y = sizeBmp.y;
}
else // bitmap on top/below the text
{
size.y += sizeBmp.y;
if ( sizeBmp.x > size.x )
size.x = sizeBmp.x;
}
// and also for the margins we always add internally (unless we have no
// border at all in which case the button has exactly the same size as
// bitmap and so no margins should be used)
if ( !HasFlag(wxBORDER_NONE) )
{
int marginH = 0,
marginV = 0;
#if wxUSE_UXTHEME
if ( wxUxThemeEngine::GetIfActive() )
{
wxUxThemeHandle theme(const_cast<wxAnyButton *>(this), L"BUTTON");
MARGINS margins;
wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL,
BP_PUSHBUTTON,
PBS_NORMAL,
TMT_CONTENTMARGINS,
NULL,
&margins);
// XP doesn't draw themed buttons correctly when the client
// area is smaller than 8x8 - enforce this minimum size for
// small bitmaps
size.IncTo(wxSize(8, 8));
marginH = margins.cxLeftWidth + margins.cxRightWidth
+ 2*XP_BUTTON_EXTRA_MARGIN;
marginV = margins.cyTopHeight + margins.cyBottomHeight
+ 2*XP_BUTTON_EXTRA_MARGIN;
}
else
#endif // wxUSE_UXTHEME
{
marginH =
marginV = OD_BUTTON_MARGIN;
}
size.IncBy(marginH, marginV);
}
}
示例5: SetWindowSizeAndFitToScreen
void SetWindowSizeAndFitToScreen(wxTopLevelWindow* tlw, wxPoint pos, wxSize size,
wxSize default_size)
{
if (tlw->IsMaximized())
return;
// NOTE: Positions can be negative and still be valid. Coordinates are relative to the
// primary monitor so if the primary monitor is in the middle then (-1000, 10) is a
// valid position on the monitor to the left of the primary. (This does not apply to
// sizes obviously)
wxRect screen_geometry;
wxRect window_geometry{pos, size};
if (wxDisplay::GetCount() > 1)
screen_geometry = GetVirtualScreenGeometry();
else
screen_geometry = wxDisplay(0).GetClientArea();
// Initialize the default size if it is wxDefaultSize or otherwise negative.
default_size.DecTo(screen_geometry.GetSize());
default_size.IncTo(tlw->GetMinSize());
if (!default_size.IsFullySpecified())
default_size.SetDefaults(wxDisplay(0).GetClientArea().GetSize() / 2);
// If the position we're given doesn't make sense then go with the current position.
// (Assuming the window was created with wxDefaultPosition then this should be reasonable)
if (pos.x - screen_geometry.GetLeft() < -1000 || pos.y - screen_geometry.GetTop() < -1000 ||
pos.x - screen_geometry.GetRight() > 1000 || pos.y - screen_geometry.GetBottom() > 1000)
{
window_geometry.SetPosition(tlw->GetPosition());
}
// If the window is bigger than all monitors combined, or negative (uninitialized) then reset it.
if (window_geometry.IsEmpty() || window_geometry.GetWidth() > screen_geometry.GetWidth() ||
window_geometry.GetHeight() > screen_geometry.GetHeight())
{
window_geometry.SetSize(default_size);
}
// Check if the window entirely lives on a single monitor without spanning.
// If the window does not span multiple screens then we should constrain it within that
// single monitor instead of the entire virtual desktop space.
// The benefit to doing this is that we can account for the OS X menu bar and Windows task
// bar which are treated as invisible when only looking at the virtual desktop instead of
// an individual screen.
if (wxDisplay::GetCount() > 1)
{
// SPECIAL CASE: If the window is entirely outside the visible area of the desktop then we
// put it back on the primary (zero) monitor.
wxRect monitor_intersection{window_geometry};
int the_monitor = 0;
if (!monitor_intersection.Intersect(screen_geometry).IsEmpty())
{
std::array<int, 4> monitors{{wxDisplay::GetFromPoint(monitor_intersection.GetTopLeft()),
wxDisplay::GetFromPoint(monitor_intersection.GetTopRight()),
wxDisplay::GetFromPoint(monitor_intersection.GetBottomLeft()),
wxDisplay::GetFromPoint(monitor_intersection.GetBottomRight())}};
the_monitor = wxNOT_FOUND;
bool intersected = false;
for (int one_monitor : monitors)
{
if (one_monitor == the_monitor || one_monitor == wxNOT_FOUND)
continue;
if (the_monitor != wxNOT_FOUND)
{
// The window is spanning multiple screens.
the_monitor = wxNOT_FOUND;
break;
}
the_monitor = one_monitor;
intersected = true;
}
// If we get wxNOT_FOUND for all corners then there are holes in the virtual desktop and the
// entire window is lost in one. (e.g. 3 monitors in an 'L', window in top-right)
if (!intersected)
the_monitor = 0;
}
if (the_monitor != wxNOT_FOUND)
{
// We'll only use the client area of this monitor if the window will actually fit.
// (It may not fit if the window is spilling off the edge so it isn't entirely visible)
wxRect client_area{wxDisplay(the_monitor).GetClientArea()};
if (client_area.GetWidth() >= window_geometry.GetWidth() &&
client_area.GetHeight() >= window_geometry.GetHeight())
{
screen_geometry = client_area;
}
}
}
// The window SHOULD be small enough to fit on the screen, but it might be spilling off an edge
// so we'll snap it to the nearest edge as necessary.
if (!screen_geometry.Contains(window_geometry))
{
// NOTE: The order is important here, if the window *is* too big to fit then it will snap to
// the top-left corner.
int spill_x = std::max(0, window_geometry.GetRight() - screen_geometry.GetRight());
int spill_y = std::max(0, window_geometry.GetBottom() - screen_geometry.GetBottom());
window_geometry.Offset(-spill_x, -spill_y);
if (window_geometry.GetTop() < screen_geometry.GetTop())
//.........这里部分代码省略.........