Restore SEBPatch

This commit is contained in:
2025-06-01 11:44:20 +02:00
commit 8c656e3137
1297 changed files with 142172 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell.Events
{
/// <summary>
/// Event handler fired by an <see cref="IActionCenterActivator"/> to control the visibility of the <see cref="IActionCenter"/>.
/// </summary>
public delegate void ActivatorEventHandler();
}

View File

@@ -0,0 +1,17 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System.ComponentModel;
namespace SafeExamBrowser.UserInterface.Contracts.Shell.Events
{
/// <summary>
/// Event handler used to define the control flow when the <see cref="ITaskbar"/>'s quit button is clicked.
/// </summary>
public delegate void QuitButtonClickedEventHandler(CancelEventArgs args);
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The action center is a user interface element via which the user can access and control various aspects of SEB.
/// </summary>
public interface IActionCenter
{
/// <summary>
/// Controls the visibility of the clock.
/// </summary>
bool ShowClock { set; }
/// <summary>
/// Controls the visibility of the quit button.
/// </summary>
bool ShowQuitButton { set; }
/// <summary>
/// Event fired when the user clicked the quit button.
/// </summary>
event QuitButtonClickedEventHandler QuitButtonClicked;
/// <summary>
/// Adds the given application control to the action center.
/// </summary>
void AddApplicationControl(IApplicationControl control, bool atFirstPosition = false);
/// <summary>
/// Adds the given notification control to the action center.
/// </summary>
void AddNotificationControl(INotificationControl control);
/// <summary>
/// Adds the given system control to the action center.
/// </summary>
void AddSystemControl(ISystemControl control);
/// <summary>
/// Closes the action center.
/// </summary>
void Close();
/// <summary>
/// Makes the action center invisible.
/// </summary>
void Hide();
/// <summary>
/// Moves the action center to the left of the screen and resizes it accordingly.
/// </summary>
void InitializeBounds();
/// <summary>
/// Initializes all text elements in the action center.
/// </summary>
void InitializeText(IText text);
/// <summary>
/// Makes the action center visible and automatically hides it after a short delay.
/// </summary>
void Promote();
/// <summary>
/// Registers the specified activator to control the visibility of the action center.
/// </summary>
void Register(IActionCenterActivator activator);
/// <summary>
/// Makes the action center visible.
/// </summary>
void Show();
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// A module which can be used to control the <see cref="IActionCenter"/>.
/// </summary>
public interface IActionCenterActivator : IActivator
{
/// <summary>
/// Fired when the action center should be made visible.
/// </summary>
event ActivatorEventHandler Activated;
/// <summary>
/// Fired when the action center should be made invisible.
/// </summary>
event ActivatorEventHandler Deactivated;
/// <summary>
/// Fired when the action center visibility should be toggled.
/// </summary>
event ActivatorEventHandler Toggled;
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// Defines an activator for a shell component.
/// </summary>
public interface IActivator
{
/// <summary>
/// Temporarily stops processing all user input.
/// </summary>
void Pause();
/// <summary>
/// Resumes processing user input.
/// </summary>
void Resume();
/// <summary>
/// Starts monitoring user input events.
/// </summary>
void Start();
/// <summary>
/// Stops monitoring user input events.
/// </summary>
void Stop();
}
}

View File

@@ -0,0 +1,17 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The control for an application which can be loaded into the shell.
/// </summary>
public interface IApplicationControl
{
}
}

View File

@@ -0,0 +1,17 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The control for a notification which can be loaded into the shell.
/// </summary>
public interface INotificationControl
{
}
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The control of a system component which can be loaded into the shell.
/// </summary>
public interface ISystemControl
{
/// <summary>
/// Closes the control and / or any associated user interface elements.
/// </summary>
void Close();
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Applications.Contracts;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The task view provides an overview of all currently running application instances.
/// </summary>
public interface ITaskview
{
/// <summary>
/// Adds the given application to the task view.
/// </summary>
void Add(IApplication<IApplicationWindow> application);
/// <summary>
/// Registers the specified activator for the task view.
/// </summary>
void Register(ITaskviewActivator activator);
}
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// A module which can be used to control the <see cref="ITaskview"/>.
/// </summary>
public interface ITaskviewActivator : IActivator
{
/// <summary>
/// Fired when the task view should be hidden.
/// </summary>
event ActivatorEventHandler Deactivated;
/// <summary>
/// Fired when the task view should be made visible and the next application instance should be selected.
/// </summary>
event ActivatorEventHandler NextActivated;
/// <summary>
/// Fired when the task view should be made visible and the previous application instance should be selected.
/// </summary>
event ActivatorEventHandler PreviousActivated;
}
}

View File

@@ -0,0 +1,90 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.Browser.Contracts.Events;
using SafeExamBrowser.I18n.Contracts;
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// The taskbar is a user interface element via which the user can access and control various aspects of the application.
/// </summary>
public interface ITaskbar
{
/// <summary>
/// Controls the visibility of the clock.
/// </summary>
bool ShowClock { set; }
/// <summary>
/// Controls the visibility of the quit button.
/// </summary>
bool ShowQuitButton { set; }
/// <summary>
/// Event fired when the user clicked the quit button in the taskbar.
/// </summary>
event QuitButtonClickedEventHandler QuitButtonClicked;
/// <summary>
/// Event fired when the Taskbar wants to lose focus.
/// </summary>
event LoseFocusRequestedEventHandler LoseFocusRequested;
/// <summary>
/// Adds the given application control to the taskbar.
/// </summary>
void AddApplicationControl(IApplicationControl control, bool atFirstPosition = false);
/// <summary>
/// Adds the given notification control to the taskbar.
/// </summary>
void AddNotificationControl(INotificationControl control);
/// <summary>
/// Adds the given system control to the taskbar.
/// </summary>
void AddSystemControl(ISystemControl control);
/// <summary>
/// Closes the taskbar.
/// </summary>
void Close();
/// <summary>
/// Puts the focus on the taskbar.
/// </summary>
void Focus(bool forward = true);
/// <summary>
/// Returns the absolute height of the taskbar (i.e. in physical pixels).
/// </summary>
int GetAbsoluteHeight();
/// <summary>
/// Moves the taskbar to the bottom of the screen and resizes it accordingly.
/// </summary>
void InitializeBounds();
/// <summary>
/// Initializes all text elements in the taskbar.
/// </summary>
void InitializeText(IText text);
/// <summary>
/// Registers the specified activator for the taskbar.
/// </summary>
void Register(ITaskbarActivator activator);
/// <summary>
/// Shows the taskbar.
/// </summary>
void Show();
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// A module which can be used to activate the <see cref="ITaskbar"/>.
/// </summary>
public interface ITaskbarActivator : IActivator
{
/// <summary>
/// Fired when the taskbar should be activated (i.e. put into focus).
/// </summary>
event ActivatorEventHandler Activated;
}
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using SafeExamBrowser.UserInterface.Contracts.Shell.Events;
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// A module which observes user input and indicates when the user would like to terminate SEB.
/// </summary>
public interface ITerminationActivator : IActivator
{
/// <summary>
/// Fired when a termination request has been detected.
/// </summary>
event ActivatorEventHandler Activated;
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 ETH Zürich, IT Services
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
namespace SafeExamBrowser.UserInterface.Contracts.Shell
{
/// <summary>
/// Defines all possible locations of a user control in the shell.
/// </summary>
public enum Location
{
/// <summary>
/// A user control styled for and placed in the action center.
/// </summary>
ActionCenter,
/// <summary>
/// A user control styled for and placed in the taskbar.
/// </summary>
Taskbar
}
}