1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
|
{%MainUnit customdrawnint.pas}
{******************************************************************************
All CustomDrawn interface support routines
Initial Revision : Sat Jan 17 19:00:00 2004
!! Keep alphabetical !!
******************************************************************************
Implementation
******************************************************************************
*****************************************************************************
This file is part of the Lazarus Component Library (LCL)
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
}
//##apiwiz##sps## // Do not remove
function TCDWidgetSet.AskUser(const DialogCaption, DialogMessage: string;
DialogType: LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
begin
end;
(*{------------------------------------------------------------------------------
Function: CreateEmptyRegion
Params:
Returns: valid empty region
------------------------------------------------------------------------------}
function TQtWidgetSet.CreateEmptyRegion: hRGN;
begin
Result:= HRGN(TQtRegion.Create(True));
end;
{------------------------------------------------------------------------------
Function: CreateStandardCursor
Params:
Returns:
------------------------------------------------------------------------------}
function TQtWidgetSet.CreateStandardCursor(ACursor: SmallInt): HCURSOR;
var
CursorShape: QtCursorShape;
begin
Result := 0;
if ACursor < crLow then Exit;
if ACursor > crHigh then Exit;
// TODO: map is better
case ACursor of
crNone : CursorShape := QtBlankCursor;
crArrow : CursorShape := QtArrowCursor;
crCross : CursorShape := QtCrossCursor;
crIBeam : CursorShape := QtIBeamCursor;
crSizeAll : CursorShape := QtSizeAllCursor;
crSizeNESW : CursorShape := QtSizeBDiagCursor;
crSizeNS : CursorShape := QtSizeVerCursor;
crSizeNWSE : CursorShape := QtSizeFDiagCursor;
crSizeWE : CursorShape := QtSizeHorCursor;
crSizeNW : CursorShape := QtSizeFDiagCursor;
crSizeN : CursorShape := QtSizeVerCursor;
crSizeNE : CursorShape := QtSizeBDiagCursor;
crSizeW : CursorShape := QtSizeHorCursor;
crSizeE : CursorShape := QtSizeHorCursor;
crSizeSW : CursorShape := QtSizeBDiagCursor;
crSizeS : CursorShape := QtSizeVerCursor;
crSizeSE : CursorShape := QtSizeFDiagCursor;
crUpArrow : CursorShape := QtUpArrowCursor;
crHourGlass : CursorShape := QtWaitCursor;
crHSplit : CursorShape := QtSplitHCursor;
crVSplit : CursorShape := QtSplitVCursor;
crNo : CursorShape := QtForbiddenCursor;
crAppStart : CursorShape := QtBusyCursor;
crHelp : CursorShape := QtWhatsThisCursor;
crHandPoint : CursorShape := QtPointingHandCursor;
else
CursorShape := QtCursorShape(-1);
end;
if CursorShape <> QtCursorShape(-1) then
Result := HCURSOR(TQtCursor.Create(CursorShape));
end;*)
(*{------------------------------------------------------------------------------
Function: FontIsMonoSpace
Params:
Returns:
------------------------------------------------------------------------------}
function TQtWidgetSet.FontIsMonoSpace(Font: HFont): Boolean;
var
QtFontInfo: QFontInfoH;
begin
Result := IsValidGDIObject(Font);
if Result then
begin
QtFontInfo := QFontInfo_create(TQtFont(Font).FHandle);
try
Result := QFontInfo_fixedPitch(QtFontInfo);
finally
QFontInfo_destroy(QtFontInfo);
end;
end;
end;*)
procedure TCDWidgetSet.HideVirtualKeyboard();
begin
end;
function TCDWidgetSet.IsMobilePlatform: Boolean;
begin
Result := Application.ApplicationType in [atPDA, atKeyPadDevice, atTV, atMobileEmulator];
end;
{------------------------------------------------------------------------------
Function: PromptUser
Params:
Returns:
------------------------------------------------------------------------------}
function TCDWidgetSet.PromptUser(const DialogCaption : string;
const DialogMessage : string;
DialogType : LongInt;
Buttons : PLongInt;
ButtonCount : LongInt;
DefaultIndex : LongInt;
EscapeResult : LongInt) : LongInt;
var
i: Integer;
Caption: String;
TaskConfig: TTASKDIALOGCONFIG;
DialogButtons: PTASKDIALOG_BUTTON;
State: TApplicationState;
begin
//TaskDialogIndirect is available in Vista and up, but only if app was built with manifest.
//The check for the latter is done by checking for ComCtlVersionIE6 (which is set in the manifest)
//The availability of TaskDialogIndirect does not depend on the status of ThemeServices
//Issue #0027664
if (WindowsVersion >= wvVista) and (GetFileVersion(comctl32) >= ComCtlVersionIE6) then
begin
FillChar(TaskConfig, SizeOf(TaskConfig), 0);
TaskConfig.cbSize := SizeOf(TaskConfig);
// if we skip hwndParent our form will be a root window - with the taskbar item and icon
// this is unwanted
if Assigned(Screen.ActiveCustomForm) then
TaskConfig.hwndParent := Screen.ActiveCustomForm.Handle
else
if Assigned(Application.MainForm) then
TaskConfig.hwndParent := Application.MainFormHandle
else
TaskConfig.hwndParent := AppHandle;
TaskConfig.hInstance := HInstance;
TaskConfig.dwFlags := TDF_ALLOW_DIALOG_CANCELLATION;
if DialogCaption <> '' then
Caption := DialogCaption
else
case DialogType of
idDialogConfirm,
idDialogInfo,
idDialogWarning,
idDialogError: Caption := GetDialogCaption(DialogType);
else
Caption := Application.Title;
end;
TaskConfig.pszWindowTitle := PWideChar(UTF8ToUTF16(Caption));
case DialogType of
idDialogConfirm:
begin
TaskConfig.hMainIcon := Windows.LoadIcon(0, IDI_QUESTION);
TaskConfig.dwFlags := TaskConfig.dwFlags or TDF_USE_HICON_MAIN;
end;
idDialogInfo: TaskConfig.pszMainIcon := TD_INFORMATION_ICON;
idDialogWarning: TaskConfig.pszMainIcon := TD_WARNING_ICON;
idDialogError: TaskConfig.pszMainIcon := TD_ERROR_ICON;
idDialogShield: TaskConfig.pszMainIcon := TD_SHIELD_ICON;
else
TaskConfig.dwFlags := TaskConfig.dwFlags or TDF_USE_HICON_MAIN;
end;
TaskConfig.pszContent := PWideChar(UTF8ToUTF16(DialogMessage));
TaskConfig.cButtons := ButtonCount;
GetMem(DialogButtons, SizeOf(TTASKDIALOG_BUTTON) * ButtonCount);
for i := 0 to ButtonCount - 1 do
begin
DialogButtons[i].nButtonID := Buttons[i];
DialogButtons[i].pszButtonText := UTF8StringToPWideChar(GetButtonCaption(Buttons[i]));
end;
TaskConfig.pButtons := DialogButtons;
//we need idButtonXX value
if DefaultIndex < ButtonCount then
TaskConfig.nDefaultButton := Buttons[DefaultIndex]
else
TaskConfig.nDefaultButton := 0;
State := SaveApplicationState;
try
Result := IDCANCEL;
TaskDialogIndirect(@TaskConfig, @Result, nil, nil);
if Result = IDCANCEL then
Result := EscapeResult;
finally
RestoreApplicationState(State);
for i := 0 to ButtonCount - 1 do
FreeMem(DialogButtons[i].pszButtonText);
FreeMem(DialogButtons);
end;
end
else
Result := inherited PromptUser(DialogCaption, DialogMessage, DialogType,
Buttons, ButtonCount, DefaultIndex, EscapeResult);
end;
{------------------------------------------------------------------------------
Function: RawImage_FromDevice
Params: ADC:
ARect:
ARawImage:
Returns:
This function is utilized when the function TBitmap.LoadFromDevice is called
The main use for this function is to get a screenshot. It may have other uses,
but this is the only one implemented here.
MWE: exept for the desktop, there is always a bitmep selected in the DC.
So get this internal bitmap and pass it to RawImage_FromBitmap
------------------------------------------------------------------------------}
function TCDWidgetSet.RawImage_FromDevice(out ARawImage: TRawImage; ADC: HDC; const ARect: TRect): Boolean;
begin
Result := True;
ARawImage.Init;
end;
procedure TCDWidgetset.ShowVirtualKeyboard();
begin
end;
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|