From b8c82bc41f88e86c66e60d4671a4dea542c365a8 Mon Sep 17 00:00:00 2001 From: micha Date: Wed, 12 May 2004 09:46:25 +0000 Subject: [PATCH] fix toolbar buttons by handling them as customcontrols remove handledialogmessage, now handled in lcl git-svn-id: trunk@5459 - --- lcl/interfaces/win32/win32int.pp | 6 ++++- lcl/interfaces/win32/win32object.inc | 39 +++++++++++++--------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/lcl/interfaces/win32/win32int.pp b/lcl/interfaces/win32/win32int.pp index bfe58656e5..dddcc63844 100644 --- a/lcl/interfaces/win32/win32int.pp +++ b/lcl/interfaces/win32/win32int.pp @@ -130,7 +130,7 @@ Type Desc: PRawImageDescription); Function WinRegister: Boolean; - Function ToolBtnWinRegister: Boolean; +// Function ToolBtnWinRegister: Boolean; Procedure SetOwner(Window: HWND; Owner: TObject); Procedure PaintPixmap(Surface: TObject; PixmapData: Pointer); Procedure NormalizeIconName(Var IconName: String); @@ -255,6 +255,10 @@ End. { ============================================================================= $Log$ + Revision 1.78 2004/05/12 09:46:25 micha + fix toolbar buttons by handling them as customcontrols + remove handledialogmessage, now handled in lcl + Revision 1.77 2004/04/11 10:19:28 micha cursor management updated: - lcl notifies interface via WSControl.SetCursor of changes diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 22c88b40f9..78d170683e 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -91,7 +91,7 @@ Begin DestroyWindow(FAppHandle); Windows.UnregisterClass(@ClsName, System.HInstance); - Windows.UnregisterClass(@ToolBtnClsName, System.HInstance); +// Windows.UnregisterClass(@ToolBtnClsName, System.HInstance); Inherited Destroy; End; @@ -115,12 +115,13 @@ Begin writeln('Trace:Win32Object.Init - Register Failed'); Exit; End; +{ If Not ToolBtnWinRegister then Begin Assert(False, 'Trace:Win32Object.Init - Toolbar button Register Failed'); Exit; End; - +} //Init stock objects; LogBrush.lbStyle := BS_NULL; FStockNullBrush := CreateBrushIndirect(LogBrush); @@ -1134,30 +1135,14 @@ Procedure TWin32WidgetSet.HandleEvents; var AMessage: TMsg; AccelTable: HACCEL; - - function HandleDialogMessage: Boolean; - var - TopParent, TmpParent: HWnd; - begin - TmpParent := AMessage.HWnd; - repeat - TopParent := TmpParent; - TmpParent := Windows.GetParent(TmpParent); - until TmpParent = HWND(nil); - Result := Windows.IsDialogMessage(TopParent, @AMessage); - end; - Begin While PeekMessage(AMessage, HWnd(Nil), 0, 0,PM_REMOVE) Do Begin AccelTable := HACCEL(Windows.GetProp(AMessage.HWnd, 'Accel')); If (AccelTable = HACCEL(nil)) or (TranslateAccelerator(AMessage.HWnd, AccelTable, @AMessage) = 0) Then Begin - if not HandleDialogMessage then - Begin - TranslateMessage(@AMessage); - DispatchMessage(@AMessage); - End; + TranslateMessage(@AMessage); + DispatchMessage(@AMessage); End; End; End; @@ -1308,6 +1293,7 @@ Begin Assert(False, 'Trace:WinRegister - Exit'); End; +(* Function TWin32WidgetSet.ToolBtnWinRegister: boolean; var WinClass: WndClass; begin @@ -1325,6 +1311,7 @@ begin end; Result := Windows.RegisterClass(@WinClass) <> 0; end; +*) {------------------------------------------------------------------------------ Method: TWin32WidgetSet.PaintPixmap @@ -2036,7 +2023,7 @@ Begin WindowTitle := StrCaption; Flags := Flags Or ES_AUTOHSCROLL; End; - csArrow, csFixed: + csArrow, csFixed, csToolButton: Begin Assert(False, 'Trace:TODO: Figure out what component style csFixed is and code the component. No component created.'); pClassName := @ClsName; @@ -2205,12 +2192,14 @@ Begin pClassName := TOOLBARCLASSNAME; Flags := Flags OR CCS_ADJUSTABLE; End; +{ csToolButton: Begin pClassName := ToolBtnClsName; Flags := 0; SubClassWndProc := nil; End; +} // TCustomPage - Notebook page csPage: Begin @@ -2308,6 +2297,10 @@ Begin end; Window := CreateWindowEx(FlagsEx, pClassName, WindowTitle, Flags, Left, Top, Width, Height, Parent, MenuHandle, HInstance, Nil); + if Window = 0 then + begin + raise exception.create('failed to create win32 control, error: '+IntToStr(GetLastError())); + end; { after creating a child window the following happens: 1) the previously bottom window is thrown to the top 2) the created window is added at the bottom @@ -2981,6 +2974,10 @@ End; { $Log$ + Revision 1.191 2004/05/12 09:46:25 micha + fix toolbar buttons by handling them as customcontrols + remove handledialogmessage, now handled in lcl + Revision 1.190 2004/05/09 19:14:45 micha fix update menu caption at runtime (code accidently commented by me, i think)