当前位置: 首页>>代码示例>>C++>>正文


C++ CacheBestSize函数代码示例

本文整理汇总了C++中CacheBestSize函数的典型用法代码示例。如果您正苦于以下问题:C++ CacheBestSize函数的具体用法?C++ CacheBestSize怎么用?C++ CacheBestSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CacheBestSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetBitmapSize

wxSize wxBitmapComboBox::DoGetBestSize() const
{
    wxSize best = wxComboBox::DoGetBestSize();

    int delta = GetBitmapSize().y - GetCharHeight();
    if ( delta > 0 )
    {
        best.y += delta;
        CacheBestSize(best);
    }
    return best;
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:12,代码来源:bmpcbox.cpp

示例2: wxRectFromRECT

// TODO: handle WM_WININICHANGE
wxSize wxCalendarCtrl::DoGetBestSize() const
{
    RECT rc;
    if ( !GetHwnd() || !MonthCal_GetMinReqRect(GetHwnd(), &rc) )
    {
        return wxCalendarCtrlBase::DoGetBestSize();
    }

    const wxSize best = wxRectFromRECT(rc).GetSize() + GetWindowBorderSize();
    CacheBestSize(best);
    return best;
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:13,代码来源:calctrl.cpp

示例3: GetBitmap

wxSize wxStaticBitmapBase::DoGetBestSize() const
{
    wxSize best;
    wxBitmap bmp = GetBitmap();
    if ( bmp.IsOk() )
        best = wxSize(bmp.GetWidth(), bmp.GetHeight());
    else
        // this is completely arbitrary
        best = wxSize(16, 16);
    CacheBestSize(best);
    return best;
}
开发者ID:djbarry004,项目名称:Ishiiruka,代码行数:12,代码来源:ctrlcmn.cpp

示例4: ret

// Get the "best" size for this control.
wxSize wxToggleButton::DoGetBestSize() const
{
    wxSize ret(wxControl::DoGetBestSize());

    if (!HasFlag(wxBU_EXACTFIT))
    {
        if (ret.x < 80) ret.x = 80;
    }

    CacheBestSize(ret);
    return ret;
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:13,代码来源:tglbtn.cpp

示例5: dc

wxSize wxHyperlinkCtrl::DoGetBestSize() const
{
    int w, h;

    wxClientDC dc((wxWindow *)this);
    dc.SetFont(GetFont());
    dc.GetTextExtent(GetLabel(), &w, &h);

    wxSize best(w, h);
    CacheBestSize(best);
    return best;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:12,代码来源:hyperlink.cpp

示例6: best

wxSize wxStaticBitmap::DoGetBestSize() const
{
    if ( ImageIsOk() )
    {
        wxSize best(m_image->GetWidth(), m_image->GetHeight());
        CacheBestSize(best);
        return best;
    }

    // this is completely arbitrary
    return wxSize(16, 16);
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:12,代码来源:statbmp.cpp

示例7: dc

wxSize wxStaticText::DoGetBestSize() const
{
    wxClientDC dc(const_cast<wxStaticText *>(this));
    wxFont font(GetFont());
    if (!font.Ok())
        font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);

    dc.SetFont(font);

    wxCoord widthTextMax, heightTextTotal;
    dc.GetMultiLineTextExtent(GetLabelText(), &widthTextMax, &heightTextTotal);

#ifdef __WXWINCE__
    if ( widthTextMax )
        widthTextMax += 2;
#endif // __WXWINCE__

    // border takes extra space
    //
    // TODO: this is probably not wxStaticText-specific and should be moved
    wxCoord border;
    switch ( GetBorder() )
    {
        case wxBORDER_STATIC:
        case wxBORDER_SIMPLE:
            border = 1;
            break;

        case wxBORDER_SUNKEN:
            border = 2;
            break;

        case wxBORDER_RAISED:
        case wxBORDER_DOUBLE:
            border = 3;
            break;

        default:
            wxFAIL_MSG( _T("unknown border style") );
            // fall through

        case wxBORDER_NONE:
            border = 0;
    }

    widthTextMax += 2*border;
    heightTextTotal += 2*border;

    wxSize best(widthTextMax, heightTextTotal);
    CacheBestSize(best);
    return best;
}
开发者ID:jonntd,项目名称:dynamica,代码行数:52,代码来源:stattext.cpp

示例8: CacheBestSize

wxSize wxBitmapComboBox::DoGetBestSize() const
{
    wxSize sz = wxOwnerDrawnComboBox::DoGetBestSize();

    // Scale control to match height of highest image.
    int h2 = m_usedImgSize.y + IMAGE_SPACING_CTRL_VERTICAL;

    if ( h2 > sz.y )
        sz.y = h2;

    CacheBestSize(sz);
    return sz;
}
开发者ID:252525fb,项目名称:rpcs3,代码行数:13,代码来源:bmpcboxg.cpp

示例9: wxSize

wxSize wxRadioBox::DoGetBestSize() const
{
    if ( !m_radioButtons )
    {
        // if we're not fully initialized yet, we can't meaningfully compute
        // our best size, we'll do it later
        return wxSize(1, 1);
    }

    wxSize best = GetTotalButtonSize(GetMaxButtonSize());
    CacheBestSize(best);
    return best;
}
开发者ID:Asmodean-,项目名称:Ishiiruka,代码行数:13,代码来源:radiobox.cpp

示例10: GetBitmapSize

wxSize wxBitmapComboBox::DoGetBestSize() const
{
    wxSize best = wxComboBox::DoGetBestSize();
    wxSize bitmapSize = GetBitmapSize();

    wxCoord useHeightBitmap = EDIT_HEIGHT_FROM_CHAR_HEIGHT(bitmapSize.y);
    if ( best.y < useHeightBitmap )
    {
        best.y = useHeightBitmap;
        CacheBestSize(best);
    }
    return best;
}
开发者ID:Anti-Ultimate,项目名称:dolphin,代码行数:13,代码来源:bmpcbox.cpp

示例11: best

wxSize wxBitmapButton::DoGetBestSize() const
{
    if ( m_bmpNormal.Ok() )
    {
        wxSize best(m_bmpNormal.GetWidth() + 2*m_marginX,
                      m_bmpNormal.GetHeight() + 2*m_marginY);
        CacheBestSize(best);
        return best;
    }

    // no idea what our best size should be, defer to the base class
    return wxBitmapButtonBase::DoGetBestSize();
}
开发者ID:HackLinux,项目名称:chandler-1,代码行数:13,代码来源:bmpbuttn.cpp

示例12: GetParent

wxSize wxHeaderCtrl::DoGetBestSize() const
{
    wxWindow *win = GetParent();
    int height = wxRendererNative::Get().GetHeaderButtonHeight( win );

    // the vertical size is rather arbitrary but it looks better if we leave
    // some space around the text
    const wxSize size(IsEmpty() ? wxHeaderCtrlBase::DoGetBestSize().x
                      : GetColEnd(GetColumnCount() - 1),
                      height ); // (7*GetCharHeight())/4);
    CacheBestSize(size);
    return size;
}
开发者ID:Toonerz,项目名称:project64,代码行数:13,代码来源:headerctrlg.cpp

示例13: HasFlag

// Get the "best" size for this control.
wxSize wxToggleBitmapButton::DoGetBestSize() const
{
    wxSize best;

    if (m_bitmap.IsOk())
    {
        int border = HasFlag(wxNO_BORDER) ? 4 : 10;
        best.x = m_bitmap.GetWidth()+border;
        best.y = m_bitmap.GetHeight()+border;
    }
    CacheBestSize(best);
    return best;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:14,代码来源:tglbtn.cpp

示例14: wxGetWindowText

wxSize wxCheckBox::DoGetBestClientSize() const
{
    static int s_checkSize = 0;

    if ( !s_checkSize )
    {
        wxScreenDC dc;
        dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));

        s_checkSize = dc.GetCharHeight();
    }

    wxString str = wxGetWindowText(GetHWND());

    int wCheckbox, hCheckbox;
    if ( !str.empty() )
    {
        wxClientDC dc(const_cast<wxCheckBox *>(this));
        dc.SetFont(GetFont());
        dc.GetMultiLineTextExtent(GetLabelText(str), &wCheckbox, &hCheckbox);
        wCheckbox += s_checkSize + GetCharWidth();

        if ( ::GetWindowLong(GetHwnd(), GWL_STYLE) & BS_MULTILINE )
        {
            // We need to make the checkbox even wider in this case because
            // otherwise it wraps lines automatically and not only on "\n"s as
            // we need and this makes the size computed here wrong resulting in
            // checkbox contents being truncated when it's actually displayed.
            // Without this hack simple checkbox with "Some thing\n and more"
            // label appears on 3 lines, not 2, under Windows 2003 using
            // classic look and feel (although it works fine under Windows 7,
            // with or without themes).
            wCheckbox += s_checkSize;
        }

        if ( hCheckbox < s_checkSize )
            hCheckbox = s_checkSize;
    }
    else
    {
        wCheckbox = s_checkSize;
        hCheckbox = s_checkSize;
    }
#ifdef __WXWINCE__
    hCheckbox += 1;
#endif

    wxSize best(wCheckbox, hCheckbox);
    CacheBestSize(best);
    return best;
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:51,代码来源:checkbox.cpp

示例15: GetLastChild

wxSize wxTreeCtrlBase::DoGetBestSize() const
{
    wxSize size;

    // this doesn't really compute the total bounding rectangle of all items
    // but a not too bad guess of it which has the advantage of not having to
    // examine all (potentially hundreds or thousands) items in the control

    if (GetQuickBestSize())
    {
        for ( wxTreeItemId item = GetRootItem();
                item.IsOk();
                item = GetLastChild(item) )
        {
            wxRect rect;

            // last parameter is "true" to get only the dimensions of the text
            // label, we don't want to get the entire item width as it's determined
            // by the current size
            if ( GetBoundingRect(item, rect, true) )
            {
                if ( size.x < rect.x + rect.width )
                    size.x = rect.x + rect.width;
                if ( size.y < rect.y + rect.height )
                    size.y = rect.y + rect.height;
            }
        }
    }
    else // use precise, if potentially slow, size computation method
    {
        // iterate over all items recursively
        wxTreeItemId idRoot = GetRootItem();
        if ( idRoot.IsOk() )
            wxGetBestTreeSize(this, idRoot, size);
    }

    // need some minimal size even for empty tree
    if ( !size.x || !size.y )
        size = wxControl::DoGetBestSize();
    else
    {
        // Add border size
        size += GetWindowBorderSize();

        CacheBestSize(size);
    }

    return size;
}
开发者ID:ruifig,项目名称:nutcracker,代码行数:49,代码来源:treebase.cpp


注:本文中的CacheBestSize函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。