Ejemplo n.º 1
0
// This is a helper for all wxControls made with UPDOWN native control.
// In wxMSW it was only wxSpinCtrl derived from wxSpinButton but in
// WinCE of Smartphones this happens also for native wxTextCtrl,
// wxChoice and others.
wxSize wxControl::GetBestSpinnerSize(const bool is_vertical) const
{
    // take size according to layout
    wxSize bestSize(
#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
                    0,GetCharHeight()
#else
                    ::GetSystemMetrics(is_vertical ? SM_CXVSCROLL : SM_CXHSCROLL),
                    ::GetSystemMetrics(is_vertical ? SM_CYVSCROLL : SM_CYHSCROLL)
#endif
    );

    // correct size as for undocumented MSW variants cases (WinCE and perhaps others)
    if (bestSize.x==0)
        bestSize.x = bestSize.y;
    if (bestSize.y==0)
        bestSize.y = bestSize.x;

    // double size according to layout
    if (is_vertical)
        bestSize.y *= 2;
    else
        bestSize.x *= 2;

    return bestSize;
}
Ejemplo n.º 2
0
QSize ModuleHandleDock::sizeHint() const
{
  QSize currSize = size();
  QSize bestSize( 180, currSize.height() );
  if( currSize.width() < bestSize.width() )
    return bestSize;
  else
    return currSize;
}
Ejemplo n.º 3
0
void SkylineBinPack::Insert(List<Size2U> &sizes, List<Rect2U> &outRects, LevelChoiceHeuristic method)
{
    while (sizes.Count() > 0)
    {
        Rect2U bestRect;
        Size2U bestSize(Math::IntMaxValue, Math::IntMaxValue);
        int bestSkylineIndex = -1;
        int bestRectIndex = -1;
        for (size_t i = 0; i < sizes.Count(); ++i)
        {
            Rect2U newRect;
            Size2U outBestSize;
            int outBestIndex = 0;
            switch (method)
            {
            case LevelChoiceHeuristic::LevelBottomLeft:
                newRect = FindPositionForNewNodeBottomLeft(sizes[i], outBestSize, outBestIndex);
                break;
            case LevelChoiceHeuristic::LevelMinWasteFit:
                newRect = FindPositionForNewNodeMinWaste(sizes[i], outBestSize.Height, outBestSize.Width, outBestIndex);
                break;
            default:
                assert(false);
                break;
            }

            if (newRect.Size.Height != 0)
            {
                if (outBestSize.Width < bestSize.Width || (outBestSize.Width == bestSize.Width && outBestSize.Height < bestSize.Height))
                {
                    bestRect = newRect;
                    bestSize = outBestSize;
                    bestSkylineIndex = outBestIndex;
                    bestRectIndex = (int)i;
                }
            }
        }

        if (bestRectIndex == -1)
            return;

        // Perform the actual packing.

        AddSkylineLevel(bestSkylineIndex, bestRect);
        mUsedSurfaceArea += (sizes[bestRectIndex]).Area();
        sizes.RemoveAt(bestRectIndex);
        outRects.Add(bestRect);
    }
}
Ejemplo n.º 4
0
void wxMenuButton::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
    wxSize curSize( GetSize() );
    wxSize bestSize( DoGetBestSize() );

    if (width == -1)
        width = curSize.GetWidth();
    if (width < 10)
        width = bestSize.GetWidth();

    if (height == -1)
        height = curSize.GetHeight();
    if (height < 5)
        height = bestSize.GetHeight();

    wxWindow::DoSetSize(x, y, width, height, sizeFlags);

    if (m_labelButton)
        m_labelButton->SetSize(0, 0, width - wxMENUBUTTON_DROP_WIDTH, height);
    if (m_dropdownButton)
        m_dropdownButton->SetSize(width-wxMENUBUTTON_DROP_WIDTH, 0, wxMENUBUTTON_DROP_WIDTH, height);
}