fixed changing unitname during update

git-svn-id: trunk@2659 -
This commit is contained in:
mattias 2002-08-17 23:41:34 +00:00
parent c9a3bc987c
commit d2ef70e4c2
3 changed files with 88 additions and 9 deletions

View File

@ -1325,6 +1325,54 @@ begin
RaiseInvalidFixedWidget;
end;
function GetParentWidget(Child: PGtkWidget): PGtkWidget;
var
LCLParent: TObject;
begin
Result:=nil;
LCLParent:=GetParentLCLObject(Child);
if (LCLParent=nil) or (not (LCLParent is TWinControl))
or (not TWinControl(LCLParent).HandleAllocated)
then exit;
Result:=PGtkWidget(TWinControl(LCLParent).Handle);
end;
function GetParentFixedWidget(Child: PGtkWidget): PGtkWidget;
begin
Result:=GetParentWidget(Child);
if Result=nil then exit;
Result:=GetFixedWidget(Result);
end;
function FindFixedChild(ParentFixed: PGtkFixed; Child: PGtkWidget): PGList;
begin
Result:=ParentFixed^.children;
while (Result<>nil) do begin
if (Result^.Data<>nil) and (PGtkFixedChild(Result^.Data)^.Widget=Child) then
exit;
Result:=Result^.Next;
end;
end;
procedure MoveGListLinkBehind(First, Item, After: PGList);
var
Data: Pointer;
NewPos: Integer;
begin
if (g_list_position(First,Item)<0) then
RaiseException('MoveGListLinkBehind Item not found');
if (After<>nil) and (g_list_position(First,After)<0) then
RaiseException('MoveGListLinkBehind After not found');
Data:=Item^.Data;
g_list_remove_link(First,Item);
if After<>nil then begin
NewPos:=g_list_position(First,After)+1;
end else begin
NewPos:=0;
end;
g_list_insert(First,Data,NewPos);
end;
{------------------------------------------------------------------------------
Function GetControlWindow(Widget: Pointer) : PGDKWindow;
@ -4151,6 +4199,9 @@ end;
{ =============================================================================
$Log$
Revision 1.184 2003/06/19 09:26:58 mattias
fixed changing unitname during update
Revision 1.183 2003/06/18 00:10:38 marc
+ Added exceptionhandler while delivering messages

View File

@ -256,6 +256,10 @@ procedure SetHiddenLCLObject(const Widget: Pointer; const AnObject: TObject);
function GetHiddenLCLObject(const Widget: Pointer): TObject;
Procedure FixedMoveControl(Parent, Child : PGTKWIdget; Left, Top : Longint);
Procedure FixedPutControl(Parent, Child : PGTKWidget; Left, Top : Longint);
function GetParentWidget(Child: PGtkWidget): PGtkWidget;
function GetParentFixedWidget(Child: PGtkWidget): PGtkWidget;
function FindFixedChild(ParentFixed: PGtkFixed; Child: PGtkWidget): PGList;
procedure MoveGListLinkBehind(First, Item, After: PGList);
procedure SetComboBoxText(ComboWidget: PGtkCombo; NewText: PChar);
function GetComboBoxItemIndex(ComboBox: TComboBox): integer;

View File

@ -7305,17 +7305,38 @@ end;
------------------------------------------------------------------------------}
function TgtkObject.SetWindowPos(hWnd: HWND; hWndInsertAfter: HWND;
X, Y, cx, cy: Integer; uFlags: UINT): Boolean;
//var Widget: PGTKWidget;
var Widget: PGTKWidget;
{ FixedWidget: PGtkWidget;
OldListItem: PGList;
AfterWidget: PGtkWidget;
AfterListItem: PGList;}
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);
writeln('[TgtkObject.SetWindowPos] Top=',hWndInsertAfter=HWND_TOP);
Widget:=PGtkWidget(hWnd);
if GtkWidgetIsA(Widget,GTK_WINDOW_TYPE) then begin
{ 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;
}
end else begin
{AfterWidget:=PGtkWidget(hWndInsertAfter);
FixedWidget:=GetParentFixedWidget(Widget);
if FixedWidget=nil then exit;
OldListItem:=FindFixedChild(FixedWidget,Widget);
if OldListItem=nil then begin
writeln('TgtkObject.SetWindowPos WARNING: Widget not on parents fixed widget');
exit;
end;
AfterListItem:=FindFixedChild(FixedWidget,AfterWidget);
if (AfterListItem=nil) and (AfterWidget<>nil) then begin
writeln('TgtkObject.SetWindowPos WARNING: AfterWidget not on parents fixed widget');
exit;
end;
MoveGListLinkBehind(PGtkFixed(FixedWidget)^.children,
OldListItem,AfterListItem);}
end;
}
Result:=true;
end;
@ -8270,6 +8291,9 @@ end;
{ =============================================================================
$Log$
Revision 1.245 2003/06/19 09:26:58 mattias
fixed changing unitname during update
Revision 1.244 2003/06/18 11:21:07 mattias
fixed taborder=0, implemented TabOrder Editor