mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
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:
parent
95cb3db698
commit
d080b7efc1
2 changed files with 8 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ public:
|
|||
public:
|
||||
struct Style : ChStyle<Style> {
|
||||
Value vert[2], horz[2];
|
||||
int width;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue