Starts the support in the LCL for assyncronous modal dialogs, implements MessageBox in LCL-CustomDrawn-Android and updates the Android example to test this API

git-svn-id: trunk@34117 -
This commit is contained in:
sekelsenmat 2011-12-11 20:31:09 +00:00
parent 4495bb0f1f
commit 6646781795
13 changed files with 353 additions and 54 deletions

View File

@ -69,6 +69,7 @@ public class LCLActivity extends Activity
public native int LCLDrawToBitmap(int width, int height, Bitmap bitmap);
public native int LCLOnTouch(float x, float y, int action);
public native int LCLOnCreate(LCLActivity lclactivity);
public native int LCLOnMessageBoxFinished(int Result);
// -------------------------------------------
// Functions exported to the Pascal side
@ -95,12 +96,130 @@ public class LCLActivity extends Activity
localcanvas.drawText(lcltext, 0, 0, localpaint);
}
// LCLType definitions
private final int MB_OK = 0x00000000;
private final int MB_OKCANCEL = 0x00000001;
private final int MB_ABORTRETRYIGNORE = 0x00000002;
private final int MB_YESNOCANCEL = 0x00000003;
private final int MB_YESNO = 0x00000004;
private final int MB_RETRYCANCEL = 0x00000005;
private final int MB_ICONHAND = 0x00000010;
private final int MB_ICONQUESTION = 0x00000020;
private final int MB_ICONEXCLAMATION = 0x00000030;
private final int MB_ICONASTERICK = 0x00000040;
//MB_ICONWARNING = MB_ICONEXCLAMATION;
//MB_ICONERROR = MB_ICONHAND;
//MB_ICONSTOP = MB_ICONHAND;
//MB_ICONINFORMATION = MB_ICONASTERICK;
private final int IDOK = 1; //ID_OK = IDOK;
private final int IDCANCEL = 2; //ID_CANCEL = IDCANCEL;
private final int IDABORT = 3; //ID_ABORT = IDABORT;
private final int IDRETRY = 4; //ID_RETRY = IDRETRY;
private final int IDIGNORE = 5; //ID_IGNORE = IDIGNORE;
private final int IDYES = 6; //ID_YES = IDYES;
private final int IDNO = 7; //ID_NO = IDNO;
private final int IDCLOSE = 8; //ID_CLOSE = IDCLOSE;
private final int IDHELP = 9; //ID_HELP = IDHELP;
private int LCLMessageBoxType; // Stores the type of the last message box
// input: String lcltext, String lcltitle, int lclconfig (buttons)
// output: nothing, but calles LCLOnMessageBoxFinished
public void LCLDoShowMessageBox()
{
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
switch (LCLMessageBoxType)
{
case MB_OK:
LCLOnMessageBoxFinished(IDOK);
break;
case MB_OKCANCEL:
if (which == DialogInterface.BUTTON_POSITIVE) LCLOnMessageBoxFinished(IDOK);
else LCLOnMessageBoxFinished(IDCANCEL);
break;
case MB_ABORTRETRYIGNORE:
if (which == DialogInterface.BUTTON_POSITIVE) LCLOnMessageBoxFinished(IDRETRY);
else if (which == DialogInterface.BUTTON_NEGATIVE) LCLOnMessageBoxFinished(IDABORT);
else LCLOnMessageBoxFinished(IDIGNORE);
break;
case MB_YESNOCANCEL:
if (which == DialogInterface.BUTTON_POSITIVE) LCLOnMessageBoxFinished(IDYES);
else if (which == DialogInterface.BUTTON_NEGATIVE) LCLOnMessageBoxFinished(IDNO);
else LCLOnMessageBoxFinished(IDCANCEL);
break;
case MB_YESNO:
if (which == DialogInterface.BUTTON_POSITIVE) LCLOnMessageBoxFinished(IDYES);
else LCLOnMessageBoxFinished(IDNO);
break;
case MB_RETRYCANCEL:
if (which == DialogInterface.BUTTON_POSITIVE) LCLOnMessageBoxFinished(IDRETRY);
else LCLOnMessageBoxFinished(IDCANCEL);
break;
};
}
};
DialogInterface.OnCancelListener dialogCancelListener = new DialogInterface.OnCancelListener()
{
@Override
public void onCancel(DialogInterface dialog)
{
LCLOnMessageBoxFinished(IDCANCEL);
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(lcltext);
builder.setTitle(lcltitle);
LCLMessageBoxType = lclconfig;
switch (lclconfig)
{
case MB_OK:
builder.setPositiveButton("OK", dialogClickListener);
break;
case MB_OKCANCEL:
builder.setPositiveButton("OK", dialogClickListener);
builder.setNegativeButton("Cancel", dialogClickListener);
break;
case MB_ABORTRETRYIGNORE:
builder.setNegativeButton("Abort", dialogClickListener);
builder.setPositiveButton("Retry", dialogClickListener);
builder.setNeutralButton("Ignore", dialogClickListener);
break;
case MB_YESNOCANCEL:
builder.setPositiveButton("Yes", dialogClickListener);
builder.setNegativeButton("No", dialogClickListener);
builder.setNeutralButton("Cancel", dialogClickListener);
break;
case MB_YESNO:
builder.setPositiveButton("Yes", dialogClickListener);
builder.setNegativeButton("No", dialogClickListener);
break;
case MB_RETRYCANCEL:
builder.setPositiveButton("Retry", dialogClickListener);
builder.setNegativeButton("Cancel", dialogClickListener);
break;
};
builder.show().setOnCancelListener(dialogCancelListener);
}
// -------------------------------------------
// Fields exported to the Pascal side for easier data communication
// -------------------------------------------
public String lcltext;
public String lcltitle;
public String lclpositivebutton;
public String lclnegativebutton;
public String lclneutralbutton;
public int lclwidth;
public int lclheight;
public int lclconfig;
public Bitmap lclbitmap;
static

View File

@ -17,6 +17,7 @@ exports
Java_com_pascal_lclproject_LCLActivity_LCLOnTouch name 'Java_com_pascal_lcltest_LCLActivity_LCLOnTouch',
Java_com_pascal_lclproject_LCLActivity_LCLDrawToBitmap name 'Java_com_pascal_lcltest_LCLActivity_LCLDrawToBitmap',
Java_com_pascal_lclproject_LCLActivity_LCLOnCreate name 'Java_com_pascal_lcltest_LCLActivity_LCLOnCreate',
Java_com_pascal_lclproject_LCLActivity_LCLOnMessageBoxFinished name 'Java_com_pascal_lcltest_LCLActivity_LCLOnMessageBoxFinished',
JNI_OnLoad name 'JNI_OnLoad',
JNI_OnUnload name 'JNI_OnUnload';
{$endif}

View File

@ -48,10 +48,19 @@ object Form1: TForm1
end
object CheckBox1: TCheckBox
Left = 72
Height = 18
Height = 21
Top = 48
Width = 91
Width = 94
Caption = 'CheckBox1'
TabOrder = 4
end
object Button2: TButton
Left = 96
Height = 25
Top = 160
Width = 75
Caption = 'Button2'
OnClick = Button2Click
TabOrder = 5
end
end

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
LCLProc, Arrow, StdCtrls, ComCtrls;
LCLProc, Arrow, StdCtrls, ComCtrls, LCLType, LCLIntf;
type
TSubControl = class;
@ -16,6 +16,7 @@ type
TForm1 = class(TForm)
Arrow1: TArrow;
Button1: TButton;
Button2: TButton;
CheckBox1: TCheckBox;
ProgressBar1: TProgressBar;
TrackBar1: TTrackBar;
@ -27,6 +28,7 @@ type
procedure Arrow1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
@ -37,6 +39,7 @@ type
{ public declarations }
SubControl: TSubControl;
ClickCounter: Integer;
procedure HandleMessageBoxExecute(Sender: TObject; AResult: Integer);
end;
{ TSubControl }
@ -132,13 +135,21 @@ begin
ProgressBar1.Position := ProgressBar1.Position + 10;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.OnMessageBoxExecute := @HandleMessageBoxExecute;
DebugLn('Button2Click A');
LCLIntf.MessageBox(0, 'Text', 'Title', MB_ABORTRETRYIGNORE);
DebugLn('Button2Click B');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
SubControl := TSubControl.Create(Self);
SubControl.Left := 40;
SubControl.Top := 160;
SubControl.Width := 100;
SubControl.Height := 100;
SubControl.Width := 50;
SubControl.Height := 50;
SubControl.Parent := Self;
end;
@ -166,5 +177,10 @@ begin
Canvas.Rectangle(200, 200, 300, 300);}
end;
procedure TForm1.HandleMessageBoxExecute(Sender: TObject; AResult: Integer);
begin
DebugLn(Format('[TForm1.HandleMessageBoxExecute] AResult=%d', [AResult]));
end;
end.

View File

@ -1111,6 +1111,7 @@ type
TIdleEvent = procedure (Sender: TObject; var Done: Boolean) of object;
TOnUserInputEvent = procedure(Sender: TObject; Msg: Cardinal) of object;
TDataEvent = procedure (Data: PtrInt) of object;
TOnMessageBoxExecute = procedure (Sender: TObject; AResult: Integer) of object;
// application hint stuff
TCMHintShow = record
@ -1244,6 +1245,7 @@ type
FMainFormOnTaskBar: Boolean;
FModalLevel: Integer;
FOnGetMainFormHandle: TGetHandleEvent;
FOnMessageBoxExecute: TOnMessageBoxExecute;
FOnModalBegin: TNotifyEvent;
FOnModalEnd: TNotifyEvent;
FShowButtonGlyphs: TApplicationShowGlyphs;
@ -1482,6 +1484,7 @@ type
property OnEndSession: TNotifyEvent read FOnEndSession write FOnEndSession;
property OnQueryEndSession: TQueryEndSessionEvent read FOnQueryEndSession write FOnQueryEndSession;
property OnMinimize: TNotifyEvent read FOnMinimize write FOnMinimize;
property OnMessageBoxExecute: TOnMessageBoxExecute read FOnMessageBoxExecute write FOnMessageBoxExecute;
property OnModalBegin: TNotifyEvent read FOnModalBegin write FOnModalBegin;
property OnModalEnd: TNotifyEvent read FOnModalEnd write FOnModalEnd;
property OnRestore: TNotifyEvent read FOnRestore write FOnRestore;

View File

@ -217,6 +217,8 @@ function Java_com_pascal_lclproject_LCLActivity_LCLDrawToBitmap(
env:PJNIEnv;this:jobject; width, height: jint; abitmap: jobject): jint; cdecl;
function Java_com_pascal_lclproject_LCLActivity_LCLOnCreate(
env:PJNIEnv; this:jobject; alclactivity: jobject): jint; cdecl;
function Java_com_pascal_lclproject_LCLActivity_LCLOnMessageBoxFinished(
env:PJNIEnv; this:jobject; AResult: jint): jint; cdecl;
function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; cdecl;
procedure JNI_OnUnload(vm:PJavaVM;reserved:pointer); cdecl;
@ -228,12 +230,18 @@ var
// Fields of our Activity
javaField_lcltext: JfieldID=nil;
javaField_lcltitle: JfieldID=nil;
javaField_lclpositivebutton: JfieldID=nil;
javaField_lclnegativebutton: JfieldID=nil;
javaField_lclneutralbutton: JfieldID=nil;
javaField_lclwidth: JfieldID=nil;
javaField_lclheight: JfieldID=nil;
javaField_lclconfig: JfieldID=nil;
// Methods of our Activity
javaMethod_LCLDoGetTextBounds: jmethodid = nil;
javaMethod_LCLDoDrawText: jmethodid = nil;
javaMethod_LCLDoShowMessageBox: jmethodid = nil;
// This is utilized to store the information such as invalidate requests in events
eventResult: jint;

View File

@ -31,9 +31,9 @@ function AddEventHandler(AHandle: THandle; AFlags: dword;
function AddPipeEventHandler(AHandle: THandle;
AEventHandler: TPipeEvent; AData: PtrInt): PPipeEventHandler; override;
function AddProcessEventHandler(AHandle: THandle;
AEventHandler: TChildExitEvent; AData: PtrInt): PProcessEventHandler; override;
AEventHandler: TChildExitEvent; AData: PtrInt): PProcessEventHandler; override;*)
function AskUser(const DialogCaption, DialogMessage: string; DialogType:
LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt; override;*)
LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt; override;
function CreateEmptyRegion: hRGN; override;
(*function CreateStandardCursor(ACursor: SmallInt): HCURSOR; override;
@ -48,7 +48,7 @@ function FontIsMonoSpace(Font: HFont): boolean; override;
function GetDesignerDC(WindowHandle: HWND): HDC; override;
function IntfSendsUTF8KeyPress: boolean; override;
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;*)
function PromptUser(const DialogCaption : string;
const DialogMessage : string;
@ -58,7 +58,7 @@ function PromptUser(const DialogCaption : string;
DefaultIndex : LongInt;
EscapeResult : LongInt) : LongInt; override;
function RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer): Boolean; override;*)
//function RadialPie(DC: HDC; x1, y1, x2, y2, Angle1, Angle2: Integer): Boolean; override;
function RawImage_CreateBitmaps(const ARawImage: TRawImage; out ABitmap, AMask: HBitmap; ASkipMask: Boolean = False): Boolean; override;
function RawImage_DescriptionFromBitmap(ABitmap: HBITMAP; out ADesc: TRawImageDescription): Boolean; override;

View File

@ -119,14 +119,29 @@ begin
javaActivityObject := alclactivity;
end;
const NativeMethods: array[0..1] of JNINativeMethod=
((name:'LCLDrawToBitmap';
signature:'(IILandroid/graphics/Bitmap;)I';
fnPtr:@Java_com_pascal_lclproject_LCLActivity_LCLDrawToBitmap;),
(name:'LCLOnTouch';
signature:'(FFI)I';
fnPtr:@Java_com_pascal_lclproject_LCLActivity_LCLOnTouch;)
);
function Java_com_pascal_lclproject_LCLActivity_LCLOnMessageBoxFinished(
env:PJNIEnv; this:jobject; AResult: jint): jint; cdecl;
begin
//__android_log_write(ANDROID_LOG_INFO, 'lclapp', 'LCLOnCreate called by LCLActivity.onCreate');
Result := 0;
if Assigned(Application.OnMessageBoxExecute) then
Application.OnMessageBoxExecute(Application, AResult);
end;
const NativeMethods: array[0..3] of JNINativeMethod=
((name:'LCLDrawToBitmap';
signature:'(IILandroid/graphics/Bitmap;)I';
fnPtr:@Java_com_pascal_lclproject_LCLActivity_LCLDrawToBitmap;),
(name:'LCLOnTouch';
signature:'(FFI)I';
fnPtr:@Java_com_pascal_lclproject_LCLActivity_LCLOnTouch;),
(name:'LCLOnCreate';
signature:'(Lcom/pascal/lcltest/LCLActivity;)I'; //android/app/Activity;
fnPtr:@Java_com_pascal_lclproject_LCLActivity_LCLOnCreate;),
(name:'LCLOnMessageBoxFinished';
signature:'(I)I';
fnPtr:@Java_com_pascal_lclproject_LCLActivity_LCLOnMessageBoxFinished;)
);
function JNI_OnLoad(vm:PJavaVM;reserved:pointer):jint; cdecl;
begin
@ -165,8 +180,13 @@ begin
// Read all field IDs
JavaField_lcltext := javaEnvRef^^.GetFieldID(javaEnvRef, javaActivityClass, 'lcltext', 'Ljava/lang/String;');
JavaField_lcltitle := javaEnvRef^^.GetFieldID(javaEnvRef, javaActivityClass, 'lcltitle', 'Ljava/lang/String;');
JavaField_lclpositivebutton := javaEnvRef^^.GetFieldID(javaEnvRef, javaActivityClass, 'lclpositivebutton', 'Ljava/lang/String;');
JavaField_lclnegativebutton := javaEnvRef^^.GetFieldID(javaEnvRef, javaActivityClass, 'lclnegativebutton', 'Ljava/lang/String;');
JavaField_lclneutralbutton := javaEnvRef^^.GetFieldID(javaEnvRef, javaActivityClass, 'lclneutralbutton', 'Ljava/lang/String;');
JavaField_lclwidth := javaEnvRef^^.GetFieldID(javaEnvRef, javaActivityClass, 'lclwidth', 'I');
JavaField_lclheight := javaEnvRef^^.GetFieldID(javaEnvRef, javaActivityClass, 'lclheight', 'I');
JavaField_lclconfig := javaEnvRef^^.GetFieldID(javaEnvRef, javaActivityClass, 'lclconfig', 'I');
if not assigned(JavaField_lcltext) then
begin
__android_log_write(ANDROID_LOG_FATAL, 'lclapp', 'javaEnvRef^.GetFieldID failed for lcltext');
@ -176,6 +196,7 @@ begin
// Read all method IDs
javaMethod_LCLDoGetTextBounds := javaEnvRef^^.GetMethodID(javaEnvRef, javaActivityClass, 'LCLDoGetTextBounds', '()V');
javaMethod_LCLDoDrawText := javaEnvRef^^.GetMethodID(javaEnvRef, javaActivityClass, 'LCLDoDrawText', '()V');
javaMethod_LCLDoShowMessageBox := javaEnvRef^^.GetMethodID(javaEnvRef, javaActivityClass, 'LCLDoShowMessageBox', '()V');
__android_log_write(ANDROID_LOG_INFO, 'lclapp', 'JNI_OnLoad finished');
result:=JNI_VERSION_1_4;// 1_6 is another option

View File

@ -4783,22 +4783,35 @@ begin
end;
Result := True;
end;
end;*)
function TQtWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer;
function TCDWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer;
var
Str: WideString;
TitleStr: WideString;
OkStr: WideString;
lJavaString: jstring;
begin
//TODO: Finish full implementation of MessageBox
Str := GetUtf8String('TQtWidgetSet.MessageBox - not implemented');
TitleStr := GetUtf8String(lpCaption);
OkStr := GetUtf8String('Ok');
Result := QMessageBox_information(TQtWidget(hWnd).Widget, @Str, @TitleStr, @OkStr);
{$ifdef VerboseCDWinAPI}
DebugLn(Format('[TCDWidgetSet.MessageBox] HWND=%x javaEnvRef=%x lpText=%s lpCaption=%s uType=%d',
[HWND, PtrInt(javaEnvRef), StrPas(lpText), StrPas(lpCaption), uType]));
{$endif}
Result := 0; // The real result goes to Application.OnMessageDialogExecute
if (javaEnvRef = nil) then Exit;
// Prepare the input
// String fields
lJavaString :=javaEnvRef^^.NewStringUTF(javaEnvRef, lpText);
javaEnvRef^^.SetObjectField(javaEnvRef, javaActivityObject, JavaField_lcltext, lJavaString);
lJavaString :=javaEnvRef^^.NewStringUTF(javaEnvRef, lpCaption);
javaEnvRef^^.SetObjectField(javaEnvRef, javaActivityObject, JavaField_lcltitle, lJavaString);
// int fields
javaEnvRef^^.SetIntField(javaEnvRef, javaActivityObject, JavaField_lclconfig, uType);
// Call the method
javaEnvRef^^.CallVoidMethod(javaEnvRef, javaActivityObject, javaMethod_LCLDoShowMessageBox);
end;
{------------------------------------------------------------------------------
(*{------------------------------------------------------------------------------
Function: MoveToEx
Params: none
Returns: Nothing
@ -6520,4 +6533,57 @@ begin
FLastWFPMousePos := APoint;
end;*)
// In the end routines from customdrawnlclintfh.inc
function TCDWidgetSet.AskUser(const DialogCaption, DialogMessage: string; DialogType:
LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
begin
Result := 0;
end;
function TCDWidgetSet.PromptUser(const DialogCaption : string;
const DialogMessage : string;
DialogType : LongInt;
Buttons : PLongInt;
ButtonCount : LongInt;
DefaultIndex : LongInt;
EscapeResult : LongInt) : LongInt;
var
lJavaString: jstring;
BtnIndex, BtnKind: Integer;
begin
{$ifdef VerboseCDWinAPI}
DebugLn(Format('[TCDWidgetSet.PromptUser] javaEnvRef=%x DialogCaption=%s '
+ 'DialogMessage=%s DialogType=%d ButtonCount=%d',
[PtrInt(javaEnvRef), DialogCaption, DialogMessage, DialogType, ButtonCount]));
{$endif}
Result := 0; // The real result goes to Application.OnMessageDialogExecute
if (javaEnvRef = nil) then Exit;
// Prepare the input
// String fields
lJavaString :=javaEnvRef^^.NewStringUTF(javaEnvRef, PChar(DialogMessage));
javaEnvRef^^.SetObjectField(javaEnvRef, javaActivityObject, JavaField_lcltext, lJavaString);
lJavaString :=javaEnvRef^^.NewStringUTF(javaEnvRef, PChar(DialogMessage));
javaEnvRef^^.SetObjectField(javaEnvRef, javaActivityObject, JavaField_lcltitle, lJavaString);
// Read the buttons
for BtnIndex := 0 to ButtonCount - 1 do
begin
BtnKind := Buttons[BtnIndex];
{$ifdef VerboseCDWinAPI}
DebugLn(Format(':[TCDWidgetSet.PromptUser] BtnKind=%d', [BtnKind]));
{$endif}
end;
// int fields
//javaEnvRef^^.SetIntField(javaEnvRef, javaActivityObject, JavaField_lclconfig, uType);
// Call the method
//javaEnvRef^^.CallVoidMethod(javaEnvRef, javaActivityObject, javaMethod_LCLDoShowMessageBox);}
end;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line

View File

@ -712,9 +712,14 @@ begin
{ // Form DC
if lFormHandle.Canvas = nil then lFormHandle.Canvas := TLazCanvas.create(nil);
Result := HDC(lFormHandle.Canvas);}
end;*)
function TCDWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer;
begin
Result := 0;
end;
function TCocoaWidgetSet.SelectObject(ADC: HDC; GDIObj: HGDIOBJ): HGDIOBJ;
(*function TCocoaWidgetSet.SelectObject(ADC: HDC; GDIObj: HGDIOBJ): HGDIOBJ;
var
dc: TCocoaContext;
gdi: TCocoaGDIObject;
@ -1025,4 +1030,26 @@ begin
end;
end;*)
// In the end routines from customdrawnlclintfh.inc
function TCDWidgetSet.AskUser(const DialogCaption, DialogMessage: string; DialogType:
LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
begin
end;
function TCDWidgetSet.PromptUser(const DialogCaption : string;
const DialogMessage : string;
DialogType : LongInt;
Buttons : PLongInt;
ButtonCount : LongInt;
DefaultIndex : LongInt;
EscapeResult : LongInt) : LongInt;
begin
{$ifdef VerboseCDWinAPI}
DebugLn(Format('[TCDWidgetSet.PromptUser] javaEnvRef=%x DialogCaption=%s '
+ 'DialogMessage=%s DialogType=%d ButtonCount=%d',
[PtrInt(javaEnvRef), DialogCaption, DialogMessage, DialogType, ButtonCount]));
{$endif}
end;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line

View File

@ -2504,7 +2504,7 @@ end;
function TWin32WidgetSet.MaskBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Mask: HBITMAP; XMask, YMask: Integer): Boolean;
begin
Result := StretchMaskBlt(DestDC, X, Y, Width, Height, SrcDC, XSrc, YSrc, Width, Height, Mask, XMask, YMask, SRCCOPY);
end;
end;*)
{------------------------------------------------------------------------------
Method: MessageBox
@ -2525,24 +2525,18 @@ end;
The MessageBox function displays a modal dialog, with text and caption defined,
and includes buttons.
------------------------------------------------------------------------------}
function TWin32WidgetSet.MessageBox(HWnd: HWND; LPText, LPCaption: PChar; UType: Cardinal): Integer;
{$ifdef WindowsUnicodeSupport}
function TCDWidgetSet.MessageBox(HWnd: HWND; LPText, LPCaption: PChar; UType: Cardinal): Integer;
var
WideLPText, WideLPCaption: widestring;
{$endif}
begin
{$ifdef WindowsUnicodeSupport}
WideLPText := UTF8ToUTF16(string(LPText));
WideLPCaption := UTF8ToUTF16(string(LPCaption));
Result := Windows.MessageBoxW(HWnd, PWideChar(WideLPText),
PWideChar(WideLPCaption), UType);
{$else}
Result := Windows.MessageBox(HWnd, LPText, LPCaption, UType);
{$endif}
end;
function TWin32WidgetSet.MonitorFromPoint(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR;
(*function TWin32WidgetSet.MonitorFromPoint(ptScreenCoords: TPoint; dwFlags: DWord): HMONITOR;
begin
Result := MultiMon.MonitorFromPoint(ptScreenCoords, dwFlags);
end;
@ -3694,11 +3688,31 @@ begin
CritSection := 0;
end;
end;
end;*)
// In the end routines from customdrawnlclintfh.inc
function TCDWidgetSet.AskUser(const DialogCaption, DialogMessage: string; DialogType:
LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
begin
end;
function TCDWidgetSet.PromptUser(const DialogCaption : string;
const DialogMessage : string;
DialogType : LongInt;
Buttons : PLongInt;
ButtonCount : LongInt;
DefaultIndex : LongInt;
EscapeResult : LongInt) : LongInt;
begin
{$ifdef VerboseCDWinAPI}
DebugLn(Format('[TCDWidgetSet.PromptUser] javaEnvRef=%x DialogCaption=%s '
+ 'DialogMessage=%s DialogType=%d ButtonCount=%d',
[PtrInt(javaEnvRef), DialogCaption, DialogMessage, DialogType, ButtonCount]));
{$endif}
end;
//##apiwiz##eps## // Do not remove
*)

View File

@ -4744,22 +4744,15 @@ begin
end;
Result := True;
end;
end;*)
function TQtWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer;
var
Str: WideString;
TitleStr: WideString;
OkStr: WideString;
function TCDWidgetSet.MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer;
begin
//TODO: Finish full implementation of MessageBox
Str := GetUtf8String('TQtWidgetSet.MessageBox - not implemented');
TitleStr := GetUtf8String(lpCaption);
OkStr := GetUtf8String('Ok');
Result := QMessageBox_information(TQtWidget(hWnd).Widget, @Str, @TitleStr, @OkStr);
// X11 has no native dialog, so just use the one installed by Dialogs.pas
Result := Application.MessageBox(lpText, lpCaption, uType);
end;
{------------------------------------------------------------------------------
(*{------------------------------------------------------------------------------
Function: MoveToEx
Params: none
Returns: Nothing
@ -6481,4 +6474,26 @@ begin
FLastWFPMousePos := APoint;
end;*)
// In the end routines from customdrawnlclintfh.inc
function TCDWidgetSet.AskUser(const DialogCaption, DialogMessage: string; DialogType:
LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
begin
end;
function TCDWidgetSet.PromptUser(const DialogCaption : string;
const DialogMessage : string;
DialogType : LongInt;
Buttons : PLongInt;
ButtonCount : LongInt;
DefaultIndex : LongInt;
EscapeResult : LongInt) : LongInt;
begin
{$ifdef VerboseCDWinAPI}
DebugLn(Format('[TCDWidgetSet.PromptUser] javaEnvRef=%x DialogCaption=%s '
+ 'DialogMessage=%s DialogType=%d ButtonCount=%d',
[PtrInt(javaEnvRef), DialogCaption, DialogMessage, DialogType, ButtonCount]));
{$endif}
end;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line

View File

@ -161,9 +161,9 @@ function IsZoomed(Handle: HWND): boolean; override;
procedure LeaveCriticalSection(var CritSection: TCriticalSection); override;*)
function LineTo(DC: HDC; X, Y: Integer): Boolean; override;
(*function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL; override;
//function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL; override;
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;*)
function MessageBox(hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
(*function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;