MG: setwindowpos + bugfixes

git-svn-id: trunk@240 -
This commit is contained in:
lazarus 2001-03-26 14:58:32 +00:00
parent 9dba2d8387
commit 0b8e9b01d6
14 changed files with 186 additions and 53 deletions

View File

@ -88,6 +88,9 @@ type
destructor Destroy; override;
procedure AddCompletion(AToken, AValue, AComment: string);
{$IFDEF SYN_LAZARUS}
procedure DeleteCompletion(Index: integer);
{$ENDIF}
function AddEditor(AEditor: TCustomSynEdit): boolean;
procedure Execute(AEditor: TCustomSynEdit); virtual;
procedure ExecuteCompletion(AToken: string; AEditor: TCustomSynEdit);
@ -175,6 +178,15 @@ begin
fEOTokenChars := '()[]{}.';
end;
{$IFDEF SYN_LAZARUS}
procedure TCustomSynAutoComplete.DeleteCompletion(Index: integer);
begin
fCompletions.Delete(Index);
fCompletionComments.Delete(Index);
fCompletionValues.Delete(Index);
end;
{$ENDIF}
destructor TCustomSynAutoComplete.Destroy;
begin
fEditors.Free;

View File

@ -664,6 +664,7 @@ TCMDialogKey = TLMKEY;
procedure DetachSignals; virtual;
procedure DestroyWnd; virtual;
procedure UpdateShowing; virtual;
Procedure SetZOrder(Topmost: Boolean); override;
procedure ShowControl(AControl: TControl); virtual;
procedure WndProc(var Message : TLMessage); override;
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; dynamic;
@ -1129,6 +1130,9 @@ end.
{ =============================================================================
$Log$
Revision 1.17 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.16 2001/03/19 14:00:50 lazarus
MG: fixed many unreleased DC and GDIObj bugs

View File

@ -99,7 +99,8 @@ type
Procedure SetDesigner(Value : TIDesigner);
Procedure SetMenu(value : TMainMenu);
Procedure SetFormStyle(Value : TFormStyle);
Procedure SetPosition(value : TPosition);
Procedure SetPosition(Value : TPosition);
Procedure SetVisible(Value: boolean);
Procedure SetWindowState(Value : TWIndowState);
Function GetCanvas: TControlCanvas;
Function IsForm : Boolean;
@ -163,6 +164,7 @@ type
property KeyPreview: Boolean read FKeyPreview write FKeyPreview;
property Menu : TMainMenu read FMenu write SetMenu;
property ModalResult : TModalResult read FModalResult write FModalResult;
property Visible write SetVisible default False;
property WindowState: TWindowState read FWindowState write SetWIndowState default wsNormal;
end;
@ -407,6 +409,7 @@ initialization
Focusmessages := True;
finalization
writeln('forms.pp - finalization section');
Application.Free;
Application:= nil;
Screen.Free;

View File

@ -113,7 +113,6 @@ Begin
if FDesigner <> nil then FDesigner.Notification(AComponent,Operation);
End;
{------------------------------------------------------------------------------
Method: TCustomForm.SetFocus
------------------------------------------------------------------------------}
@ -122,7 +121,23 @@ Begin
Assert(False, 'Trace:SETFOCUS');
//if not(Visible and Enabled) then Exit;
Assert(False, 'Trace:SETFOCUS2');
CNSendMessage(LM_SETFOCUS,Self,nil);
CNSendMessage(LM_SETFOCUS,Self,nil);
end;
{------------------------------------------------------------------------------}
{ TCustomForm SetVisible }
{------------------------------------------------------------------------------}
Procedure TCustomForm.SetVisible(Value : boolean);
Begin
if fsCreating in FFormState then
if Value then
Include(FFormState, fsVisible)
else
Exclude(FFormState, fsVisible)
else
begin
inherited Visible := Value;
end;
end;
{------------------------------------------------------------------------------
@ -859,8 +874,8 @@ end;
{ =============================================================================
$Log$
Revision 1.16 2001/03/20 16:59:15 lazarus
MG: fixed many bugs (mem leaks, canvas)
Revision 1.17 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.15 2001/03/19 14:41:56 lazarus
MG: fixed many unreleased DC and GDIObj bugs

View File

@ -396,6 +396,12 @@ Begin
Result := False;
end;
function TInterfaceBase.SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean;
begin
Result:=false;
end;
function TInterfaceBase.ShowCaret(hWnd: HWND): Boolean;
begin
Result := False;
@ -432,6 +438,9 @@ end;
{ =============================================================================
$Log$
Revision 1.13 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.12 2001/03/12 12:17:01 lazarus
MG: fixed random function results

View File

@ -396,6 +396,12 @@ begin
Result := InterfaceObject.SetWindowOrgEx(dc,NewX,NewY,lpPoint);
end;
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean;
begin
Result:=false;
end;
function ShowCaret(hWnd: HWND): Boolean;
begin
Result := InterfaceObject.ShowCaret(hWnd)
@ -965,6 +971,9 @@ end;
{ =============================================================================
$Log$
Revision 1.12 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.11 2001/02/16 19:13:30 lazarus
Added some functions
Shane

View File

@ -125,6 +125,8 @@ Function SetTextCharacterExtra(_hdc : hdc; nCharExtra : Integer):Integer; {$IFDE
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : Longint): Longint;{$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function SetWindowOrgEx(dc : hdc; NewX, NewY : Integer; Var Point : TPoint): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function ShowCaret(hWnd: HWND): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Rop: Cardinal): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
@ -221,6 +223,9 @@ function UnionRect(var lprcDst: TRect; const lprcSrc1, lprcSrc2: TRect): Boolean
{ =============================================================================
$Log$
Revision 1.9 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.8 2001/02/16 19:13:31 lazarus
Added some functions
Shane

View File

@ -116,11 +116,13 @@ var
end;
end;
end;
if (Control.Left <> Left2) or (Control.Top <> Top2) or (Control.Width <> Width2) or (Control.Height <> Height2) then begin
if (Control.Left <> Left2) or (Control.Top <> Top2)
or (Control.Width <> Width2) or (Control.Height <> Height2) then begin
Control.SetBounds(Left2, Top2, Width2, Height2);
end;
{Sometimes the control doesn't resize. This will verifiy that it is the size it is assigned to be}
{Sometimes the control doesn't resize. This will verifiy that it is the
size it is assigned to be}
if (Control.Width <> Width2) or (Control.Height <> Height2) then
with Rect do
case AAlign of
@ -355,8 +357,26 @@ end;
{------------------------------------------------------------------------------}
Procedure TWinControl.SetBorderWidth(value : TBorderWidth);
Begin
//TODO: SETBORDERWIDTH - Not sure if anything more is needed here
FBorderWidth := Value;
//TODO: SETBORDERWIDTH - Not sure if anything more is needed here
FBorderWidth := Value;
end;
Procedure TWinControl.SetZOrder(Topmost: Boolean);
const
WindowPos: array[Boolean] of Word = (HWND_BOTTOM, HWND_TOP);
var i: integer;
begin
if FParent <> nil then
begin
if TopMost then i := FParent.FWinControls.Count - 1
else i := 0;
if FParent.FControls <> nil then inc(i, FParent.FControls.Count);
SetZOrderPosition(i);
end
else if FHandle <> 0 then begin
InterfaceObject.SetWindowPos(FHandle, WindowPos[TopMost], 0, 0, 0, 0,
SWP_NOMOVE + SWP_NOSIZE);
end;
end;
{------------------------------------------------------------------------------}
@ -1802,7 +1822,8 @@ procedure TWinControl.SetBounds(aLeft, aTop, aWidth, aHeight : integer);
var
R : TRect;
begin
if (ALeft = Left) and (ATop = Top) and (AWidth = Width) and (AHeight = Height) then Exit;
if (ALeft = Left) and (ATop = Top) and (AWidth = Width) and (AHeight = Height)
then Exit;
FLeft := aLeft;
FTop := aTop;
FWidth := aWidth;
@ -1811,6 +1832,7 @@ begin
if HandleAllocated
then begin
R:= Rect(ALeft, ATop, AWidth, AHeight);
//writeln('[TWinControl.SetBounds] ',name,':',Classname,' ',Height);
CNSendMessage(LM_SetSize, Self, @R);
end
else inherited SetBounds(aLeft, aTop, aWidth, aHeight);
@ -1917,7 +1939,7 @@ end;
procedure TWinControl.CMShowingChanged(var Message: TLMessage);
begin
{ if (TWinControl(Self).HandleAllocated) or (Self is TCustomForm) then}
CNSendMessage(LM_ShowHide, Self, nil);
CNSendMessage(LM_ShowHide, Self, nil);
// SetWindowPos(FHandle, 0, 0, 0, 0, 0, ShowFlags[FShowing]);
end;
@ -1941,8 +1963,8 @@ end;
{ =============================================================================
$Log$
Revision 1.25 2001/03/20 16:59:15 lazarus
MG: fixed many bugs (mem leaks, canvas)
Revision 1.26 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.24 2001/03/19 14:38:39 lazarus
MG: fixed many unreleased DC and GDIObj bugs

View File

@ -588,7 +588,8 @@ begin
// ,TControl(Data).Left,',',TControl(Data).Top,' ',Size^.X,',',Size^.Y);
Dummy.X:=TControl(Data).Left;
Dummy.Y:=TControl(Data).Top;
gdk_window_get_root_origin(widget^.window, @Dummy.X, @Dummy.Y);
if widget^.window<>nil then
gdk_window_get_root_origin(widget^.window, @Dummy.X, @Dummy.Y);
Size^.X:=Dummy.X;
Size^.Y:=Dummy.Y;
end;
@ -1104,8 +1105,8 @@ end;
{ =============================================================================
$Log$
Revision 1.27 2001/03/21 23:48:29 lazarus
MG: fixed window positions
Revision 1.28 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.26 2001/03/19 14:44:22 lazarus
MG: fixed many unreleased DC and GDIObj bugs

View File

@ -254,7 +254,8 @@ Begin
//could we just call IntSendMessage??
//destroy old widget
gtk_widget_destroy(PgtkWidget(TWinControl(sender).HANDLE));
if TWinControl(sender).HANDLE<>0 then
gtk_widget_destroy(PgtkWidget(TWinControl(sender).HANDLE));
aParent := TWinControl(sender).Parent;
aParent.RemoveControl(TControl(sender));
@ -364,6 +365,7 @@ begin
begin
Assert(False, 'Trace:TODO:bringtofront');
//For now just hide and show again.
end;
LM_BTNDEFAULT_CHANGED :
@ -375,15 +377,16 @@ begin
LM_DESTROY :
begin
if (Sender is TTimer) then
begin
Assert(False, 'Trace:removing timer!!!');
gtk_timeout_remove((Sender as TTimer).TimerID);
if (Sender is TTimer) then begin
Assert(False, 'Trace:removing timer!!!');
gtk_timeout_remove((Sender as TTimer).TimerID);
end
else if (Sender is TWinControl) or (Sender is TCommonDialog) then begin
if Handle<>0 then
gtk_widget_destroy(PGtkWidget(Handle));
end
else if (Sender is TWinControl) or (Sender is TCommonDialog)
then gtk_widget_destroy( PGtkWidget(Handle))
else
Assert (False, Format ('Trace:Dont know how to destroy component %s', [sender.classname]));
Assert (False, Format ('Trace:Dont know how to destroy component %s', [sender.classname]));
end;
LM_DRAGINFOCHANGED :
@ -557,6 +560,8 @@ activate_time : the time at which the activation event occurred.
LM_SetSize :
begin
Assert(False, Format('Trace: [TgtkObject.IntSendMessage3] %s --> LM_SetSize(%d, %d, %d, %d)', [Sender.ClassNAme, PRect(Data)^.Left,PRect(Data)^.Top,PRect(Data)^.Right,PRect(Data)^.Bottom]));
//writeln('[IntSendMessage3.lm_setsize] ',PRect(Data)^.Left,',',PRect(Data)^.Top,',',
// PRect(Data)^.Right,',',PRect(Data)^.Bottom);
ResizeChild(Sender,PRect(Data)^.Left,PRect(Data)^.Top,
PRect(Data)^.Right,PRect(Data)^.Bottom);
end;
@ -998,22 +1003,25 @@ begin
if not (Sender is TSpeedButton) then
begin
pWidget := pgtkWidget(TWinControl(Sender).Handle);
gtk_widget_set_usize(pWidget, Width, Height);
pWidget := pgtkWidget(TWinControl(Sender).Handle);
//writeln('[TgtkObject.ResizeChild] ',Sender.ClassName,' ',Width,',',Height);
if Sender is TCustomForm then
//gdk_window_resize(pWidget^.Window, Width,Height);
gtk_widget_set_usize(pWidget, -1, -1);
gtk_widget_set_usize(pWidget, Width, Height);
if not ((Parent = nil) or (Sender is TCustomForm)) then
begin
pFixed := GetFixedWidget(PGtkWidget(Parent.Handle));
if pFixed <> nil
then begin
gtk_fixed_move(pFixed, pWidget, Left, Top);
end
else Assert(False, 'Trace:ERROR!!!! - no Fixed Widget found to use when resizing....');
end
else begin
gtk_widget_set_uposition(pWidget, Left, Top);
if not ((Parent = nil) or (Sender is TCustomForm)) then
begin
pFixed := GetFixedWidget(PGtkWidget(Parent.Handle));
if pFixed <> nil then begin
gtk_fixed_move(pFixed, pWidget, Left, Top);
end
else Assert(False, 'Trace:ERROR!!!! - no Fixed Widget found to use when resizing....');
end
else begin
gtk_widget_set_uposition(pWidget, Left, Top);
end;
end
end;
end;
{------------------------------------------------------------------------------
@ -1317,8 +1325,10 @@ begin
end;
LM_CHANGED :
if sender is TTrackBar
then ConnectSignal(gtk_Object(gtk_range_get_adjustment(GTK_RANGE(gObject))) , 'value_changed', @gtkvaluechanged)
if sender is TTrackBar then begin
ConnectSignal(gtk_Object(gtk_range_get_adjustment(
GTK_RANGE(gObject))) , 'value_changed', @gtkvaluechanged);
end
else if sender is TNotebook
then ConnectSignal(gObject, 'switch-page', @gtkswitchpage)
else if sender is TCustomCombobox
@ -1942,14 +1952,12 @@ begin
begin
if (TScrollBar(sender).kind = sbHorizontal) then
begin
Writeln('[Creating TScrollbar] Horiz');
P := gtk_hscrollbar_new(PgtkAdjustment(gtk_adjustment_new(1,TScrollBar(sender).min, TScrollBar(sender).max,
TScrollBar(sender).SmallChange, TScrollBar(sender).LargeChange,
TScrollBar(sender).Pagesize)));
end
else
Begin
Writeln('[Creating TScrollbar] Vertical');
P := gtk_vscrollbar_new(PgtkAdjustment(gtk_adjustment_new(1,TScrollBar(sender).min, TScrollBar(sender).max,
TScrollBar(sender).SmallChange, TScrollBar(sender).LargeChange,
TScrollBar(sender).Pagesize)));
@ -2299,8 +2307,12 @@ begin
Assert (Handle = nil, 'WARNING: [TgtkObject.GetValue] --> got nil pointer (no gtkobject)');
case TControl(Sender).fCompStyle of
csTrackbar : if handle <> nil then integer(data^) := round(gtk_range_get_adjustment (GTK_RANGE (handle))^.value) else
integer(data^) := 0;
csTrackbar :
if (handle <> nil) then begin
integer(data^) := round(gtk_range_get_adjustment(
GTK_RANGE (handle))^.value);
end else
integer(data^) := 0;
csRadiobutton,
@ -2344,7 +2356,9 @@ begin
csTrackbar : begin
if Handle = nil then Exit;
gtk_range_get_adjustment (GTK_RANGE (handle))^.value := integer (data^);
gtk_signal_emit_by_name (PGtkObject (gtk_range_get_adjustment (GTK_RANGE (handle))), 'value_changed');
gtk_signal_emit_by_name (PGtkObject
(gtk_range_get_adjustment (
GTK_RANGE (handle))), 'value_changed');
end;
csRadiobutton,
@ -2758,8 +2772,8 @@ end;
{ =============================================================================
$Log$
Revision 1.39 2001/03/21 23:48:29 lazarus
MG: fixed window positions
Revision 1.40 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.36 2001/03/19 18:51:57 lazarus
MG: added dynhasharray and renamed tsynautocompletion

View File

@ -337,6 +337,7 @@ begin
//write('CreateBrushIndirect->');
GObject := NewGDIObject(gdiBrush);
//writeln('[TgtkObject.CreateBrushIndirect] ',HexStr(Cardinal(GObject),8));
with LogBrush do
begin
@ -3040,7 +3041,9 @@ begin
Adjustment := PgtkvScrollBar(handle)^.Scrollbar.Range.Adjustment;
SB_CTL:
if gtk_type_is_a(gtk_object_type(PGTKObject(Handle)), gtk_range_get_type)
then Adjustment := gtk_range_get_adjustment(PGTKRange(Handle));
then begin
Adjustment := gtk_range_get_adjustment(PGTKRange(Handle));
end;
else
Adjustment := nil;
end;
@ -3225,12 +3228,30 @@ end;
Function TgtkObject.SetWindowOrgEx(dc : hdc; NewX, NewY : Integer; Var lpPoint : TPoint) : Boolean;
begin
//writeln('[TgtkObject.SetWindowOrgEx] ',NewX,' ',NewY);
// gdk_window_move(pgtkwidget(PdeviceContext(dc)^.hwnd)^.window,Newx,Newy);
// ToDo: move origin
lpPoint.X := NewX;
lpPoint.Y := NewY;
Result := True;
end;
function TgtkObject.SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean;
//var Widget: PGTKWidget;
begin
//writeln('[TgtkObject.SetWindowPos] Top=',hWndInsertAfter=HWND_TOP);
{ Widget := GetFixedWidget(pgtkwidget(hWnd));
if Widget = nil then Widget := pgtkwidget(hWnd);
case hWndInsertAfter of
HWND_BOTTOM: ; {gdk_window_lower(Widget^.Window);}
HWND_TOP: gtk_window_set_position(PGtkWindow(hWnd),GTK_WIN_POS_CENTER);
{gdk_window_raise(Widget^.Window);}
end;
}
Result:=true;
end;
{------------------------------------------------------------------------------
Function: ShowCaret
Params: none
@ -3425,8 +3446,8 @@ end;
{ =============================================================================
$Log$
Revision 1.30 2001/03/21 23:48:29 lazarus
MG: fixed window positions
Revision 1.31 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.26 2001/03/19 18:51:57 lazarus
MG: added dynhasharray and renamed tsynautocompletion

View File

@ -92,6 +92,8 @@ Function SetTextCharacterExtra(_hdc : hdc; nCharExtra : Integer):Integer; overri
function SetTextColor(DC: HDC; Color: TColorRef): TColorRef; override;
function SetWindowLong(Handle: HWND; Idx: Integer; NewLong : Longint): LongInt;
function SetWindowOrgEx(dc : hdc; NewX, NewY : Integer; Var lpPoint : TPoint) : Boolean; override;
function SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean; override;
function ShowCaret(hWnd: HWND): Boolean; override;
function ShowScrollBar(Handle: HWND; wBar: Integer; bShow: Boolean): Boolean; override;
function StretchBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc, SrcWidth, SrcHeight: Integer; Rop: Cardinal): Boolean; override;
@ -106,6 +108,9 @@ Function WindowFromPoint(Point : TPoint) : HWND; override;
{ =============================================================================
$Log$
Revision 1.13 2001/03/26 14:58:32 lazarus
MG: setwindowpos + bugfixes
Revision 1.12 2001/03/13 15:02:14 lazarus
MG: activated GetWindowOrgEx

View File

@ -266,7 +266,7 @@ end;
procedure GTKAPIWidgetClient_HideCaret(Client: PGTKAPIWidgetClient);
begin
if Client = nil
if Client = nil
then begin
WriteLn('WARNING: [GTKAPIWidgetClient_HideCaret] Got nil client');
Exit;
@ -296,7 +296,7 @@ begin
Timer := 0;
end;
IsDrawn := False;
if BackPixmap <> nil
if (BackPixmap <> nil) and (Widget^.theStyle<>nil)
then gdk_draw_pixmap(
Widget^.Window,
PGTKStyle(Widget^.theStyle)^.bg_gc[GTK_STATE_NORMAL],
@ -545,6 +545,9 @@ end.
{ =============================================================================
$Log$
Revision 1.5 2001/03/26 14:58:32 lazarus
MG: setwindowpos + bugfixes
Revision 1.4 2001/03/13 15:02:14 lazarus
MG: activated GetWindowOrgEx

View File

@ -552,6 +552,13 @@ Region_Error = Error;
WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE);
WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST);
const
{ SetWindowPos Flags }
HWND_TOP = 0;
HWND_BOTTOM = 1;
HWND_TOPMOST = HWND(-1);
HWND_NOTOPMOST = HWND(-2);
type
@ -1371,6 +1378,9 @@ end.
{
$Log$
Revision 1.6 2001/03/26 14:58:31 lazarus
MG: setwindowpos + bugfixes
Revision 1.5 2001/02/01 16:45:19 lazarus
Started the code completion.
Shane