Changed TCustomDialog to TCommonDialog

Shane

git-svn-id: trunk@26 -
This commit is contained in:
lazarus 2000-08-10 10:55:45 +00:00
parent 04bd08aab8
commit 708a392932
5 changed files with 50 additions and 32 deletions

View File

@ -47,9 +47,7 @@ const
type
// TCustomDialog = class(TComponent)
// TCustomDialog = class(TWinControl)
TCustomDialog = class(TCustomForm)
TCommonDialog = class(TComponent)
private
FHandle : integer;
FOnShow, FOnClose : TNotifyEvent;
@ -57,7 +55,7 @@ type
FUserChoice: integer;
protected
public
// FCompStyle : LongInt;
FCompStyle : LongInt;
constructor Create (AOwner : TComponent); override;
function DoExecute : boolean; virtual;
function Execute : boolean; virtual;
@ -68,7 +66,7 @@ type
property OnShow : TNotifyEvent read FOnShow write FOnShow;
end;
TFileDialog = class(TCustomDialog)
TFileDialog = class(TCommonDialog)
private
FFileName : String;
FFilter: String;
@ -92,7 +90,7 @@ type
end;
TColorDialog = class(TCustomDialog)
TColorDialog = class(TCommonDialog)
private
FColor : TColor;
public
@ -100,7 +98,7 @@ type
property Color : TColor read FColor write FColor;
end;
TFontDialog = class(TCustomDialog)
TFontDialog = class(TCommonDialog)
private
FFontName : String;
public
@ -113,7 +111,7 @@ implementation
uses
SysUtils;
{$I customdialog.inc}
{$I commondialog.inc}
{$I filedialog.inc}
{$I colordialog.inc}
{$I fontdialog.inc}
@ -122,6 +120,10 @@ end.
{ =============================================================================
$Log$
Revision 1.3 2000/08/10 10:55:45 lazarus
Changed TCustomDialog to TCommonDialog
Shane
Revision 1.2 2000/08/09 18:32:10 lazarus
Added more code for the find function.
Shane

View File

@ -1,19 +1,19 @@
{******************************************************************************
TCustomDialog
TCommonDialog
******************************************************************************}
{------------------------------------------------------------------------------
Method: TCustomDialog.Create
Method: TCommonDialog.Create
Params: AOwner: the owner of the class
Returns: Nothing
Constructor for the class.
------------------------------------------------------------------------------}
constructor TCustomDialog.Create (AOwner : TComponent);
constructor TCommonDialog.Create (AOwner : TComponent);
begin
inherited Create(AOwner);
end;
function TCustomDialog.Execute : boolean;
function TCommonDialog.Execute : boolean;
begin
FUserChoice := mrNone;
CNSendMessage(LM_CREATE, Self, nil);
@ -22,7 +22,7 @@ begin
FHandle := 0;
end;
function TCustomDialog.DoExecute : boolean;
function TCommonDialog.DoExecute : boolean;
begin
if Assigned(FOnShow) then FOnShow(Self);
Assert(False, 'Trace:Calling dialog - LM_SHOWMODAL');
@ -38,6 +38,10 @@ end;
{ =============================================================================
$Log$
Revision 1.2 2000/08/10 10:55:45 lazarus
Changed TCustomDialog to TCommonDialog
Shane
Revision 1.1 2000/07/13 10:28:25 michael
+ Initial import

View File

@ -397,7 +397,7 @@ end;
function gtkDialogOKclickedCB( widget: PGtkWidget; data: gPointer) : GBoolean; cdecl;
var
theDialog : TCustomDialog;
theDialog : TCommonDialog;
Fpointer : Pointer;
colorArray : array[0..2] of double;
colorsel : GTK_COLOR_SELECTION;
@ -405,9 +405,9 @@ var
FontName : String;
begin
Result := True;
theDialog := TCustomDialog(data);
theDialog := TCommonDialog(data);
FPointer := Pointer(theDialog.Handle);
// gtk_grab_remove(PgtkWidget(TCustomDialog(data).Handle));
// gtk_grab_remove(PgtkWidget(TCommonDialog(data).Handle));
if theDialog is TFileDialog then
begin
TFileDialog(data).FileName := gtk_file_selection_get_filename(PGtkFileSelection(FPointer));
@ -436,11 +436,11 @@ begin
function gtkDialogCancelclickedCB( widget: PGtkWidget; data: gPointer) : GBoolean; cdecl;
var
theDialog : TCustomDialog;
theDialog : TCommonDialog;
begin
Result := True;
theDialog := TCustomDialog(data);
// gtk_grab_remove(PgtkWidget(TCustomDialog(data).Handle));
theDialog := TCommonDialog(data);
// gtk_grab_remove(PgtkWidget(TCommonDialog(data).Handle));
if theDialog is TFileDialog then
begin
TFileDialog(data).FileName := '';
@ -451,11 +451,11 @@ begin
function gtkDialogDestroyCB( widget: PGtkWidget; data: gPointer) : GBoolean; cdecl;
var
theDialog : TCustomDialog;
theDialog : TCommonDialog;
begin
Result := True;
theDialog := TCustomDialog(data);
// gtk_grab_remove(PgtkWidget(TCustomDialog(data).Handle));
theDialog := TCommonDialog(data);
// gtk_grab_remove(PgtkWidget(TCommonDialog(data).Handle));
{ if theDialog is TFileDialog then
begin
TFileDialog(data).FileName := '';
@ -1032,6 +1032,10 @@ end;
{ =============================================================================
$Log$
Revision 1.3 2000/08/10 10:55:45 lazarus
Changed TCustomDialog to TCommonDialog
Shane
Revision 1.2 2000/07/30 21:48:33 lazarus
MWE:
= Moved ObjectToGTKObject to GTKProc unit

View File

@ -282,7 +282,7 @@ begin
Assert(False, 'Trace:removing timer!!!');
gtk_timeout_remove((Sender as TTimer).TimerID);
end
else if (Sender is TWinControl) or (Sender is TCustomDialog)
else if (Sender is TWinControl) or (Sender is TCommonDialog)
then gtk_widget_destroy( PGtkWidget(Handle))
else
Assert (False, Format ('Trace:Dont know how to destroy component %s', [sender.classname]));
@ -445,12 +445,12 @@ begin
LM_ShowModal :
begin
if Sender is TCustomDialog then
if Sender is TCommonDialog then
begin
// Should be done elsewhere (eg via SetLabel) not here!
pStr:= StrAlloc(Length(TCustomDialog(Sender).Title) + 1);
pStr:= StrAlloc(Length(TCommonDialog(Sender).Title) + 1);
try
StrPCopy(pStr, TCustomDialog(Sender).Title);
StrPCopy(pStr, TCommonDialog(Sender).Title);
gtk_window_set_title(PGtkWindow(handle), pStr);
finally
StrDispose(pStr);
@ -1481,8 +1481,8 @@ begin
end
else if (Sender is TMenu)
then CompStyle := TMenu(Sender).FCompStyle
else if (Sender is TCustomDialog)
then CompStyle := TCustomDialog(Sender).FCompStyle
else if (Sender is TCommonDialog)
then CompStyle := TCommonDialog(Sender).FCompStyle
else if (Sender is TTimer)
then CompStyle := csTimer;
@ -1905,8 +1905,8 @@ begin
then TMenuItem(Sender).Handle := HMenu(p)
else if (Sender is TMenu)
then TMenu(Sender).Items.Handle := HMenu(p)
else if (Sender is TCustomDialog)
then TCustomDialog(Sender).Handle:= THandle(p);
else if (Sender is TCommonDialog)
then TCommonDialog(Sender).Handle:= THandle(p);
//Set these for functions like GetWindowLong Added 01/07/2000
@ -2619,6 +2619,10 @@ end;
{ =============================================================================
$Log$
Revision 1.7 2000/08/10 10:55:45 lazarus
Changed TCustomDialog to TCommonDialog
Shane
Revision 1.6 2000/08/09 18:32:10 lazarus
Added more code for the find function.
Shane

View File

@ -500,9 +500,9 @@ begin
begin
if TMenu(AObject).HandleAllocated then handle := TMenu(AObject).Items.Handle
end
else if (AObject is TCustomDialog) then
else if (AObject is TCommonDialog) then
begin
{if TCustomDialog(AObject).HandleAllocated then } handle := TCustomDialog(AObject).Handle
{if TCommonDialog(AObject).HandleAllocated then } handle := TCommonDialog(AObject).Handle
end
else begin
Assert(False, 'Trace:Message received with unhandled class-type');
@ -654,6 +654,10 @@ end;
{
$Log$
Revision 1.3 2000/08/10 10:55:45 lazarus
Changed TCustomDialog to TCommonDialog
Shane
Revision 1.2 2000/07/30 21:48:34 lazarus
MWE:
= Moved ObjectToGTKObject to GTKProc unit