本文整理汇总了C++中graph_reference::size方法的典型用法代码示例。如果您正苦于以下问题:C++ graph_reference::size方法的具体用法?C++ graph_reference::size怎么用?C++ graph_reference::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph_reference
的用法示例。
在下文中一共展示了graph_reference::size方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _m_background
//private:
void drawer::_m_background(graph_reference graph)
{
graph.rectangle(true, {0xf0, 0xf0, 0xf0});
if (!metrics_.pressed || !_m_check())
return;
nana::rectangle_rotator r(vertical_, ::nana::rectangle{ graph.size() });
if(metrics_.what == buttons::forward)
{
r.x_ref() = static_cast<int>(fixedsize);
r.w_ref() = metrics_.scroll_pos;
}
else if(buttons::backward == metrics_.what)
{
r.x_ref() = static_cast<int>(fixedsize + metrics_.scroll_pos + metrics_.scroll_length);
r.w_ref() = static_cast<unsigned>((vertical_ ? graph.height() : graph.width()) - (fixedsize * 2 + metrics_.scroll_pos + metrics_.scroll_length));
}
else
return;
auto result = r.result();
if (!result.empty())
graph.rectangle(result, true, static_cast<color_rgb>(0xDCDCDC));
}
示例2: _m_draw_box
void trigger::_m_draw_box(graph_reference graph)
{
rectangle r{ graph.size() };
graph.gradual_rectangle(r, colors::button_face_shadow_end, colors::button_face_shadow_start, true);
::nana::color lt{ colors::gray }, rb{colors::white};
graph.frame_rectangle(r, lt, lt, rb, rb);
}
示例3: draw
void drawer::draw(graph_reference graph, buttons what)
{
if(false == metrics_.pressed || metrics_.what != buttons::scroll)
_m_adjust_scroll(graph);
_m_background(graph);
rectangle_rotator r(vertical_, ::nana::rectangle{ graph.size() });
r.x_ref() = static_cast<int>(r.w() - fixedsize);
r.w_ref() = fixedsize;
int state = ((_m_check() == false || what == buttons::none) ? states::none : states::highlight);
int moused_state = (_m_check() ? (metrics_.pressed ? states::selected : states::actived) : states::none);
auto result = r.result();
//draw first
_m_draw_button(graph, { 0, 0, result.width, result.height }, buttons::first, (buttons::first == what ? moused_state : state));
//draw second
_m_draw_button(graph, result, buttons::second, (buttons::second == what ? moused_state : state));
//draw scroll
_m_draw_scroll(graph, (buttons::scroll == what ? moused_state : states::highlight));
}
示例4: _m_draw_border
void drawer::_m_draw_border(graph_reference graph, nana::color_t bgcolor)
{
if (!API::widget_borderless(widget_->handle()))
{
nana::rectangle r(graph.size());
graph.rectangle(r, (status_.has_focus ? 0x0595E2 : 0x999A9E), false);
graph.rectangle(r.pare_off(1), bgcolor, false);
}
}
示例5: _m_draw_border
void drawer::_m_draw_border(graph_reference graph)
{
if(status_.border)
{
nana::rectangle r(graph.size());
graph.rectangle(r, (status_.has_focus ? 0x0595E2 : 0x999A9E), false);
r.pare_off(1);
graph.rectangle(r, 0xFFFFFF, false);
}
}
示例6: _m_draw_scroll
void drawer::_m_draw_scroll(graph_reference graph, int state)
{
if(_m_check())
{
rectangle_rotator r(vertical_, rectangle{ graph.size() });
r.x_ref() = static_cast<int>(fixedsize + metrics_.scroll_pos);
r.w_ref() = static_cast<unsigned>(metrics_.scroll_length);
_m_button_frame(graph, r.result(), state);
}
}
示例7: _m_draw_border
void trigger::_m_draw_border(graph_reference graph)
{
nana::rectangle r(graph.size());
::nana::color lt(static_cast<color_rgb>(0x7f7f7f)), rb(static_cast<color_rgb>(0x707070));
graph.frame_rectangle(r, lt, lt, rb, rb);
graph.set_color(colors::button_face);
draw_corner_point(graph, r);
graph.set_color(static_cast<color_rgb>(0x919191));
draw_corner_point(graph, r.pare_off(1));
if (element_state::pressed == attr_.e_state)
graph.rectangle(r, false, static_cast<color_rgb>(0xc3c3c3));
}
示例8: _m_draw_button
void drawer::_m_draw_button(graph_reference graph, rectangle r, buttons what, int state)
{
if(_m_check())
_m_button_frame(graph, r, state);
if(buttons::first == what || buttons::second == what)
{
auto sz = graph.size();
int top = static_cast<int>(sz.height - fixedsize);
int left = static_cast<int>(sz.width - fixedsize);
direction dir;
if (buttons::second == what)
{
if (vertical_)
{
r.y = top;
dir = direction::south;
}
else
{
r.x = left;
dir = direction::east;
}
}
else
dir = vertical_ ? direction::north : direction::west;
if (vertical_)
r.x = left / 2;
else
r.y = top / 2;
r.width = r.height = 16;
facade<element::arrow> arrow(states::none == state ? "hollow_triangle" : "solid_triangle");
arrow.direction(dir);
arrow.draw(graph, {}, (_m_check() ? colors::black : colors::gray), r, element_state::normal);
}
}
示例9: take_effect
void take_effect(window, graph_reference graph) const
{
graph.blur(::nana::rectangle{ graph.size() }, radius_);
}
示例10: _m_draw_title
void trigger::_m_draw_title(graph_reference graph, bool enabled)
{
nana::string text = wdg_->caption();
nana::string::value_type shortkey;
nana::string::size_type shortkey_pos;
nana::string str = API::transform_shortkey_text(text, shortkey, &shortkey_pos);
nana::size ts = graph.text_extent_size(str);
nana::size gsize = graph.size();
nana::size icon_sz;
if(attr_.icon)
{
icon_sz = attr_.icon->size();
icon_sz.width += 5;
}
nana::point pos{
static_cast<int>(gsize.width - 1 - ts.width) >> 1, static_cast<int>(gsize.height - 1 - ts.height) >> 1
};
if(pos.x < static_cast<int>(icon_sz.width))
pos.x = static_cast<int>(icon_sz.width);
unsigned omitted_pixels = gsize.width - icon_sz.width;
std::size_t txtlen = str.size();
const nana::char_t* txtptr = str.c_str();
if(ts.width)
{
nana::paint::text_renderer tr(graph);
if(enabled)
{
if (element_state::pressed == attr_.e_state)
{
++pos.x;
++pos.y;
}
graph.set_text_color(attr_.focus_color && attr_.focused ? ::nana::color(colors::blue) : attr_.fgcolor);
if (attr_.omitted)
tr.render(pos, txtptr, txtlen, omitted_pixels, true);
else
graph.bidi_string(pos, txtptr, txtlen);
if(shortkey)
{
unsigned off_w = (shortkey_pos ? graph.text_extent_size(str, static_cast<unsigned>(shortkey_pos)).width : 0);
nana::size shortkey_size = graph.text_extent_size(txtptr + shortkey_pos, 1);
pos.x += off_w;
pos.y += static_cast<int>(shortkey_size.height);
graph.set_color(colors::black);
graph.line(pos, point{ pos.x + static_cast<int>(shortkey_size.width) - 1, pos.y });
}
}
else
{
graph.set_text_color(::nana::color(colors::white));
if(attr_.omitted)
{
tr.render(point{ pos.x + 1, pos.y + 1 }, txtptr, txtlen, omitted_pixels, true);
graph.set_text_color(::nana::color(colors::gray));
tr.render(pos, txtptr, txtlen, omitted_pixels, true);
}
else
{
graph.bidi_string(point{ pos.x + 1, pos.y + 1 }, txtptr, txtlen);
graph.set_text_color(::nana::color(colors::gray));
graph.bidi_string(pos, txtptr, txtlen);
}
}
}
if(attr_.icon)
attr_.icon->paste(graph, point{ 3, static_cast<int>(gsize.height - icon_sz.height) / 2 });
}
void trigger::_m_draw_background(graph_reference graph)
{
nana::rectangle r(graph.size());
r.pare_off(1);
auto from = attr_.bgcolor.blend(colors::white, 0.2);
auto to = attr_.bgcolor.blend(colors::black, 0.95);
if (element_state::pressed == attr_.e_state)
{
r.x = r.y = 2;
std::swap(from, to);
}
graph.gradual_rectangle(r, from, to, true);
}
示例11: take_effect
void take_effect(window, graph_reference graph) const
{
graph.blur(graph.size(), radius_);
}
示例12: refresh
void refresh(graph_reference graph)
{
graph.rectangle(false, colors::black);
graph.rectangle(::nana::rectangle(graph.size()).pare_off(1), true, {0xf0, 0xf0, 0xf0});
}
示例13: refresh
void drawer::refresh(graph_reference graph)
{
auto const graphsize = graph.size();
auto & backimg = impl_->backimg;
if (!backimg.bground)
{
if (backimg.image.empty())
{
impl_->draw_background(graph, {});
return;
}
auto valid_area = backimg.valid_area;
if (valid_area.empty())
valid_area.dimension(backimg.image.size());
//The position where the image to be drawn.
::nana::point pos;
if (backimg.stretchable)
{
auto fit_size = fit_zoom(valid_area.dimension(), graphsize);
if (fit_size.width != graphsize.width)
{
switch (backimg.align_horz)
{
case ::nana::align::left: break;
case ::nana::align::center:
pos.x = (int(graphsize.width) - int(fit_size.width)) / 2;
break;
case ::nana::align::right:
pos.x = int(graphsize.width) - int(fit_size.width);
break;
}
}
else if (fit_size.height != graphsize.height)
{
switch (backimg.align_vert)
{
case ::nana::align_v::top: break;
case ::nana::align_v::center:
pos.y = (int(graphsize.height) - int(fit_size.height)) / 2;
break;
case ::nana::align_v::bottom:
pos.y = int(graphsize.height) - int(fit_size.height);
break;
}
}
impl_->draw_background(graph, fit_size);
backimg.image.stretch(valid_area, graph, ::nana::rectangle{ pos, fit_size });
}
else
{
switch (backimg.align_horz)
{
case ::nana::align::left: break;
case ::nana::align::center:
pos.x = (int(graphsize.width) - int(valid_area.width)) / 2;
break;
case ::nana::align::right:
pos.x = int(graphsize.width) - int(valid_area.width);
break;
}
switch (backimg.align_vert)
{
case ::nana::align_v::top: break;
case ::nana::align_v::center:
pos.y = (int(graphsize.height) - int(valid_area.height)) / 2;
break;
case ::nana::align_v::bottom:
pos.y = int(graphsize.height) - int(valid_area.height);
break;
}
impl_->draw_background(graph, valid_area.dimension());
backimg.image.paste(valid_area, graph, pos);
}
}
else
{
impl_->draw_background(graph, graphsize);
color invalid_clr_for_call;
backimg.bground->draw(graph, invalid_clr_for_call, invalid_clr_for_call, rectangle{ graphsize }, element_state::normal);
}
graph.setsta();
}
示例14: _m_draw_title
void trigger::_m_draw_title(graph_reference graph, bool enabled)
{
wchar_t shortkey;
std::string::size_type shortkey_pos;
std::string mbstr = API::transform_shortkey_text(wdg_->caption(), shortkey, &shortkey_pos);
std::wstring str = to_wstring(mbstr);
nana::size ts = graph.text_extent_size(str);
nana::size gsize = graph.size();
nana::size icon_sz;
if(attr_.icon)
{
icon_sz = attr_.icon->size();
icon_sz.width += 5;
}
nana::point pos{
static_cast<int>(gsize.width - 1 - ts.width) >> 1, static_cast<int>(gsize.height - 1 - ts.height) >> 1
};
if(pos.x < static_cast<int>(icon_sz.width))
pos.x = static_cast<int>(icon_sz.width);
unsigned omitted_pixels = gsize.width - icon_sz.width;
std::size_t txtlen = str.size();
const auto txtptr = str.c_str();
if(ts.width)
{
nana::paint::text_renderer tr(graph);
if(enabled)
{
if (element_state::pressed == attr_.e_state)
{
++pos.x;
++pos.y;
}
auto text_color = (attr_.focus_color && attr_.focused ? ::nana::color(colors::blue) : attr_.fgcolor);
graph.palette(true, text_color);
if (attr_.omitted)
tr.render(pos, txtptr, txtlen, omitted_pixels, true);
else
#ifdef _nana_std_has_string_view
graph.bidi_string(pos, { txtptr, txtlen });
#else
graph.bidi_string(pos, txtptr, txtlen);
#endif
API::dev::draw_shortkey_underline(graph, mbstr, shortkey, shortkey_pos, pos, text_color);
}
else
{
graph.palette(true, color{ colors::white });
if(attr_.omitted)
{
tr.render(point{ pos.x + 1, pos.y + 1 }, txtptr, txtlen, omitted_pixels, true);
graph.palette(true, color{ colors::gray });
tr.render(pos, txtptr, txtlen, omitted_pixels, true);
}
else
{
#ifdef _nana_std_has_string_view
graph.bidi_string(point{ pos.x + 1, pos.y + 1 }, { txtptr, txtlen });
graph.palette(true, color{ colors::gray });
graph.bidi_string(pos, { txtptr, txtlen });
#else
graph.bidi_string(point{ pos.x + 1, pos.y + 1 }, txtptr, txtlen);
graph.palette(true, color{ colors::gray });
graph.bidi_string(pos, txtptr, txtlen);
#endif
}
}
}
if(attr_.icon)
attr_.icon->paste(graph, point{ 3, static_cast<int>(gsize.height - icon_sz.height) / 2 });
}
void trigger::_m_draw_background(graph_reference graph)
{
nana::rectangle r(graph.size());
r.pare_off(1);
auto from = attr_.bgcolor.blend(colors::white, 0.8);
auto to = attr_.bgcolor.blend(colors::black, 0.05);
if (element_state::pressed == attr_.e_state)
{
r.x = r.y = 2;
std::swap(from, to);
}
graph.gradual_rectangle(r, from, to, true);
}