summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-10-12 17:17:35 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-10-28 10:57:21 +0200
commit8c7e0c3444a9746fbff7caecbc2014e114b837c6 (patch)
tree693f16be9d10eb546c5c7a9773ff4e94b3ac3000 /src/corelib
parent7a94a5002ed8af6e8e163ff375bf31fb25363088 (diff)
downloadfpGUI-8c7e0c3444a9746fbff7caecbc2014e114b837c6.tar.xz
Ad conversion helper functions from OLE DND to fpGUI DropActions
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/gdi/fpg_gdi.pas48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index f59c7330..7da02311 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -477,20 +477,54 @@ begin
{$ENDIF}
end;
+{ ********** Some helper conversion functions ************* }
+
function WinkeystateToShiftstate(keystate: cardinal): TShiftState;
begin
- result:= [];
- if GetKeyState(vk_menu) < 0 then begin
+ Result := [];
+ if GetKeyState(vk_menu) < 0 then
Include(result, ssAlt);
- end;
- if GetKeyState(vk_shift) < 0 then begin
+ if GetKeyState(vk_shift) < 0 then
Include(result, ssShift);
- end;
- if GetKeyState(vk_control) < 0 then begin
+ if GetKeyState(vk_control) < 0 then
Include(result, ssCtrl);
- end;
end;
+function TranslateToFPGDropActions(const pdwEffects: DWORD): TfpgDropActions;
+begin
+ Result := [daIgnore];
+ if (pdwEffects and DROPEFFECT_LINK) <> 0 then
+ Result := Result + [daLink];
+ if (pdwEffects and DROPEFFECT_COPY) <> 0 then
+ Result := Result + [daCopy];
+ if (pdwEffects and DROPEFFECT_MOVE) <> 0 then
+ Result := Result + [daMove];
+end;
+
+function TranslateToFPGDropAction(const pdwEffects: DWORD): TfpgDropAction;
+begin
+ if (pdwEffects and DROPEFFECT_LINK) <> 0 then
+ Result := daLink
+ else if (pdwEffects and DROPEFFECT_COPY) <> 0 then
+ Result := daCopy
+ else if (pdwEffects and DROPEFFECT_MOVE) <> 0 then
+ Result := daMove
+ else
+ Result := daIgnore;
+end;
+
+function TranslateToWinDragEffects(const AActions: TfpgDropActions): DWORD;
+begin
+ Result := DROPEFFECT_NONE;
+ if daLink in AActions then
+ Result := Result or DROPEFFECT_LINK;
+ if daCopy in AActions then
+ Result := Result or DROPEFFECT_COPY;
+ if daMove in AActions then
+ Result := Result or DROPEFFECT_MOVE;
+end;
+
+
{$IFDEF wince}
procedure WinCESetDibBits(BMP: HBITMAP; awidth, aheight: Integer; aimgdata: Pointer; var bi: TBitmapInfo);
var