moved THintInfo from forms.pp to controls.pp and changed TControlShowHint event from pointer to PHintHinfo

git-svn-id: trunk@7092 -
This commit is contained in:
mattias 2005-04-20 07:14:00 +00:00
parent c9ac8e1e6f
commit 4088211fec
6 changed files with 41 additions and 28 deletions

View File

@ -185,7 +185,7 @@ type
ARect: TRect; State: TOwnerDrawState);
procedure ItemsListBoxMouseDown(Sender: TOBject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ItemsListBoxShowHint(Sender: TObject; HintInfo: Pointer);
procedure ItemsListBoxShowHint(Sender: TObject; HintInfo: PHintInfo);
procedure OkButtonClick(Sender: TObject);
procedure CancelButtonClick(Sender: TObject);
procedure TargetDirectoryButtonClick(Sender: TObject);
@ -833,17 +833,17 @@ begin
end;
procedure TConfigureBuildLazarusDlg.ItemsListBoxShowHint(Sender:TObject;
HintInfo:Pointer);
HintInfo: PHintInfo);
var
MakeMode: TMakeMode;
i: Integer;
begin
with PHintInfo(HintInfo)^ do begin
with HintInfo^ do begin
HintStr:='';
if not GetMakeModeAtX(CursorPos.X, MakeMode) then exit;
i:=ItemsListBox.GetIndexAtY(CursorPos.Y);
if (i<0) or (i>=Options.Count) then exit;
HintStr := MakeModeNames[MakeMode] ;
HintStr := MakeModeNames[MakeMode];
end;
end;

View File

@ -114,7 +114,7 @@ type
procedure btnSearchAgainClick(Sender: TObject);
procedure ListboxDrawitem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
procedure LazLBShowHint(Sender: TObject; HintInfo: Pointer);
procedure LazLBShowHint(Sender: TObject; HintInfo: PHintInfo);
procedure LazLBMousemove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
Procedure LazLBMouseWheel(Sender: TObject; Shift: TShiftState;
@ -439,7 +439,8 @@ begin
end;//AddResult
procedure TSearchResultsView.LazLBShowHint(Sender: TObject; HintInfo: Pointer);
procedure TSearchResultsView.LazLBShowHint(Sender: TObject;
HintInfo: PHintInfo);
var
MatchPos: TLazSearchMatchPos;
HintStr: string;
@ -467,7 +468,6 @@ begin
end;//if
end;//LazLBShowHint
procedure TSearchResultsView.ListboxDrawitem(Control: TWinControl;
Index: Integer; ARect: TRect;
State: TOwnerDrawState);

View File

@ -374,7 +374,7 @@ type
procedure MoveEditorLeftClicked(Sender: TObject);
procedure MoveEditorRightClicked(Sender: TObject);
Procedure NotebookPageChanged(Sender: TObject);
procedure NotebookShowTabHint(Sender: TObject; HintInfo: Pointer);
procedure NotebookShowTabHint(Sender: TObject; HintInfo: PHintInfo);
Procedure OpenAtCursorClicked(Sender: TObject);
Procedure ReadOnlyClicked(Sender: TObject);
procedure OnPopupMenuOpenPasFile(Sender: TObject);
@ -2866,7 +2866,7 @@ begin
end;
procedure TSourceNotebook.NotebookShowTabHint(Sender: TObject;
HintInfo: Pointer);
HintInfo: PHintInfo);
var
Tabindex: integer;
ASrcEdit: TSourceEditor;
@ -2878,7 +2878,7 @@ begin
ASrcEdit:=FindSourceEditorWithPageIndex(TabIndex);
if ASrcEdit=nil then exit;
if ASrcEdit.CodeBuffer<>nil then begin
PHintInfo(HintInfo)^.HintStr:=ASrcEdit.CodeBuffer.Filename;
HintInfo^.HintStr:=ASrcEdit.CodeBuffer.Filename;
end;
end;

View File

@ -239,6 +239,23 @@ type
procedure FreeHandle;
property Control: TControl read FControl write SetControl;
end;
{ Hint stuff }
PHintInfo = ^THintInfo;
THintInfo = record
HintControl: TControl;
HintWindowClass: TWinControlClass;
HintPos: TPoint;
HintMaxWidth: Integer;
HintColor: TColor;
CursorRect: TRect;
CursorPos: TPoint;
ReshowTimeout: Integer;
HideTimeout: Integer;
HintStr: string;
HintData: Pointer;
end;
{ TDragImageList }
@ -654,8 +671,9 @@ type
TTabOrder = -1..32767;
TControlShowHintEvent = procedure(Sender: TObject; HintInfo: Pointer) of object;
TContextPopupEvent = procedure(Sender: TObject; MousePos: TPoint; var Handled: Boolean) of object;
TControlShowHintEvent = procedure(Sender: TObject; HintInfo: PHintInfo) of object;
TContextPopupEvent = procedure(Sender: TObject; MousePos: TPoint;
var Handled: Boolean) of object;
TControlFlag = (
cfRequestAlignNeeded,
@ -2891,6 +2909,9 @@ end.
{ =============================================================================
$Log$
Revision 1.296 2005/04/20 07:14:00 mattias
moved THintInfo from forms.pp to controls.pp and changed TControlShowHint event from pointer to PHintHinfo
Revision 1.295 2005/04/17 18:41:15 micha
implement active default control switching
pressing return key executes active default control action

View File

@ -817,21 +817,6 @@ type
//TODO: move to LMessages ?
// application hint stuff
PHintInfo = ^THintInfo;
THintInfo = record
HintControl: TControl;
HintWindowClass: THintWindowClass;
HintPos: TPoint;
HintMaxWidth: Integer;
HintColor: TColor;
CursorRect: TRect;
CursorPos: TPoint;
ReshowTimeout: Integer;
HideTimeout: Integer;
HintStr: string;
HintData: Pointer;
end;
TCMHintShow = record
Msg: Cardinal;
Reserved: WPARAM;

View File

@ -600,6 +600,10 @@ begin
HintInfo.HintWindowClass := HintWindowClass;
HintInfo.HintData := nil;
CanShow := FHintControl.Perform(CM_HINTSHOW, 0, LParam(@HintInfo)) = 0;
if (HintInfo.HintWindowClass=nil)
or (not HintInfo.HintWindowClass.InheritsFrom(THintWindow)) then
HintInfo.HintWindowClass := HintWindowClass;
if CanShow and Assigned(FOnShowHint) then
FOnShowHint(HintInfo.HintStr, CanShow, HintInfo);
if CanShow and (FHintControl <> nil) and (HintInfo.HintStr <> '') then
@ -609,7 +613,7 @@ begin
then
FreeThenNil(FHintWindow);
if FHintWindow=nil then begin
FHintWindow:=HintInfo.HintWindowClass.Create(Self);
FHintWindow:=THintWindowClass(HintInfo.HintWindowClass).Create(Self);
with FHintWindow do begin
Visible := False;
Caption := '';
@ -1462,6 +1466,9 @@ end;
{ =============================================================================
$Log$
Revision 1.118 2005/04/20 07:14:00 mattias
moved THintInfo from forms.pp to controls.pp and changed TControlShowHint event from pointer to PHintHinfo
Revision 1.117 2005/04/18 14:40:36 mattias
fixed invaldating hintwindow on changing hintstr