mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 08:19:41 +02:00
wince:
- copy missed TListBox code from win32 - copy win32 fix to CallDefaultWindowProc - some formatting git-svn-id: trunk@13723 -
This commit is contained in:
parent
b6ebd55696
commit
39dd581366
@ -29,8 +29,8 @@ TWinControlAccess = class(TWinControl);
|
||||
|
||||
Enumerates and removes properties for the target window
|
||||
-----------------------------------------------------------------------------}
|
||||
Function PropEnumProc(Window: Hwnd; Str: PChar; Data: Handle): LongBool; StdCall;
|
||||
Begin
|
||||
function PropEnumProc(Window: Hwnd; Str: PChar; Data: Handle): LongBool; stdcall;
|
||||
begin
|
||||
Result:=false;
|
||||
if PtrUInt(Str) <= $FFFF then exit; // global atom handle
|
||||
Assert(False, 'Trace:PropEnumProc - Start');
|
||||
@ -39,7 +39,7 @@ Begin
|
||||
RemoveProp(Window{, Str});
|
||||
Result := True;
|
||||
Assert(False, 'Trace:PropEnumProc - Exit');
|
||||
End;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: CallDefaultWindowProc
|
||||
@ -67,8 +67,10 @@ begin
|
||||
MessageStackDepth[depthLen] := '#';
|
||||
{$endif}
|
||||
PrevWndProc := GetWindowInfo(Window)^.DefWndProc;
|
||||
if PrevWndProc = nil then
|
||||
if (PrevWndProc = nil) or (PrevWndProc = @WindowProc) // <- prevent recursion
|
||||
then begin
|
||||
Result := Windows.DefWindowProc(Window, Msg, WParam, LParam)
|
||||
end
|
||||
else begin
|
||||
// combobox child edit weirdness: combobox handling WM_SIZE will compare text
|
||||
// to list of strings, and if appears in there, will set the text, and select it
|
||||
@ -1232,8 +1234,7 @@ begin
|
||||
end;
|
||||
End;*)
|
||||
WM_DRAWITEM:
|
||||
Begin
|
||||
|
||||
begin
|
||||
if (WParam = 0) and (PDrawItemStruct(LParam)^.ctlType = ODT_MENU) then
|
||||
begin
|
||||
menuItem := TObject(PDrawItemStruct(LParam)^.itemData);
|
||||
@ -1285,7 +1286,7 @@ begin
|
||||
end;
|
||||
WinProcess := false;
|
||||
end;
|
||||
End;
|
||||
end;
|
||||
WM_ENABLE:
|
||||
Begin
|
||||
If WParam <> 0 Then
|
||||
@ -1848,8 +1849,9 @@ begin
|
||||
Windows.InvalidateRect(Window, nil, true);
|
||||
End;
|
||||
WM_MEASUREITEM:
|
||||
Begin
|
||||
if WParam = 0 then begin
|
||||
begin
|
||||
if WParam = 0 then
|
||||
begin
|
||||
menuItem := TObject(PMeasureItemStruct(LParam)^.itemData);
|
||||
if menuItem is TMenuItem then
|
||||
begin
|
||||
@ -1862,16 +1864,20 @@ begin
|
||||
end else
|
||||
DebugLn('WM_MEASUREITEM for a menuitem catched but menuitem is not TmenuItem');
|
||||
end;
|
||||
if LWinControl<>nil then begin
|
||||
if LWinControl is TCustomCombobox then begin
|
||||
if LWinControl<>nil then
|
||||
begin
|
||||
if LWinControl is TCustomCombobox then
|
||||
begin
|
||||
LMessage.Msg := LM_MEASUREITEM;
|
||||
LMessage.LParam := LParam;
|
||||
LMessage.WParam := WParam;
|
||||
Winprocess := False;
|
||||
end else
|
||||
if WParam <> 0 then begin
|
||||
if WParam <> 0 then
|
||||
begin
|
||||
LWinControl := TWinControl(WParam);
|
||||
if LWinControl<>nil then begin
|
||||
if LWinControl<>nil then
|
||||
begin
|
||||
LMessage.Msg := LM_MEASUREITEM;
|
||||
LMessage.LParam := LParam;
|
||||
LMessage.WParam := WParam;
|
||||
@ -1879,7 +1885,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
End;
|
||||
end;
|
||||
WM_LCL_SOCK_ASYNC:
|
||||
begin
|
||||
if (Window = TWinCEWidgetSet(WidgetSet).AppHandle) and
|
||||
|
@ -30,7 +30,7 @@ uses
|
||||
// Libs
|
||||
Windows,
|
||||
// LCL
|
||||
SysUtils, LCLType, Classes, StdCtrls, Controls, Graphics, Forms, WinCEProc ,
|
||||
SysUtils, LCLType, Classes, StdCtrls, Controls, Graphics, Forms, WinCEProc,
|
||||
InterfaceBase,
|
||||
// Widgetset
|
||||
WSStdCtrls, WSLCLClasses, WinCEInt, WinCEWSControls, WinCEExtra;
|
||||
@ -116,6 +116,7 @@ type
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class function GetIndexAtY(const ACustomListBox: TCustomListBox; y: integer): integer; override;
|
||||
class function GetItemIndex(const ACustomListBox: TCustomListBox): integer; override;
|
||||
class function GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean; override;
|
||||
class function GetSelCount(const ACustomListBox: TCustomListBox): integer; override;
|
||||
class function GetSelected(const ACustomListBox: TCustomListBox; const AIndex: integer): boolean; override;
|
||||
class function GetStrings(const ACustomListBox: TCustomListBox): TStrings; override;
|
||||
@ -123,6 +124,7 @@ type
|
||||
|
||||
class procedure SelectItem(const ACustomListBox: TCustomListBox; AIndex: integer; ASelected: boolean); override;
|
||||
class procedure SetBorder(const ACustomListBox: TCustomListBox); override;
|
||||
class procedure SetColumnCount(const ACustomListBox: TCustomListBox; ACount: Integer); override;
|
||||
class procedure SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer); override;
|
||||
class procedure SetSelectionMode(const ACustomListBox: TCustomListBox; const AExtendedSelect,
|
||||
AMultiSelect: boolean); override;
|
||||
@ -438,6 +440,8 @@ begin
|
||||
Flags := Flags or LBS_EXTENDEDSEL
|
||||
else
|
||||
Flags := Flags or LBS_MULTIPLESEL;
|
||||
if Columns > 1 then
|
||||
Flags := Flags or LBS_MULTICOLUMN;
|
||||
if AWinControl.FCompStyle = csCheckListBox then
|
||||
Flags := Flags or LBS_OWNERDRAWFIXED
|
||||
else case Style of
|
||||
@ -468,10 +472,14 @@ begin
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
//this should not be called in multiple selection things
|
||||
class function TWinCEWSCustomListBox.GetItemIndex(const ACustomListBox: TCustomListBox): integer;
|
||||
begin
|
||||
Result := SendMessage(ACustomListBox.Handle, LB_GETCURSEL, 0, 0);
|
||||
if ACustomListBox.MultiSelect then
|
||||
// Return focused item for multiselect listbox
|
||||
Result := SendMessage(ACustomListBox.Handle, LB_GETCARETINDEX, 0, 0)
|
||||
else
|
||||
// LB_GETCURSEL is only for single select listbox
|
||||
Result := SendMessage(ACustomListBox.Handle, LB_GETCURSEL, 0, 0);
|
||||
if Result = LB_ERR then
|
||||
begin
|
||||
Assert(false, 'Trace:[TWinCEWSCustomListBox.GetItemIndex] could not retrieve itemindex, try selecting an item first');
|
||||
@ -479,6 +487,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TWinCEWSCustomListBox.GetItemRect(
|
||||
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
||||
): boolean;
|
||||
begin
|
||||
Result := Windows.SendMessage(ACustomListBox.Handle, LB_GETITEMRECT, Index,
|
||||
LPARAM(@ARect)) <> LB_ERR;
|
||||
end;
|
||||
|
||||
class function TWinCEWSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer;
|
||||
begin
|
||||
// GetSelCount only works for multiple-selection listboxes
|
||||
@ -546,6 +562,13 @@ begin
|
||||
SetWindowLong(Handle, GWL_EXSTYLE, StyleEx);
|
||||
end;
|
||||
|
||||
class procedure TWinCEWSCustomListBox.SetColumnCount(const ACustomListBox: TCustomListBox;
|
||||
ACount: Integer);
|
||||
begin
|
||||
// The listbox styles can't be updated, so recreate the listbox
|
||||
RecreateWnd(ACustomListBox);
|
||||
end;
|
||||
|
||||
class procedure TWinCEWSCustomListBox.SetItemIndex(const ACustomListBox: TCustomListBox; const AIndex: integer);
|
||||
var
|
||||
Handle: HWND;
|
||||
|
Loading…
Reference in New Issue
Block a user