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


C++ extents_t类代码示例

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


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

示例1: measure

void image_t::measure(extents_t& result)
{
    if (callback_m)
        result.horizontal().length_m = fixed_width; // REVISIT (fbrereto) : Fixed value
    else
        result.horizontal().length_m = (long)image_m.width();
}
开发者ID:ilelann,项目名称:adobe_platform_libraries,代码行数:7,代码来源:platform_image.cpp

示例2: measure_vertical

void measure_vertical(label_t& value, extents_t& result, const place_data_t& placed_horizontal)
{
    // Note (fbrereto) : This is explicit (instead of using implementation::measure) because
    //                   we need to set the inbound rect to be the potential dimensions of the
    //                   text so the reflow will shrink the bounds if it needs to.

    assert(value.control_m.get());

    ::Rect           old_bounds = { 0 };

    ::GetControlBounds(value.control_m.get(), &old_bounds);

    ::Rect           static_bounds = { 0, 0, 2048, static_cast<short>(placed_horizontal.horizontal().length_m) };
    ::Rect           bounds = { 0 };
    ::SInt16         best_baseline(0);

    implementation::set_bounds(value.control_m, static_bounds);

    ::GetBestControlRect(value.control_m.get(), &bounds, &best_baseline);

    result.height() = bounds.bottom - bounds.top;
    result.width() = bounds.right - bounds.left;

    if (best_baseline)
        result.vertical().guide_set_m.push_back(result.height() + best_baseline);

    result = implementation::apply_fudges(value, result);

    implementation::set_bounds(value.control_m, old_bounds);
}
开发者ID:ilelann,项目名称:adobe_platform_libraries,代码行数:30,代码来源:platform_label.cpp

示例3: state

void button_t::measure(extents_t& result)
{
    result = metrics::measure(control_m);

    button_state_set_t::iterator state(button_modifier_state(state_set_m,
                                                             modifier_mask_m,
                                                             modifiers_m));

    boost::shared_ptr<GG::Font> font = implementation::DefaultFont();

    if (state == state_set_m.end())
        state = button_default_state(state_set_m);

    extents_t cur_text_extents(metrics::measure_text(state->name_m, font));

    result.width() -= cur_text_extents.width();
    result.height() = Value(control_m->Height());

    long width_additional(0);
    
    for (button_state_set_t::iterator iter(state_set_m.begin()), last(state_set_m.end()); iter != last; ++iter)
    {
        extents_t tmp(metrics::measure_text(iter->name_m, font));
        width_additional = (std::max)(width_additional, tmp.width());
    }

    result.width() += width_additional;
    result.width() += Value(2 * implementation::CharWidth());

    result.width() = (std::max)(result.width(), 70L);
}
开发者ID:Syntaf,项目名称:GG,代码行数:31,代码来源:platform_button.cpp

示例4: measure

void reveal_t::measure(extents_t& result)
{
    using adobe::measure;

    // REVISIT (fbrereto) : hardwired defaults
    result.width() = 16;
    result.height() = 17;

    if (!using_label_m)
        return;

    extents_t label_extents;

    measure(name_m, label_extents);

    place_data_t label_place;

    width(label_place) = label_extents.width();
    height(label_place) = label_extents.height();

    measure_vertical(name_m, label_extents, label_place);

    result.width() += 4 /* gap */ + label_extents.width();
    result.height() = (std::max)(result.height(), label_extents.height());
}
开发者ID:Ablu,项目名称:freeorion,代码行数:25,代码来源:platform_reveal.cpp

示例5: measure

void link_t::measure(extents_t& result)
{
    result.width() = 15;
    result.height() = 5;

    for (long i(0); i < count_m; ++i)
        result.vertical().guide_set_m.push_back(2);
}
开发者ID:ilelann,项目名称:adobe_platform_libraries,代码行数:8,代码来源:platform_link.cpp

示例6: measure

void measure(label_t& value, extents_t& result)
{
    assert(value.window_m);
    GG::X w = static_cast<int>(value.characters_m) * implementation::CharWidth();
    GG::Pt extent = implementation::DefaultFont()->TextExtent(value.name_m, value.format_m, w);
    result.horizontal().length_m = Value(extent.x);
    assert(result.horizontal().length_m);
}
开发者ID:Ablu,项目名称:freeorion,代码行数:8,代码来源:platform_label.cpp

示例7: measure_vertical

void measure_vertical(label_t& value, extents_t& calculated_horizontal, 
                      const place_data_t& placed_horizontal)
{
    assert(value.window_m);
    GG::Pt extent = implementation::DefaultFont()->TextExtent(value.name_m, value.format_m,
                                                              GG::X(width(placed_horizontal)));
    calculated_horizontal.vertical().length_m = Value(extent.y);
    calculated_horizontal.vertical().guide_set_m.push_back(
        Value(implementation::DefaultFont()->Ascent()));
}
开发者ID:Ablu,项目名称:freeorion,代码行数:10,代码来源:platform_label.cpp

示例8: measure

void separator_t::measure(extents_t& result)
{
#ifdef BOOST_MSVC
    result.horizontal().length_m   = 2;
    result.vertical().length_m     = 2;
#elif ADOBE_PLATFORM_MAC
    result.horizontal().length_m   = is_vertical_m ? 5 : 6;
    result.vertical().length_m     = is_vertical_m ? 6 : 5;
#endif
}
开发者ID:ilelann,项目名称:adobe_platform_libraries,代码行数:10,代码来源:platform_separator.cpp

示例9: assert

void presets_t::measure(extents_t& result)
{
    assert(control_m);

    popup_m.measure(result);

    result.width() += 4 + 26; // gap + icon
    result.height() = (std::max)(result.height(), 21L);

    extents_t cat_result;

    category_popup_m.measure(cat_result);

    result.width() = (std::max)(result.width(), cat_result.width());

    // REVISIT (fbrereto) : This presumes the popups are of the same height.

    popup_height_m = cat_result.height();

    result.height() += popup_height_m + 4;

    if (!result.horizontal().guide_set_m.empty() &&
        !cat_result.horizontal().guide_set_m.empty()) {
        result.horizontal().guide_set_m[0] =
            (std::max)(result.horizontal().guide_set_m[0],
                       cat_result.horizontal().guide_set_m[0]);
    }
}
开发者ID:Ablu,项目名称:freeorion,代码行数:28,代码来源:platform_presets.cpp

示例10: assert

void toggle_t::measure(extents_t& result)
{
    assert(control_m);

    result = extents_t();

    const adobe::toggle_t::image_type& image(current_image(*this));

    result.height() = static_cast<long>(image.height());
    result.width() = static_cast<long>(image.width());
}
开发者ID:sehe,项目名称:legacy,代码行数:11,代码来源:platform_toggle.cpp

示例11: measure

void button_t::measure(extents_t& result)
{
    assert(control_m);

    std::vector<std::string> name_set;

    adobe::for_each(state_set_m, boost::bind(&add_to_name_set, boost::ref(name_set), _1));

    result = implementation::widget_best_bounds(*this, &name_set[0], &name_set[0] + name_set.size());

    result.horizontal().length_m =
        std::max<long>(70 /* REVISIT (fbrereto) : fixed value */, result.horizontal().length_m );
}
开发者ID:sehe,项目名称:legacy,代码行数:13,代码来源:platform_button.cpp

示例12: assert

void edit_text_t::measure(extents_t& result)
{
    assert(control_m);

    extents_t attrs;
    std::string      base_text(cols_m, std::string::value_type('0'));

    if (rows_m > 1)
    {
        attrs = implementation::measure_theme_text(base_text, theme_m);

        result = attrs;
        
        // REVISIT (fbrereto) : There is an issue here where the attributes of an edit_text
        //                      widget don't propagate properly to a static_text widget, so
        //                      measurement is inherently inaccurate. A better solution should
        //                      be found than simply doubling the row count.
        result.height() *= rows_m;
    }
    else
    {
        std::string placeholder(implementation::get_field_text(*this));

        implementation::set_field_text(*this, base_text);

        // measure the control directly because we don't apply the
        // fudges yet; we want to do that with the edit text values

        result = implementation::measure(this->control_m);

        implementation::set_field_text(*this, placeholder);
    }

    result = implementation::apply_fudges(*this, result);

    edit_height_m = result.height();
    edit_baseline_m = result.vertical().guide_set_m[0];

    if (!using_label_m)
        return;

    extents_t label_bounds(implementation::measure_theme_text(implementation::get_name(get_label()), theme_m));

    if (result.vertical().guide_set_m.size() && label_bounds.vertical().guide_set_m.size())
        align_slices(result.vertical(), label_bounds.vertical());

    result.horizontal() = implementation::merge_slices_with(result,
                                                                   metrics_m,
                                                                   label_bounds,
                                                                   get_label().metrics_m,
                                                                   extents_slices_t::horizontal);

    result.width() += implementation::global_metrics()(implementation::k_metric_gap);

    result.horizontal().guide_set_m.push_back(label_bounds.width());

    static_width_m = label_bounds.width();
    static_height_m = label_bounds.height();
    static_baseline_m = label_bounds.vertical().guide_set_m.empty() ? 0 : label_bounds.vertical().guide_set_m[0];
}
开发者ID:ilelann,项目名称:adobe_platform_libraries,代码行数:60,代码来源:platform_edit_text.cpp

示例13: measure_vertical

void image_t::measure_vertical(extents_t& result, const place_data_t& placed_horizontal)
{
    if (callback_m)
        result.vertical().length_m = fixed_height; // REVISIT (fbrereto) : Fixed value
    else
    {
        // NOTE (fbrereto) : We calculate and use the aspect ratio here to
        //                   maintain a proper initial height and width in
        //                   the case when the image grew based on how it
        //                   is being laid out.

        float aspect_ratio(image_m.height() / static_cast<float>(image_m.width()));

        result.vertical().length_m = static_cast<long>(placed_horizontal.horizontal().length_m * aspect_ratio);
    }
}
开发者ID:ilelann,项目名称:adobe_platform_libraries,代码行数:16,代码来源:platform_image.cpp

示例14: assert

    void display_text_t::measure_vertical(extents_t& calculated_horizontal, const place_data_t& placed_horizontal)
    {
        assert(window_m);

        extents_t::slice_t& vert = calculated_horizontal.vertical();
        vert.length_m = Value(implementation::DefaultFont()->Lineskip());
        vert.guide_set_m.push_back(Value(implementation::DefaultFont()->Ascent()));
    }
开发者ID:Syntaf,项目名称:GG,代码行数:8,代码来源:platform_display_text.cpp

示例15: assert

void display_number_t::measure_vertical(extents_t& calculated_horizontal, const place_data_t& placed_horizontal)
{
    assert(window_m);

    place_data_t save_bounds;
    implementation::get_control_bounds(window_m, save_bounds);

    place_data_t static_bounds;

    top(static_bounds) = top(placed_horizontal);
    left(static_bounds) = left(placed_horizontal);
    width(static_bounds) = width(placed_horizontal);
    height(static_bounds) = 10000; // bottomless

    implementation::set_control_bounds(window_m, static_bounds);

	HDC hdc(::GetWindowDC(window_m));
    std::string title(implementation::get_window_title(window_m));

    std::wstring wtitle;
    to_utf16(title.begin(), title.end(), std::back_inserter(wtitle));
    place_data_liukahr_t out_extent;

//    metrics::set_theme_name(L"Edit");
    //
    // If we don't have the type of this widget, then we should return a
    // zero sized rectangle. This is usually correct, and a good assumption
    // anyway.
    //
    int uxtheme_type = EP_EDITTEXT;
    //
    // Get the text metrics (and calculate the baseline of this widget)
    //
    TEXTMETRIC widget_tm;
    bool have_tm = metrics::get_font_metrics(uxtheme_type, widget_tm);

    assert(have_tm);

    const place_data_liukahr_t in_extents = static_bounds;

    bool have_extents = metrics::get_text_extents(uxtheme_type,
        wtitle.c_str(), out_extent, &in_extents);

    assert(have_extents);

    extents_t::slice_t& vert = calculated_horizontal.vertical();
    vert.length_m = height(out_extent);
    // set the baseline for the text

    metrics::set_window(window_m);

    if (have_tm)
        // distance from top to baseline
        vert.guide_set_m.push_back(widget_tm.tmHeight - widget_tm.tmDescent);

    implementation::set_control_bounds(window_m, save_bounds);
}
开发者ID:ilelann,项目名称:legacy,代码行数:57,代码来源:platform_display_number.cpp


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