您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CacheBestSize函数代码示例

51自学网 2021-06-01 20:08:45
  C++
这篇教程C++ CacheBestSize函数代码示例写得很实用,希望能帮到您。

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

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


示例2: wxRectFromRECT

// TODO: handle WM_WININICHANGEwxSize 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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例21: DStripMenuButton

UsernameBox::UsernameBox(wxWindow *parent, const char* name) : DStripMenuButton(parent, name){	setOffset(10);	wxSize size = GetBestSize();	size.x+=getOffset();	CacheBestSize(size);	if (size.x < 82)		size.x = 82;	SetSize(wxSize( -1,38 ));	SetMinSize( wxSize( size.x,38 ) );	SetCursor(wxCURSOR_HAND);}
开发者ID:Alasaad,项目名称:Desurium,代码行数:18,


示例22: best

wxSize wxScrollBar::DoGetBestSize() const{    int w = 100;    int h = 100;    if ( IsVertical() )    {        w = wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);    }    else    {        h = wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);    }    wxSize best(w, h);    CacheBestSize(best);    return best;}
开发者ID:beanhome,项目名称:dev,代码行数:18,


示例23: ret

wxSize wxChoice::DoGetBestSize() const{    wxSize ret( wxControl::DoGetBestSize() );    // we know better our horizontal extent: it depends on the longest string    // we have    ret.x = 0;    if ( m_widget )    {        int width;        unsigned int count = GetCount();        for ( unsigned int n = 0; n < count; n++ )        {            GetTextExtent(GetString(n), &width, NULL, NULL, NULL );            if ( width > ret.x )                ret.x = width;        }        // add extra for the choice "=" button        // VZ: I don't know how to get the right value, it seems to be in        //     GtkOptionMenuProps struct from gtkoptionmenu.c but we can't get        //     to it - maybe we can use gtk_option_menu_size_request() for this        //     somehow?        //        //     This default value works only for the default GTK+ theme (i.e.        //     no theme at all) (FIXME)        static const int widthChoiceIndicator = 35;        ret.x += widthChoiceIndicator;    }    // but not less than the minimal width    if ( ret.x < 80 )        ret.x = 80;    // If this request_size is called with no entries then    // the returned height is wrong. Give it a reasonable    // default value.    if (ret.y <= 18)        ret.y = 8 + GetCharHeight();    CacheBestSize(ret);    return ret;}
开发者ID:beanhome,项目名称:dev,代码行数:44,


示例24: gtk_widget_get_style_context

wxSize wxSpinButton::DoGetBestSize() const{    wxSize best = base_type::DoGetBestSize();#ifdef __WXGTK3__    GtkStyleContext* sc = gtk_widget_get_style_context(m_widget);    GtkBorder pad = { 0, 0, 0, 0 };    gtk_style_context_get_padding(sc, GtkStateFlags(0), &pad);    best.x -= pad.left + pad.right;#else    gtk_widget_ensure_style(m_widget);    int w = PANGO_PIXELS(pango_font_description_get_size(m_widget->style->font_desc));    w &= ~1;    if (w < 6)        w = 6;    best.x = w + 2 * m_widget->style->xthickness;#endif    CacheBestSize(best);    return best;}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:19,


示例25: update_locker

wxSize AutoResizingTreeCtrl::DoGetBestSize() const{    AutoResizingTreeCtrl& myself = const_cast<AutoResizingTreeCtrl&>(*this);    wxWindowUpdateLocker update_locker(&myself);    wxSize best_size(0, 0);    wxTreeItemId const selection = GetSelection();    wxTreeItemId const first_visible = GetFirstVisibleItem();    wxTreeItemId const root = GetRootItem();    myself.DoGetBestSizePrivate(best_size, root, true);    // need some minimal size even for an empty tree    if(best_size.x == 0 || best_size.y == 0)        {        wxSize min_size = wxTreeCtrl::DoGetBestSize();        if(best_size.x == 0)            {            best_size.x = min_size.x;            }        if(best_size.y == 0)            {            best_size.y = min_size.y;            }        }    best_size += GetSize() - GetClientSize();    if(selection.IsOk())        {        myself.SelectItem(selection);        }    if(first_visible.IsOk())        {        myself.ScrollTo(first_visible);        }    CacheBestSize(best_size);    return best_size;}
开发者ID:vadz,项目名称:lmi,代码行数:42,


示例26: wxASSERT_MSG

wxSize wxStaticText::DoGetBestSize() const{    // Do not return any arbitrary default value...    wxASSERT_MSG( m_widget, wxT("wxStaticText::DoGetBestSize called before creation") );    // GetBestSize is supposed to return unwrapped size but calling    // gtk_label_set_line_wrap() from here is a bad idea as it queues another    // size request by calling gtk_widget_queue_resize() and we end up in    // infinite loop sometimes (notably when the control is in a toolbar)    GTK_LABEL(m_widget)->wrap = FALSE;    wxSize size = wxStaticTextBase::DoGetBestSize();    GTK_LABEL(m_widget)->wrap = TRUE; // restore old value    // Adding 1 to width to workaround GTK sometimes wrapping the text needlessly    size.x++;    CacheBestSize(size);    return size;}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:20,


示例27: dc

// Overloaded form wxPanel and friends.wxSize pxStaticText::DoGetBestSize() const{    wxClientDC dc(const_cast<pxStaticText *>(this));    dc.SetFont(GetFontOk());    wxSize best;    if (m_autowrap) {        best = GetBestWrappedSize(dc);        //best.x = wxDefaultCoord;    } else {        // No autowrapping, so we can force a specific size here!        best = dc.GetMultiLineTextExtent(GetLabel());        best.x += calcPaddingWidth(best.x);    }    best.y += calcPaddingHeight(best.y);    CacheBestSize(best);    return best;}
开发者ID:aerisarn,项目名称:pcsx2,代码行数:22,


示例28: MSWGetBorders

wxSize wxStatusBar::DoGetBestSize() const{    const MSWBorders borders = MSWGetBorders();    // calculate width    int width = 0;    for ( size_t i = 0; i < m_panes.GetCount(); ++i )    {        int widthField =            m_bSameWidthForAllPanes ? DEFAULT_FIELD_WIDTH : m_panes[i].GetWidth();        if ( widthField >= 0 )        {            width += widthField;        }        else        {            // variable width field, its width is really a proportion            // related to the other fields            width += -widthField*DEFAULT_FIELD_WIDTH;        }        // add the space between fields        width += borders.between;    }    if ( !width )    {        // still need something even for an empty status bar        width = 2*DEFAULT_FIELD_WIDTH;    }    // calculate height: by default it should be just big enough to show text    // (see SetMinHeight() for the explanation of 4 factor)    int height = GetCharHeight();    height += 4*borders.vert;    wxSize best(width, height);    CacheBestSize(best);    return best;}
开发者ID:Annovae,项目名称:Dolphin-Core,代码行数:40,


示例29: GetLabel

wxSize wxRadioButton::DoGetBestSize() const{    static int s_radioSize = 0;    if ( !s_radioSize )    {        wxScreenDC dc;        dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));        s_radioSize = dc.GetCharHeight();        // radio button bitmap size under CE is bigger than the font height,        // adding just one pixel seems to work fine for the default font but it        // would be nice to find some better way to find the correct height#ifdef __WXWINCE__        s_radioSize++;#endif // __WXWINCE__    }    wxString str = GetLabel();    int wRadio, hRadio;    if ( !str.empty() )    {        GetTextExtent(GetLabelText(str), &wRadio, &hRadio);        wRadio += s_radioSize + GetCharWidth();        if ( hRadio < s_radioSize )            hRadio = s_radioSize;    }    else    {        wRadio = s_radioSize;        hRadio = s_radioSize;    }    wxSize best(wRadio, hRadio);    CacheBestSize(best);    return best;}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:40,



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


C++ Cache_Check函数代码示例
C++ C_TYPECHECK函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。