patch from Martin Smat for menu items and default messages

git-svn-id: trunk@3957 -
This commit is contained in:
mattias 2003-03-25 08:12:39 +00:00
parent 964c20a9c5
commit c184ecd39a
4 changed files with 53 additions and 5 deletions

View File

@ -482,6 +482,9 @@ Begin
End;
End;
If WinProcess Then
Result := DefWindowProc(Window, Msg, WParam, LParam);
{$IFDEF VER1_1}
List := TMsgArray(GetProp(Window, 'MsgList'));
If Pointer(List) <> Nil Then
@ -496,9 +499,6 @@ Begin
DeliverMessage(OwnerObject, LMessage);
{$ENDIF VER1_1}
If WinProcess Then
Result := DefWindowProc(Window, Msg, WParam, LParam);
Assert(False, 'Trace:WindowProc - Exit');
End;
@ -545,6 +545,9 @@ end;
{
$Log$
Revision 1.26 2003/03/25 08:12:39 mattias
patch from Martin Smat for menu items and default messages
Revision 1.25 2003/03/18 18:23:07 mattias
popupmenus for win32 intf from Martin Smat

View File

@ -525,8 +525,15 @@ Begin
DestroyWindow(Handle);
End
Else If Sender Is TMenu Then
Begin
If Handle <> 0 Then
DestroyMenu(Handle)
End
Else If Sender Is TMenuItem Then
Begin
DeleteMenu((Sender as TMenuItem).Parent.Handle, Handle, MF_BYCOMMAND);
DrawMenuBar(((Sender as TMenuItem).Owner as TWinControl).Handle);
End
Else
Assert(False, Format('Trace:I don''t know how to destroy component %S', [Sender.ClassName]));
End;
@ -2568,10 +2575,30 @@ Procedure TWin32Object.AttachMenu(Sender: TObject);
var MenuInfo: MENUITEMINFO;
MenuHandle: HMenu;
ParentMenuHandle: HMenu;
ParentOfParent: HMenu;
Style: integer;
Mask: integer;
Msg: TLMShortCut;
Begin
ParentMenuHandle := (Sender as TMenuItem).Parent.Handle;
{Following part fixes the case when an item is added in runtime
but the parent item has not defined the submenu flag (hSubmenu=0) }
if (Sender as TMenuItem).Parent.Parent<>nil then
begin
ParentOfParent := (Sender as TMenuItem).Parent.Parent.Handle;
with MenuInfo do begin
cbSize:=sizeof(MENUITEMINFO);
fMask:=MIIM_SUBMENU;
end;
GetMenuItemInfo(ParentOfParent, ParentMenuHandle, false, @MenuInfo);
if MenuInfo.hSubmenu=0 then // the parent menu item is not yet defined with submenu flag
begin
MenuInfo.hSubmenu:=ParentMenuHandle;
SetMenuItemInfo(ParentOfParent, ParentMenuHandle, false, MenuInfo);
end;
end;
Mask := MIIM_ID or MIIM_DATA;
if ((Sender as TMenuItem).Count > 0) then Mask := Mask or MIIM_SUBMENU;
MenuHandle := (Sender as TMenuItem).Handle;
@ -2588,7 +2615,6 @@ Begin
{dwTypeData:=LPSTR((Sender as TmenuItem).Caption);}
{cch:=length((Sender as TMenuItem).Caption);} {not needed}
end;
ParentMenuHandle := (Sender as TMenuItem).Parent.Handle;
InsertMenuItem(ParentMenuHandle, 0, false, @MenuInfo);
if (Sender as TMenuItem).ShortCut <> 0 then
begin
@ -2633,6 +2659,9 @@ End;
{
$Log$
Revision 1.51 2003/03/25 08:12:39 mattias
patch from Martin Smat for menu items and default messages
Revision 1.50 2003/03/18 18:23:07 mattias
popupmenus for win32 intf from Martin Smat

View File

@ -1390,6 +1390,16 @@ begin
Result := Windows.IntersectClipRect(DC, Left, Top, Right, Bottom);
end;
{------------------------------------------------------------------------------
Method: IsWindowVisible
Params: handle - window handle
Returns: true if window is visible, false otherwise
------------------------------------------------------------------------------}
function TWin32Object.IsWindowVisible(handle: HWND): boolean;
begin
Result := Windows.IsWindowVisible(handle);
end;
{------------------------------------------------------------------------------
Method: LineTo
Params: DC - device context handle
@ -2312,6 +2322,9 @@ end;
{ =============================================================================
$Log$
Revision 1.33 2003/03/25 08:12:39 mattias
patch from Martin Smat for menu items and default messages
Revision 1.32 2003/03/18 18:23:07 mattias
popupmenus for win32 intf from Martin Smat

View File

@ -108,7 +108,7 @@ Function HideCaret(HWnd: HWND): Boolean; Override;
function IntersectClipRect(dc: hdc; Left, Top, Right, Bottom: Integer): Integer; override;
Function InvalidateRect(AHandle: HWND; Rect: PRect; BErase: Boolean): Boolean; Override;
function IsWindowVisible(handle: HWND): 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;
@ -173,6 +173,9 @@ Procedure DeleteCriticalSection(var CritSection: TCriticalSection); Override;
{ =============================================================================
$Log$
Revision 1.23 2003/03/25 08:12:39 mattias
patch from Martin Smat for menu items and default messages
Revision 1.22 2003/03/06 17:15:49 mattias
applied patch from Martin Smat fixing LM_SETSIZE, LM_SETDESIGNING, LM_SCREENINIT