convert LM_SETFORMICON message to interface method

git-svn-id: trunk@6002 -
This commit is contained in:
micha 2004-09-15 07:58:00 +00:00
parent 89fe6ac437
commit 1a1fa9f508
8 changed files with 56 additions and 33 deletions

View File

@ -735,7 +735,8 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
procedure TApplication.IconChanged(Sender: TObject); procedure TApplication.IconChanged(Sender: TObject);
begin begin
CNSendMessage(LM_SETFORMICON, Self, Pointer(GetIconHandle)); DebugLn('TApplication.IconChanged - TODO: convert this message...no implementation in gtk or win32');
// CNSendMessage(LM_SETFORMICON, Self, Pointer(GetIconHandle));
// NotifyForms(CM_ICONCHANGED); // NotifyForms(CM_ICONCHANGED);
end; end;
@ -1339,6 +1340,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.91 2004/09/15 07:57:59 micha
convert LM_SETFORMICON message to interface method
Revision 1.90 2004/09/11 13:38:37 micha Revision 1.90 2004/09/11 13:38:37 micha
convert LM_BRINGTOFRONT message to interface method convert LM_BRINGTOFRONT message to interface method
NOTE: was only used for tapplication, not from other controls NOTE: was only used for tapplication, not from other controls

View File

@ -195,7 +195,7 @@ End;
procedure TCustomForm.IconChanged(Sender: TObject); procedure TCustomForm.IconChanged(Sender: TObject);
begin begin
if HandleAllocated then if HandleAllocated then
CNSendMessage(LM_SETFORMICON,Self,Pointer(GetIconHandle)); TWSCustomForm(WidgetSetClass).SetIcon(Self, GetIconHandle);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -1489,7 +1489,7 @@ begin
inherited CreateWnd; inherited CreateWnd;
if Parent=nil then begin if Parent=nil then begin
CNSendMessage(LM_SETFORMICON, Self, Pointer(GetIconHandle)); TWSCustomFormClass(WidgetSetClass).SetIcon(Self, GetIconHandle);
DC:=GetDC(Handle); DC:=GetDC(Handle);
FPixelsPerInch:=GetDeviceCaps(DC,LOGPIXELSX); FPixelsPerInch:=GetDeviceCaps(DC,LOGPIXELSX);
ReleaseDC(Handle,DC); ReleaseDC(Handle,DC);
@ -1808,6 +1808,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.157 2004/09/15 07:57:59 micha
convert LM_SETFORMICON message to interface method
Revision 1.156 2004/09/13 13:13:46 micha Revision 1.156 2004/09/13 13:13:46 micha
convert LM_SHOWMODAL to interface methods convert LM_SHOWMODAL to interface methods

View File

@ -3064,9 +3064,7 @@ var
Widget : PGtkWidget; // pointer to gtk-widget (local use when neccessary) Widget : PGtkWidget; // pointer to gtk-widget (local use when neccessary)
GList : pGList; // Only used for listboxes, replace with widget!!!!! GList : pGList; // Only used for listboxes, replace with widget!!!!!
ListItem : PGtkListItem; // currently only used for listboxes ListItem : PGtkListItem; // currently only used for listboxes
FormIconGdiObject: PGdiObject; // currently only used by LM_SETFORMICON
Geometry : TGdkGeometry; Geometry : TGdkGeometry;
AWindow : PGdkWindow;
begin begin
Result := 0; //default value just in case nothing sets it Result := 0; //default value just in case nothing sets it
@ -3118,25 +3116,6 @@ begin
TLMNotebookEvent(Data^).Page); TLMNotebookEvent(Data^).Page);
end; end;
LM_SETFORMICON :
begin
if (Sender is TCustomForm) and (TCustomForm(Sender).Parent=nil) then
begin
if (Handle<>0) and (Data<>nil) then begin
FormIconGdiObject:=Data;
//DebugLn('LM_SETFORMICON ',FormIconGdiObject<>nil,' ',pgtkWidget(Handle)^.Window<>nil);
if (FormIconGdiObject<>nil) then begin
AWindow:=GetControlWindow(PGtkWidget(Handle));
if AWindow<>nil then begin
gdk_window_set_icon(AWindow, nil,
FormIconGdiObject^.GDIBitmapObject,
FormIconGdiObject^.GDIBitmapMaskObject);
end;
end;
end;
end;
end;
LM_SCREENINIT : LM_SCREENINIT :
begin begin
{ Compute pixels per inch variable } { Compute pixels per inch variable }
@ -8211,6 +8190,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.568 2004/09/15 07:57:59 micha
convert LM_SETFORMICON message to interface method
Revision 1.567 2004/09/14 15:48:28 micha Revision 1.567 2004/09/14 15:48:28 micha
convert LM_INVALIDATE message to interface method convert LM_INVALIDATE message to interface method

View File

@ -30,7 +30,7 @@ uses
{$IFDEF GTK2} Gtk2, Glib2, gdk2, {$ELSE} Gtk, gdk, Glib, {$ENDIF} {$IFDEF GTK2} Gtk2, Glib2, gdk2, {$ELSE} Gtk, gdk, Glib, {$ENDIF}
SysUtils, Classes, Controls, LMessages, InterfaceBase, graphics, SysUtils, Classes, Controls, LMessages, InterfaceBase, graphics,
Dialogs, WSDialogs, WSLCLClasses, gtkint, gtkproc, gtkwscontrols, Dialogs, WSDialogs, WSLCLClasses, gtkint, gtkproc, gtkwscontrols,
Forms, WSForms, Math; Forms, WSForms, Math, lcltype, gtkdef;
type type
@ -74,6 +74,7 @@ type
public public
class procedure SetFormBorderStyle(const AForm: TCustomForm; class procedure SetFormBorderStyle(const AForm: TCustomForm;
const AFormBorderStyle: TFormBorderStyle); override; const AFormBorderStyle: TFormBorderStyle); override;
class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); override;
class procedure ShowModal(const ACustomForm: TCustomForm); override; class procedure ShowModal(const ACustomForm: TCustomForm); override;
end; end;
@ -122,6 +123,28 @@ begin
// This is Delphi compatible, so no Recreatewnd needed. // This is Delphi compatible, so no Recreatewnd needed.
end; end;
procedure TGtkWSCustomForm.SetIcon(const AForm: TCustomForm; const AIcon: HICON);
var
FormIconGdiObject: PGdiObject;
AWindow : PGdkWindow;
begin
if AForm.Parent = nil then
begin
if AForm.HandleAllocated and (AIcon <> 0) then begin
FormIconGdiObject:=PGdiObject(AIcon);
//DebugLn('LM_SETFORMICON ',FormIconGdiObject<>nil,' ',pgtkWidget(Handle)^.Window<>nil);
if (FormIconGdiObject <> nil) then begin
AWindow:=GetControlWindow(PGtkWidget(AForm.Handle));
if AWindow<>nil then begin
gdk_window_set_icon(AWindow, nil,
FormIconGdiObject^.GDIBitmapObject,
FormIconGdiObject^.GDIBitmapMaskObject);
end;
end;
end;
end;
end;
procedure TGtkWSCustomForm.ShowModal(const ACustomForm: TCustomForm); procedure TGtkWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
var var
GtkWindow: PGtkWindow; GtkWindow: PGtkWindow;

View File

@ -330,10 +330,6 @@ Begin
Else Else
Assert(False, Format('Trace:I don''t know how to destroy component %S', [Sender.ClassName])); Assert(False, Format('Trace:I don''t know how to destroy component %S', [Sender.ClassName]));
End; End;
LM_SETFORMICON:
Begin
SetClassLong(Handle, GCL_HIcon, integer(Data));
End;
LM_GETITEMS : LM_GETITEMS :
Begin Begin
If (Sender as TControl).fCompStyle = csCListBox If (Sender as TControl).fCompStyle = csCListBox
@ -2239,6 +2235,9 @@ End;
{ {
$Log$ $Log$
Revision 1.261 2004/09/15 07:58:00 micha
convert LM_SETFORMICON message to interface method
Revision 1.260 2004/09/14 21:30:37 vincents Revision 1.260 2004/09/14 21:30:37 vincents
replaced writeln by DebugLn replaced writeln by DebugLn

View File

@ -77,6 +77,7 @@ type
private private
protected protected
public public
class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); override;
class procedure ShowModal(const ACustomForm: TCustomForm); override; class procedure ShowModal(const ACustomForm: TCustomForm); override;
end; end;
@ -141,6 +142,11 @@ end;
{ TWin32WSCustomForm } { TWin32WSCustomForm }
procedure TWin32WSCustomForm.SetIcon(const AForm: TCustomForm; const AIcon: HICON);
begin
SendMessage(AForm.Handle, WM_SETICON, ICON_BIG, AIcon);
end;
procedure TWin32WSCustomForm.ShowModal(const ACustomForm: TCustomForm); procedure TWin32WSCustomForm.ShowModal(const ACustomForm: TCustomForm);
var var
FormHandle: HWND; FormHandle: HWND;

View File

@ -62,7 +62,6 @@ const
LM_GETVALUE = LM_ComUser+41; // get actual value from visual object LM_GETVALUE = LM_ComUser+41; // get actual value from visual object
LM_RECREATEWND = LM_COMUSER+57; LM_RECREATEWND = LM_COMUSER+57;
LM_SETFORMICON = LM_COMUSER+58;
LM_MINIMIZE = LM_COMUSER+59; LM_MINIMIZE = LM_COMUSER+59;
@ -831,7 +830,6 @@ begin
LM_GETVALUE :Result:='LM_GETVALUE'; LM_GETVALUE :Result:='LM_GETVALUE';
LM_RECREATEWND :Result:='LM_RECREATEWND'; LM_RECREATEWND :Result:='LM_RECREATEWND';
LM_SETFORMICON :Result:='LM_SETFORMICON';
LM_MINIMIZE :Result:='LM_MINIMIZE'; LM_MINIMIZE :Result:='LM_MINIMIZE';
@ -961,6 +959,9 @@ end.
{ {
$Log$ $Log$
Revision 1.100 2004/09/15 07:57:59 micha
convert LM_SETFORMICON message to interface method
Revision 1.99 2004/09/14 15:48:28 micha Revision 1.99 2004/09/14 15:48:28 micha
convert LM_INVALIDATE message to interface method convert LM_INVALIDATE message to interface method

View File

@ -46,7 +46,7 @@ uses
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
Forms, Forms,
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
WSLCLClasses, WSControls, Controls; WSLCLClasses, WSControls, Controls, LCLType;
type type
{ TWSScrollingWinControl } { TWSScrollingWinControl }
@ -74,6 +74,7 @@ type
TWSCustomForm = class(TWSScrollingWinControl) TWSCustomForm = class(TWSScrollingWinControl)
class procedure SetFormBorderStyle(const AForm: TCustomForm; class procedure SetFormBorderStyle(const AForm: TCustomForm;
const AFormBorderStyle: TFormBorderStyle); virtual; const AFormBorderStyle: TFormBorderStyle); virtual;
class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); virtual;
class procedure ShowModal(const ACustomForm: TCustomForm); virtual; class procedure ShowModal(const ACustomForm: TCustomForm); virtual;
end; end;
TWSCustomFormClass = class of TWSCustomForm; TWSCustomFormClass = class of TWSCustomForm;
@ -108,7 +109,11 @@ procedure TWSCustomForm.SetFormBorderStyle(const AForm: TCustomForm;
begin begin
// will be done in interface override // will be done in interface override
end; end;
procedure TWSCustomForm.SetIcon(const AForm: TCustomForm; const AIcon: HICON);
begin
end;
procedure TWSCustomForm.ShowModal(const ACustomForm: TCustomForm); procedure TWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
begin begin
end; end;