lazarus/lcl/interfaces/win32/win32wsforms.pp
vincents 67212be365 fix fpc 1.0.x. compilation
git-svn-id: trunk@6050 -
2004-09-23 07:54:16 +00:00

178 lines
5.1 KiB
ObjectPascal

{ $Id$}
{
*****************************************************************************
* Win32WSForms.pp *
* --------------- *
* *
* *
*****************************************************************************
*****************************************************************************
* *
* This file is part of the Lazarus Component Library (LCL) *
* *
* See the file COPYING.LCL, included in this distribution, *
* for details about the copyright. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* *
*****************************************************************************
}
unit Win32WSForms;
{$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
////////////////////////////////////////////////////
Forms,
////////////////////////////////////////////////////
WSForms, WSLCLClasses, Windows, SysUtils, WinExt;
type
{ TWin32WSScrollingWinControl }
TWin32WSScrollingWinControl = class(TWSScrollingWinControl)
private
protected
public
end;
{ TWin32WSScrollBox }
TWin32WSScrollBox = class(TWSScrollBox)
private
protected
public
end;
{ TWin32WSCustomFrame }
TWin32WSCustomFrame = class(TWSCustomFrame)
private
protected
public
end;
{ TWin32WSFrame }
TWin32WSFrame = class(TWSFrame)
private
protected
public
end;
{ TWin32WSCustomForm }
TWin32WSCustomForm = class(TWSCustomForm)
private
protected
public
class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); override;
class procedure ShowModal(const ACustomForm: TCustomForm); override;
end;
{ TWin32WSForm }
TWin32WSForm = class(TWSForm)
private
protected
public
end;
{ TWin32WSHintWindow }
TWin32WSHintWindow = class(TWSHintWindow)
private
protected
public
end;
{ TWin32WSScreen }
TWin32WSScreen = class(TWSScreen)
private
protected
public
end;
{ TWin32WSApplicationProperties }
TWin32WSApplicationProperties = class(TWSApplicationProperties)
private
protected
public
end;
implementation
{-----------------------------------------------------------------------------
Function: DisableWindowsProc
Params: Window - handle of toplevel windows to be disabled
Data - handle of current window form
Returns: Whether the enumeration should continue
Used in LM_SHOWMODAL to disable the windows of application thread
except the current form.
-----------------------------------------------------------------------------}
function DisableWindowsProc(Window: HWND; Data: LParam): LongBool; stdcall;
var
Buffer: array[0..15] of Char;
begin
Result:=true;
// Don't disable the current window form
if Window=HWND(Data) then exit;
// Don't disable any ComboBox listboxes
if (GetClassName(Window, @Buffer, sizeof(Buffer))<sizeof(Buffer))
and (StrIComp(Buffer, 'ComboLBox')=0) then exit;
EnableWindow(Window,False);
end;
{ 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);
var
FormHandle: HWND;
begin
FormHandle := ACustomForm.Handle;
EnumThreadWindows(GetWindowThreadProcessId(FormHandle, nil), @DisableWindowsProc, FormHandle);
ShowWindow(FormHandle, SW_SHOW);
end;
initialization
////////////////////////////////////////////////////
// I M P O R T A N T
////////////////////////////////////////////////////
// To improve speed, register only classes
// which actually implement something
////////////////////////////////////////////////////
// RegisterWSComponent(TScrollingWinControl, TWin32WSScrollingWinControl);
// RegisterWSComponent(TScrollBox, TWin32WSScrollBox);
// RegisterWSComponent(TCustomFrame, TWin32WSCustomFrame);
// RegisterWSComponent(TFrame, TWin32WSFrame);
RegisterWSComponent(TCustomForm, TWin32WSCustomForm);
// RegisterWSComponent(TForm, TWin32WSForm);
// RegisterWSComponent(THintWindow, TWin32WSHintWindow);
// RegisterWSComponent(TScreen, TWin32WSScreen);
// RegisterWSComponent(TApplicationProperties, TWin32WSApplicationProperties);
////////////////////////////////////////////////////
end.