1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-12 04:15:07 -05:00
Simba/Projects/SAMufasaGUI/framefunctionlist.pas
Raymond 8f88d8a0ab Made the function list functional! :-)
Extra -> Fill Function List

And the dragging w0rks.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@331 3f818213-9676-44b0-a9b4-5e4c4e03d09d
2009-12-24 16:21:31 +00:00

108 lines
2.7 KiB
ObjectPascal

unit framefunctionlist;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, ComCtrls, StdCtrls, Controls;
type
{ TFunctionListFrame }
TFunctionListFrame = class(TFrame)
editSearchList: TEdit;
FunctionList: TTreeView;
procedure editSearchListChange(Sender: TObject);
procedure editSearchListExit(Sender: TObject);
procedure FunctionListMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FunctionListMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DockFormOnClose(Sender: TObject; var CloseAction: TCloseAction);
private
{ private declarations }
public
DraggingNode : TTreeNode;
{ public declarations }
end;
implementation
uses
TestUnit, Graphics;
{ TFunctionListFrame }
procedure TFunctionListFrame.editSearchListChange(Sender: TObject);
var
I: Integer;
begin
if(editSearchList.Text = '')then
begin
editSearchList.Color := clWhite;
exit;
end;
for I := 0 to FunctionList.Items.Count do //WTF LOOPS FAIL. for I := 1 to 3 do ;; would make I 4 after a successful, non-brakeing run :<
begin
if(I = FunctionList.Items.Count)then break;
if(pos(lowercase(editSearchList.Text), lowercase(FunctionList.Items[I].Text)) > 0)then
break;
end;
if(I = FunctionList.Items.Count)then
editSearchList.Color := 6711039
else
editSearchList.Color := clWhite;
end;
procedure TFunctionListFrame.editSearchListExit(Sender: TObject);
begin
editSearchList.Color := clWhite;
end;
procedure TFunctionListFrame.DockFormOnClose(Sender: TObject; var CloseAction: TCloseAction);
begin
CloseAction := caHide;
Form1.MenuItemFunctionList.Checked := False;
end;
procedure TFunctionListFrame.FunctionListMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
N: TTreeNode;
begin
N := Self.FunctionList.GetNodeAt(x, y);
if(N = nil)then
begin
Self.DragKind := dkDock;
Self.BeginDrag(false, 40);
exit;
end;
Self.DragKind := dkDrag;
if(Button = mbLeft) and (N.Level > 0)then
Self.BeginDrag(False, 10);
DraggingNode := N;
end;
procedure TFunctionListFrame.FunctionListMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
F: ^TCustomDockForm;
begin
if(Self.Parent is TCustomDockForm)then
begin
F := @Self.Parent; //can't typecast parent as a TCustomDockForm
F^.Caption := 'Function List';
F^.BorderStyle := bsSizeable;
F^.OnClose := @DockFormOnClose;
Form1.Splitter1.Hide;
end;
end;
initialization
{$I framefunctionlist.lrs}
end.