CtrlLib: Splitter can now have any width

git-svn-id: svn://ultimatepp.org/upp/trunk@2965 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
unodgs 2011-01-06 23:55:13 +00:00
parent 95cb3db698
commit d080b7efc1
2 changed files with 8 additions and 4 deletions

View file

@ -51,11 +51,14 @@ void Splitter::Layout() {
}
return;
}
int wd = width >> 1;
int lw = width >> 1;
int rw = width - lw;
int i = 0;
for(Ctrl *q = GetFirstChild(); q; q = q->GetNext()) {
int lo = i > 0 ? PosToClient(pos[i - 1]) + wd : 0;
int hi = i < count ? PosToClient(pos[i]) - wd : vert ? sz.cy : sz.cx;
int lo = i > 0 ? PosToClient(pos[i - 1]) + rw : 0;
int hi = i < count ? PosToClient(pos[i]) - lw : vert ? sz.cy : sz.cx;
q->Show();
if(vert)
q->SetRect(0, lo, sz.cx, hi - lo);
@ -100,7 +103,7 @@ int Splitter::FindIndex(Point client) const {
int maxdist = width;
for(int i = 0; i < pos.GetCount(); i++) {
int dist = abs((vert ? client.y : client.x) - PosToClient(pos[i]));
if(dist < maxdist) {
if(dist <= maxdist) {
best = i;
maxdist = abs(dist);
}

View file

@ -11,6 +11,7 @@ public:
public:
struct Style : ChStyle<Style> {
Value vert[2], horz[2];
int width;
};
protected: