diff options
Diffstat (limited to 'src/corelib/gdi')
-rw-r--r-- | src/corelib/gdi/fpg_gdi.pas | 45 | ||||
-rw-r--r-- | src/corelib/gdi/fpgui_toolkit.lpk | 4 | ||||
-rw-r--r-- | src/corelib/gdi/fpgui_toolkit.pas | 26 |
3 files changed, 56 insertions, 19 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index a1d314f6..e909782e 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -30,6 +30,14 @@ unit fpg_gdi; {.$Define DND_DEBUG} {.$Define DEBUGKEYS} +// enable or disable DND support. Disabled by default while implementing AlienWindows. +{$define HAS_DND} + +{$IFDEF WINCE} + // WinCE doesn't have DND support + {$undefine HAS_DND} +{$ENDIF} + interface uses @@ -42,7 +50,9 @@ uses {$IFDEF DEBUG} ,fpg_dbugintf {$ENDIF DEBUG} + {$IFDEF HAS_DND} ,fpg_OLEDragDrop + {$ENDIF} ; { Constants missing on windows unit } @@ -153,15 +163,19 @@ type TfpgGDIWindow = class(TfpgWindowBase) private + {$IFDEF HAS_DND} FDropManager: TfpgOLEDropTarget; + {$ENDIF} FDropPos: TPoint; FUserMimeSelection: TfpgString; FUserAcceptDrag: Boolean; - function GetDropManager: TfpgOLEDropTarget; + {$IFDEF HAS_DND} procedure HandleDNDLeave(Sender: TObject); procedure HandleDNDEnter(Sender: TObject; DataObj: IDataObject; KeyState: Longint; PT: TPoint; var Effect: DWORD); + function GetDropManager: TfpgOLEDropTarget; procedure HandleDNDPosition(Sender: TObject; KeyState: Longint; PT: TPoint; var Effect: TfpgOLEDragDropEffect); procedure HandleDNDDrop(Sender: TObject; DataObj: IDataObject; KeyState: Longint; PT: TPoint; Effect: TfpgOLEDragDropEffect); + {$ENDIF} private FMouseInWindow: boolean; FNonFullscreenRect: TfpgRect; @@ -171,7 +185,9 @@ type QueueAcceptDrops: boolean; function DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean; procedure WindowSetFullscreen(aFullScreen, aUpdate: boolean); + {$IFDEF HAS_DND} property DropManager: TfpgOLEDropTarget read GetDropManager; + {$ENDIF} protected FWinHandle: TfpgWinHandle; FModalForWin: TfpgGDIWindow; @@ -1445,6 +1461,7 @@ var // this are required for Windows MouseEnter & MouseExit detection. uLastWindowHndl: TfpgWinHandle; +{$IFDEF HAS_DND} procedure TfpgGDIWindow.HandleDNDLeave(Sender: TObject); var wg: TfpgWidget; @@ -1610,6 +1627,7 @@ begin end; Result := FDropManager; end; +{$ENDIF HAS_DND} function TfpgGDIWindow.DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean; var @@ -2016,6 +2034,7 @@ end; procedure TfpgGDIWindow.DoAcceptDrops(const AValue: boolean); begin + {$IFDEF HAS_DND} if AValue then begin if HasHandle then @@ -2029,6 +2048,7 @@ begin DropManager.RevokeDragDrop; QueueAcceptDrops := False; end; + {$ENDIF} end; procedure TfpgGDIWindow.DoDragStartDetected; @@ -2066,7 +2086,9 @@ begin else begin + {$IFNDEF WINCE} placement.length:= sizeof(placement); + // This Windows function doesn't exist in WinCE if GetWindowPlacement(FWinHandle, placement) then begin case placement.ShowCmd of @@ -2074,6 +2096,7 @@ begin SW_SHOWMINIMIZED: result:= wsMinimized; end; end; + {$ENDIF} end; { case..else } end; { case } end; @@ -2082,7 +2105,9 @@ constructor TfpgGDIWindow.Create(AOwner: TComponent); begin inherited Create(AOwner); FWinHandle := 0; + {$IFDEF HAS_DND} FDropManager := nil; + {$ENDIF} FDropPos.x := 0; FDropPos.y := 0; FFullscreenIsSet := false; @@ -2092,8 +2117,10 @@ end; destructor TfpgGDIWindow.Destroy; begin + {$IFDEF HAS_DND} if Assigned(FDropManager) then FDropManager.Free; + {$ENDIF} inherited Destroy; end; @@ -3027,10 +3054,13 @@ var M: PStgMedium; itm: TfpgMimeDataItem; lEffects: DWORD; + {$IFDEF HAS_DND} FDataObject: TfpgOLEDataObject; FDropSource: TfpgOLEDropSource; + {$ENDIF} lIsTranslated: boolean; begin + {$IFDEF HAS_DND} if FDragging then begin {$IFDEF DND_DEBUG} @@ -3121,6 +3151,7 @@ begin // (FDropSource as IUnknown)._Release; // (FDataObject as IUnknown)._Release; end; + {$ENDIF HAS_DND} end; { TGDIDragManager } @@ -3164,18 +3195,22 @@ end; procedure TGDIDragManager.RegisterDragDrop; begin + {$IFDEF HAS_DND} Activex.RegisterDragDrop(TfpgWidget(FDropTarget).WinHandle, self as IDropTarget) + {$ENDIF} end; procedure TGDIDragManager.RevokeDragDrop; begin + {$IFDEF HAS_DND} ActiveX.RevokeDragDrop(TfpgWidget(FDropTarget).WinHandle); + {$ENDIF} end; {$IF FPC_FULLVERSION<20602} procedure TimerCallBackProc(hWnd: HWND; uMsg: UINT; idEvent: UINT; dwTime: DWORD); stdcall; {$ELSE} -procedure TimerCallBackProc(hWnd: HWND; uMsg: UINT; idEvent: UINT_PTR; dwTime: DWORD); stdcall; +procedure TimerCallBackProc(hWnd: HWND; uMsg: UINT; idEvent: UINT_PTR; dwTime: DWORD); {$IFNDEF WINCE} stdcall; {$ELSE} cdecl; {$ENDIF} {$IFEND} begin { idEvent contains the handle to the timer that got triggered } @@ -3240,12 +3275,12 @@ end; initialization wapplication := nil; MouseFocusedWH := 0; - NeedToUnitialize := Succeeded(OleInitialize(nil)); {$IFDEF WinCE} UnicodeEnabledOS := True; FontSmoothingType := DEFAULT_QUALITY; {$ELSE} + NeedToUnitialize := Succeeded(OleInitialize(nil)); WinVersion.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); GetVersionEx(WinVersion); UnicodeEnabledOS := (WinVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) or @@ -3256,11 +3291,11 @@ initialization FontSmoothingType := CLEARTYPE_QUALITY else FontSmoothingType := ANTIALIASED_QUALITY; -{$ENDIF} finalization if NeedToUnitialize then OleUninitialize; +{$ENDIF} end. diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk index 3566dc09..e14414e4 100644 --- a/src/corelib/gdi/fpgui_toolkit.lpk +++ b/src/corelib/gdi/fpgui_toolkit.lpk @@ -30,7 +30,7 @@ </CompilerOptions> <Description Value="fpGUI Toolkit"/> <License Value="LGPL 2 with static linking exception."/> - <Version Major="1" Minor="4"/> + <Version Major="1" Minor="4" Release="1"/> <Files Count="107"> <Item1> <Filename Value="..\stdimages.inc"/> @@ -166,6 +166,7 @@ </Item33> <Item34> <Filename Value="fpg_oledragdrop.pas"/> + <AddToUsesPkgSection Value="False"/> <UnitName Value="fpg_OLEDragDrop"/> </Item34> <Item35> @@ -422,6 +423,7 @@ </Item97> <Item98> <Filename Value="..\render\software\Agg2D.pas"/> + <AddToUsesPkgSection Value="False"/> <UnitName Value="Agg2D"/> </Item98> <Item99> diff --git a/src/corelib/gdi/fpgui_toolkit.pas b/src/corelib/gdi/fpgui_toolkit.pas index 4704d56a..2cc8e7f0 100644 --- a/src/corelib/gdi/fpgui_toolkit.pas +++ b/src/corelib/gdi/fpgui_toolkit.pas @@ -2,27 +2,27 @@ This source is only used to compile and install the package. } -unit fpgui_toolkit; +unit fpgui_toolkit; interface uses - fpg_base, fpg_main, fpg_cmdlineparams, fpg_command_intf, fpg_constants, + fpg_base, fpg_main, fpg_cmdlineparams, fpg_command_intf, fpg_constants, fpg_extinterpolation, fpg_imagelist, fpg_imgfmt_bmp, fpg_pofiles, fpg_popupwindow, fpg_stdimages, fpg_stringhashlist, fpg_translations, fpg_stringutils, fpg_utils, fpg_widget, fpg_wuline, fpg_impl, fpg_gdi, - fpg_OLEDragDrop, fpg_animation, fpg_basegrid, fpg_button, fpg_checkbox, - fpg_combobox, fpg_customgrid, fpg_dialogs, fpg_editcombo, fpg_edit, - fpg_form, fpg_gauge, fpg_grid, fpg_hyperlink, fpg_iniutils, fpg_label, - fpg_listbox, fpg_listview, fpg_memo, fpg_menu, fpg_mru, fpg_panel, - fpg_popupcalendar, fpg_progressbar, fpg_radiobutton, fpg_scrollbar, - fpg_style, fpg_tab, fpg_trackbar, fpg_tree, fpgui_db, fpg_splitter, - fpg_hint, fpg_spinedit, fpg_extgraphics, fpg_ColorMapping, fpg_ColorWheel, - fpg_interface, fpg_editbtn, fpg_imgfmt_jpg, fpg_imgutils, fpg_stylemanager, - fpg_style_win2k, fpg_style_motif, fpg_style_clearlooks, fpg_style_bluecurve, + fpg_animation, fpg_basegrid, fpg_button, fpg_checkbox, fpg_combobox, + fpg_customgrid, fpg_dialogs, fpg_editcombo, fpg_edit, fpg_form, fpg_gauge, + fpg_grid, fpg_hyperlink, fpg_iniutils, fpg_label, fpg_listbox, fpg_listview, + fpg_memo, fpg_menu, fpg_mru, fpg_panel, fpg_popupcalendar, fpg_progressbar, + fpg_radiobutton, fpg_scrollbar, fpg_style, fpg_tab, fpg_trackbar, fpg_tree, + fpgui_db, fpg_splitter, fpg_hint, fpg_spinedit, fpg_extgraphics, + fpg_ColorMapping, fpg_ColorWheel, fpg_interface, fpg_editbtn, + fpg_imgfmt_jpg, fpg_imgutils, fpg_stylemanager, fpg_style_win2k, + fpg_style_motif, fpg_style_clearlooks, fpg_style_bluecurve, fpg_style_bitmap, fpg_readonly, fpg_imgfmt_png, U_Command, U_Pdf, U_Report, - U_ReportImages, U_Visu, fpg_trayicon, Agg2D, fpg_dbugintf, fpg_dbugmsg, - fpg_style_carbon, fpg_style_plastic, fpg_style_win8, fpg_toggle, + U_ReportImages, U_Visu, fpg_trayicon, fpg_dbugintf, fpg_dbugmsg, + fpg_style_carbon, fpg_style_plastic, fpg_style_win8, fpg_toggle, fpg_StringGridBuilder, fpg_CSVParser; implementation |