summaryrefslogtreecommitdiff
path: root/src/corelib/gdi
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-08 23:56:32 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-08 23:56:32 +0000
commit7c683a4453a56e2b27a9d9a450e5078cb3d243c8 (patch)
tree545b9bbabe396367caedb03ed70f3140fe5bcf08 /src/corelib/gdi
parentd1b3f4809d58376b3180afd8b25533e743ff9dcf (diff)
downloadfpGUI-7c683a4453a56e2b27a9d9a450e5078cb3d243c8.tar.xz
* Mouse Cursor support has been added (GDI is untested).
* TfpgEdit and TfpgMemo now change the mouse cursor correctly. * The prototypes/fpgui2/tests/edittest project show the mouse cursor in action. A GUI example project will be created soon to show all available cursors.
Diffstat (limited to 'src/corelib/gdi')
-rw-r--r--src/corelib/gdi/gfx_gdi.pas55
1 files changed, 41 insertions, 14 deletions
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas
index 821d855b..2dcade7e 100644
--- a/src/corelib/gdi/gfx_gdi.pas
+++ b/src/corelib/gdi/gfx_gdi.pas
@@ -136,6 +136,7 @@ type
function DoWindowToScreen(ASource: TfpgWindowBase; const AScreenPos: TPoint): TPoint; override;
//procedure MoveToScreenCenter; override;
procedure DoSetWindowTitle(const ATitle: string); override;
+ procedure DoSetMouseCursor; override;
property WinHandle: TfpgWinHandle read FWinHandle;
public
constructor Create(AOwner: TComponent); override;
@@ -157,6 +158,7 @@ type
hcr_dir_nesw: HCURSOR;
hcr_move: HCURSOR;
hcr_crosshair: HCURSOR;
+ hcr_wait: HCURSOR;
FFocusedWindow: THANDLE;
LastClickWindow: TfpgWinHandle; // double click generation
LastWinClickTime: longword;
@@ -491,18 +493,19 @@ begin
end;
end;
-(*
+
WM_SETCURSOR:
- begin
- //Writeln('Hittest: ',IntToHex((lParam and $FFFF),4));
- if (lParam and $FFFF) <= 1 then
- begin
- ptkSetMouseCursor(wg.WinHandle, wg.MouseCursor);
- result := 1;
- end
- else Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam);
- end;
-*)
+ begin
+// {$IFDEF DEBUG} write(w.ClassName + ': '); {$ENDIF}
+ //Writeln('Hittest: ',IntToHex((lParam and $FFFF),4));
+ if (lParam and $FFFF) <= 1 then
+ begin
+ w.DoSetMouseCursor;
+// ptkSetMouseCursor(wg.WinHandle, wg.MouseCursor);
+ end
+// else Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam);
+ end;
+
WM_MOUSEMOVE,
WM_LBUTTONDOWN,
@@ -738,9 +741,10 @@ begin
hcr_dir_ns := LoadCursor(0, IDC_SIZENS);
hcr_edit := LoadCursor(0, IDC_IBEAM);
hcr_dir_nwse := LoadCursor(0, IDC_SIZENWSE);
- hcr_DIR_NESW := LoadCursor(0, IDC_SIZENESW);
- hcr_MOVE := LoadCursor(0, IDC_SIZEALL);
- hcr_CROSSHAIR := LoadCursor(0, IDC_CROSS);
+ hcr_dir_nesw := LoadCursor(0, IDC_SIZENESW);
+ hcr_move := LoadCursor(0, IDC_SIZEALL);
+ hcr_crosshair := LoadCursor(0, IDC_CROSS);
+ hcr_wait := LoadCursor(0, IDC_WAIT);
FIsInitialized := True;
wapplication := TfpgApplication(self);
@@ -1050,6 +1054,29 @@ begin
{$endif}
end;
+procedure TfpgWindowImpl.DoSetMouseCursor;
+var
+ hc: HCURSOR;
+begin
+ if not HasHandle then
+ Exit; //==>
+
+ case FMouseCursor of
+ mcSizeEW: hc := wapplication.hcr_dir_ew;
+ mcSizeNS: hc := wapplication.hcr_dir_ns;
+ mcIBeam: hc := wapplication.hcr_edit;
+ mcSizeNWSE: hc := wapplication.hcr_dir_nwse;
+ mcSizeNESW: hc := wapplication.hcr_dir_nesw;
+ mcMove: hc := wapplication.hcr_move;
+ mcCross: hc := wapplication.hcr_crosshair;
+ mcHourGlass: hc := wapplication.hcr_wait;
+ else
+ hc := hcr_default;
+ end;
+
+ SetCursor(hc);
+end;
+
constructor TfpgWindowImpl.Create(aowner: TComponent);
begin
inherited;