implemented TCustomForm.ShowInTaskBar for gtk1+2 from Andrew Haines

git-svn-id: trunk@6995 -
This commit is contained in:
mattias 2005-03-19 23:36:26 +00:00
parent 3e4b7bdaed
commit 5ec0ba3595
6 changed files with 80 additions and 0 deletions

View File

@ -402,6 +402,7 @@ type
FRestoredTop: integer;
FRestoredWidth: integer;
FRestoredHeight: integer;
FShowInTaskbar: Boolean;
FWindowState: TWindowState;
function IsForm : Boolean;
function IsHelpFileStored: boolean;
@ -424,6 +425,7 @@ type
procedure SetMenu(Value : TMainMenu);
procedure SetModalResult(const AValue: TModalResult);
procedure SetPosition(Value : TPosition);
procedure SetShowInTaskbar(Value: Boolean);
procedure SetVisible(Value: boolean);
procedure SetWindowFocus;
procedure SetWindowState(Value : TWIndowState);
@ -552,6 +554,8 @@ type
property RestoredTop: integer read FRestoredTop;
property RestoredWidth: integer read FRestoredWidth;
property RestoredHeight: integer read FRestoredHeight;
property ShowInTaskBar: Boolean read FShowInTaskbar write SetShowInTaskBar
default True;
property TextHeight: Longint read FDummyTextHeight write FDummyTextHeight
stored False;
property Visible write SetVisible stored VisibleIsStored default false;
@ -619,6 +623,7 @@ type
property Position;
property SessionProperties;
property ShowHint;
property ShowInTaskBar;
property TextHeight;
property UseDockManager;
property Visible;

View File

@ -1185,12 +1185,20 @@ begin
end;
end;
procedure TCustomForm.SetShowInTaskbar(Value: Boolean);
begin
if Value = FShowInTaskbar then exit;
TWSCustomFormClass(WidgetSetClass).SetShowInTaskbar(Self, Value);
FShowInTaskbar := Value;
end;
{------------------------------------------------------------------------------
TCustomForm Constructor
------------------------------------------------------------------------------}
constructor TCustomForm.Create(AOwner : TComponent);
begin
//DebugLn('[TCustomForm.Create] A Class=',Classname);
FShowInTaskbar := True;
BeginFormUpdate;
try
CreateNew(AOwner, 1);
@ -1897,6 +1905,9 @@ end;
{ =============================================================================
$Log$
Revision 1.180 2005/03/19 23:36:26 mattias
implemented TCustomForm.ShowInTaskBar for gtk1+2 from Andrew Haines
Revision 1.179 2005/03/07 21:59:44 vincents
changed hexstr(cardinal()) for pointers to dbgs() and other 64-bits fixes from Peter Vreman

View File

@ -73,6 +73,7 @@ const
procedure GDK_WINDOW_ACTIVATE(Window: PGdkWindowPrivate);
procedure GDK_WINDOW_MAXIMIZE(Window: PGdkWindowPrivate);
procedure GDK_WINDOW_MINIMIZE(Window: PGdkWindowPrivate);
procedure GDK_WINDOW_SHOW_IN_TASKBAR(Window: PGdkWindowPrivate; Show: Boolean);
{$ENDIF}
@ -1262,6 +1263,36 @@ begin
end;
procedure GDK_WINDOW_SHOW_IN_TASKBAR(Window: PGdkWindowPrivate; Show: Boolean);
var
XDisplay: PDisplay;
XScreen: PScreen;
XRootWindow,
XWindow: TWindow;
XEvent: TXClientMessageEvent;
_NET_WM_STATE,
_NET_WM_STATE_SKIP_TASKBAR: clong;
begin
XDisplay := GDK_WINDOW_XDISPLAY (Window);
XScreen := XDefaultScreenOfDisplay(xdisplay);
XRootWindow := XRootWindowOfScreen(xscreen);
XWindow := GDK_WINDOW_XWINDOW (Window);
_NET_WM_STATE := XInternAtom(xdisplay, '_NET_WM_STATE', false);
_NET_WM_STATE_SKIP_TASKBAR := XInternAtom(xdisplay, '_NET_WM_STATE_SKIP_TASKBAR', false);
XEvent._type := ClientMessage;
XEvent.window := XWindow;
XEvent.message_type := _NET_WM_STATE;
XEvent.format := 32;
XEvent.data.l[0] := Ord(not(Show)); // 0=Remove 1=Add 2=Toggle
XEvent.data.l[1] := _NET_WM_STATE_SKIP_TASKBAR;
XSendEvent(XDisplay, XRootWindow, False, SubstructureNotifyMask, @XEvent);
end;
{$ENDIF}
initialization

View File

@ -78,6 +78,7 @@ type
class procedure SetFormBorderStyle(const AForm: TCustomForm;
const AFormBorderStyle: TFormBorderStyle); override;
class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); override;
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: Boolean); override;
class procedure ShowModal(const ACustomForm: TCustomForm); override;
class procedure SetBorderIcons(const AForm: TCustomForm;
const ABorderIcons: TBorderIcons); override;
@ -157,6 +158,25 @@ begin
end;
end;
procedure TGtkWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
const AValue: Boolean);
{$IFDEF GTK1}
var
AWindow: PGdkWindowPrivate;
{$ENDIF}
begin
if (AForm.Parent<>nil) or not(AForm.HandleAllocated) then exit;
{$IFDEF GTK1}
AWindow := PGdkWindowPrivate(PGtkWidget(AForm.Handle)^.window);
GDK_WINDOW_SHOW_IN_TASKBAR(AWindow,AValue);
{$ENDIF}
{$IFDEF GTK2}
gtk_window_set_skip_taskbar_hint(PGtkWindow(AForm.Handle), not AValue);
{$ENDIF}
end;
procedure TGtkWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
var
GtkWindow: PGtkWindow;

View File

@ -90,6 +90,7 @@ type
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop,
AWidth, AHeight: Integer); override;
class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); override;
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: Boolean); override;
class procedure ShowModal(const ACustomForm: TCustomForm); override;
end;
@ -317,6 +318,12 @@ begin
SendMessage(winHandle, WM_SETICON, ICON_BIG, iconHandle);
end;
procedure TWin32WSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
const AValue: Boolean);
begin
{$Warning TODO: TWin32WSCustomForm.SetShowInTaskbar}
end;
procedure TWin32WSCustomForm.ShowModal(const ACustomForm: TCustomForm);
var
DisableWindowsInfo: PDisableWindowsInfo;

View File

@ -81,6 +81,7 @@ type
class procedure SetFormBorderStyle(const AForm: TCustomForm;
const AFormBorderStyle: TFormBorderStyle); virtual;
class procedure SetIcon(const AForm: TCustomForm; const AIcon: HICON); virtual;
class procedure SetShowInTaskbar(const AForm: TCustomForm; const AValue: Boolean); virtual;
class procedure ShowModal(const ACustomForm: TCustomForm); virtual;
end;
TWSCustomFormClass = class of TWSCustomForm;
@ -135,6 +136,11 @@ end;
procedure TWSCustomForm.SetIcon(const AForm: TCustomForm; const AIcon: HICON);
begin
end;
procedure TWSCustomForm.SetShowInTaskbar(const AForm: TCustomForm;
const AValue: Boolean);
begin
end;
procedure TWSCustomForm.ShowModal(const ACustomForm: TCustomForm);
begin