mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 04:18:48 +02:00
Many small fixes for TOpenDialog in wince
git-svn-id: trunk@21246 -
This commit is contained in:
parent
3c64282e95
commit
3c8e6f9173
@ -148,28 +148,23 @@ begin
|
||||
|
||||
// Create parent of all windows, 'button on taskbar'
|
||||
// does this work on wince?!
|
||||
FAppHandle := CreateWindowExW(0, @ClsName,
|
||||
(*FAppHandle := CreateWindowExW(0, @ClsName,
|
||||
PWideChar(UTF8Decode(Application.Title)),
|
||||
WS_POPUP or WS_CLIPSIBLINGS or WS_CAPTION or WS_SYSMENU or WS_MINIMIZEBOX,
|
||||
WS_POPUP or WS_CLIPSIBLINGS {or WS_CAPTION} or WS_SYSMENU or WS_MINIMIZEBOX,
|
||||
0, {Windows.GetSystemMetrics(SM_CXSCREEN) div 2,}
|
||||
0, {Windows.GetSystemMetrics(SM_CYSCREEN) div 2,}
|
||||
0, 0, HWND(nil), HMENU(nil), HInstance, nil);
|
||||
AllocWindowInfo(FAppHandle);
|
||||
AllocWindowInfo(FAppHandle);*)
|
||||
|
||||
// set nice main icon
|
||||
SendMessage(FAppHandle, WM_SETICON, ICON_BIG,
|
||||
Windows.LoadIcon(MainInstance, 'MAINICON'));
|
||||
// remove useless menuitems from sysmenu
|
||||
{}
|
||||
// SysMenu := Windows.GetSystemMenu(FAppHandle, False);
|
||||
|
||||
// Windows.DeleteMenu(SysMenu, SC_MAXIMIZE, MF_BYCOMMAND);
|
||||
|
||||
// Windows.DeleteMenu(SysMenu, SC_SIZE, MF_BYCOMMAND);
|
||||
|
||||
// Windows.DeleteMenu(SysMenu, SC_MOVE, MF_BYCOMMAND);
|
||||
|
||||
|
||||
// initialize ScreenInfo
|
||||
Handle := GetDesktopWindow;
|
||||
DC := Windows.GetDC(Handle);
|
||||
|
@ -1311,16 +1311,16 @@ Begin
|
||||
end;
|
||||
|
||||
function GetWinCEPlatform: TApplicationType;
|
||||
{$ifndef Win32}
|
||||
{$ifdef Win32}
|
||||
begin
|
||||
Result := atDesktop;
|
||||
end;
|
||||
{$else}
|
||||
var
|
||||
buf: array[0..50] of WideChar;
|
||||
{$endif}
|
||||
begin
|
||||
Result := atDefault;
|
||||
|
||||
{$ifdef Win32}
|
||||
Result := atDefault;//atDesktop;
|
||||
{$else}
|
||||
if Windows.SystemParametersInfo(SPI_GETPLATFORMTYPE, sizeof(buf), @buf, 0) then
|
||||
begin
|
||||
if WideStrCmp(@buf, 'PocketPC') = 0 then
|
||||
@ -1330,8 +1330,8 @@ begin
|
||||
else if GetLastError = ERROR_ACCESS_DENIED then
|
||||
Result := atSmartphone;
|
||||
end;
|
||||
{$endif}
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
|
@ -1684,49 +1684,46 @@ end;
|
||||
Returns: true on success
|
||||
|
||||
Returns the current widget Width and Height
|
||||
|
||||
Note: Windows.GetWindowInfo doesnt exist in wince, but
|
||||
we can use GetWindowLong and other APIs for most information
|
||||
|
||||
Also GetWindowPlacement doesnt exist
|
||||
------------------------------------------------------------------------------}
|
||||
function TWinCEWidgetSet.GetWindowSize(Handle : hwnd;
|
||||
var Width, Height: integer): boolean;
|
||||
var
|
||||
WP: WINDOWPLACEMENT;
|
||||
R: TRect;
|
||||
Style, ExStyle: LongInt;
|
||||
WindowInfo: PWindowInfo;
|
||||
Style, ExStyle: longint;
|
||||
|
||||
procedure AdjustForBuddySize;
|
||||
var
|
||||
BuddyWidth, BuddyHeight: integer;
|
||||
begin
|
||||
GetWindowSize(Windows.SendMessage(Handle, UDM_GETBUDDY, 0, 0), BuddyWidth, BuddyHeight);
|
||||
Inc(Width, BuddyWidth);
|
||||
end;
|
||||
{ procedure AdjustForBuddySize;
|
||||
var
|
||||
BuddyHandle: HWND;
|
||||
BuddyWP: WINDOWPLACEMENT;
|
||||
begin
|
||||
BuddyHandle := Windows.SendMessage(Handle, UDM_GETBUDDY, 0, 0);
|
||||
if (BuddyHandle<>HWND(nil)) and Windows.GetWindowPlacement(BuddyHandle, BuddyWP)
|
||||
then Width := WP.rcNormalPosition.Right - BuddyWP.rcNormalPosition.Left;
|
||||
end;}
|
||||
|
||||
begin
|
||||
WP.length := SizeOf(WP);
|
||||
// Result := Boolean(Windows.GetWindowPlacement(Handle, WP));
|
||||
// if (WP.showCmd=SW_MAXIMIZE) then
|
||||
begin
|
||||
// if the form is maximized, you can't use the normal size
|
||||
Result := Boolean(Windows.GetWindowRect(Handle,@R));
|
||||
with R do
|
||||
begin
|
||||
Width := Right - Left;
|
||||
Height := Bottom - Top;
|
||||
end;
|
||||
end;
|
||||
{ else
|
||||
with WP.rcNormalPosition do
|
||||
begin
|
||||
Width := Right - Left;
|
||||
Height := Bottom - Top;
|
||||
end;}
|
||||
WindowInfo := GetWindowInfo(Handle);
|
||||
Result := Boolean(Windows.GetWindowRect(Handle, R));
|
||||
|
||||
//debugln('TWinCEWidgetSet.GetWindowSize ',DbgSName(WindowInfo^.WinControl),' SW_MAXIMIZE=',dbgs(WP.showCmd=SW_MAXIMIZE),' ',dbgs(WP.rcNormalPosition));
|
||||
if not Result then
|
||||
Exit;
|
||||
|
||||
// No special handling for maximized windows
|
||||
// they dont exist in wince anyway, they are
|
||||
// emulated by calculating the desktop size
|
||||
Width := R.Right - R.Left;
|
||||
Height := R.Bottom - R.Top;
|
||||
|
||||
WindowInfo := winceproc.GetWindowInfo(Handle);
|
||||
|
||||
// convert top level lcl window coordinaties to win32 coord
|
||||
Style := Windows.GetWindowLong(Handle, GWL_STYLE);
|
||||
ExStyle := Windows.GetWindowLong(Handle, GWL_EXSTYLE);
|
||||
Style := Windows.GetWindowLongW(Handle, GWL_STYLE);
|
||||
ExStyle := Windows.GetWindowLongW(Handle, GWL_EXSTYLE);
|
||||
if (Style and WS_THICKFRAME) <> 0 then
|
||||
begin
|
||||
// thick, sizing border
|
||||
@ -1740,6 +1737,8 @@ begin
|
||||
Dec(Width, 2*Windows.GetSystemMetrics(SM_CXFIXEDFRAME));
|
||||
Dec(Height, 2*Windows.GetSystemMetrics(SM_CYFIXEDFRAME));
|
||||
end;
|
||||
|
||||
// ExcludeCaption
|
||||
if (Style and WS_CAPTION) <> 0 then
|
||||
if (ExStyle and WS_EX_TOOLWINDOW) <> 0 then
|
||||
Dec(Height, Windows.GetSystemMetrics(SM_CYSMCAPTION))
|
||||
@ -1751,8 +1750,6 @@ begin
|
||||
end;
|
||||
|
||||
{
|
||||
|
||||
|
||||
function TWinCEWidgetSet.GradientFill(DC: HDC; Vertices: PTriVertex;
|
||||
NumVertices: Longint; Meshes: Pointer; NumMeshes: Longint; Mode: Longint
|
||||
): Boolean;
|
||||
|
@ -246,7 +246,7 @@ begin
|
||||
WindowInfo^.WinControl := AWinControl;
|
||||
AWinControl.Handle := Window;
|
||||
if SubClassWndProc <> nil then
|
||||
WindowInfo^.DefWndProc := Windows.WNDPROC(Windows.SetWindowLong(
|
||||
WindowInfo^.DefWndProc := Windows.WNDPROC(Windows.SetWindowLongW(
|
||||
Window, GWL_WNDPROC, LongInt(SubClassWndProc)));
|
||||
if AWinControl.Font.IsDefault then
|
||||
lhFont := WinCEWidgetset.MessageFont
|
||||
|
@ -230,6 +230,9 @@ begin
|
||||
ResultForm := TWinCEFileDialogForm(ACommonDialog.Handle);
|
||||
|
||||
ResultForm.ShowModal;
|
||||
|
||||
// Without setting UserChoice the app will be locked
|
||||
ACommonDialog.UserChoice := ResultForm.ModalResult;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
@ -273,16 +273,17 @@ begin
|
||||
// customization of Params
|
||||
with Params do
|
||||
begin
|
||||
//TODO: Make control respond to user scroll request
|
||||
pClassName := @ClsName;
|
||||
// Different from win32
|
||||
FlagsEx := 0;
|
||||
Flags := WS_OVERLAPPEDWINDOW;
|
||||
WindowTitle := StrCaption;
|
||||
SubClassWndProc := nil; // Otherwise crash in wince, works in win32
|
||||
BorderStyle := TCustomForm(AWinControl).BorderStyle;
|
||||
|
||||
// Same as in win32
|
||||
lForm := TCustomForm(AWinControl);
|
||||
CalcFormWindowFlags(lForm, Flags, FlagsEx);
|
||||
SubClassWndProc := nil;
|
||||
Parent := 0;
|
||||
BorderStyle := TCustomForm(AWinControl).BorderStyle;
|
||||
pClassName := @ClsName;
|
||||
WindowTitle := StrCaption;
|
||||
AdjustFormBounds(lForm, Bounds);
|
||||
|
||||
// Gets the work area
|
||||
@ -337,9 +338,11 @@ begin
|
||||
end;
|
||||
end
|
||||
else
|
||||
{ On Desktop mode we need to take into consideration the size of
|
||||
the window decoration }
|
||||
begin
|
||||
{ On Desktop mode we need to take into consideration the size of
|
||||
the window decoration }
|
||||
CalculateDialogPosition(Params, Bounds, lForm);
|
||||
end;
|
||||
end;
|
||||
|
||||
// create window
|
||||
|
Loading…
Reference in New Issue
Block a user