the dockpane splitbar is done
This commit is contained in:
parent
b453529366
commit
65a876cc74
@ -1794,9 +1794,15 @@ namespace nana
|
|||||||
int delta = (_m_is_vert(dir_) ? now_pos.y : now_pos.x) - base_pos_.x;
|
int delta = (_m_is_vert(dir_) ? now_pos.y : now_pos.x) - base_pos_.x;
|
||||||
int new_pos = base_pos_.y + delta;
|
int new_pos = base_pos_.y + delta;
|
||||||
if (new_pos < range_.x)
|
if (new_pos < range_.x)
|
||||||
|
{
|
||||||
new_pos = range_.x;
|
new_pos = range_.x;
|
||||||
|
delta = new_pos - base_pos_.y;
|
||||||
|
}
|
||||||
else if (new_pos >= range_.y)
|
else if (new_pos >= range_.y)
|
||||||
|
{
|
||||||
new_pos = range_.y - 1;
|
new_pos = range_.y - 1;
|
||||||
|
delta = new_pos - base_pos_.y;
|
||||||
|
}
|
||||||
|
|
||||||
now_pos = this->pos();
|
now_pos = this->pos();
|
||||||
if (_m_is_vert(dir_))
|
if (_m_is_vert(dir_))
|
||||||
@ -1922,24 +1928,32 @@ namespace nana
|
|||||||
auto child_dv = dynamic_cast<div_dockpane*>(child.get());
|
auto child_dv = dynamic_cast<div_dockpane*>(child.get());
|
||||||
const bool is_vert = _m_is_vert(child->dir);
|
const bool is_vert = _m_is_vert(child->dir);
|
||||||
|
|
||||||
double weight;
|
auto room_px = (is_vert ? room.height : room.width);
|
||||||
if (child->weight.is_none())
|
|
||||||
weight = (is_vert ? (room.height / double(vert_count)) : (room.width / double(horz_count)));
|
|
||||||
else
|
|
||||||
weight = child->weight.get_value(is_vert ? area.height : area.width);
|
|
||||||
|
|
||||||
auto div_next = _m_right(child_dv);
|
double weight;
|
||||||
|
if (child->weight.is_not_none())
|
||||||
|
{
|
||||||
|
weight = child->weight.get_value(is_vert ? area.height : area.width);
|
||||||
|
if (weight > room_px)
|
||||||
|
weight = room_px;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
weight = room_px / double(is_vert ? vert_count : horz_count);
|
||||||
|
|
||||||
|
splitter* split = nullptr;
|
||||||
|
if (_m_right(child_dv))
|
||||||
|
{
|
||||||
|
//Creates a splitbar if the 'right' leaf is not empty
|
||||||
|
|
||||||
auto & splitter_ptr = swp_splitters[child_dv];
|
auto & splitter_ptr = swp_splitters[child_dv];
|
||||||
|
|
||||||
auto si = splitters_.find(child_dv);
|
auto si = splitters_.find(child_dv);
|
||||||
if (si == splitters_.end())
|
if (si == splitters_.end())
|
||||||
{
|
|
||||||
splitter_ptr.reset(new splitter(impl_->window_handle, child->dir, this, child_dv));
|
splitter_ptr.reset(new splitter(impl_->window_handle, child->dir, this, child_dv));
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
splitter_ptr.swap(si->second);
|
splitter_ptr.swap(si->second);
|
||||||
|
|
||||||
|
split = splitter_ptr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
::nana::rectangle child_r;
|
::nana::rectangle child_r;
|
||||||
@ -1952,10 +1966,10 @@ namespace nana
|
|||||||
child_r.width = static_cast<unsigned>(weight);
|
child_r.width = static_cast<unsigned>(weight);
|
||||||
child_r.height = static_cast<unsigned>(bottom - top);
|
child_r.height = static_cast<unsigned>(bottom - top);
|
||||||
left += weight;
|
left += weight;
|
||||||
if (div_next)
|
if (split)
|
||||||
{
|
{
|
||||||
splitter_ptr->move(rectangle{child_r.right(), child_r.y, splitter_px, child_r.height});
|
split->move(rectangle{ child_r.right(), child_r.y, splitter_px, child_r.height });
|
||||||
splitter_ptr->range(left - weight, right - static_cast<int>(splitter_px));
|
split->range(left - weight, right - static_cast<int>(splitter_px));
|
||||||
left += splitter_px;
|
left += splitter_px;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1965,10 +1979,10 @@ namespace nana
|
|||||||
child_r.y = static_cast<int>(top);
|
child_r.y = static_cast<int>(top);
|
||||||
child_r.width = static_cast<unsigned>(weight);
|
child_r.width = static_cast<unsigned>(weight);
|
||||||
child_r.height = static_cast<unsigned>(bottom - top);
|
child_r.height = static_cast<unsigned>(bottom - top);
|
||||||
if (div_next)
|
if (split)
|
||||||
{
|
{
|
||||||
splitter_ptr->move(rectangle{ child_r.x - static_cast<int>(splitter_px), child_r.y, splitter_px, child_r.height });
|
split->move(rectangle{ child_r.x - static_cast<int>(splitter_px), child_r.y, splitter_px, child_r.height });
|
||||||
splitter_ptr->range(left, right - static_cast<int>(splitter_px) + weight);
|
split->range(left, right - static_cast<int>(splitter_px)+weight);
|
||||||
right -= splitter_px;
|
right -= splitter_px;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1978,10 +1992,10 @@ namespace nana
|
|||||||
child_r.width = static_cast<unsigned>(right - left);
|
child_r.width = static_cast<unsigned>(right - left);
|
||||||
child_r.height = static_cast<unsigned>(weight);
|
child_r.height = static_cast<unsigned>(weight);
|
||||||
top += weight;
|
top += weight;
|
||||||
if (div_next)
|
if (split)
|
||||||
{
|
{
|
||||||
splitter_ptr->move(rectangle{ child_r.x, child_r.bottom(), child_r.width, splitter_px });
|
split->move(rectangle{ child_r.x, child_r.bottom(), child_r.width, splitter_px });
|
||||||
splitter_ptr->range(top - weight, bottom - static_cast<int>(splitter_px));
|
split->range(top - weight, bottom - static_cast<int>(splitter_px));
|
||||||
top += splitter_px;
|
top += splitter_px;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1991,11 +2005,11 @@ namespace nana
|
|||||||
child_r.y = static_cast<int>(bottom);
|
child_r.y = static_cast<int>(bottom);
|
||||||
child_r.width = static_cast<unsigned>(right - left);
|
child_r.width = static_cast<unsigned>(right - left);
|
||||||
child_r.height = static_cast<unsigned>(weight);
|
child_r.height = static_cast<unsigned>(weight);
|
||||||
if (div_next)
|
if (split)
|
||||||
{
|
{
|
||||||
bottom -= splitter_px;
|
bottom -= splitter_px;
|
||||||
splitter_ptr->move(rectangle{ child_r.x, child_r.y - static_cast<int>(splitter_px), child_r.width, splitter_px });
|
split->move(rectangle{ child_r.x, child_r.y - static_cast<int>(splitter_px), child_r.width, splitter_px });
|
||||||
splitter_ptr->range(top, bottom + weight);
|
split->range(top, bottom + weight);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user