implemented gtkwidgetset.IsWindowEnabled

git-svn-id: trunk@6740 -
This commit is contained in:
mattias 2005-02-05 13:33:05 +00:00
parent 77aa9f5174
commit a6b0ee0289
5 changed files with 94 additions and 11 deletions

View File

@ -11279,7 +11279,7 @@ begin
GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo);
if FDisplayState = dsSource then begin
// send command to source editor
if ActiveSourceEditor=nil then exit;
if (ActiveSourceEditor=nil) then exit;
ActiveSourceEditor.DoEditorExecuteCommand(EditorCommand);
end else begin
// send command to form editor
@ -11383,6 +11383,9 @@ end.
{ =============================================================================
$Log$
Revision 1.843 2005/02/05 13:33:05 mattias
implemented gtkwidgetset.IsWindowEnabled
Revision 1.842 2005/01/29 14:36:03 mattias
reactivated fast xml units without widestrings

View File

@ -685,6 +685,8 @@ type
snActiveFormChanged
);
{ TScreen }
TScreen = class(TLCLComponent)
private
FActiveControl: TWinControl;
@ -732,12 +734,15 @@ type
function GetHintFont: TFont; virtual;
public
constructor Create(AOwner : TComponent); override;
destructor Destroy; Override;
destructor Destroy; override;
function CustomFormIndex(AForm: TCustomForm): integer;
function FormIndex(AForm: TForm): integer;
function CustomFormZIndex(AForm: TCustomForm): integer;
procedure MoveFormToFocusFront(ACustomForm: TCustomForm);
procedure MoveFormToZFront(ACustomForm: TCustomForm);
function GetCurrentModalForm: TCustomForm;
function GetCurrentModalFormZIndex: Integer;
function CustomFormBelongsToActiveGroup(AForm: TCustomForm): Boolean;
procedure UpdateScreen;
// handler
procedure AddHandlerFormAdded(OnFormAdded: TScreenFormEvent;

View File

@ -1750,6 +1750,8 @@ begin
SaveFocusCount := FocusCount;
Screen.FSaveFocusedList.Insert(0, Screen.FFocusedForm);
Screen.FFocusedForm := Self;
Screen.MoveFormToFocusFront(Self);
Screen.MoveFormToZFront(Self);
//SaveCursor := Screen.Cursor;
//Screen.Cursor := crDefault;
//SaveCount := Screen.FCursorCount;
@ -1890,6 +1892,9 @@ end;
{ =============================================================================
$Log$
Revision 1.177 2005/02/05 13:33:05 mattias
implemented gtkwidgetset.IsWindowEnabled
Revision 1.176 2005/02/03 15:10:23 micha
implement shortcut handling, tcustomlabel accelerator focuscontrol functionality

View File

@ -92,19 +92,62 @@ begin
if (Self=nil) or (ACustomForm=nil)
or (csDestroying in ACustomForm.ComponentState) then
RaiseGDBException('TScreen.MoveFormToFocusFront');
FCustomForms.Remove(ACustomForm);
FCustomForms.Insert(0, ACustomForm);
if ACustomForm is TForm then
if (FCustomForms.Count=0) or (TObject(FCustomForms[0])<>ACustomForm) then
begin
Screen.FFormList.Remove(ACustomForm);
Screen.FFormList.Insert(0, ACustomForm);
FCustomForms.Remove(ACustomForm);
FCustomForms.Insert(0, ACustomForm);
end;
if ACustomForm is TForm then begin
if (FFormList.Count=0) or (TObject(FFormList[0])<>ACustomForm) then begin
FFormList.Remove(ACustomForm);
FFormList.Insert(0, ACustomForm);
end;
end;
end;
procedure TScreen.MoveFormToZFront(ACustomForm: TCustomForm);
begin
FCustomFormsZOrdered.Remove(ACustomForm);
FCustomFormsZOrdered.Insert(0, ACustomForm);
if (FCustomFormsZOrdered.Count=0)
or (TObject(FCustomFormsZOrdered[0])<>ACustomForm) then begin
FCustomFormsZOrdered.Remove(ACustomForm);
FCustomFormsZOrdered.Insert(0, ACustomForm);
end;
end;
function TScreen.GetCurrentModalForm: TCustomForm;
var
i: Integer;
begin
i:=GetCurrentModalFormZIndex;
if (i>=0) then
Result:=CustomFormsZOrdered[i]
else
Result:=nil;
end;
function TScreen.GetCurrentModalFormZIndex: Integer;
begin
Result:=0;
while (Result<CustomFormCount)
and (not (fsModal in CustomFormsZOrdered[Result].FormState)) do
inc(Result);
if Result=CustomFormCount then Result:=-1;
end;
function TScreen.CustomFormBelongsToActiveGroup(AForm: TCustomForm): Boolean;
var
CurForm: TCustomForm;
i: Integer;
begin
i:=0;
Result:=false;
while (i<CustomFormCount) do begin
CurForm:=CustomFormsZOrdered[i];
if CurForm=AForm then
Result:=true;
if fsModal in CurForm.FormState then exit;
inc(i);
end;
end;
procedure TScreen.UpdateScreen;

View File

@ -5961,9 +5961,33 @@ end;
------------------------------------------------------------------------------}
function TGtkWidgetSet.IsWindowEnabled(handle: HWND): boolean;
var
LCLObject: TObject;
Widget: PGtkWidget;
AForm: TCustomForm;
//i: Integer;
begin
{ TODO: implement me! }
Result := false;
Widget:=PGtkWidget(handle);
Result:=(Widget<>nil) and GTK_WIDGET_SENSITIVE(Widget)
and GTK_WIDGET_PARENT_SENSITIVE(Widget);
LCLObject:=GetLCLObject(PGtkWidget(Handle));
//debugln('TGtkWidgetSet.IsWindowEnabled A ',DbgSName(LCLObject),' Result=',dbgs(Result),
// ' SENSITIVE=',dbgs(GTK_WIDGET_SENSITIVE(Widget)),
// ' PARENT_SENSITIVE=',dbgs(GTK_WIDGET_PARENT_SENSITIVE(Widget)),
// ' TOPLEVEL=',dbgs(GTK_WIDGET_TOPLEVEL(Widget)),
// '');
if Result and GtkWidgetIsA(Widget,GTK_TYPE_WINDOW) then begin
LCLObject:=GetLCLObject(Widget);
if (LCLObject is TCustomForm) then begin
AForm:=TCustomForm(LCLObject);
if not Screen.CustomFormBelongsToActiveGroup(AForm) then
Result:=false;
//debugln('TGtkWidgetSet.IsWindowEnabled B ',dbgs(Screen.CustomFormBelongsToActiveGroup(AForm)));
//for i:=0 to Screen.CustomFormCount-1 do begin
// debugln(' ',dbgs(i),' ',DbgSName(Screen.CustomFormsZOrdered[i]));
//end;
end;
end;
end;
{------------------------------------------------------------------------------
@ -8872,6 +8896,9 @@ end;
{ =============================================================================
$Log$
Revision 1.393 2005/02/05 13:33:05 mattias
implemented gtkwidgetset.IsWindowEnabled
Revision 1.392 2005/02/05 09:05:50 micha
add platform independent winapi function IsWindowEnabled