new docker-place branch
This commit is contained in:
parent
42dd27b68f
commit
658ab3fb7f
@ -98,25 +98,31 @@ namespace nana
|
||||
}
|
||||
};
|
||||
|
||||
void add_crook(const std::string& name, const pat::cloneable<factory_interface<crook_interface>>&);
|
||||
crook_interface* const * keeper_crook(const std::string& name);
|
||||
void add_arrow(const std::string&, const pat::cloneable<factory_interface<arrow_interface>>&);
|
||||
arrow_interface* const * cite_arrow(const std::string&);
|
||||
|
||||
void add_border(const std::string&, const pat::cloneable<factory_interface<border_interface>>&);
|
||||
border_interface* const * keeper_border(const std::string&);
|
||||
|
||||
void add_arrow(const std::string&, const pat::cloneable<factory_interface<arrow_interface>>&);
|
||||
arrow_interface* const * keeper_arrow(const std::string&);
|
||||
border_interface* const * cite_border(const std::string&);
|
||||
|
||||
void add_button(const std::string&, const pat::cloneable<factory_interface<element_interface>>&);
|
||||
element_interface* const* keeper_button(const std::string&);
|
||||
element_interface* const* cite_button(const std::string&);
|
||||
|
||||
void add_x_icon(const std::string& name, const pat::cloneable<factory_interface<element_interface>>&);
|
||||
element_interface* const* cite_x_icon(const std::string&);
|
||||
|
||||
void add_crook(const std::string& name, const pat::cloneable<factory_interface<crook_interface>>&);
|
||||
crook_interface* const * cite_crook(const std::string& name);
|
||||
|
||||
void add_cross(const std::string& name, const pat::cloneable<factory_interface<element_interface>>&);
|
||||
element_interface* const* cite_cross(const std::string&);
|
||||
};
|
||||
|
||||
class crook;
|
||||
template<typename UserElement>
|
||||
void add_crook(const std::string& name)
|
||||
class arrow;
|
||||
template<typename ArrowElement>
|
||||
void add_arrow(const std::string& name)
|
||||
{
|
||||
using factory_t = provider::factory<UserElement, crook_interface>;
|
||||
provider().add_crook(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
|
||||
using factory_t = provider::factory<ArrowElement, arrow_interface>;
|
||||
provider().add_arrow(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
|
||||
}
|
||||
|
||||
class border;
|
||||
@ -127,14 +133,6 @@ namespace nana
|
||||
provider().add_border(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
|
||||
}
|
||||
|
||||
class arrow;
|
||||
template<typename ArrowElement>
|
||||
void add_arrow(const std::string& name)
|
||||
{
|
||||
using factory_t = provider::factory<ArrowElement, arrow_interface>;
|
||||
provider().add_arrow(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
|
||||
}
|
||||
|
||||
class button;
|
||||
template<typename ButtonElement>
|
||||
void add_button(const std::string& name)
|
||||
@ -142,6 +140,30 @@ namespace nana
|
||||
using factory_t = provider::factory<ButtonElement, element_interface>;
|
||||
provider().add_button(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
|
||||
}
|
||||
|
||||
class x_icon;
|
||||
template<typename UserElement>
|
||||
void add_x_icon(const std::string& name)
|
||||
{
|
||||
using factory_t = provider::factory<UserElement, element_interface>;
|
||||
provider().add_x_icon(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
|
||||
}
|
||||
|
||||
class crook;
|
||||
template<typename UserElement>
|
||||
void add_crook(const std::string& name)
|
||||
{
|
||||
using factory_t = provider::factory<UserElement, crook_interface>;
|
||||
provider().add_crook(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
|
||||
}
|
||||
|
||||
class cross;
|
||||
template<typename UserElement>
|
||||
void add_cross(const std::string& name)
|
||||
{
|
||||
using factory_t = provider::factory<UserElement, element_interface>;
|
||||
provider().add_cross(name, pat::cloneable<typename factory_t::interface_type>(factory_t()));
|
||||
}
|
||||
}//end namespace element
|
||||
|
||||
template<typename Element> class facade;
|
||||
@ -169,9 +191,27 @@ namespace nana
|
||||
bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state) override;
|
||||
private:
|
||||
element::crook_interface::data data_;
|
||||
element::crook_interface* const * keeper_;
|
||||
element::crook_interface* const * cite_;
|
||||
}; //end class facade<element::crook>
|
||||
|
||||
template<> class facade<element::cross>
|
||||
: public element::element_interface
|
||||
{
|
||||
public:
|
||||
facade(const char* name = nullptr);
|
||||
void switch_to(const char*);
|
||||
|
||||
void thickness(unsigned thk);
|
||||
void size(unsigned size_pixels);
|
||||
public:
|
||||
//Implement element_interface
|
||||
bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state) override;
|
||||
private:
|
||||
unsigned thickness_{6};
|
||||
unsigned size_{ 14 };
|
||||
element::element_interface* const * cite_;
|
||||
};
|
||||
|
||||
template<>
|
||||
class facade<element::border>
|
||||
: public element::element_interface
|
||||
@ -185,7 +225,7 @@ namespace nana
|
||||
//Implement element_interface
|
||||
bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) override;
|
||||
private:
|
||||
element::border_interface* const * keeper_;
|
||||
element::border_interface* const * cite_;
|
||||
};//end class facade<element::border>
|
||||
|
||||
template<>
|
||||
@ -207,7 +247,7 @@ namespace nana
|
||||
//Implement element_interface
|
||||
bool draw(graph_reference, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle&, element_state) override;
|
||||
private:
|
||||
element::arrow_interface* const * keeper_;
|
||||
element::arrow_interface* const * cite_;
|
||||
::nana::direction dir_{::nana::direction::north};
|
||||
};//end class facade<element::arrow>
|
||||
|
||||
@ -222,9 +262,22 @@ namespace nana
|
||||
//Implement element_interface
|
||||
bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state) override;
|
||||
private:
|
||||
element::element_interface* const * keeper_;
|
||||
element::element_interface* const * cite_;
|
||||
};//end class facade<element::button>
|
||||
|
||||
template<>
|
||||
class facade<element::x_icon>
|
||||
: public element::element_interface
|
||||
{
|
||||
public:
|
||||
facade(const char* name = nullptr);
|
||||
void switch_to(const char*);
|
||||
public:
|
||||
//Implement element_interface
|
||||
bool draw(graph_reference, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle&, element_state) override;
|
||||
private:
|
||||
element::element_interface* const * cite_;
|
||||
};//end class facade<element::button>
|
||||
|
||||
namespace element
|
||||
{
|
||||
|
||||
@ -109,9 +109,11 @@ namespace nana
|
||||
window window_handle() const;
|
||||
|
||||
void div(const char* s); ///< Divides the attached widget into fields.
|
||||
void modify(const char* field_name, const char* div_text); ///< Modifies a specified field.
|
||||
|
||||
field_reference field(const char* name);///< Returns a field with the specified name.
|
||||
|
||||
void field_visible(const char* filed_name, bool visible); ///<<Shows/Hides an existing field.
|
||||
void field_visible(const char* field_name, bool visible); ///<<Shows/Hides an existing field.
|
||||
bool field_visible(const char* field_name) const; ///<Determines whether the specified field is visible.
|
||||
|
||||
void field_display(const char* field_name, bool display); ///<Displays/Discards an existing field.
|
||||
@ -122,6 +124,18 @@ namespace nana
|
||||
void erase(window handle); ///< Erases a window from field.
|
||||
|
||||
field_reference operator[](const char* name); ///< Returns a field with the specified name. Equal to field();
|
||||
|
||||
/// Add a panel factory
|
||||
template<typename Panel, typename ...Args>
|
||||
void dock(const std::string& dockname, Args&& ... args)
|
||||
{
|
||||
dock(dockname, std::bind([](window parent, Args && ... args)
|
||||
{
|
||||
return std::unique_ptr<widget>(new Panel(parent, std::forward<Args>(args)...));
|
||||
}, std::placeholders::_1, std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
void dock(const std::string& dockname, std::function<std::unique_ptr<widget>(window)> factory);
|
||||
private:
|
||||
implement * impl_;
|
||||
};
|
||||
|
||||
@ -191,7 +191,7 @@ namespace API
|
||||
}
|
||||
|
||||
point window_position(window);
|
||||
void move_window(window, int x, int y);
|
||||
void move_window(window, const point&);
|
||||
void move_window(window wd, const rectangle&);
|
||||
|
||||
void bring_top(window, bool activated);
|
||||
|
||||
@ -164,7 +164,7 @@ namespace nana
|
||||
if (!t.restrict_area.empty())
|
||||
_m_check_restrict_area(wdps, API::window_size(t.wd), t.restrict_area);
|
||||
|
||||
API::move_window(t.wd, wdps.x, wdps.y);
|
||||
API::move_window(t.wd, wdps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ namespace nana
|
||||
}
|
||||
else
|
||||
{
|
||||
::nana::color highlighted(static_cast<color_rgb>(0x5eb6f7));
|
||||
::nana::color highlighted(0x5e, 0xb6, 0xf7);
|
||||
auto bld_bgcolor = bgcolor;
|
||||
auto bld_fgcolor = fgcolor;
|
||||
switch(es)
|
||||
@ -156,7 +156,7 @@ namespace nana
|
||||
bld_fgcolor = fgcolor.blend(highlighted, 0.4);
|
||||
break;
|
||||
case element_state::disabled:
|
||||
bld_bgcolor = bld_fgcolor.from_rgb(0xb2, 0xb7, 0xbc);
|
||||
bld_bgcolor = bld_fgcolor = nana::color(0xb2, 0xb7, 0xbc);
|
||||
break;
|
||||
default:
|
||||
//Leave things as they are
|
||||
@ -264,7 +264,7 @@ namespace nana
|
||||
bool draw(graph_reference graph, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle& r, element_state estate, unsigned weight)
|
||||
{
|
||||
graph.rectangle(r, false, static_cast<color_rgb>((element_state::focus_hovered == estate || element_state::focus_normal == estate) ? 0x0595E2 : 0x999A9E));
|
||||
graph.rectangle(::nana::rectangle(r).pare_off(1), false, bgcolor);
|
||||
graph.rectangle(::nana::rectangle{r}.pare_off(1), false, bgcolor);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@ -529,6 +529,63 @@ namespace nana
|
||||
return true;
|
||||
}
|
||||
};//end class annex_button
|
||||
|
||||
class x_icon
|
||||
: public element_interface
|
||||
{
|
||||
bool draw(graph_reference graph, const ::nana::color&, const ::nana::color& fgcolor, const rectangle& r, element_state estate) override
|
||||
{
|
||||
auto clr = fgcolor;
|
||||
|
||||
switch (estate)
|
||||
{
|
||||
case element_state::hovered:
|
||||
case element_state::pressed:
|
||||
clr = clr.blend(colors::black, 0.8);
|
||||
break;
|
||||
case element_state::disabled:
|
||||
clr = colors::dark_gray;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
graph.set_color(clr);
|
||||
|
||||
const int x = r.x + 4;
|
||||
const int y = r.y + 4;
|
||||
|
||||
point p1{ x, y }, p2{ x + 7, y + 7 };
|
||||
|
||||
graph.line(p1, p2);
|
||||
|
||||
++p1.x;
|
||||
--p2.y;
|
||||
graph.line(p1, p2);
|
||||
|
||||
p1.x = x;
|
||||
++p1.y;
|
||||
p2.x = x + 6;
|
||||
p2.y = y + 7;
|
||||
graph.line(p1, p2);
|
||||
|
||||
p1.x += 7;
|
||||
p1.y = y;
|
||||
p2.x = x;
|
||||
graph.line(p1, p2);
|
||||
|
||||
p1.x = x + 6;
|
||||
p2.y = y + 6;
|
||||
graph.line(p1, p2);
|
||||
|
||||
++p1.x;
|
||||
++p1.y;
|
||||
++p2.x;
|
||||
++p2.y;
|
||||
graph.line(p1, p2);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}//end namespace element
|
||||
|
||||
template<typename ElementInterface>
|
||||
@ -567,7 +624,7 @@ namespace nana
|
||||
spare_.emplace_back(keep_e, keep_f);
|
||||
}
|
||||
|
||||
element_t * const * keeper() const
|
||||
element_t * const * cite() const
|
||||
{
|
||||
return &element_ptr_;
|
||||
}
|
||||
@ -580,6 +637,9 @@ namespace nana
|
||||
class element_manager
|
||||
: nana::noncopyable, nana::nonmovable
|
||||
{
|
||||
//VC2012 does not support alias declaration.
|
||||
//template<typename E> using factory_interface = element::provider::factory_interface<E>;
|
||||
|
||||
template<typename ElementInterface>
|
||||
struct item
|
||||
{
|
||||
@ -613,6 +673,8 @@ namespace nana
|
||||
element::add_arrow<element::arrow_hollow_triangle>("hollow_triangle");
|
||||
|
||||
element::add_button<element::annex_button>(""); //"annex" in default
|
||||
|
||||
element::add_x_icon<element::x_icon>("");
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@ -624,7 +686,17 @@ namespace nana
|
||||
|
||||
element::crook_interface * const * crook(const std::string& name) const
|
||||
{
|
||||
return _m_get(name, crook_).keeper();
|
||||
return _m_get(name, crook_).cite();
|
||||
}
|
||||
|
||||
void cross(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::element_interface>>& factory)
|
||||
{
|
||||
_m_add(name, cross_, factory);
|
||||
}
|
||||
|
||||
element::element_interface* const * cross(const std::string& name) const
|
||||
{
|
||||
return _m_get(name, cross_).cite();
|
||||
}
|
||||
|
||||
void border(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::border_interface>>& factory)
|
||||
@ -634,7 +706,7 @@ namespace nana
|
||||
|
||||
element::border_interface * const * border(const std::string& name) const
|
||||
{
|
||||
return _m_get(name, border_).keeper();
|
||||
return _m_get(name, border_).cite();
|
||||
}
|
||||
|
||||
void arrow(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::arrow_interface>>& factory)
|
||||
@ -644,7 +716,7 @@ namespace nana
|
||||
|
||||
element::arrow_interface * const * arrow(const std::string& name) const
|
||||
{
|
||||
return _m_get((name.empty() ? "arrowhead" : name), arrow_).keeper();
|
||||
return _m_get((name.empty() ? "arrowhead" : name), arrow_).cite();
|
||||
}
|
||||
|
||||
void button(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::element_interface>>& factory)
|
||||
@ -654,7 +726,17 @@ namespace nana
|
||||
|
||||
element::element_interface * const * button(const std::string& name) const
|
||||
{
|
||||
return _m_get((name.empty() ? "annex" : name), button_).keeper();
|
||||
return _m_get((name.empty() ? "annex" : name), button_).cite();
|
||||
}
|
||||
|
||||
void x_icon(const std::string& name, const pat::cloneable<element::provider::factory_interface<element::element_interface>>& factory)
|
||||
{
|
||||
_m_add(name, x_icon_, factory);
|
||||
}
|
||||
|
||||
element::element_interface * const * x_icon(const std::string& name) const
|
||||
{
|
||||
return _m_get(name, x_icon_).cite();
|
||||
}
|
||||
private:
|
||||
using lock_guard = std::lock_guard<std::recursive_mutex>;
|
||||
@ -689,9 +771,11 @@ namespace nana
|
||||
private:
|
||||
mutable std::recursive_mutex mutex_;
|
||||
item<element::crook_interface> crook_;
|
||||
item<element::element_interface> cross_;
|
||||
item<element::border_interface> border_;
|
||||
item<element::arrow_interface> arrow_;
|
||||
item<element::element_interface> button_;
|
||||
item<element::element_interface> x_icon_;
|
||||
};
|
||||
|
||||
namespace element
|
||||
@ -702,17 +786,27 @@ namespace nana
|
||||
element_manager::instance().crook(name, factory);
|
||||
}
|
||||
|
||||
crook_interface* const * provider::keeper_crook(const std::string& name)
|
||||
crook_interface* const * provider::cite_crook(const std::string& name)
|
||||
{
|
||||
return element_manager::instance().crook(name);
|
||||
}
|
||||
|
||||
void provider::add_cross(const std::string& name, const pat::cloneable<factory_interface<element_interface>>& factory)
|
||||
{
|
||||
element_manager::instance().cross(name, factory);
|
||||
}
|
||||
|
||||
element_interface* const* provider::cite_cross(const std::string& name)
|
||||
{
|
||||
return element_manager::instance().cross(name);
|
||||
}
|
||||
|
||||
void provider::add_border(const std::string& name, const pat::cloneable<factory_interface<border_interface>>& factory)
|
||||
{
|
||||
element_manager::instance().border(name, factory);
|
||||
}
|
||||
|
||||
border_interface* const * provider::keeper_border(const std::string& name)
|
||||
border_interface* const * provider::cite_border(const std::string& name)
|
||||
{
|
||||
return element_manager::instance().border(name);
|
||||
}
|
||||
@ -722,7 +816,7 @@ namespace nana
|
||||
element_manager::instance().arrow(name, factory);
|
||||
}
|
||||
|
||||
arrow_interface* const * provider::keeper_arrow(const std::string& name)
|
||||
arrow_interface* const * provider::cite_arrow(const std::string& name)
|
||||
{
|
||||
return element_manager::instance().arrow(name);
|
||||
}
|
||||
@ -732,16 +826,26 @@ namespace nana
|
||||
element_manager::instance().button(name, factory);
|
||||
}
|
||||
|
||||
element_interface* const* provider::keeper_button(const std::string& name)
|
||||
element_interface* const* provider::cite_button(const std::string& name)
|
||||
{
|
||||
return element_manager::instance().button(name);
|
||||
}
|
||||
|
||||
void provider::add_x_icon(const std::string& name, const pat::cloneable<factory_interface<element_interface>>& factory)
|
||||
{
|
||||
element_manager::instance().x_icon(name, factory);
|
||||
}
|
||||
|
||||
element_interface* const* provider::cite_x_icon(const std::string& name)
|
||||
{
|
||||
return element_manager::instance().x_icon(name);
|
||||
}
|
||||
}//end namespace element
|
||||
|
||||
//facades
|
||||
//template<> class facade<element::crook>
|
||||
facade<element::crook>::facade(const char* name)
|
||||
: keeper_(element::provider().keeper_crook(name ? name : ""))
|
||||
: cite_(element::provider().cite_crook(name ? name : ""))
|
||||
{
|
||||
data_.check_state = state::unchecked;
|
||||
data_.radio = false;
|
||||
@ -777,40 +881,120 @@ namespace nana
|
||||
|
||||
void facade<element::crook>::switch_to(const char* name)
|
||||
{
|
||||
keeper_ = element::provider().keeper_crook(name ? name : "");
|
||||
cite_ = element::provider().cite_crook(name ? name : "");
|
||||
}
|
||||
|
||||
bool facade<element::crook>::draw(graph_reference graph, const ::nana::color& bgcol, const ::nana::color& fgcol, const nana::rectangle& r, element_state es)
|
||||
{
|
||||
return (*keeper_)->draw(graph, bgcol, fgcol, r, es, data_);
|
||||
return (*cite_)->draw(graph, bgcol, fgcol, r, es, data_);
|
||||
}
|
||||
//end class facade<element::crook>
|
||||
|
||||
//class facade<element::cross>
|
||||
facade<element::cross>::facade(const char* name)
|
||||
: cite_(element::provider().cite_cross(name ? name : ""))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void facade<element::cross>::switch_to(const char* name)
|
||||
{
|
||||
cite_ = element::provider().cite_cross(name ? name : "");
|
||||
}
|
||||
|
||||
void facade<element::cross>::thickness(unsigned thk)
|
||||
{
|
||||
thickness_ = thk;
|
||||
}
|
||||
|
||||
void facade<element::cross>::size(unsigned size_px)
|
||||
{
|
||||
size_ = size_px;
|
||||
}
|
||||
|
||||
//Implement element_interface
|
||||
bool facade<element::cross>::draw(graph_reference graph, const ::nana::color&, const ::nana::color& fgcolor, const ::nana::rectangle& r, element_state)
|
||||
{
|
||||
if (thickness_ + 2 <= size_)
|
||||
{
|
||||
int gap = (static_cast<int>(size_) - static_cast<int>(thickness_)) / 2;
|
||||
|
||||
nana::point ps[12];
|
||||
ps[0].x = r.x + gap;
|
||||
ps[1].x = ps[0].x + static_cast<int>(thickness_) - 1;
|
||||
ps[1].y = ps[0].y = r.y;
|
||||
|
||||
ps[2].x = ps[1].x;
|
||||
ps[2].y = r.y + gap;
|
||||
|
||||
ps[3].x = ps[2].x + gap;
|
||||
ps[3].y = ps[2].y;
|
||||
|
||||
ps[4].x = ps[3].x;
|
||||
ps[4].y = ps[3].y + static_cast<int>(thickness_)-1;
|
||||
|
||||
ps[5].x = ps[1].x;
|
||||
ps[5].y = ps[4].y;
|
||||
|
||||
ps[6].x = ps[5].x;
|
||||
ps[6].y = ps[5].y + gap;
|
||||
|
||||
ps[7].x = r.x + gap;
|
||||
ps[7].y = ps[6].y;
|
||||
|
||||
ps[8].x = ps[7].x;
|
||||
ps[8].y = ps[4].y;
|
||||
|
||||
ps[9].x = r.x;
|
||||
ps[9].y = ps[4].y;
|
||||
|
||||
ps[10].x = r.x;
|
||||
ps[10].y = r.y + gap;
|
||||
|
||||
ps[11].x = r.x + gap;
|
||||
ps[11].y = r.y + gap;
|
||||
|
||||
graph.set_color(fgcolor.blend(colors::black, true));
|
||||
|
||||
for (int i = 0; i < 11; ++i)
|
||||
graph.line(ps[i], ps[i + 1]);
|
||||
graph.line(ps[11], ps[0]);
|
||||
|
||||
graph.set_color(fgcolor);
|
||||
|
||||
unsigned thk_minus_2 = thickness_ - 2;
|
||||
graph.rectangle(rectangle{ ps[10].x + 1, ps[10].y + 1, (gap << 1) + thk_minus_2, thk_minus_2 }, true);
|
||||
graph.rectangle(rectangle{ ps[0].x + 1, ps[0].y + 1, thk_minus_2, (gap << 1) + thk_minus_2 }, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//end class facade<element::cross>
|
||||
|
||||
//class facade<element::border>
|
||||
facade<element::border>::facade(const char* name)
|
||||
: keeper_(element::provider().keeper_border(name ? name : ""))
|
||||
: cite_(element::provider().cite_border(name ? name : ""))
|
||||
{}
|
||||
|
||||
void facade<element::border>::switch_to(const char* name)
|
||||
{
|
||||
keeper_ = element::provider().keeper_border(name ? name : "");
|
||||
cite_ = element::provider().cite_border(name ? name : "");
|
||||
}
|
||||
|
||||
bool facade<element::border>::draw(graph_reference graph, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state es)
|
||||
{
|
||||
return (*keeper_)->draw(graph, bgcolor, fgcolor, r, es, 2);
|
||||
return (*cite_)->draw(graph, bgcolor, fgcolor, r, es, 2);
|
||||
}
|
||||
//end class facade<element::border>
|
||||
|
||||
//class facade<element::arrow>
|
||||
facade<element::arrow>::facade(const char* name)
|
||||
: keeper_(element::provider().keeper_arrow(name ? name : ""))
|
||||
: cite_(element::provider().cite_arrow(name ? name : ""))
|
||||
{
|
||||
}
|
||||
|
||||
void facade<element::arrow>::switch_to(const char* name)
|
||||
{
|
||||
keeper_ = element::provider().keeper_arrow(name ? name : "");
|
||||
cite_ = element::provider().cite_arrow(name ? name : "");
|
||||
}
|
||||
|
||||
void facade<element::arrow>::direction(::nana::direction dir)
|
||||
@ -822,27 +1006,45 @@ namespace nana
|
||||
bool facade<element::arrow>::draw(graph_reference graph, const nana::color& bgcolor, const nana::color& fgcolor, const nana::rectangle& r, element_state estate)
|
||||
{
|
||||
graph.set_color(fgcolor);
|
||||
return (*keeper_)->draw(graph, bgcolor, fgcolor, r, estate, dir_);
|
||||
return (*cite_)->draw(graph, bgcolor, fgcolor, r, estate, dir_);
|
||||
}
|
||||
//end class facade<element::arrow>
|
||||
|
||||
//class facade<element::button>::
|
||||
facade<element::button>::facade(const char* name)
|
||||
: keeper_(element::provider().keeper_button(name ? name : ""))
|
||||
: cite_(element::provider().cite_button(name ? name : ""))
|
||||
{}
|
||||
|
||||
void facade<element::button>::switch_to(const char* name)
|
||||
{
|
||||
keeper_ = element::provider().keeper_button(name ? name : "");
|
||||
cite_ = element::provider().cite_button(name ? name : "");
|
||||
}
|
||||
|
||||
//Implement element_interface
|
||||
bool facade<element::button>::draw(graph_reference graph, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle& r, element_state estate)
|
||||
{
|
||||
return (*keeper_)->draw(graph, bgcolor, fgcolor, r, estate);
|
||||
return (*cite_)->draw(graph, bgcolor, fgcolor, r, estate);
|
||||
}
|
||||
//end class facade<element::button>
|
||||
|
||||
|
||||
//class facade<element::x_icon>
|
||||
facade<element::x_icon>::facade(const char* name)
|
||||
: cite_(element::provider().cite_x_icon(name ? name : ""))
|
||||
{}
|
||||
|
||||
void facade<element::x_icon>::switch_to(const char* name)
|
||||
{
|
||||
cite_ = element::provider().cite_x_icon(name ? name : "");
|
||||
}
|
||||
|
||||
//Implement element_interface
|
||||
bool facade<element::x_icon>::draw(graph_reference graph, const ::nana::color& bgcolor, const ::nana::color& fgcolor, const ::nana::rectangle& r, element_state estate)
|
||||
{
|
||||
return (*cite_)->draw(graph, bgcolor, fgcolor, r, estate);
|
||||
}
|
||||
//end class facade<element::x_icon>
|
||||
|
||||
namespace element
|
||||
{
|
||||
void set_bground(const char* name, const pat::cloneable<element_interface>& obj)
|
||||
|
||||
1256
source/gui/place.cpp
1256
source/gui/place.cpp
File diff suppressed because it is too large
Load Diff
@ -538,11 +538,11 @@ namespace API
|
||||
return nana::point{};
|
||||
}
|
||||
|
||||
void move_window(window wd, int x, int y)
|
||||
void move_window(window wd, const point& pos)
|
||||
{
|
||||
auto iwd = reinterpret_cast<restrict::core_window_t*>(wd);
|
||||
internal_scope_guard lock;
|
||||
if(restrict::window_manager.move(iwd, x, y, false))
|
||||
if(restrict::window_manager.move(iwd, pos.x, pos.y, false))
|
||||
{
|
||||
restrict::core_window_t* update_wd = nullptr;
|
||||
if (iwd->displayed() && iwd->effect.bground)
|
||||
|
||||
@ -305,7 +305,7 @@ namespace nana
|
||||
|
||||
void widget::_m_move(int x, int y)
|
||||
{
|
||||
API::move_window(handle(), x, y);
|
||||
API::move_window(handle(), { x, y });
|
||||
}
|
||||
|
||||
void widget::_m_move(const rectangle& r)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user