本文整理汇总了C++中graph_reference类的典型用法代码示例。如果您正苦于以下问题:C++ graph_reference类的具体用法?C++ graph_reference怎么用?C++ graph_reference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了graph_reference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _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);
}
开发者ID:sarrow104,项目名称:nana,代码行数:7,代码来源:progress.cpp
示例2: attached
void drawer::attached(graph_reference graph)
{
window wd = widget_->handle();
editor_ = new text_editor(wd, graph);
editor_->textbase().bind_ext_evtbase(extra_evtbase);
editor_->border_renderer(nana::make_fun(*this, &drawer::_m_draw_border));
_m_text_area(graph.width(), graph.height());
using namespace API::dev;
make_drawer_event<events::focus>(wd);
make_drawer_event<events::key_char>(wd);
make_drawer_event<events::key_down>(wd);
make_drawer_event<events::mouse_down>(wd);
make_drawer_event<events::mouse_up>(wd);
make_drawer_event<events::mouse_move>(wd);
make_drawer_event<events::mouse_wheel>(wd);
make_drawer_event<events::mouse_enter>(wd);
make_drawer_event<events::mouse_leave>(wd);
API::tabstop(wd);
API::eat_tabstop(wd, true);
API::effects_edge_nimbus(wd, effects::edge_nimbus::active);
API::effects_edge_nimbus(wd, effects::edge_nimbus::over);
}
开发者ID:gfannes,项目名称:nana,代码行数:26,代码来源:textbox.cpp
示例3: solid_triangle
void solid_triangle(graph_reference graph, int x, int y, nana::color_t color, uint32_t dir)
{
x += 3;
y += 3;
switch(dir)
{
case directions::to_east:
for(int i = 0; i < 5; ++i)
graph.line(x + 3 + i, y + 1 + i, x + 3 + i, y + 9 - i, color);
break;
case directions::to_southeast:
for(int i = 0; i < 6; ++i)
graph.line(x + 2 + i, y + 7 - i, x + 7, y + 7 - i, color);
break;
case directions::to_south:
y += 3;
for(int i = 0; i < 5; ++i)
graph.line(x + i, y + i, x + 8 - i, y + i, color);
break;
case directions::to_west:
x += 5;
y += 1;
for(int i = 0; i < 5; ++i)
graph.line(x - i, y + i, x - i, y + 8 - i, color);
break;
case directions::to_north:
y += 7;
for(int i = 0; i < 5; ++i)
graph.line(x + i, y - i, x + 8 - i, y - i, color);
break;
}
}
开发者ID:gfannes,项目名称:nana,代码行数:32,代码来源:gadget.cpp
示例4: scroll_delta_pos
void drawer::scroll_delta_pos(graph_reference graph, int mouse_pos)
{
if(mouse_pos + metrics_.scroll_mouse_offset == metrics_.scroll_pos) return;
unsigned scale = vertical_ ? graph.height() : graph.width();
if(scale > fixedsize * 2)
{
int pos = mouse_pos - metrics_.scroll_mouse_offset;
const unsigned scroll_area = static_cast<unsigned>(scale - fixedsize * 2 - metrics_.scroll_length);
if(pos < 0)
pos = 0;
else if(pos > static_cast<int>(scroll_area))
pos = static_cast<int>(scroll_area);
metrics_.scroll_pos = pos;
auto value_max = metrics_.peak - metrics_.range;
//Check scroll_area to avoiding division by zero.
if (scroll_area)
metrics_.value = pos * value_max / scroll_area;
if(metrics_.value < value_max)
{
int selfpos = static_cast<int>(metrics_.value * scroll_area / value_max);
int nextpos = static_cast<int>((metrics_.value + 1) * scroll_area / value_max);
if(selfpos != nextpos && (pos - selfpos > nextpos - pos))
++metrics_.value;
}
else
metrics_.value = value_max;
}
}
开发者ID:sarrow104,项目名称:nana,代码行数:35,代码来源:scroll.cpp
示例5: _m_adjust_scroll
void drawer::_m_adjust_scroll(graph_reference graph)
{
if(metrics_.range == 0 || metrics_.peak <= metrics_.range) return;
unsigned pixels = vertical_ ? graph.height() : graph.width();
int pos = 0;
unsigned len = 0;
if(pixels > fixedsize * 2)
{
pixels -= (fixedsize * 2);
len = static_cast<unsigned>(pixels * metrics_.range / metrics_.peak);
if(len < fixedsize)
len = fixedsize;
if(metrics_.value)
{
pos = static_cast<int>(pixels - len);
if(metrics_.value + metrics_.range >= metrics_.peak)
metrics_.value = metrics_.peak - metrics_.range;
else
pos = static_cast<int>((metrics_.value * pos) /(metrics_.peak - metrics_.range));
}
}
metrics_.scroll_pos = pos;
metrics_.scroll_length = len;
}
开发者ID:sarrow104,项目名称:nana,代码行数:30,代码来源:scroll.cpp
示例6: what
buttons drawer::what(graph_reference graph, const point& screen_pos)
{
unsigned scale;
int pos;
if(vertical_)
{
scale = graph.height();
pos = screen_pos.y;
}
else
{
scale = graph.width();
pos = screen_pos.x;
}
const auto bound_pos = static_cast<int>(scale >= fixedsize * 2 ? fixedsize : scale / 2);
if (pos < bound_pos)
return buttons::first;
if (pos > static_cast<int>(scale) - bound_pos)
return buttons::second;
if(metrics_.scroll_length)
{
if(metrics_.scroll_pos + static_cast<int>(fixedsize) <= pos && pos < metrics_.scroll_pos + static_cast<int>(fixedsize + metrics_.scroll_length))
return buttons::scroll;
}
if(static_cast<int>(fixedsize) <= pos && pos < metrics_.scroll_pos)
return buttons::forward;
else if(metrics_.scroll_pos + static_cast<int>(metrics_.scroll_length) <= pos && pos < static_cast<int>(scale - fixedsize))
return buttons::backward;
return buttons::none;
}
开发者ID:sarrow104,项目名称:nana,代码行数:35,代码来源:scroll.cpp
示例7: _m_button_frame
void drawer::_m_button_frame(graph_reference graph, rectangle r, int state)
{
if (!state)
return;
::nana::color clr{0x97, 0x97, 0x97}; //highlight
switch(state)
{
case states::actived:
clr.from_rgb(0x86, 0xD5, 0xFD); break;
case states::selected:
clr.from_rgb(0x3C, 0x7F, 0xB1); break;
}
graph.rectangle(r, false, clr);
clr = clr.blend(colors::white, 0.5);
graph.palette(false, clr);
r.pare_off(2);
if(vertical_)
{
unsigned half = r.width / 2;
graph.rectangle({ r.x + static_cast<int>(r.width - half), r.y, half, r.height }, true);
r.width -= half;
}
else
{
unsigned half = r.height / 2;
graph.rectangle({r.x, r.y + static_cast<int>(r.height - half), r.width, half}, true);
r.height -= half;
}
graph.gradual_rectangle(r, colors::white, clr, !vertical_);
}
开发者ID:sarrow104,项目名称:nana,代码行数:34,代码来源:scroll.cpp
示例8: _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));
}
开发者ID:sarrow104,项目名称:nana,代码行数:26,代码来源:scroll.cpp
示例9: paste
void image_ico::paste(const nana::rectangle& src_r, graph_reference graph, int x, int y) const
{
if(ptr_ && (graph.empty() == false))
{
#if defined(NANA_WINDOWS)
::DrawIconEx(graph.handle()->context, x, y, *ptr_, src_r.width, src_r.height, 0, 0, DI_NORMAL);
#endif
}
}
开发者ID:gfannes,项目名称:nana,代码行数:9,代码来源:image.cpp
示例10: stretch
void image_ico::stretch(const nana::rectangle&, graph_reference graph, const nana::rectangle& r) const
{
if(ptr_ && (graph.empty() == false))
{
#if defined(NANA_WINDOWS)
::DrawIconEx(graph.handle()->context, r.x, r.y, *ptr_, r.width, r.height, 0, 0, DI_NORMAL);
#endif
}
}
开发者ID:gfannes,项目名称:nana,代码行数:9,代码来源:image.cpp
示例11: _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);
}
}
开发者ID:kirbyfan64,项目名称:nana,代码行数:9,代码来源:textbox.cpp
示例12: _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);
}
}
开发者ID:gfannes,项目名称:nana,代码行数:10,代码来源:textbox.cpp
示例13: 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));
}
开发者ID:sarrow104,项目名称:nana,代码行数:26,代码来源:scroll.cpp
示例14: _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));
}
开发者ID:Greentwip,项目名称:Windy,代码行数:16,代码来源:button.cpp
示例15: refresh
void trigger::refresh(graph_reference graph)
{
if (false == unknown_)
draw_width_ = static_cast<unsigned>((graph.width() - border * 2) * (double(value_) / max_));
_m_draw_box(graph);
_m_draw_progress(graph);
}
开发者ID:sarrow104,项目名称:nana,代码行数:8,代码来源:progress.cpp
示例16: attached
void drawer::attached(widget_reference wdg, graph_reference graph)
{
auto wd = wdg.handle();
widget_ = &wdg;
evt_agent_.reset(new event_agent(static_cast<::nana::textbox&>(wdg), editor_->text_position()));
auto scheme = API::dev::get_scheme(wdg);
editor_ = new text_editor(wd, graph, dynamic_cast<::nana::widgets::skeletons::text_editor_scheme*>(scheme));
editor_->textbase().set_event_agent(evt_agent_.get());
editor_->set_event(evt_agent_.get());
_m_text_area(graph.width(), graph.height());
API::tabstop(wd);
API::eat_tabstop(wd, true);
API::effects_edge_nimbus(wd, effects::edge_nimbus::active);
API::effects_edge_nimbus(wd, effects::edge_nimbus::over);
}
开发者ID:CodeBees,项目名称:nana,代码行数:19,代码来源:textbox.cpp
示例17: _m_draw_title
void drawer::_m_draw_title(graph_reference graph)
{
if(graph.width() > 16 + interval)
{
nana::string title = widget_->caption();
unsigned fgcolor = widget_->foreground();
unsigned pixels = graph.width() - (16 + interval);
nana::paint::text_renderer tr(graph);
if(API::window_enabled(widget_->handle()) == false)
{
tr.render(17 + interval, 2, 0xFFFFFF, title.c_str(), title.length(), pixels);
fgcolor = 0x808080;
}
tr.render(16 + interval, 1, fgcolor, title.c_str(), title.length(), pixels);
}
}
开发者ID:kirbyfan64,项目名称:nana,代码行数:19,代码来源:checkbox.cpp
示例18: direction_arrow
void direction_arrow(graph_reference graph, int x, int y, nana::color_t color, uint32_t dir)
{
y += 5;
switch(dir)
{
case directions::to_north:
{
x += 3;
int pixels = 1;
for(int l = 0; l < 4; ++l)
{
for(int i = 0; i < pixels; ++i)
{
if(l ==3 && i == 3)
{}
else
graph.set_pixel(x + i, y, 0x262);
}
x--;
y++;
pixels += 2;
}
graph.set_pixel(x + 1, y, 0x262);
graph.set_pixel(x + 2, y, 0x262);
graph.set_pixel(x + 6, y, 0x262);
graph.set_pixel(x + 7, y, 0x262);
}
break;
case directions::to_south:
{
graph.set_pixel(x, y, 0x262);
graph.set_pixel(x + 1, y, 0x262);
graph.set_pixel(x + 5, y, 0x262);
graph.set_pixel(x + 6, y, 0x262);
++y;
int pixels = 7;
for(int l = 0; l < 4; ++l)
{
for(int i = 0; i < pixels; ++i)
{
if(l == 0 && i == 3){}
else
graph.set_pixel(x + i, y, 0x262);
}
x++;
y++;
pixels -= 2;
}
}
break;
}
}
开发者ID:gfannes,项目名称:nana,代码行数:58,代码来源:gadget.cpp
示例19: _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);
}
}
开发者ID:sarrow104,项目名称:nana,代码行数:11,代码来源:scroll.cpp
示例20: _m_draw_title
void drawer::_m_draw_title(graph_reference graph)
{
if (graph.width() > 16 + interval)
{
nana::string title = widget_->caption();
unsigned pixels = graph.width() - (16 + interval);
nana::paint::text_renderer tr(graph);
if (API::window_enabled(widget_->handle()) == false)
{
graph.set_text_color(colors::white);
tr.render({ 17 + interval, 2 }, title.c_str(), title.length(), pixels);
graph.set_text_color({ 0x80, 0x80, 0x80 });
}
else
graph.set_text_color(widget_->fgcolor());
tr.render({ 16 + interval, 1 }, title.c_str(), title.length(), pixels);
}
}
开发者ID:a397871706,项目名称:plug,代码行数:21,代码来源:checkbox.cpp
注:本文中的graph_reference类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论