remove conversion constructors of point,size and rectangle
This commit is contained in:
parent
ceff7c0c27
commit
9947d0c511
@ -84,7 +84,7 @@ namespace nana
|
|||||||
|
|
||||||
enum class mouse_action
|
enum class mouse_action
|
||||||
{
|
{
|
||||||
begin, normal = begin, over, pressed, end
|
begin, normal = begin, hovered, pressed, end
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class element_state
|
enum class element_state
|
||||||
@ -337,6 +337,8 @@ namespace nana
|
|||||||
|
|
||||||
bool operator==(const color& other) const;
|
bool operator==(const color& other) const;
|
||||||
bool operator!=(const color& other) const;
|
bool operator!=(const color& other) const;
|
||||||
|
|
||||||
|
friend color operator+(const color&, const color&);
|
||||||
private:
|
private:
|
||||||
double r_{ 0.0 };
|
double r_{ 0.0 };
|
||||||
double g_{ 0.0 };
|
double g_{ 0.0 };
|
||||||
@ -344,60 +346,91 @@ namespace nana
|
|||||||
double a_{ 0.0 }; //invisible
|
double a_{ 0.0 }; //invisible
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
struct rectangle;
|
struct basic_point
|
||||||
|
|
||||||
struct point
|
|
||||||
{
|
{
|
||||||
point();
|
//typedef-names
|
||||||
point(int x, int y);
|
using value_type = T;
|
||||||
point(const rectangle&);
|
|
||||||
|
|
||||||
point& operator=(const rectangle&);
|
//data member
|
||||||
bool operator==(const point&) const;
|
value_type x{};
|
||||||
bool operator!=(const point&) const;
|
value_type y{};
|
||||||
bool operator<(const point&) const;
|
|
||||||
bool operator<=(const point&) const;
|
|
||||||
bool operator>(const point&) const;
|
|
||||||
bool operator>=(const point&) const;
|
|
||||||
|
|
||||||
point operator-(const point&) const;
|
//member functions
|
||||||
point operator+(const point&) const;
|
basic_point() = default;
|
||||||
point& operator-=(const point&);
|
|
||||||
point& operator+=(const point&);
|
|
||||||
|
|
||||||
int x;
|
basic_point(value_type x, value_type y)
|
||||||
int y;
|
: x{ x }, y{y}
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool operator==(const basic_point& other) const noexcept
|
||||||
|
{
|
||||||
|
return (x == other.x && y == other.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const basic_point& other) const noexcept
|
||||||
|
{
|
||||||
|
return (x != other.x || y != other.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<(const basic_point& other) const noexcept
|
||||||
|
{
|
||||||
|
return ((y < other.y) || (y == other.y && x < other.x));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator<=(const basic_point& other) const noexcept
|
||||||
|
{
|
||||||
|
return ((y < other.y) || (y == other.y && x <= other.x));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator>(const basic_point& other) const noexcept
|
||||||
|
{
|
||||||
|
return ((y > other.y) || (y == other.y && x > other.x));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator>=(const basic_point& other) const noexcept
|
||||||
|
{
|
||||||
|
return ((y > other.y) || (y == other.y && x >= other.x));
|
||||||
|
}
|
||||||
|
|
||||||
|
basic_point operator-(const basic_point& other) const noexcept
|
||||||
|
{
|
||||||
|
return{ x - other.x, y - other.y };
|
||||||
|
}
|
||||||
|
|
||||||
|
basic_point operator+(const basic_point& other) const noexcept
|
||||||
|
{
|
||||||
|
return{ x + other.x, y + other.y };
|
||||||
|
}
|
||||||
|
|
||||||
|
basic_point& operator-=(const basic_point& other) noexcept
|
||||||
|
{
|
||||||
|
x -= other.x;
|
||||||
|
y -= other.y;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
basic_point& operator+=(const basic_point& other) noexcept
|
||||||
|
{
|
||||||
|
x += other.x;
|
||||||
|
y += other.y;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct upoint
|
using point = basic_point<int>;
|
||||||
{
|
using upoint = basic_point<unsigned>;
|
||||||
typedef unsigned value_type;
|
|
||||||
|
|
||||||
upoint();
|
|
||||||
upoint(value_type x, value_type y);
|
|
||||||
bool operator==(const upoint&) const;
|
|
||||||
bool operator!=(const upoint&) const;
|
|
||||||
bool operator<(const upoint&) const;
|
|
||||||
bool operator<=(const upoint&) const;
|
|
||||||
bool operator>(const upoint&) const;
|
|
||||||
bool operator>=(const upoint&) const;
|
|
||||||
|
|
||||||
value_type x;
|
|
||||||
value_type y;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct size
|
struct size
|
||||||
{
|
{
|
||||||
using value_type = unsigned;
|
using value_type = unsigned;
|
||||||
size();
|
size();
|
||||||
size(value_type width, value_type height);
|
size(value_type width, value_type height);
|
||||||
size(const rectangle&);
|
|
||||||
|
|
||||||
size& operator=(const rectangle&);
|
|
||||||
|
|
||||||
bool empty() const; ///< true if width * height == 0
|
bool empty() const; ///< true if width * height == 0
|
||||||
bool is_hit(const point&) const; ///< Assume it is a rectangle at (0,0), and check whether a specified position is in the rectange.
|
bool is_hit(const point&) const; ///< Assume it is a rectangle at (0,0), and check whether a specified position is in the rectange.
|
||||||
|
size& shift();
|
||||||
|
|
||||||
bool operator==(const size& rhs) const;
|
bool operator==(const size& rhs) const;
|
||||||
bool operator!=(const size& rhs) const;
|
bool operator!=(const size& rhs) const;
|
||||||
size operator+(const size&) const;
|
size operator+(const size&) const;
|
||||||
@ -419,8 +452,11 @@ namespace nana
|
|||||||
rectangle& operator=(const point&);
|
rectangle& operator=(const point&);
|
||||||
rectangle& operator=(const size&);
|
rectangle& operator=(const size&);
|
||||||
|
|
||||||
rectangle& set_pos(const point&);
|
point position() const noexcept;
|
||||||
rectangle& set_size(const size&);
|
rectangle& position(const point&) noexcept;
|
||||||
|
|
||||||
|
size dimension() const noexcept;
|
||||||
|
rectangle& dimension(const size&) noexcept;
|
||||||
|
|
||||||
rectangle& pare_off(int pixels); ///<Pares the specified pixels off the rectangle. It's equal to x += pixels; y + pixels; width -= (pixels << 1); height -= (pixels << 1);
|
rectangle& pare_off(int pixels); ///<Pares the specified pixels off the rectangle. It's equal to x += pixels; y + pixels; width -= (pixels << 1); height -= (pixels << 1);
|
||||||
|
|
||||||
@ -428,7 +464,8 @@ namespace nana
|
|||||||
int bottom() const;
|
int bottom() const;
|
||||||
bool is_hit(int x, int y) const;
|
bool is_hit(int x, int y) const;
|
||||||
bool is_hit(const point& pos) const;
|
bool is_hit(const point& pos) const;
|
||||||
bool empty() const; ///< true if width * height == 0
|
bool empty() const; ///< true if width * height == 0.
|
||||||
|
rectangle& shift(); ///< Swap position x and y, size width and height.
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|||||||
@ -144,7 +144,7 @@ namespace nana{
|
|||||||
{
|
{
|
||||||
if((focused_wd == wd) && (static_cast<unsigned>(wd->effect.edge_nimbus) & static_cast<unsigned>(effects::edge_nimbus::active)))
|
if((focused_wd == wd) && (static_cast<unsigned>(wd->effect.edge_nimbus) & static_cast<unsigned>(effects::edge_nimbus::active)))
|
||||||
return true;
|
return true;
|
||||||
else if((static_cast<unsigned>(wd->effect.edge_nimbus) & static_cast<unsigned>(effects::edge_nimbus::over)) && (wd->flags.action == mouse_action::over))
|
else if((static_cast<unsigned>(wd->effect.edge_nimbus) & static_cast<unsigned>(effects::edge_nimbus::over)) && (wd->flags.action == mouse_action::hovered))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -528,124 +528,25 @@ namespace nana
|
|||||||
return (px_color().value != other.px_color().value);
|
return (px_color().value != other.px_color().value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
color operator+(const color& x, const color& y)
|
||||||
|
{
|
||||||
|
double a = x.a_ + y.a_;
|
||||||
|
auto r = static_cast<unsigned>(x.r_ + y.r_);
|
||||||
|
auto g = static_cast<unsigned>(x.g_ + y.g_);
|
||||||
|
auto b = static_cast<unsigned>(x.b_ + y.b_);
|
||||||
|
|
||||||
|
return color{
|
||||||
|
r > 255 ? 255 : r,
|
||||||
|
g > 255 ? 255 : g,
|
||||||
|
b > 255 ? 255 : b,
|
||||||
|
a > 1.0 ? 1.0 : a };
|
||||||
|
}
|
||||||
//end class color
|
//end class color
|
||||||
//struct point
|
|
||||||
point::point():x(0), y(0){}
|
|
||||||
point::point(int x, int y):x(x), y(y){}
|
|
||||||
point::point(const rectangle& r)
|
|
||||||
: x(r.x), y(r.y)
|
|
||||||
{}
|
|
||||||
|
|
||||||
point& point::operator=(const rectangle& r)
|
|
||||||
{
|
|
||||||
x = r.x;
|
|
||||||
y = r.y;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool point::operator==(const point& rhs) const
|
|
||||||
{
|
|
||||||
return ((x == rhs.x) && (y == rhs.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool point::operator!=(const point& rhs) const
|
|
||||||
{
|
|
||||||
return ((x != rhs.x) || (y != rhs.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool point::operator<(const point& rhs) const
|
|
||||||
{
|
|
||||||
return ((y < rhs.y) || (y == rhs.y && x < rhs.x));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool point::operator<=(const point& rhs) const
|
|
||||||
{
|
|
||||||
return ((y < rhs.y) || (y == rhs.y && x <= rhs.x));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool point::operator>(const point& rhs) const
|
|
||||||
{
|
|
||||||
return ((y > rhs.y) || (y == rhs.y && x > rhs.x));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool point::operator>=(const point& rhs) const
|
|
||||||
{
|
|
||||||
return ((y > rhs.y) || (y == rhs.y && x >= rhs.x));
|
|
||||||
}
|
|
||||||
|
|
||||||
point point::operator-(const point& rhs) const
|
|
||||||
{
|
|
||||||
return{x - rhs.x, y - rhs.y};
|
|
||||||
}
|
|
||||||
|
|
||||||
point point::operator+(const point& rhs) const
|
|
||||||
{
|
|
||||||
return{ x + rhs.x, y + rhs.y };
|
|
||||||
}
|
|
||||||
|
|
||||||
point& point::operator-=(const point& rhs)
|
|
||||||
{
|
|
||||||
x -= rhs.x;
|
|
||||||
y -= rhs.y;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
point& point::operator+=(const point& rhs)
|
|
||||||
{
|
|
||||||
x += rhs.x;
|
|
||||||
y += rhs.y;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
//end struct point
|
|
||||||
|
|
||||||
//struct upoint
|
|
||||||
upoint::upoint():x(0), y(0){}
|
|
||||||
upoint::upoint(unsigned x, unsigned y):x(x), y(y){}
|
|
||||||
|
|
||||||
bool upoint::operator==(const upoint& rhs) const
|
|
||||||
{
|
|
||||||
return ((x == rhs.x) && (y == rhs.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool upoint::operator!=(const upoint& rhs) const
|
|
||||||
{
|
|
||||||
return ((x != rhs.x) || (y != rhs.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool upoint::operator<(const upoint& rhs) const
|
|
||||||
{
|
|
||||||
return ((y < rhs.y) || (y == rhs.y && x < rhs.x));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool upoint::operator<=(const upoint& rhs) const
|
|
||||||
{
|
|
||||||
return ((y < rhs.y) || (y == rhs.y && x <= rhs.x));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool upoint::operator>(const upoint& rhs) const
|
|
||||||
{
|
|
||||||
return ((y > rhs.y) || (y == rhs.y && x > rhs.x));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool upoint::operator>=(const upoint& rhs) const
|
|
||||||
{
|
|
||||||
return ((y > rhs.y) || (y == rhs.y && x >= rhs.x));
|
|
||||||
}
|
|
||||||
//end struct upoint
|
|
||||||
|
|
||||||
//struct size
|
//struct size
|
||||||
size::size():width(0), height(0){}
|
size::size():width(0), height(0){}
|
||||||
size::size(value_type width, value_type height) : width(width), height(height){}
|
size::size(value_type width, value_type height) : width(width), height(height){}
|
||||||
size::size(const rectangle& r)
|
|
||||||
: width(r.width), height(r.height)
|
|
||||||
{}
|
|
||||||
|
|
||||||
size& size::operator=(const rectangle& r)
|
|
||||||
{
|
|
||||||
width = r.width;
|
|
||||||
height = r.height;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool size::empty() const
|
bool size::empty() const
|
||||||
{
|
{
|
||||||
@ -657,6 +558,12 @@ namespace nana
|
|||||||
return (0 <= pos.x && pos.x < static_cast<int>(width) && 0 <= pos.y && pos.y < static_cast<int>(height));
|
return (0 <= pos.x && pos.x < static_cast<int>(width) && 0 <= pos.y && pos.y < static_cast<int>(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size& size::shift()
|
||||||
|
{
|
||||||
|
std::swap(width, height);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
bool size::operator==(const size& rhs) const
|
bool size::operator==(const size& rhs) const
|
||||||
{
|
{
|
||||||
return (width == rhs.width) && (height == rhs.height);
|
return (width == rhs.width) && (height == rhs.height);
|
||||||
@ -714,19 +621,38 @@ namespace nana
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
rectangle& rectangle::set_pos(const point& pos)
|
point rectangle::position() const
|
||||||
{
|
{
|
||||||
x = pos.x;
|
return{ x, y };
|
||||||
y = pos.y;
|
}
|
||||||
|
|
||||||
|
rectangle& rectangle::position(const point& p)
|
||||||
|
{
|
||||||
|
x = p.x;
|
||||||
|
y = p.y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size rectangle::dimension() const
|
||||||
|
{
|
||||||
|
return{width, height};
|
||||||
|
}
|
||||||
|
|
||||||
|
rectangle& rectangle::dimension(const size& sz)
|
||||||
|
{
|
||||||
|
width = sz.width;
|
||||||
|
height = sz.height;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
rectangle& rectangle::set_size(const size& sz)
|
rectangle& rectangle::set_size(const size& sz)
|
||||||
{
|
{
|
||||||
width = sz.width;
|
width = sz.width;
|
||||||
height = sz.height;
|
height = sz.height;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
rectangle& rectangle::pare_off(int pixels)
|
rectangle& rectangle::pare_off(int pixels)
|
||||||
{
|
{
|
||||||
@ -763,6 +689,13 @@ namespace nana
|
|||||||
{
|
{
|
||||||
return (0 == width) || (0 == height);
|
return (0 == width) || (0 == height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rectangle& rectangle::shift()
|
||||||
|
{
|
||||||
|
std::swap(x, y);
|
||||||
|
std::swap(width, height);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
//end struct rectangle
|
//end struct rectangle
|
||||||
|
|
||||||
//class rectangle_rotator
|
//class rectangle_rotator
|
||||||
|
|||||||
@ -354,8 +354,8 @@ namespace nana
|
|||||||
|
|
||||||
void basic_window::_m_init_pos_and_size(basic_window* parent, const rectangle& r)
|
void basic_window::_m_init_pos_and_size(basic_window* parent, const rectangle& r)
|
||||||
{
|
{
|
||||||
pos_owner = pos_root = r;
|
pos_owner = pos_root = r.position();
|
||||||
dimension = r;
|
dimension = r.dimension();
|
||||||
|
|
||||||
if (parent)
|
if (parent)
|
||||||
pos_root += parent->pos_root;
|
pos_root += parent->pos_root;
|
||||||
|
|||||||
@ -999,7 +999,7 @@ namespace detail
|
|||||||
|
|
||||||
if (msgwnd->dimension.is_hit(arg.pos))
|
if (msgwnd->dimension.is_hit(arg.pos))
|
||||||
{
|
{
|
||||||
msgwnd->set_action(mouse_action::over);
|
msgwnd->set_action(mouse_action::hovered);
|
||||||
if ((::nana::mouse::left_button == arg.button) && (pressed_wd == msgwnd))
|
if ((::nana::mouse::left_button == arg.button) && (pressed_wd == msgwnd))
|
||||||
{
|
{
|
||||||
click_arg.window_handle = reinterpret_cast<window>(msgwnd);
|
click_arg.window_handle = reinterpret_cast<window>(msgwnd);
|
||||||
@ -1065,7 +1065,7 @@ namespace detail
|
|||||||
if (pressed_wd == msgwnd)
|
if (pressed_wd == msgwnd)
|
||||||
msgwnd->set_action(mouse_action::pressed);
|
msgwnd->set_action(mouse_action::pressed);
|
||||||
else if (mouse_action::pressed != msgwnd->flags.action)
|
else if (mouse_action::pressed != msgwnd->flags.action)
|
||||||
msgwnd->set_action(mouse_action::over);
|
msgwnd->set_action(mouse_action::hovered);
|
||||||
}
|
}
|
||||||
arg_mouse arg;
|
arg_mouse arg;
|
||||||
assign_arg(arg, msgwnd, message, pmdec);
|
assign_arg(arg, msgwnd, message, pmdec);
|
||||||
@ -1084,7 +1084,7 @@ namespace detail
|
|||||||
if (pressed_wd == msgwnd)
|
if (pressed_wd == msgwnd)
|
||||||
msgwnd->set_action(mouse_action::pressed);
|
msgwnd->set_action(mouse_action::pressed);
|
||||||
else if (mouse_action::pressed != msgwnd->flags.action)
|
else if (mouse_action::pressed != msgwnd->flags.action)
|
||||||
msgwnd->set_action(mouse_action::over);
|
msgwnd->set_action(mouse_action::hovered);
|
||||||
|
|
||||||
hovered_wd = msgwnd;
|
hovered_wd = msgwnd;
|
||||||
arg.evt_code = event_code::mouse_enter;
|
arg.evt_code = event_code::mouse_enter;
|
||||||
|
|||||||
@ -1300,7 +1300,7 @@ namespace nana
|
|||||||
if (stretch_all_)
|
if (stretch_all_)
|
||||||
{
|
{
|
||||||
if (from_r.width == to_r.width && from_r.height == to_r.height)
|
if (from_r.width == to_r.width && from_r.height == to_r.height)
|
||||||
method_->paste(from_r, dst, to_r);
|
method_->paste(from_r, dst, to_r.position());
|
||||||
else
|
else
|
||||||
method_->stretch(from_r, dst, to_r);
|
method_->stretch(from_r, dst, to_r);
|
||||||
|
|
||||||
@ -1392,7 +1392,7 @@ namespace nana
|
|||||||
if (top_)
|
if (top_)
|
||||||
{
|
{
|
||||||
src_r.height = top_;
|
src_r.height = top_;
|
||||||
method_->paste(src_r, dst, to_r);
|
method_->paste(src_r, dst, to_r.position());
|
||||||
}
|
}
|
||||||
if (bottom_)
|
if (bottom_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -135,7 +135,7 @@ namespace nana
|
|||||||
if (!x_pointed_)
|
if (!x_pointed_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
x_state_ = ::nana::mouse_action::over;
|
x_state_ = ::nana::mouse_action::hovered;
|
||||||
refresh(graph);
|
refresh(graph);
|
||||||
API::dev::lazy_refresh();
|
API::dev::lazy_refresh();
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ namespace nana
|
|||||||
}
|
}
|
||||||
|
|
||||||
panels_.emplace_back();
|
panels_.emplace_back();
|
||||||
widget * w=wdg.get();
|
auto wdg = wdg.get();
|
||||||
panels_.back().widget_ptr.swap(wdg);
|
panels_.back().widget_ptr.swap(wdg);
|
||||||
|
|
||||||
for (auto & pn : panels_)
|
for (auto & pn : panels_)
|
||||||
@ -395,7 +395,7 @@ namespace nana
|
|||||||
if (pn.widget_ptr)
|
if (pn.widget_ptr)
|
||||||
pn.widget_ptr->move(r);
|
pn.widget_ptr->move(r);
|
||||||
}
|
}
|
||||||
return w;
|
return wdg;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1358,7 +1358,7 @@ namespace API
|
|||||||
{
|
{
|
||||||
case nana::mouse_action::normal:
|
case nana::mouse_action::normal:
|
||||||
return (is_focused ? nana::element_state::focus_normal : nana::element_state::normal);
|
return (is_focused ? nana::element_state::focus_normal : nana::element_state::normal);
|
||||||
case nana::mouse_action::over:
|
case nana::mouse_action::hovered:
|
||||||
return (is_focused ? nana::element_state::focus_hovered : nana::element_state::hovered);
|
return (is_focused ? nana::element_state::focus_hovered : nana::element_state::hovered);
|
||||||
case nana::mouse_action::pressed:
|
case nana::mouse_action::pressed:
|
||||||
return nana::element_state::pressed;
|
return nana::element_state::pressed;
|
||||||
|
|||||||
@ -89,7 +89,7 @@ namespace nana
|
|||||||
|
|
||||||
if(ui_el_.what == ui_el_.item_root)
|
if(ui_el_.what == ui_el_.item_root)
|
||||||
{
|
{
|
||||||
_m_item_bground(graph, r.x + 1, r.y, r.width - 2, r.height, (state == mouse_action::pressed ? mouse_action::pressed : mouse_action::over));
|
_m_item_bground(graph, r.x + 1, r.y, r.width - 2, r.height, (state == mouse_action::pressed ? mouse_action::pressed : mouse_action::hovered));
|
||||||
graph.rectangle(r, false, static_cast<color_rgb>(0x3C7FB1));
|
graph.rectangle(r, false, static_cast<color_rgb>(0x3C7FB1));
|
||||||
if(state == mouse_action::pressed)
|
if(state == mouse_action::pressed)
|
||||||
{
|
{
|
||||||
@ -114,8 +114,8 @@ namespace nana
|
|||||||
mouse_action state_arrow, state_name;
|
mouse_action state_arrow, state_name;
|
||||||
if(mouse_action::pressed != state)
|
if(mouse_action::pressed != state)
|
||||||
{
|
{
|
||||||
state_arrow = (ui_el_.what == ui_el_.item_arrow ? mouse_action::over : mouse_action::normal);
|
state_arrow = (ui_el_.what == ui_el_.item_arrow ? mouse_action::hovered : mouse_action::normal);
|
||||||
state_name = (ui_el_.what == ui_el_.item_name ? mouse_action::over : mouse_action::normal);
|
state_name = (ui_el_.what == ui_el_.item_name ? mouse_action::hovered : mouse_action::normal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -170,7 +170,7 @@ namespace nana
|
|||||||
nana::color clr_top(static_cast<color_rgb>(0xEAEAEA)), clr_bottom(static_cast<color_rgb>(0xDCDCDC));
|
nana::color clr_top(static_cast<color_rgb>(0xEAEAEA)), clr_bottom(static_cast<color_rgb>(0xDCDCDC));
|
||||||
switch(state)
|
switch(state)
|
||||||
{
|
{
|
||||||
case mouse_action::over:
|
case mouse_action::hovered:
|
||||||
clr_top.from_rgb(0xdf, 0xf2, 0xfc);
|
clr_top.from_rgb(0xdf, 0xf2, 0xfc);
|
||||||
clr_bottom.from_rgb(0xa9, 0xda, 0xf5);
|
clr_bottom.from_rgb(0xa9, 0xda, 0xf5);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1270,7 +1270,7 @@ namespace nana
|
|||||||
if(size.width > attr.area.width || size.height > attr.area.height)
|
if(size.width > attr.area.width || size.height > attr.area.height)
|
||||||
{
|
{
|
||||||
nana::size fit_size;
|
nana::size fit_size;
|
||||||
nana::fit_zoom(size, attr.area, fit_size);
|
nana::fit_zoom(size, attr.area.dimension(), fit_size);
|
||||||
|
|
||||||
attr.area.x += (attr.area.width - fit_size.width) / 2;
|
attr.area.x += (attr.area.width - fit_size.width) / 2;
|
||||||
attr.area.y += (attr.area.height - fit_size.height) / 2;
|
attr.area.y += (attr.area.height - fit_size.height) / 2;
|
||||||
@ -1444,6 +1444,7 @@ namespace nana
|
|||||||
attr.area = node_r_;
|
attr.area = node_r_;
|
||||||
if (impl_->data.comp_placer->locate(comp, node_attr_, &attr.area))
|
if (impl_->data.comp_placer->locate(comp, node_attr_, &attr.area))
|
||||||
{
|
{
|
||||||
|
attr.mouse_pointed = node_attr_.mouse_pointed;
|
||||||
attr.area.x += pos_.x;
|
attr.area.x += pos_.x;
|
||||||
attr.area.y += pos_.y;
|
attr.area.y += pos_.y;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user