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

View File

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

View File

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

View File

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

View File

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