mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-26 19:09:36 +02:00
Further work on wince standard dialogs
git-svn-id: trunk@20011 -
This commit is contained in:
parent
f977ee640b
commit
531e682b04
4
.gitattributes
vendored
4
.gitattributes
vendored
@ -3620,6 +3620,9 @@ lcl/images/lcl_dbnav_images.bat svneol=native#text/plain
|
||||
lcl/images/lcl_dbnav_images_list.txt svneol=native#text/plain
|
||||
lcl/images/lcl_edbtnimg.bat svneol=native#text/plain
|
||||
lcl/images/lcl_edbtnimg_list.txt svneol=native#text/plain
|
||||
lcl/images/wince/build.bat svneol=native#text/plain
|
||||
lcl/images/wince/wincedialog_cancel.png -text
|
||||
lcl/images/wince/wincedialog_ok.PNG -text
|
||||
lcl/imglist.pp svneol=native#text/pascal
|
||||
lcl/include/actionlink.inc svneol=native#text/pascal
|
||||
lcl/include/application.inc svneol=native#text/pascal
|
||||
@ -4089,6 +4092,7 @@ lcl/interfaces/wince/interfaces.pp svneol=native#text/plain
|
||||
lcl/interfaces/wince/win32compat.pas svneol=native#text/plain
|
||||
lcl/interfaces/wince/wincecallback.inc svneol=native#text/plain
|
||||
lcl/interfaces/wince/wincedef.pp svneol=native#text/plain
|
||||
lcl/interfaces/wince/wincedialogs.lrs svneol=native#text/plain
|
||||
lcl/interfaces/wince/winceextra.pp svneol=native#text/plain
|
||||
lcl/interfaces/wince/winceint.pp svneol=native#text/plain
|
||||
lcl/interfaces/wince/wincelclintf.inc svneol=native#text/plain
|
||||
|
2
lcl/images/wince/build.bat
Normal file
2
lcl/images/wince/build.bat
Normal file
@ -0,0 +1,2 @@
|
||||
..\..\..\tools\lazres ..\..\interfaces\wince\wincedialogs.lrs wincedialog_ok.png wincedialog_cancel.png
|
||||
pause
|
BIN
lcl/images/wince/wincedialog_cancel.png
Normal file
BIN
lcl/images/wince/wincedialog_cancel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 643 B |
BIN
lcl/images/wince/wincedialog_ok.PNG
Normal file
BIN
lcl/images/wince/wincedialog_ok.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 236 B |
38
lcl/interfaces/wince/wincedialogs.lrs
Normal file
38
lcl/interfaces/wince/wincedialogs.lrs
Normal file
@ -0,0 +1,38 @@
|
||||
LazarusResources.Add('wincedialog_ok','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#4#3#0#0#0#237#221#226
|
||||
+'R'#0#0#0#1'sRGB'#0#174#206#28#233#0#0#0#4'gAMA'#0#0#177#143#11#252'a'#5#0#0
|
||||
+#0' cHRM'#0#0'z&'#0#0#128#132#0#0#250#0#0#0#128#232#0#0'u0'#0#0#234'`'#0#0':'
|
||||
+#152#0#0#23'p'#156#186'Q<'#0#0#0'0PLTE'#0#0#0#128#0#0#0#128#0#128#128#0#0#0
|
||||
+#128#128#0#128#0#128#128#192#192#192#128#128#128#255#0#0#0#255#0#255#255#0#0
|
||||
+#0#255#255#0#255#0#255#255#255#255#255'O'#19'&I'#0#0#0'.IDAT'#24#211'c('#135
|
||||
+#2#6#236#140#18'w'#236#140#18#23#247#18' d(w)w)qw)'#135'0\'#220#209#25'`)'
|
||||
+#184'b'#252'v'#129#0#0'U'#14'6 '#204#254#201#174#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('wincedialog_cancel','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
|
||||
+#0#0#2'JIDATx^'#165#210'MKTa'#20#7#240's'#159';:w'#198'{G&'#7'!'#169#6#179
|
||||
+#168'x'#22'!m'#138#202#156','#141#136'jg/j'#190'U4'#161#24'V&'#134'D'#139#214
|
||||
+#173#164'E'#208#247#8'$'#130#136'VRp'#183'9'#166#142'3'#147#140#19#154#222
|
||||
+#235'}^N'#15'w'#208'fj\D'#7#254#240#192#195#239#191'9GCD'#248#151#217#236#27
|
||||
+#12#7#223#188#222#216#2#164#12'<z'#18'W'#161';'#226#222#1#138#204#187#189#209
|
||||
+'y'#163'e'#187#160#12#235#250#28#18'b'#203#145'Q'#250#23#190#213'OA'#253#17
|
||||
+#203'z)'#25'K'#174']'#190'z'#196'/('#197#16#12#2#24#6#128'*'#225#201#161#237
|
||||
+#18#183#167#143#130#166#217#186'Y'#3#213#177#24'TE"'#157#210'c'#237#133#182
|
||||
+'vR,@'#204#161#231'I'#228#28#180'P'#168'X'#2'`{'#253#131#212#237#238#165#154
|
||||
+#194#196'2!`E'#192']X'#0'7'#147#17#210#243#166#162#211'o'#165#178#232'G'#12
|
||||
+'?0'#248#253'a.'#30#142'!>'#129'|'#244'1'#186#253#131#232't'#247#162#151#28
|
||||
+'B'#28#159#240#223#133#243#23#248'J'#162#205#216'r>'#222#10#187'{'#207#216#28
|
||||
+#184#195#217#208#8#226#228'3'#196#137'I'#5#159'"'#142#141#163#211#213#131#133
|
||||
+'s'#29'|'#165#245#172'Qb'#202#183#16'x5'#229'"c&'#203#231'%0'#1'07'#7#144'J'
|
||||
+#1#8#1'n&+%'#243#204#232#187'i'#183#212#16#248'c$cM'#154#6#4#4#7'`'#12#128's'
|
||||
+'?'#154'N'#136#244'X'#147#175'v*p'#174'wQ'#208#192#214'Ca'#133#20'nhP'#217
|
||||
+#237#23#4'kkA'#15#232'v'#174#249#24#173'X'#176'q'#237#166#143#3#10'WY'#22'8K'
|
||||
+'KP'#248#242'Y'#228'gf'#228#250#183'y0vE!'#24#141#170#146#128#189't'#152#210
|
||||
+#178#2'uY'#254#170#138#184#6#156't'#26#220'lVH'#143#153#200'X'#205'z:-'#214
|
||||
+'fS'#16#142#213'AH'#221'A'#160#186#202'^ll'#162#219#5#146#177'z'#148#2#0#165
|
||||
+#194#25'prE\'#247#225#189#27#251#244#209'U'#255#230'OU'#178#250'u'#22#8'!'
|
||||
+#160#169#160#16#245#138#254'^'#227#143#142#139#137#213'KW0'#223#210'*'#150'O'
|
||||
+#156#242'WU'#154#244#193'C'#198#226#254#3#252#251#209'f'#156#223#27'OT'#188
|
||||
+#131#252#233'3'#137#229#227'''}\)'#11#241'Fc~'#207#190'D'#169#209#20#132#255
|
||||
+#153'_'#137'Uq'#156#16'Dt'#133#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
@ -26,11 +26,13 @@ unit WinCEWSDialogs;
|
||||
interface
|
||||
|
||||
uses
|
||||
// RTL, FCL, LCL
|
||||
// RTL, FCL
|
||||
SysUtils, Classes,
|
||||
Windows,
|
||||
// LCL
|
||||
ShellCtrls, Forms, Dialogs, FileCtrl, Controls, ComCtrls,
|
||||
LResources, ExtCtrls, Buttons, Graphics,
|
||||
// Widgetset
|
||||
ShellCtrls, Forms, Dialogs, FileCtrl, Controls,
|
||||
WSDialogs, WSLCLClasses, InterfaceBase;
|
||||
|
||||
type
|
||||
@ -99,42 +101,105 @@ type
|
||||
implementation
|
||||
|
||||
type
|
||||
|
||||
{ TWinCEFileDialogForm }
|
||||
|
||||
TWinCEFileDialogForm = class(TForm)
|
||||
public
|
||||
// User interface
|
||||
ShellTreeView: TShellTreeView;
|
||||
ShellListView: TShellListView;
|
||||
Panel: TPanel;
|
||||
// Communication fields
|
||||
LCLDialog: TFileDialog;
|
||||
procedure HandleOkClick(ASender: TObject);
|
||||
procedure HandleCancelClick(ASender: TObject);
|
||||
end;
|
||||
|
||||
{ TWinCEFileDialogForm }
|
||||
|
||||
procedure TWinCEFileDialogForm.HandleOkClick(ASender: TObject);
|
||||
begin
|
||||
LCLDialog.FileName := ShellListView.GetPathFromItem(ShellListView.Selected);
|
||||
ModalResult := mrOk;
|
||||
end;
|
||||
|
||||
procedure TWinCEFileDialogForm.HandleCancelClick(ASender: TObject);
|
||||
begin
|
||||
ModalResult := mrCancel;
|
||||
end;
|
||||
|
||||
{ TWinCEWSFileDialog }
|
||||
|
||||
class function TWinCEWSFileDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
|
||||
var
|
||||
ResultForm: TWinCEFileDialogForm absolute Result;
|
||||
ShellTreeView: TShellTreeView;
|
||||
ShellListView: TShellListView;
|
||||
AButton: TBitBtn;
|
||||
AImage: TPortableNetworkGraphic;
|
||||
begin
|
||||
Result := THandle(TWinCEFileDialogForm.Create(Application));
|
||||
|
||||
// ResultForm.
|
||||
ResultForm.LCLDialog := TFileDialog(ACommonDialog);
|
||||
|
||||
// Add the Panel to the dialog (Toolbar didn't work well)
|
||||
ResultForm.Panel := TPanel.Create(ResultForm);
|
||||
ResultForm.Panel.Parent := ResultForm;
|
||||
ResultForm.Panel.Left := 0;
|
||||
ResultForm.Panel.Height := 20;
|
||||
ResultForm.Panel.Top := ResultForm.Height -
|
||||
ResultForm.Panel.Height;
|
||||
ResultForm.Panel.Width := ResultForm.Width;
|
||||
ResultForm.Panel.Align := alBottom;
|
||||
|
||||
AImage := TPortableNetworkGraphic.Create;
|
||||
|
||||
// ok button
|
||||
AButton := TBitBtn.Create(ResultForm);
|
||||
AButton.Parent := ResultForm.Panel;
|
||||
AButton.Height := 17;
|
||||
AButton.Width := 17;
|
||||
AImage.LoadFromLazarusResource('wincedialog_ok');
|
||||
AButton.Glyph.Assign(AImage);
|
||||
AButton.OnClick := @ResultForm.HandleOkClick;
|
||||
AButton.Left := 0;
|
||||
|
||||
// cancel button
|
||||
AButton := TBitBtn.Create(ResultForm);
|
||||
AButton.Parent := ResultForm.Panel;
|
||||
AButton.Height := 17;
|
||||
AButton.Width := 17;
|
||||
AImage.LoadFromLazarusResource('wincedialog_cancel');
|
||||
AButton.Glyph.Assign(AImage);
|
||||
AButton.OnClick := @ResultForm.HandleCancelClick;
|
||||
AButton.Left := 20;
|
||||
|
||||
// dialog images
|
||||
// the wincedialogs.lrs image is compiled with the script at
|
||||
// lcl/images/wince/build.bat
|
||||
//ResultForm.ToolBar.Images := TImageList.Create(ResultForm);
|
||||
//ResultForm.ToolBar.Images.AddLazarusResource('wincedialog_ok');
|
||||
//ResultForm.ToolBar.Images.AddLazarusResource('wincedialog_cancel');
|
||||
AImage.Free;
|
||||
|
||||
// Add the ShellTreeView to the dialog
|
||||
ShellTreeView := TShellTreeView.Create(ResultForm);
|
||||
ResultForm.ShellTreeView := ShellTreeView;
|
||||
ShellTreeView.Parent := ResultForm;
|
||||
ShellTreeView.Left := 0;
|
||||
ShellTreeView.Top := 0;
|
||||
ShellTreeView.Width := ResultForm.Width;
|
||||
ShellTreeView.Height := 100;
|
||||
ShellTreeView.Align := alTop;
|
||||
ResultForm.ShellTreeView := TShellTreeView.Create(ResultForm);
|
||||
ResultForm.ShellTreeView.Parent := ResultForm;
|
||||
ResultForm.ShellTreeView.Left := 0;
|
||||
ResultForm.ShellTreeView.Top := 0;
|
||||
ResultForm.ShellTreeView.Width := ResultForm.Width;
|
||||
ResultForm.ShellTreeView.Height := 100;
|
||||
ResultForm.ShellTreeView.Align := alTop;
|
||||
|
||||
// Add the ShellListView to the dialog
|
||||
ShellListView := TShellListView.Create(ResultForm);
|
||||
ResultForm.ShellListView := ShellListView;
|
||||
ShellListView.Parent := ResultForm;
|
||||
ShellListView.Left := 0;
|
||||
ShellListView.Top := ShellTreeView.Height;
|
||||
ShellListView.Width := ResultForm.Width;
|
||||
ShellListView.Height := 100;
|
||||
ShellListView.ShellTreeView := ShellTreeView;
|
||||
ResultForm.ShellListView := TShellListView.Create(ResultForm);
|
||||
ResultForm.ShellListView.Parent := ResultForm;
|
||||
ResultForm.ShellListView.Left := 0;
|
||||
ResultForm.ShellListView.Top := ResultForm.ShellTreeView.Height;
|
||||
ResultForm.ShellListView.Width := ResultForm.Width;
|
||||
ResultForm.ShellListView.Height :=
|
||||
ResultForm.Height - ResultForm.ShellTreeView.Height
|
||||
- ResultForm.Panel.Height;
|
||||
ResultForm.ShellListView.ShellTreeView := ResultForm.ShellTreeView;
|
||||
end;
|
||||
|
||||
class procedure TWinCEWSFileDialog.DestroyHandle(const ACommonDialog: TCommonDialog);
|
||||
@ -143,8 +208,6 @@ var
|
||||
begin
|
||||
ResultForm := TWinCEFileDialogForm(ACommonDialog.Handle);
|
||||
|
||||
ResultForm.ShellTreeView.Free;
|
||||
ResultForm.ShellListView.Free;
|
||||
ResultForm.Free;
|
||||
end;
|
||||
|
||||
@ -157,4 +220,6 @@ begin
|
||||
ResultForm.ShowModal;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I wincedialogs.lrs}
|
||||
end.
|
||||
|
@ -539,6 +539,8 @@ begin
|
||||
Self.Column[1].Caption := 'Size';
|
||||
Self.Columns.Add;
|
||||
Self.Column[2].Caption := 'Type';
|
||||
// Initial sizes, necessary under Windows CE
|
||||
HandleResize(Self);
|
||||
|
||||
// Internal event handlers
|
||||
OnResize := @HandleResize;
|
||||
|
Loading…
Reference in New Issue
Block a user