Implemented column resize

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@97 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2007-02-27 13:32:54 +00:00
parent 94edd76efc
commit aaa1e2cc6a

View File

@@ -10608,15 +10608,18 @@ begin
FColumns[I].ParentBiDiModeChanged; FColumns[I].ParentBiDiModeChanged;
LM_MBUTTONDOWN: LM_MBUTTONDOWN:
begin begin
//lclheader: NCMessages are given in screen coordinates unlike the ordinary
with TLMMButtonDown(Message) do with TLMMButtonDown(Message) do
P := Treeview.ScreenToClient(Point(XPos, YPos)); P:= Point(XPos, YPos);
//P := Treeview.ScreenToClient(Point(XPos, YPos));
if InHeader(P) then if InHeader(P) then
FOwner.DoHeaderMouseDown(mbMiddle, GetShiftState, P.X, P.Y + Integer(FHeight)); FOwner.DoHeaderMouseDown(mbMiddle, GetShiftState, P.X, P.Y + Integer(FHeight));
end; end;
LM_MBUTTONUP: LM_MBUTTONUP:
begin begin
with TLMMButtonUp(Message) do with TLMMButtonUp(Message) do
P := FOwner.ScreenToClient(Point(XPos, YPos)); P:= Point(XPos, YPos);
//P := FOwner.ScreenToClient(Point(XPos, YPos));
if InHeader(P) then if InHeader(P) then
begin begin
FColumns.HandleClick(P, mbMiddle, True, False); FColumns.HandleClick(P, mbMiddle, True, False);
@@ -10629,7 +10632,8 @@ begin
LM_RBUTTONDBLCLK: LM_RBUTTONDBLCLK:
begin begin
with TLMLButtonDblClk(Message) do with TLMLButtonDblClk(Message) do
P := FOwner.ScreenToClient(Point(XPos, YPos)); P:= Point(XPos, YPos);
//P := FOwner.ScreenToClient(Point(XPos, YPos));
// If the click was on a splitter then resize column do smallest width. // If the click was on a splitter then resize column do smallest width.
if InHeader(P) then if InHeader(P) then
begin begin
@@ -10668,8 +10672,10 @@ begin
with TLMLButtonDown(Message) do with TLMLButtonDown(Message) do
begin begin
// want the drag start point in screen coordinates // want the drag start point in screen coordinates
FDragStart := Point(XPos, YPos); P:= Point(XPos, YPos);
P := Treeview.ScreenToClient(FDragStart); FDragStart:=Treeview.ClientToScreen(P);
//FDragStart := Point(XPos, YPos);
//P := Treeview.ScreenToClient(FDragStart);
end; end;
if InHeader(P) then if InHeader(P) then
@@ -10704,7 +10710,8 @@ begin
LM_RBUTTONDOWN: LM_RBUTTONDOWN:
begin begin
with TLMRButtonDown(Message) do with TLMRButtonDown(Message) do
P := FOwner.ScreenToClient(Point(XPos, YPos)); P:=Point(XPos,YPos);
//P := FOwner.ScreenToClient(Point(XPos, YPos));
if InHeader(P) then if InHeader(P) then
FOwner.DoHeaderMouseDown(mbRight, GetShiftState, P.X, P.Y + Integer(FHeight)); FOwner.DoHeaderMouseDown(mbRight, GetShiftState, P.X, P.Y + Integer(FHeight));
end; end;
@@ -10714,7 +10721,8 @@ begin
begin begin
Application.CancelHint; Application.CancelHint;
P := FOwner.ScreenToClient(Point(XPos, YPos)); P:=Point(XPos,YPos);
//P := FOwner.ScreenToClient(Point(XPos, YPos));
if InHeader(P) then if InHeader(P) then
begin begin
FColumns.HandleClick(P, mbRight, True, False); FColumns.HandleClick(P, mbRight, True, False);
@@ -10816,10 +10824,14 @@ begin
end; end;
// hovering, mouse leave detection // hovering, mouse leave detection
//todo: see the difference to below //todo: see the difference to below
{LM_NCMOUSEMOVE: LM_MOUSEMOVE:
with TLMMouseMove(Message), FColumns do with TLMMouseMove(Message), FColumns do
begin begin
P := Treeview.ScreenToClient(Point(XPos, YPos)); //lcl
HandleMessage := HandleHeaderMouseMove(TLMMouseMove(Message));
P:=Point(XPos,YPos);
//P := Treeview.ScreenToClient(Point(XPos, YPos));
Treeview.DoHeaderMouseMove(GetShiftState, P.X, P.Y + Integer(FHeight)); Treeview.DoHeaderMouseMove(GetShiftState, P.X, P.Y + Integer(FHeight));
if InHeader(P) and ((AdjustHoverColumn(P)) or ((FDownIndex >= 0) and (FHoverIndex <> FDownIndex))) then if InHeader(P) and ((AdjustHoverColumn(P)) or ((FDownIndex >= 0) and (FHoverIndex <> FDownIndex))) then
begin begin
@@ -10839,7 +10851,7 @@ begin
end; end;
end end
end; end;
}
LM_TIMER:; LM_TIMER:;
//todo: add timer //todo: add timer
{ {
@@ -10863,8 +10875,11 @@ begin
end; end;
end; end;
} }
//todo
{
LM_MOUSEMOVE: // mouse capture and general message redirection LM_MOUSEMOVE: // mouse capture and general message redirection
Result := HandleHeaderMouseMove(TLMMouseMove(Message)); Result := HandleHeaderMouseMove(TLMMouseMove(Message));
}
LM_SETCURSOR: LM_SETCURSOR:
if FStates = [] then if FStates = [] then
begin begin
@@ -10884,7 +10899,7 @@ begin
Result := NewCursor <> Screen.Cursors[crDefault]; Result := NewCursor <> Screen.Cursors[crDefault];
if Result then if Result then
begin begin
Windows.SetCursor(NewCursor); LclIntf.SetCursor(NewCursor);
Message.Result := 1; Message.Result := 1;
end end
end; end;
@@ -11195,6 +11210,9 @@ var
R, RW: TRect; R, RW: TRect;
begin begin
//lclheader
Result := PtInRect(TreeView.FHeaderRect,P);
{
R := Treeview.FHeaderRect; R := Treeview.FHeaderRect;
// Current position of the owner in screen coordinates. // Current position of the owner in screen coordinates.
@@ -11206,6 +11224,7 @@ begin
// Consider the header within this rectangle. // Consider the header within this rectangle.
OffsetRect(R, RW.Left, RW.Top); OffsetRect(R, RW.Left, RW.Top);
Result := PtInRect(R, P); Result := PtInRect(R, P);
}
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@@ -17058,9 +17077,15 @@ var
begin begin
Logger.EnterMethod([lcSetCursor],'WMSetCursor'); Logger.EnterMethod([lcSetCursor],'WMSetCursor');
{ {
lcl
wParam: Handle to the window that contains the cursor.
lParam:
The low-order word of lParam specifies the hit-test code.
The high-order word of lParam specifies the identifier of the mouse message
}
with Message do with Message do
begin begin
if (CursorWnd = Handle) and not (csDesigning in ComponentState) and if (wParam = Handle) and not (csDesigning in ComponentState) and
([tsWheelPanning, tsWheelScrolling] * FStates = []) then ([tsWheelPanning, tsWheelScrolling] * FStates = []) then
begin begin
if not FHeader.HandleMessage(TLMessage(Message)) then if not FHeader.HandleMessage(TLMessage(Message)) then
@@ -17074,17 +17099,18 @@ begin
NewCursor := Cursor; NewCursor := Cursor;
DoGetCursor(NewCursor); DoGetCursor(NewCursor);
LCLIntf.SetCursor(Screen.Cursors[NewCursor]); Windows.SetCursor(Screen.Cursors[NewCursor]);
Message.Result := 1; Message.Result := 1;
end end;
else //lcl does not have WMSetCursor
inherited WMSetCursor(Message); //else
// inherited WMSetCursor(Message);
end; end;
end end;
else //else
inherited WMSetCursor(Message); // inherited WMSetCursor(Message);
end; end;
}
Logger.ExitMethod([lcSetCursor],'WMSetCursor'); Logger.ExitMethod([lcSetCursor],'WMSetCursor');
end; end;
@@ -18628,6 +18654,9 @@ begin
begin begin
// Invalidate client area from the current column all to the right (or left in RTL mode). // Invalidate client area from the current column all to the right (or left in RTL mode).
R := ClientRect; R := ClientRect;
//lclheader
if hoVisible in FHeader.FOptions then
Inc(R.Bottom,FHeader.Height);
if not (toAutoSpanColumns in FOptions.FAutoOptions) then if not (toAutoSpanColumns in FOptions.FAutoOptions) then
if UseRightToLeftAlignment then if UseRightToLeftAlignment then
R.Right := FHeader.Columns[Column].Left + FHeader.Columns[Column].Width + ComputeRTLOffset R.Right := FHeader.Columns[Column].Left + FHeader.Columns[Column].Width + ComputeRTLOffset