mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-02 19:47:36 +01:00
lazcontrols: added TShortPathEdit
git-svn-id: trunk@37570 -
This commit is contained in:
parent
80ee800f90
commit
a322f2534d
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1464,6 +1464,8 @@ components/lazcontrols/lazcontrols.lpk svneol=native#text/xml
|
||||
components/lazcontrols/lazcontrols.pas svneol=native#text/pascal
|
||||
components/lazcontrols/listfilteredit.pas svneol=native#text/plain
|
||||
components/lazcontrols/listfilteredit_icon.lrs svneol=native#text/plain
|
||||
components/lazcontrols/shortpathedit.pas svneol=native#text/plain
|
||||
components/lazcontrols/shortpathedit_icon.lrs svneol=native#text/plain
|
||||
components/lazcontrols/treefilteredit.pas svneol=native#text/plain
|
||||
components/lazcontrols/treefilteredit_icon.lrs svneol=native#text/plain
|
||||
components/lazreport/doc/contributors.txt svneol=native#text/plain
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<Description Value="Some extra LCL controls needed by the IDE."/>
|
||||
<License Value="modified LGPL-2"/>
|
||||
<Version Major="1" Release="1"/>
|
||||
<Files Count="4">
|
||||
<Files Count="5">
|
||||
<Item1>
|
||||
<Filename Value="dividerbevel.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
@ -40,6 +40,11 @@
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="TreeFilterEdit"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Filename Value="shortpathedit.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="shortpathedit"/>
|
||||
</Item5>
|
||||
</Files>
|
||||
<LazDoc Paths="docs"/>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
|
||||
@ -2,24 +2,25 @@
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit LazControls;
|
||||
unit LazControls;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
DividerBevel, ExtendedNotebook, ListFilterEdit, TreeFilterEdit,
|
||||
LazarusPackageIntf;
|
||||
shortpathedit, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('DividerBevel', @DividerBevel.Register);
|
||||
RegisterUnit('ExtendedNotebook', @ExtendedNotebook.Register);
|
||||
RegisterUnit('ListFilterEdit', @ListFilterEdit.Register);
|
||||
RegisterUnit('TreeFilterEdit', @TreeFilterEdit.Register);
|
||||
end;
|
||||
RegisterUnit('DividerBevel', @DividerBevel.Register);
|
||||
RegisterUnit('ExtendedNotebook', @ExtendedNotebook.Register);
|
||||
RegisterUnit('ListFilterEdit', @ListFilterEdit.Register);
|
||||
RegisterUnit('TreeFilterEdit', @TreeFilterEdit.Register);
|
||||
RegisterUnit('shortpathedit', @shortpathedit.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('LazControls', @Register);
|
||||
RegisterPackage('LazControls', @Register);
|
||||
end.
|
||||
|
||||
79
components/lazcontrols/shortpathedit.pas
Normal file
79
components/lazcontrols/shortpathedit.pas
Normal file
@ -0,0 +1,79 @@
|
||||
unit shortpathedit;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, EditBtn, LResources, Dialogs, FileUtil;
|
||||
|
||||
Type
|
||||
TShortPathEdit = class(TDirectoryEdit)
|
||||
private
|
||||
FDirectory : String;
|
||||
FOnAcceptDir: TAcceptFileNameEvent;
|
||||
protected
|
||||
function CreateDialog: TCommonDialog; override;
|
||||
procedure RunDialog; override;
|
||||
published
|
||||
property Directory: String read FDirectory write FDirectory;
|
||||
property OnAcceptDirectory: TAcceptFileNameEvent read FOnAcceptDir write FonAcceptDir;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
function TShortPathEdit.CreateDialog: TCommonDialog;
|
||||
begin
|
||||
Result:=TSelectDirectoryDialog.Create(Self);
|
||||
if DirPathExists(Directory) then
|
||||
begin
|
||||
TSelectDirectoryDialog(Result).InitialDir:=Directory;
|
||||
TSelectDirectoryDialog(Result).FileName:='';
|
||||
end
|
||||
else
|
||||
begin
|
||||
TSelectDirectoryDialog(Result).InitialDir:=RootDir;
|
||||
TSelectDirectoryDialog(Result).FileName:=Directory;
|
||||
end;
|
||||
// Set some common things.
|
||||
Result.Title := DialogTitle;
|
||||
end;
|
||||
|
||||
procedure TShortPathEdit.RunDialog;
|
||||
var
|
||||
D: String;
|
||||
Dlg: TCommonDialog;
|
||||
B: Boolean;
|
||||
begin
|
||||
Dlg:=CreateDialog;
|
||||
try
|
||||
B:=Dlg.Execute;
|
||||
if B then
|
||||
D:=GetDialogResult(Dlg);
|
||||
finally
|
||||
Dlg.Free;
|
||||
end;
|
||||
if B then
|
||||
begin
|
||||
if Assigned(FOnAcceptDir) then
|
||||
begin
|
||||
FOnAcceptdir(Self,D);
|
||||
if (D<>'') then
|
||||
Directory:=D;
|
||||
end
|
||||
else
|
||||
Directory:=D;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
{$I shortpathedit_icon.lrs}
|
||||
RegisterComponents('LazControls',[TShortPathEdit]);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
35
components/lazcontrols/shortpathedit_icon.lrs
Normal file
35
components/lazcontrols/shortpathedit_icon.lrs
Normal file
@ -0,0 +1,35 @@
|
||||
LazarusResources.Add('TShortPathEdit','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#1'sRGB'#0#174#206#28#233#0#0#0#6'bKGD'#0#0#0#0#0#0#249'C'#187#127#0#0#0
|
||||
+#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#7'tIME'#7#219#6#28#11'8'#0
|
||||
+':h'#8#209#0#0#2#151'IDATH'#199#189#149#205'O'#19'A'#24#198#127#211#150'm'#3
|
||||
+'i'#26#17#141#30'P'#211#131#136#17#13#136'&'#4#2'acj'#224#194#31'`'#140#28
|
||||
+#140#137#7#19#19#15#212#255#160#18#140'&'#156'='#168#193#179'FS'#18#162'X>'
|
||||
+#12#23#229'3R'#163#166#225'C'#129#131#17#203'R'#211#150'v'#199'Cwki'#23'(*>'
|
||||
+#151#217#157#153#247'y'#222'y?f'#132#174#235#8'!'#216'+'#8')%{'#9#7#128#223
|
||||
+#223#251#207'T'#2#129#27#162'@ #r'#233#15#200#250'6'#217'MM'#207#226#247#247
|
||||
+#202'\'#17'G'#174#129#170#250#138'&'#31#28#28#200'~WTT'#144#214'%'#161#208#8
|
||||
+#0'C'#195#163#178#165#185'I'#20#8#228#26#237#6']]'#183#241'x<['#231#224'o05='
|
||||
+#139#239'b'#219#246'I'#190'za'#138'h'#248#219#174#201'/'#159#127#207#227'`'
|
||||
+#17'U'#180#17'['#162#242'H'#29'8VA'#249#2#202'"('#243'`['#1#214'H'#199'!'#165
|
||||
+#185#216#248#225'&'#165#185'I'#199#202'H'''#156#172'/h'#180#181#223#20#128#11
|
||||
+'8'#4#184#250#131#19#165#192#167#130#16'E'#194'/'#240#214'4'#2#224't'#219'A'
|
||||
+#1#236') IZ'#1';6'#236#233#20#235#154#4#1'K'#11#26#0'gN'#159'<'#0'D'#129'y'
|
||||
+#128#254#224#132#4#236'&'#175#13#160#186'#('#0'"3o'#0'Hh)'#176'h'#238#184#150
|
||||
+#241'g'#241'c'#18#128#235#143#20#161#170#190#152#170#250#146'l'#182#208#11'N'
|
||||
+'P'#221#17#20#225'g'#237'2'#242'n'#30'o'#131' '#17#5#231#190#223#22#9'M'#1'`'
|
||||
+'nR'#1#24#175#234#12#157#29#236#196#1#252'4'#29#5'd'#222#152']`'#211'I'#198
|
||||
+'2'#235#137'5'#135'1f'#200'?'#143#148#3'P'#213#25'j4<'#214'sF'#189#168'2}8'
|
||||
+#214'&'#174'4'#244#203#200'p%'#222#214#149',y'#248#249'Q'#0'b'#167#238#213
|
||||
+#143#191#157#136#231'{'#154#7#155')h'#213#7''''#150#203'n'#137#195#177#187'2'
|
||||
+#242#250#28#222#214'W'#204'<'#169#202#198#28#186','#175#222#158#238';'#185
|
||||
+#191'r'#187'F'#251#0#148#154'"'#153#237#146'X'#205'}'#209#211'M'#9#144#178
|
||||
+#176'q'#3#235'9'#196'N '#190'e'''#215#213#215#30#4#230#230#158'F'#205#169#241
|
||||
+#186#250'Z'#167'A'#158#31#22'/'#240#213#156#31'x9'#139'I^'#144#228#28#28#203
|
||||
+#215'4'#200#173#18#25#1#18#219'v'#178#5#153#150'?'#169#170'>'#177#195#237'*'
|
||||
+#172#146'n%0'#9#148#3'$V'#215#152'|p'#220'$P'#140#154'7'#161#0'I'#171#196#238
|
||||
+'$'#160#7#2'}'#223'3'#159#215'\FX<'#4#250#242#247#165#141#30#144#187'~'#147
|
||||
+#135#134'G'#205#170'p'#26#241#221#15#148#0#203#197#190#245'-'#205'M'#242#191
|
||||
+'<'#250'6'#246#24#191#0#136#230#242'w'#134#223#12'V'#0#0#0#0'IEND'#174'B`'
|
||||
+#130
|
||||
]);
|
||||
Loading…
Reference in New Issue
Block a user