* implemented new LCL(check|enable)Menuitem functions

* introduced the lclintf inc files to win32

git-svn-id: trunk@4843 -
This commit is contained in:
marc 2003-11-26 00:23:47 +00:00
parent 4bd55550fd
commit 3b9c6758e9
13 changed files with 209 additions and 89 deletions

2
.gitattributes vendored
View File

@ -1011,6 +1011,8 @@ lcl/interfaces/win32/interfaces.pp svneol=native#text/pascal
lcl/interfaces/win32/win32callback.inc svneol=native#text/pascal
lcl/interfaces/win32/win32def.pp svneol=native#text/pascal
lcl/interfaces/win32/win32int.pp svneol=native#text/pascal
lcl/interfaces/win32/win32lclintf.inc svneol=native#text/pascal
lcl/interfaces/win32/win32lclintfh.inc svneol=native#text/pascal
lcl/interfaces/win32/win32listsl.inc svneol=native#text/pascal
lcl/interfaces/win32/win32listslh.inc svneol=native#text/pascal
lcl/interfaces/win32/win32object.inc svneol=native#text/pascal

View File

@ -258,12 +258,12 @@ begin
Result:=true;
end;
function TInterfaceBase.LclCheckMenuItem(AMenuItem: TMenuItem; bChecked: Boolean): Boolean;
function TInterfaceBase.LclCheckMenuItem(AMenuItem: TMenuItem): Boolean;
begin
Result := False;
end;
function TInterfaceBase.LclEnableMenuItem(AMenuItem: TMenuItem; bEnable: Boolean): Boolean;
function TInterfaceBase.LclEnableMenuItem(AMenuItem: TMenuItem): Boolean;
begin
Result := False;
end;
@ -468,6 +468,10 @@ end;
{ =============================================================================
$Log$
Revision 1.3 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.2 2003/11/25 14:21:28 micha
new api lclenable,checkmenuitem according to list

View File

@ -224,14 +224,14 @@ begin
Result := InterfaceObject.InvalidateFrame(aHandle,ARect,bErase,BorderWidth);
end;
function LclCheckMenuItem(AMenuItem: TMenuItem; bChecked: Boolean): Boolean;
function LclCheckMenuItem(AMenuItem: TMenuItem): Boolean;
begin
Result := InterfaceObject.LclCheckMenuItem(AMenuItem, bChecked);
Result := InterfaceObject.LclCheckMenuItem(AMenuItem);
end;
function LclEnableMenuItem(AMenuItem: TMenuItem; bEnable: Boolean): Boolean;
function LclEnableMenuItem(AMenuItem: TMenuItem): Boolean;
begin
Result := InterfaceObject.LclEnableMenuItem(AMenuItem, bEnable);
Result := InterfaceObject.LclEnableMenuItem(AMenuItem);
end;
function LoadStockPixmap(StockID: longint) : HBitmap;
@ -448,6 +448,10 @@ end;
{ =============================================================================
$Log$
Revision 1.3 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.2 2003/11/25 14:21:28 micha
new api lclenable,checkmenuitem according to list

View File

@ -79,8 +79,8 @@ function InvalidateFrame(aHandle : HWND; ARect : pRect; bErase : Boolean; Border
function LoadStockPixmap(StockID: longint) : HBitmap; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function LclCheckMenuItem(AMenuItem: TMenuItem; bChecked: Boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function LclEnableMenuItem(AMenuItem: TMenuItem; bEnable: Boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function LclCheckMenuItem(AMenuItem: TMenuItem): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function LclEnableMenuItem(AMenuItem: TMenuItem): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function MoveWindowOrgEx(dc : hdc; dX,dY : Integer): boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
@ -141,6 +141,10 @@ procedure RaiseLastOSError;
{ =============================================================================
$Log$
Revision 1.3 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.2 2003/11/25 14:21:28 micha
new api lclenable,checkmenuitem according to list

View File

@ -632,7 +632,7 @@ begin
if (FParent <> nil)
and not (csReading in ComponentState)
and HandleAllocated
then LclCheckMenuItem(Self, FChecked);
then LclCheckMenuItem(Self);
end;
end;
@ -661,7 +661,7 @@ begin
if FEnabled <> AValue then begin
FEnabled := AValue;
if HandleAllocated and (Parent <> nil)
then LclEnableMenuItem(Self, FEnabled);
then LclEnableMenuItem(Self);
MenuChanged(False);
end;
end;
@ -984,6 +984,10 @@ end;
{ =============================================================================
$Log$
Revision 1.43 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.42 2003/11/25 14:21:28 micha
new api lclenable,checkmenuitem according to list
@ -1138,6 +1142,10 @@ end;
$Log$
Revision 1.43 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.42 2003/11/25 14:21:28 micha
new api lclenable,checkmenuitem according to list

View File

@ -71,7 +71,7 @@ uses
{$ENDIF}
SysUtils, Classes, ExtDlgs, Dialogs, Controls, Forms, LCLStrConsts, LMessages,
VclGlobals, LCLProc, LCLIntf, LCLType, gtkDef, DynHashArray, gtkMsgQueue,
GraphType, GraphMath, Graphics;
GraphType, GraphMath, Graphics, Menus;
type
@ -304,7 +304,7 @@ type
implementation
uses
Buttons, Menus, StdCtrls, PairSplitter, Math,
Buttons, StdCtrls, PairSplitter, Math,
GTKWinApiWindow, ComCtrls, CListBox, Calendar, Arrow, Spin, CommCtrl,
ExtCtrls, FileCtrl, LResources, gtkglobals, gtkproc;
@ -401,6 +401,10 @@ end.
{ =============================================================================
$Log$
Revision 1.158 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.157 2003/11/24 11:03:07 marc
* Splitted winapi*.inc into a winapi and a lcl interface communication part

View File

@ -1,4 +1,4 @@
{ $ID: $ }
{ $Id$ }
{******************************************************************************
All GTK interface communication implementations.
Initial Revision : Sun Nov 23 23:53:53 2003
@ -29,58 +29,51 @@
//##apiwiz##sps## // Do not remove
{------------------------------------------------------------------------------
Function: CheckMenuItem
Params: hndMenu: HMENU; uIDEnableItem: Integer; bChecked: Boolean
Function: LCLCheckMenuItem
Params: AMenuItem
Returns: Nothing
Checks or unchecks the specified menu item.
------------------------------------------------------------------------------}
function TgtkObject.CheckMenuItem(hndMenu: HMENU; uIDEnableItem: Integer; bChecked: Boolean): Boolean;
function TgtkObject.LclCheckMenuItem(AMenuItem: TMenuItem): Boolean;
var
LCLMenuItem: TMenuItem;
IsRadio: Boolean;
Group: PGSList;
Item: Pointer;
begin
IsRadio := gtk_is_radio_menu_item(Pointer(hndMenu));
if IsRadio or gtk_is_check_menu_item(Pointer(hndMenu))
Item := Pointer(AMenuItem.Handle);
IsRadio := gtk_is_radio_menu_item(Item);
if IsRadio or gtk_is_check_menu_item(Item)
then begin
if IsRadio
then begin
Group := gtk_radio_menu_item_group(Pointer(hndMenu));
Group := gtk_radio_menu_item_group(Item);
LockRadioGroupOnChange(Group, +1);
end
else LockOnChange(PgtkObject(hndMenu),1);
gtk_check_menu_item_set_active(PGtkCheckMenuItem(hndMenu),bChecked);
else LockOnChange(Item, +1);
gtk_check_menu_item_set_active(Item, AMenuItem.Checked);
if IsRadio
then begin
LockRadioGroupOnChange(Group, -1);
end
else LockOnChange(PgtkObject(hndMenu),-1);
then LockRadioGroupOnChange(Group, -1)
else LockOnChange(Item, -1);
Result := True;
end
else begin
AMenuItem.RecreateHandle;
Result := True;
end else begin
LCLMenuItem:=TMenuItem(GetLCLObject(Pointer(hndMenu)));
if LCLMenuItem<>nil
then begin
LCLMenuItem.RecreateHandle;
Result := True;
end else
Result := False;
end;
end;
{------------------------------------------------------------------------------
Function: EnableMenuItem
Params: hndMenu:
uIDEnableItem:
Function: LCLEnableMenuItem
Params: AMenuItem:
Returns:
Enables, disables, or grays the specified menu item.
------------------------------------------------------------------------------}
function TGTKObject.EnableMenuItem(hndMenu: HMENU; uIDEnableItem: Integer;
bEnable: Boolean): Boolean;
function TGTKObject.LclEnableMenuItem(AMenuItem: TMenuItem): Boolean;
begin
if hndMenu <> 0
then gtk_widget_set_sensitive(pgtkwidget(hndMenu), bEnable);
Result:=true;
gtk_widget_set_sensitive(pgtkwidget(AMenuItem.Handle), AMenuItem.Enabled);
Result := True;
end;
@ -89,6 +82,10 @@ end;
{ =============================================================================
$Log$
Revision 1.2 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.1 2003/11/24 11:03:07 marc
* Splitted winapi*.inc into a winapi and a lcl interface communication part

View File

@ -1,4 +1,4 @@
{ $ID: $ }
{ $Id$ }
{******************************************************************************
All GTK interface communication implementations.
Initial Revision : Sun Nov 23 23:53:53 2003
@ -28,9 +28,8 @@
//##apiwiz##sps## // Do not remove
function CheckMenuItem(hndMenu: HMENU; uIDEnableItem: Integer; bChecked: Boolean): Boolean; override;
function EnableMenuItem(hndMenu: HMENU; uIDEnableItem: Integer; bEnable: Boolean): Boolean; override;
function LclCheckMenuItem(AMenuItem: TMenuItem): Boolean; override;
function LclEnableMenuItem(AMenuItem: TMenuItem): Boolean; override;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
@ -38,6 +37,10 @@ function EnableMenuItem(hndMenu: HMENU; uIDEnableItem: Integer; bEnable: Boolean
{ =============================================================================
$Log$
Revision 1.2 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.1 2003/11/24 11:03:07 marc
* Splitted winapi*.inc into a winapi and a lcl interface communication part

View File

@ -126,6 +126,7 @@ Type
function DestroyTimer(TimerHandle: Integer) : boolean; override;
{$I win32winapih.inc}
{$I win32lclintfh.inc}
End;
{$I win32listslh.inc}
@ -168,6 +169,7 @@ Var
{$I win32callback.inc}
{$I win32object.inc}
{$I win32winapi.inc}
{$I win32lclintf.inc}
Initialization
@ -185,6 +187,10 @@ End.
{ =============================================================================
$Log$
Revision 1.55 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.54 2003/11/25 21:20:38 micha
implement tchecklistbox

View File

@ -0,0 +1,77 @@
{ $Id$ }
{******************************************************************************
All GTK interface communication implementations.
Initial Revision : Sun Nov 23 23:53:53 2003
!! Keep alphabetical !!
Support routines go to gtkproc.pp
******************************************************************************
Implementation
******************************************************************************
*****************************************************************************
* *
* 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. *
* *
*****************************************************************************
}
//##apiwiz##sps## // Do not remove
{------------------------------------------------------------------------------
Function: LCLCheckMenuItem
Params: AMenuItem
Returns: Nothing
Checks or unchecks the specified menu item.
------------------------------------------------------------------------------}
Function TWin32Object.LclCheckMenuItem(AMenuItem: TMenuItem): Boolean;
var
CheckFlag: Integer;
Begin
if AMenuItem.Checked then CheckFlag := MF_CHECKED
else CheckFlag := MF_UNCHECKED;
CheckFlag := CheckFlag or MF_BYCOMMAND;
Result := Windows.CheckMenuItem(AMenuItem.Parent.Handle, AMenuItem.Command, CheckFlag) <> $FFFFFFFF;
End;
{------------------------------------------------------------------------------
Function: LCLEnableMenuItem
Params: AMenuItem:
Returns:
Enables, disables, or grays the specified menu item.
------------------------------------------------------------------------------}
Function TWin32Object.LclEnableMenuItem(AMenuItem: TMenuItem): Boolean;
Var
EnableFlag: Integer;
Begin
if AMenuItem.Enabled then EnableFlag := MF_ENABLED
else EnableFlag := MF_GRAYED;
EnableFlag := EnableFlag or MF_BYCOMMAND;
Result := Windows.EnableMenuItem(AMenuItem.Parent.Handle, AMenuItem.Command, EnableFlag);
End;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
{ =============================================================================
$Log$
Revision 1.1 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
}

View File

@ -0,0 +1,44 @@
{ $Id$ }
{******************************************************************************
All GTK interface communication implementations.
Initial Revision : Sun Nov 23 23:53:53 2003
!! Keep alphabetical !!
Support routines go to gtkproc.pp
******************************************************************************
Interface
******************************************************************************
*****************************************************************************
* *
* 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. *
* *
*****************************************************************************
}
//##apiwiz##sps## // Do not remove
function LclCheckMenuItem(AMenuItem: TMenuItem): Boolean; override;
function LclEnableMenuItem(AMenuItem: TMenuItem): Boolean; override;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
{ =============================================================================
$Log$
Revision 1.1 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
}

View File

@ -1958,44 +1958,6 @@ begin
Result := Windows.IsWindowVisible(handle);
end;
{------------------------------------------------------------------------------
Function: CheckMenuItem
Params: hndMenu: HMENU - menu handle
uIDEnableItem: Integer - menu item to check/uncheck
bChecked: Boolean - new state of the menu item
Returns: The previous state of the menu item.
Checks or unchecks the specified menu item.
------------------------------------------------------------------------------}
Function TWin32Object.LclCheckMenuItem(AMenuItem: TMenuItem; bChecked: Boolean): Boolean;
var
CheckFlag: Integer;
Begin
if BChecked then CheckFlag := MF_CHECKED
else CheckFlag := MF_UNCHECKED;
CheckFlag := CheckFlag or MF_BYCOMMAND;
Result := Windows.CheckMenuItem(AMenuItem.Parent.Handle, AMenuItem.Command, CheckFlag) <> $FFFFFFFF;
End;
{------------------------------------------------------------------------------
Method: EnableMenuItem
Params: HndMenu - handle to menu
UIDEnableItem - menu item to enable/disable
BEnable - new state of the menu item
Returns: The previous state of the menu item.
Enables, disables, or grays the specified menu item.
------------------------------------------------------------------------------}
Function TWin32Object.LclEnableMenuItem(AMenuItem: TMenuItem; BEnable: Boolean): Boolean;
Var
EnableFlag: Integer;
Begin
if BEnable then EnableFlag := MF_ENABLED
else EnableFlag := MF_GRAYED;
EnableFlag := EnableFlag or MF_BYCOMMAND;
Result := Windows.EnableMenuItem(AMenuItem.Parent.Handle, AMenuItem.Command, EnableFlag);
End;
{------------------------------------------------------------------------------
Method: LineTo
Params: DC - device context handle
@ -2882,6 +2844,10 @@ end;
{ =============================================================================
$Log$
Revision 1.77 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.76 2003/11/25 21:20:38 micha
implement tchecklistbox

View File

@ -124,9 +124,6 @@ function IntersectClipRect(dc: hdc; Left, Top, Right, Bottom: Integer): Integer;
Function InvalidateRect(AHandle: HWND; Rect: PRect; BErase: Boolean): Boolean; Override;
function IsWindowVisible(handle: HWND): boolean; override;
Function LclCheckMenuItem(AMenuItem: TMenuItem; bChecked: Boolean): Boolean; Override;
Function LclEnableMenuItem(AMenuItem: TMenuItem; BEnable: Boolean): Boolean; Override;
Function LineTo(DC: HDC; X, Y: Integer): Boolean; Override;
Function MaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Mask: HBITMAP; XMask, YMask: Integer; Rop: DWORD): Boolean; Override;
@ -193,6 +190,10 @@ Procedure DeleteCriticalSection(var CritSection: TCriticalSection); Override;
{ =============================================================================
$Log$
Revision 1.42 2003/11/26 00:23:47 marc
* implemented new LCL(check|enable)Menuitem functions
* introduced the lclintf inc files to win32
Revision 1.41 2003/11/25 14:21:28 micha
new api lclenable,checkmenuitem according to list