• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ CacheBestSize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: InvalidateBestSize

bool CTransparentStaticTextAssociate::SetFont(const wxFont& font) {

    bool ret = wxPanel::SetFont(font);

    InvalidateBestSize();

    wxCoord width, height;
    wxClientDC dc(this);
    dc.SetFont(font);
    dc.GetMultiLineTextExtent(GetLabel(), &width, &height);

    CacheBestSize(wxSize(width, height));

    return ret;
}
开发者ID:DanAurea,项目名称:boinc,代码行数:15,代码来源:sg_CustomControls.cpp


示例17: wxGetCharSize

wxSize wxStaticBox::DoGetBestSize() const
{
    int cx, cy;
    wxGetCharSize(GetHWND(), &cx, &cy, GetFont());

    int wBox;
    GetTextExtent(GetLabelText(wxGetWindowText(m_hWnd)), &wBox, &cy);

    wBox += 3*cx;
    int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);

    wxSize best(wBox, hBox);
    CacheBestSize(best);
    return best;
}
开发者ID:DumaGit,项目名称:winsparkle,代码行数:15,代码来源:statbox.cpp


示例18: wxASSERT_MSG

wxSize wxControl::DoGetBestSize() const
{
    // Do not return any arbitrary default value...
    wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );

    GtkRequisition req;
    req.width = 2;
    req.height = 2;
    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
    (m_widget, &req );

    wxSize best(req.width, req.height);
    CacheBestSize(best);
    return best;
}
开发者ID:esrrhs,项目名称:fuck-music-player,代码行数:15,代码来源:control.cpp


示例19: CacheBestSize

wxSize wxCheckListBox::DoGetBestClientSize() const
{
    wxSize best = wxListBox::DoGetBestClientSize();

    // add room for the checkbox
    wxSize size = wxRendererNative::Get().GetCheckBoxSize(const_cast<wxCheckListBox*>(this));
    size.x += 2 * CHECKMARK_EXTRA_SPACE;
    size.y += 2 * CHECKMARK_EXTRA_SPACE;

    best.x += size.GetWidth();
    if ( best.y < size.GetHeight() )
        best.y = size.GetHeight();

    CacheBestSize(best);
    return best;
}
开发者ID:AdmiralCurtiss,项目名称:pcsx2,代码行数:16,代码来源:checklst.cpp


示例20: wxCHECK_MSG

wxSize wxListBox::DoGetBestSize() const
{
    wxCHECK_MSG(m_treeview, wxDefaultSize, wxT("invalid tree view"));

    // Start with a minimum size that's not too small
    int cx, cy;
    GetTextExtent( wxT("X"), &cx, &cy);
    int lbWidth = 0;
    int lbHeight = 10;

    // Find the widest string.
    const unsigned int count = GetCount();
    if ( count )
    {
        int wLine;
        for ( unsigned int i = 0; i < count; i++ )
        {
            GetTextExtent(GetString(i), &wLine, NULL);
            if ( wLine > lbWidth )
                lbWidth = wLine;
        }
    }

    lbWidth += 3 * cx;

    // And just a bit more for the checkbox if present and then some
    // (these are rough guesses)
#if wxUSE_CHECKLISTBOX
    if ( m_hasCheckBoxes )
    {
        lbWidth += 35;
        cy = cy > 25 ? cy : 25; // rough height of checkbox
    }
#endif

    // Add room for the scrollbar
    lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);

    // Don't make the listbox too tall but don't make it too small neither
    lbHeight = (cy+4) * wxMin(wxMax(count, 3), 10);

    wxSize best(lbWidth, lbHeight);
    CacheBestSize(best);
    return best;
}
开发者ID:krossell,项目名称:wxWidgets,代码行数:45,代码来源:listbox.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Cache_Check函数代码示例发布时间:2022-05-30
下一篇:
C++ C_TYPECHECK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap