File: fpguiwsdialogs.pp

package info (click to toggle)
lazarus 4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 275,760 kB
  • sloc: pascal: 2,341,904; xml: 509,420; makefile: 348,726; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (194 lines) | stat: -rw-r--r-- 5,510 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
{ $Id: FpGuiwsdialogs.pp 5319 2004-03-17 20:11:29Z marc $}
{
 *****************************************************************************
 *                              FpGuiWSDialogs.pp                               * 
 *                              --------------                               * 
 *                                                                           *
 *                                                                           *
 *****************************************************************************

 *****************************************************************************
  This file is part of the Lazarus Component Library (LCL)

  See the file COPYING.LCL, included in this distribution,
  for details about the license.
 *****************************************************************************
}
unit FpGuiWSDialogs;

{$mode objfpc}{$H+}

interface

uses
////////////////////////////////////////////////////
// I M P O R T A N T                                
////////////////////////////////////////////////////
// To get as little as posible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
  Dialogs,
////////////////////////////////////////////////////
// Bindings
  fpg_base, fpg_main, fpg_dialogs, fpguiwsprivate,
  LCLType, WSDialogs, WSLCLClasses;

type

  { TFpGuiWSCommonDialog }

  TFpGuiWSCommonDialog = class(TWSCommonDialog)
  private
  protected
  published
    class function CreateHandle(const ACommonDialog: TCommonDialog): TLCLHandle; override;
    class procedure ShowModal(const ACommonDialog: TCommonDialog); override;
    class procedure DestroyHandle(const ACommonDialog: TCommonDialog); override;
  end;

  { TFpGuiWSFileDialog }

  TFpGuiWSFileDialog = class(TWSFileDialog)
  private
  protected
  published
    class function CreateHandle(const ACommonDialog: TCommonDialog): TLCLHandle; override;
  end;

  { TFpGuiWSOpenDialog }

  TFpGuiWSOpenDialog = class(TWSOpenDialog)
  private
  protected
  published
    class function CreateHandle(const ACommonDialog: TCommonDialog): TLCLHandle; override;
  end;

  { TFpGuiWSSaveDialog }

  TFpGuiWSSaveDialog = class(TWSSaveDialog)
  private
  protected
  published
    class function CreateHandle(const ACommonDialog: TCommonDialog): TLCLHandle; override;
  end;

  { TFpGuiWSSelectDirectoryDialog }

  TFpGuiWSSelectDirectoryDialog = class(TWSSelectDirectoryDialog)
  private
  protected
  public
  end;

  { TFpGuiWSColorDialog }

  TFpGuiWSColorDialog = class(TWSColorDialog)
  private
  protected
  public
  published
    class function CreateHandle(const ACommonDialog: TCommonDialog): TLCLHandle; override;
  end;

  { TFpGuiWSColorButton }

  TFpGuiWSColorButton = class(TWSColorButton)
  private
  protected
  public
  end;

  { TFpGuiWSFontDialog }

  TFpGuiWSFontDialog = class(TWSFontDialog)
  private
  protected
  published
    class function CreateHandle(const ACommonDialog: TCommonDialog): TLCLHandle; override;
  end;


implementation

{ TFpGuiWSColorDialog }

class function TFpGuiWSColorDialog.CreateHandle(
  const ACommonDialog: TCommonDialog): TLCLHandle;
begin
  Result := TLCLHandle(TFPGUIPrivateColorDialog.Create(ACommonDialog));
end;

{ TFpGuiWSCommonDialog }

class function TFpGuiWSCommonDialog.CreateHandle(
  const ACommonDialog: TCommonDialog): TLCLHandle;
begin
  Result := TLCLHandle(TFPGUIPrivateCommonDialog.Create(ACommonDialog));
end;

class procedure TFpGuiWSCommonDialog.ShowModal(
  const ACommonDialog: TCommonDialog);
begin
  TFPGUIPrivateCommonDialog(ACommonDialog.Handle).ShowDialog;
end;

class procedure TFpGuiWSCommonDialog.DestroyHandle(
  const ACommonDialog: TCommonDialog);
var
  FPGDialog: TFPGUIPrivateCommonDialog;
begin
  FPGDialog := TFPGUIPrivateCommonDialog(ACommonDialog.Handle);
  FPGDialog.Free;
end;

{ TFpGuiWSFileDialog }

class function TFpGuiWSFileDialog.CreateHandle(
  const ACommonDialog: TCommonDialog): TLCLHandle;
begin
  Result := TLCLHandle(TFPGUIPrivateFileDialog.Create(ACommonDialog));
end;

{ TFpGuiWSOpenDialog }

class function TFpGuiWSOpenDialog.CreateHandle(
  const ACommonDialog: TCommonDialog): TLCLHandle;
begin
  Result := TLCLHandle(TFPGUIPrivateOpenDialog.Create(ACommonDialog));
end;

{ TFpGuiWSSaveDialog }

class function TFpGuiWSSaveDialog.CreateHandle(
  const ACommonDialog: TCommonDialog): TLCLHandle;
begin
  Result := TLCLHandle(TFPGUIPrivateSaveDialog.Create(ACommonDialog));
end;

{ TFpGuiWSFontDialog }

class function TFpGuiWSFontDialog.CreateHandle(
  const ACommonDialog: TCommonDialog): TLCLHandle;
begin
  Result := TLCLHandle(TFPGUIPrivateFontDialog.Create(ACommonDialog));
end;

initialization

////////////////////////////////////////////////////
// I M P O R T A N T
////////////////////////////////////////////////////
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
//  RegisterWSComponent(TCommonDialog, TFpGuiWSCommonDialog);
//  RegisterWSComponent(TFileDialog, TFpGuiWSFileDialog);
//  RegisterWSComponent(TOpenDialog, TFpGuiWSOpenDialog);
//  RegisterWSComponent(TSaveDialog, TFpGuiWSSaveDialog);
//  RegisterWSComponent(TSelectDirectoryDialog, TFpGuiWSSelectDirectoryDialog);
//  RegisterWSComponent(TColorDialog, TFpGuiWSColorDialog);
//  RegisterWSComponent(TColorButton, TFpGuiWSColorButton);
//  RegisterWSComponent(TFontDialog, TFpGuiWSFontDialog);
////////////////////////////////////////////////////
end.