mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 22:40:27 +02:00
implemented gtkwidgetset.IsWindowEnabled
git-svn-id: trunk@6740 -
This commit is contained in:
parent
77aa9f5174
commit
a6b0ee0289
@ -11279,7 +11279,7 @@ begin
|
|||||||
GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo);
|
GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo);
|
||||||
if FDisplayState = dsSource then begin
|
if FDisplayState = dsSource then begin
|
||||||
// send command to source editor
|
// send command to source editor
|
||||||
if ActiveSourceEditor=nil then exit;
|
if (ActiveSourceEditor=nil) then exit;
|
||||||
ActiveSourceEditor.DoEditorExecuteCommand(EditorCommand);
|
ActiveSourceEditor.DoEditorExecuteCommand(EditorCommand);
|
||||||
end else begin
|
end else begin
|
||||||
// send command to form editor
|
// send command to form editor
|
||||||
@ -11383,6 +11383,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.843 2005/02/05 13:33:05 mattias
|
||||||
|
implemented gtkwidgetset.IsWindowEnabled
|
||||||
|
|
||||||
Revision 1.842 2005/01/29 14:36:03 mattias
|
Revision 1.842 2005/01/29 14:36:03 mattias
|
||||||
reactivated fast xml units without widestrings
|
reactivated fast xml units without widestrings
|
||||||
|
|
||||||
|
@ -685,6 +685,8 @@ type
|
|||||||
snActiveFormChanged
|
snActiveFormChanged
|
||||||
);
|
);
|
||||||
|
|
||||||
|
{ TScreen }
|
||||||
|
|
||||||
TScreen = class(TLCLComponent)
|
TScreen = class(TLCLComponent)
|
||||||
private
|
private
|
||||||
FActiveControl: TWinControl;
|
FActiveControl: TWinControl;
|
||||||
@ -732,12 +734,15 @@ type
|
|||||||
function GetHintFont: TFont; virtual;
|
function GetHintFont: TFont; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner : TComponent); override;
|
constructor Create(AOwner : TComponent); override;
|
||||||
destructor Destroy; Override;
|
destructor Destroy; override;
|
||||||
function CustomFormIndex(AForm: TCustomForm): integer;
|
function CustomFormIndex(AForm: TCustomForm): integer;
|
||||||
function FormIndex(AForm: TForm): integer;
|
function FormIndex(AForm: TForm): integer;
|
||||||
function CustomFormZIndex(AForm: TCustomForm): integer;
|
function CustomFormZIndex(AForm: TCustomForm): integer;
|
||||||
procedure MoveFormToFocusFront(ACustomForm: TCustomForm);
|
procedure MoveFormToFocusFront(ACustomForm: TCustomForm);
|
||||||
procedure MoveFormToZFront(ACustomForm: TCustomForm);
|
procedure MoveFormToZFront(ACustomForm: TCustomForm);
|
||||||
|
function GetCurrentModalForm: TCustomForm;
|
||||||
|
function GetCurrentModalFormZIndex: Integer;
|
||||||
|
function CustomFormBelongsToActiveGroup(AForm: TCustomForm): Boolean;
|
||||||
procedure UpdateScreen;
|
procedure UpdateScreen;
|
||||||
// handler
|
// handler
|
||||||
procedure AddHandlerFormAdded(OnFormAdded: TScreenFormEvent;
|
procedure AddHandlerFormAdded(OnFormAdded: TScreenFormEvent;
|
||||||
|
@ -1750,6 +1750,8 @@ begin
|
|||||||
SaveFocusCount := FocusCount;
|
SaveFocusCount := FocusCount;
|
||||||
Screen.FSaveFocusedList.Insert(0, Screen.FFocusedForm);
|
Screen.FSaveFocusedList.Insert(0, Screen.FFocusedForm);
|
||||||
Screen.FFocusedForm := Self;
|
Screen.FFocusedForm := Self;
|
||||||
|
Screen.MoveFormToFocusFront(Self);
|
||||||
|
Screen.MoveFormToZFront(Self);
|
||||||
//SaveCursor := Screen.Cursor;
|
//SaveCursor := Screen.Cursor;
|
||||||
//Screen.Cursor := crDefault;
|
//Screen.Cursor := crDefault;
|
||||||
//SaveCount := Screen.FCursorCount;
|
//SaveCount := Screen.FCursorCount;
|
||||||
@ -1890,6 +1892,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.177 2005/02/05 13:33:05 mattias
|
||||||
|
implemented gtkwidgetset.IsWindowEnabled
|
||||||
|
|
||||||
Revision 1.176 2005/02/03 15:10:23 micha
|
Revision 1.176 2005/02/03 15:10:23 micha
|
||||||
implement shortcut handling, tcustomlabel accelerator focuscontrol functionality
|
implement shortcut handling, tcustomlabel accelerator focuscontrol functionality
|
||||||
|
|
||||||
|
@ -92,19 +92,62 @@ begin
|
|||||||
if (Self=nil) or (ACustomForm=nil)
|
if (Self=nil) or (ACustomForm=nil)
|
||||||
or (csDestroying in ACustomForm.ComponentState) then
|
or (csDestroying in ACustomForm.ComponentState) then
|
||||||
RaiseGDBException('TScreen.MoveFormToFocusFront');
|
RaiseGDBException('TScreen.MoveFormToFocusFront');
|
||||||
FCustomForms.Remove(ACustomForm);
|
if (FCustomForms.Count=0) or (TObject(FCustomForms[0])<>ACustomForm) then
|
||||||
FCustomForms.Insert(0, ACustomForm);
|
|
||||||
if ACustomForm is TForm then
|
|
||||||
begin
|
begin
|
||||||
Screen.FFormList.Remove(ACustomForm);
|
FCustomForms.Remove(ACustomForm);
|
||||||
Screen.FFormList.Insert(0, 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;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScreen.MoveFormToZFront(ACustomForm: TCustomForm);
|
procedure TScreen.MoveFormToZFront(ACustomForm: TCustomForm);
|
||||||
begin
|
begin
|
||||||
FCustomFormsZOrdered.Remove(ACustomForm);
|
if (FCustomFormsZOrdered.Count=0)
|
||||||
FCustomFormsZOrdered.Insert(0, ACustomForm);
|
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;
|
end;
|
||||||
|
|
||||||
procedure TScreen.UpdateScreen;
|
procedure TScreen.UpdateScreen;
|
||||||
|
@ -5961,9 +5961,33 @@ end;
|
|||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TGtkWidgetSet.IsWindowEnabled(handle: HWND): boolean;
|
function TGtkWidgetSet.IsWindowEnabled(handle: HWND): boolean;
|
||||||
|
var
|
||||||
|
LCLObject: TObject;
|
||||||
|
Widget: PGtkWidget;
|
||||||
|
AForm: TCustomForm;
|
||||||
|
//i: Integer;
|
||||||
begin
|
begin
|
||||||
{ TODO: implement me! }
|
Widget:=PGtkWidget(handle);
|
||||||
Result := false;
|
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;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -8872,6 +8896,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.393 2005/02/05 13:33:05 mattias
|
||||||
|
implemented gtkwidgetset.IsWindowEnabled
|
||||||
|
|
||||||
Revision 1.392 2005/02/05 09:05:50 micha
|
Revision 1.392 2005/02/05 09:05:50 micha
|
||||||
add platform independent winapi function IsWindowEnabled
|
add platform independent winapi function IsWindowEnabled
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user