Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
#include <berryWindow.h>
Classes | |
struct | IExceptionHandler |
Public Member Functions | |
berryObjectMacro (Window, IShellProvider) static const int OK | |
virtual bool | Close () |
virtual void | Create () |
int | GetReturnCode () |
Shell::Pointer | GetShell () const override |
WindowManager * | GetWindowManager () |
MenuManager * | GetMenuBarManager () const |
int | Open () |
void | SetBlockOnOpen (bool shouldBlock) |
void | SetWindowManager (WindowManager *manager) |
Public Member Functions inherited from berry::IShellProvider | |
berryObjectMacro (berry::IShellProvider, Object)~IShellProvider() | |
Public Member Functions inherited from berry::Object | |
virtual QString | GetClassName () const |
virtual Reflection::TypeInfo | GetTypeInfo () const |
virtual QList< Reflection::TypeInfo > | GetSuperclasses () const |
virtual void | Delete () |
QDebug | Print (QDebug os, Indent Indent=0) const |
virtual QString | ToString () const |
virtual uint | HashCode () const |
virtual bool | operator< (const Object *) const |
void | Register () const |
void | UnRegister (bool del=true) const |
int | GetReferenceCount () const |
void | SetReferenceCount (int) |
void | AddDestroyListener (const MessageAbstractDelegate<> &delegate) const |
void | RemoveDestroyListener (const MessageAbstractDelegate<> &delegate) const |
virtual bool | operator== (const Object *) const |
Static Public Member Functions | |
static QIcon | GetDefaultImage () |
static QList< QIcon > | GetDefaultImages () |
static void | SetDefaultImage (const QIcon &image) |
static void | SetDefaultImages (const QList< QIcon > &images) |
static void | SetExceptionHandler (IExceptionHandler::Pointer handler) |
static void | SetDefaultModalParent (IShellProvider::Pointer provider) |
Static Public Member Functions inherited from berry::Object | |
static const char * | GetStaticClassName () |
static Reflection::TypeInfo | GetStaticTypeInfo () |
static QList< Reflection::TypeInfo > | GetStaticSuperclasses () |
Static Public Attributes | |
static const int | CANCEL |
static QList< QIcon > | defaultImages |
Protected Member Functions | |
Window (Shell::Pointer parentShell) | |
Window (IShellProvider::Pointer shellProvider) | |
~Window () | |
QRect | GetConstrainedShellBounds (const QRect &preferredSize) |
virtual void | Init () |
virtual bool | CanHandleShellCloseEvent () |
virtual void | ConfigureShell (Shell::Pointer newShell) |
virtual QWidget * | CreateContents (Shell::Pointer parent) |
virtual Shell::Pointer | CreateShell () |
virtual QWidget * | GetContents () |
virtual QPoint | GetInitialLocation (const QPoint &initialSize) |
virtual QPoint | GetInitialSize () |
Shell::Pointer | GetParentShell () |
virtual IShellListener * | GetShellListener () |
int | GetShellStyle () |
virtual void | HandleShellCloseEvent () |
virtual void | InitializeBounds () |
void | SetParentShell (Shell::Pointer newParentShell) |
void | SetReturnCode (int code) |
void | SetShellStyle (int newShellStyle) |
void | AddMenuBar () |
virtual SmartPointer< MenuManager > | CreateMenuManager () |
virtual void | CreateTrimWidgets (SmartPointer< Shell > shell) |
Protected Member Functions inherited from berry::Object | |
Object () | |
virtual | ~Object () |
virtual QDebug | PrintSelf (QDebug os, Indent indent) const |
virtual QDebug | PrintHeader (QDebug os, Indent indent) const |
virtual QDebug | PrintTrailer (QDebug os, Indent indent) const |
Additional Inherited Members | |
Public Types inherited from berry::Object | |
typedef Object | Self |
typedef berry::SmartPointer< Self > | Pointer |
typedef berry::SmartPointer< const Self > | ConstPointer |
typedef berry::WeakPointer< Self > | WeakPtr |
typedef berry::WeakPointer< const Self > | ConstWeakPtr |
Protected Attributes inherited from berry::Object | |
QAtomicInt | m_ReferenceCount |
QMutex | m_ReferenceCountLock |
A JFace window is an object that has no visual representation (no widgets) until it is told to open.
Creating a window involves the following steps:
Window
create
(optional) WindowManager.add
(optional) open
Opening the window will create its shell and widget tree if they have not already been created. When the window is closed, the shell and widget tree are disposed of and are no longer referenced, and the window is automatically removed from its window manager. A window may be reopened.
The JFace window framework (this package) consists of this class, Window
, the abstract base of all windows, and one concrete window classes (ApplicationWindow
) which may also be subclassed. Clients may define additional window subclasses as required.
The Window
class provides methods that subclasses may override to configure the window, including:
close
- extend to free other SWT resources configureShell
- extend or reimplement to set shell properties before window opens createContents
- extend or reimplement to create controls before window opens getInitialSize
- reimplement to give the initial size for the shell getInitialLocation
- reimplement to give the initial location for the shell getShellListener
- extend or reimplement to receive shell events handleFontChange
- reimplement to respond to font changes handleShellCloseEvent
- extend or reimplement to handle shell closings Definition at line 86 of file berryWindow.h.
|
protected |
Runs the event loop for the given shell.
loopShell | the shell Creates a window instance, whose shell will be created under the given parent shell. Note that the window will have no visual representation until it is told to open. By default, open does not block. |
parentShell | the parent shell, or null to create a top-level shell. Try passing "(Shell)null" to this method instead of "null" if your compiler complains about an ambiguity error. |
Definition at line 139 of file berryWindow.cpp.
References Init().
|
protected |
Creates a new window which will create its shell as a child of whatever the given shellProvider returns.
shellProvider | object that will return the current parent shell. Not null. |
|
protected |
Definition at line 152 of file berryWindow.cpp.
|
protected |
Configures this window to have a menu bar. Does nothing if it already has one. This method must be called before this window's shell is created.
Definition at line 394 of file berryWindow.cpp.
References CreateMenuManager(), and GetShell().
berry::Window::berryObjectMacro | ( | Window | , |
IShellProvider | |||
) | const |
Standard return code constant (value 0) indicating that the window was opened.
|
protectedvirtual |
Determines if the window should handle the close event or do nothing.
The default implementation of this framework method returns true
, which will allow the handleShellCloseEvent
method to be called. Subclasses may extend or reimplement.
Definition at line 164 of file berryWindow.cpp.
|
virtual |
Closes this window, disposes its shell, and removes this window from its window manager (if it has one).
This framework method may be extended (super.close
must be called).
Note that in order to prevent recursive calls to this method it does not call Shell::close()
. As a result ShellListener
s will not receive a shellClosed
event.
true
if the window is (or was already) closed, and false
if it is still open Definition at line 429 of file berryWindow.cpp.
References GetShellListener(), and berry::GuiWidgetsTweaklet::KEY.
Referenced by HandleShellCloseEvent().
|
protectedvirtual |
Configures the given shell in preparation for opening this window in it.
The default implementation of this framework method sets the shell's image and gives it a grid layout. Subclasses may extend or reimplement.
newShell | the shell |
Definition at line 169 of file berryWindow.cpp.
References CreateTrimWidgets(), and defaultImages.
Referenced by CreateShell().
|
virtual |
Creates this window's widgetry in a new top-level shell.
The default implementation of this framework method creates this window's shell (by calling createShell
), and its controls (by calling createContents
), then initializes this window's shell bounds (by calling initializeBounds
).
Definition at line 466 of file berryWindow.cpp.
References CreateContents(), CreateShell(), and InitializeBounds().
Referenced by Open().
|
protectedvirtual |
Constrain the shell size to be no larger than the display bounds.
It is common practise to create and return a single composite that contains the entire window contents.
The default implementation of this framework method creates an instance of Composite
. Subclasses may override.
parent | the parent composite for the controls in this window. The type of layout used is determined by getLayout() |
Definition at line 220 of file berryWindow.cpp.
Referenced by Create().
|
protectedvirtual |
Returns a new menu manager for the window.
Subclasses may override this method to customize the menu manager.
Definition at line 402 of file berryWindow.cpp.
Referenced by AddMenuBar().
|
protectedvirtual |
Creates and returns this window's shell.
The default implementation of this framework method creates a new shell and configures it using configureShell
. Rather than override this method, subclasses should instead override configureShell
.
Definition at line 227 of file berryWindow.cpp.
References ConfigureShell(), GetParentShell(), GetShellListener(), GetShellStyle(), and berry::GuiWidgetsTweaklet::KEY.
Referenced by Create().
|
protectedvirtual |
Creates the trim widgets around the content area.
shell | the shell |
Definition at line 408 of file berryWindow.cpp.
Referenced by ConfigureShell().
|
protected |
Given the desired position of the window, this method returns an adjusted position such that the window is no larger than its monitor, and does not extend beyond the edge of the monitor. This is used for computing the initial window position, and subclasses can use this as a utility method if they want to limit the region in which the window may be moved.
preferredSize | the preferred position of the window |
Definition at line 354 of file berryWindow.cpp.
References berry::GuiWidgetsTweaklet::GetAvailableScreenSize(), berry::GuiWidgetsTweaklet::GetClosestScreenNumber(), and berry::GuiWidgetsTweaklet::KEY.
Referenced by InitializeBounds().
|
protectedvirtual |
Returns the top level control for this window. The parent of this control is the shell.
null
if this window's control has not been created yet Definition at line 265 of file berryWindow.cpp.
|
static |
Returns the default image. This is the image that will be used for windows that have no shell image at the time they are opened. There is no default image unless one is installed via setDefaultImage
.
null
if none Definition at line 476 of file berryWindow.cpp.
References defaultImages.
|
static |
Returns the array of default images to use for newly opened windows. It is expected that the array will contain the same icon rendered at different resolutions.
Definition at line 481 of file berryWindow.cpp.
References defaultImages.
|
protectedvirtual |
Returns the initial location to use for the shell. The default implementation centers the shell horizontally (1/2 of the difference to the left and 1/2 to the right) and vertically (1/3 above and 2/3 below) relative to the parent shell, or display bounds if there is no parent shell.
initialSize | the initial size of the shell, as returned by getInitialSize . |
Definition at line 270 of file berryWindow.cpp.
References berry::GuiWidgetsTweaklet::KEY.
Referenced by InitializeBounds().
|
protectedvirtual |
Returns the initial size to use for the shell. The default implementation returns the preferred size of the shell, using Shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)
.
Definition at line 296 of file berryWindow.cpp.
References berry::Constants::DEFAULT.
Referenced by InitializeBounds().
MenuManager * berry::Window::GetMenuBarManager | ( | ) | const |
Returns the menu bar manager for this window (if it has one).
null
if this window does not have a menu bar Definition at line 501 of file berryWindow.cpp.
|
protected |
Returns parent shell, under which this window's shell is created.
null
if there is no parent shell Definition at line 301 of file berryWindow.cpp.
References berry::Constants::APPLICATION_MODAL, GetShellStyle(), berry::Constants::PRIMARY_MODAL, and berry::Constants::SYSTEM_MODAL.
Referenced by CreateShell().
int berry::Window::GetReturnCode | ( | ) |
Returns this window's return code. A window's return codes are window-specific, although two standard return codes are predefined: OK
and CANCEL
.
Definition at line 486 of file berryWindow.cpp.
|
overridevirtual |
Returns this window's shell.
null
if this window's shell has not been created yet Implements berry::IShellProvider.
Definition at line 491 of file berryWindow.cpp.
Referenced by AddMenuBar().
|
protectedvirtual |
Returns a shell listener. This shell listener gets registered with this window's shell.
The default implementation of this framework method returns a new listener that makes this window the active window for its window manager (if it has one) when the shell is activated, and calls the framework method handleShellCloseEvent
when the shell is closed. Subclasses may extend or reimplement.
Definition at line 319 of file berryWindow.cpp.
Referenced by Close(), and CreateShell().
|
protected |
Returns the shell style bits.
The default value is SWT.CLOSE|SWT.MIN|SWT.MAX|SWT.RESIZE
. Subclassers should call setShellStyle
to change this value, rather than overriding this method.
Definition at line 327 of file berryWindow.cpp.
Referenced by CreateShell(), and GetParentShell().
WindowManager * berry::Window::GetWindowManager | ( | ) |
Returns the window manager of this window.
null
if none Definition at line 496 of file berryWindow.cpp.
|
protectedvirtual |
Notifies that the window's close button was pressed, the close menu was selected, or the ESCAPE key pressed.
The default implementation of this framework method sets the window's return code to CANCEL
and closes the window using close
. Subclasses may extend or reimplement.
Definition at line 332 of file berryWindow.cpp.
References CANCEL, Close(), and SetReturnCode().
|
protectedvirtual |
Initializes this windows variables
Definition at line 157 of file berryWindow.cpp.
References OK, and berry::Constants::SHELL_TRIM.
Referenced by Window().
|
protectedvirtual |
Initializes the location and size of this window's SWT shell after it has been created.
This framework method is called by the create
framework method. The default implementation calls getInitialSize
and getInitialLocation
and passes the results to Shell.setBounds
. This is only done if the bounds of the shell have not already been modified. Subclasses may extend or reimplement.
Definition at line 338 of file berryWindow.cpp.
References GetConstrainedShellBounds(), GetInitialLocation(), and GetInitialSize().
Referenced by Create().
int berry::Window::Open | ( | ) |
Opens this window, creating it first if it has not yet been created.
If this window has been configured to block on open ( setBlockOnOpen
), this method waits until the window is closed by the end user, and then it returns the window's return code; otherwise, this method returns immediately. A window's return codes are window-specific, although two standard return codes are predefined: OK
and CANCEL
.
Definition at line 506 of file berryWindow.cpp.
References Create().
void berry::Window::SetBlockOnOpen | ( | bool | shouldBlock | ) |
Sets whether the open
method should block until the window closes.
shouldBlock | true if the open method should not return until the window closes, and false if the open method should return immediately |
Definition at line 530 of file berryWindow.cpp.
|
static |
Sets the default image. This is the image that will be used for windows that have no shell image at the time they are opened. There is no default image unless one is installed via this method.
image | the default image, or null if none |
Definition at line 535 of file berryWindow.cpp.
References defaultImages.
|
static |
Sets the array of default images to use for newly opened windows. It is expected that the array will contain the same icon rendered at different resolutions.
images | the array of images to be used when this window is opened |
Definition at line 541 of file berryWindow.cpp.
References defaultImages, and images.
|
static |
Sets the default parent for modal Windows. This will be used to locate the parent for any modal Window constructed with a null parent.
provider | shell provider that will be used to locate the parent shell whenever a Window is created with a null parent |
Definition at line 574 of file berryWindow.cpp.
|
static |
Sets the exception handler for this application.
Note that the handler may only be set once. Subsequent calls to this method will be ignored.
handler | the exception handler for the application. |
Definition at line 566 of file berryWindow.cpp.
References us::handler.
|
protected |
Changes the parent shell. This is only safe to use when the shell is not yet realized (i.e., created). Once the shell is created, it must be disposed (i.e., closed) before this method can be called.
newParentShell | The new parent shell; this value may be null if there is to be no parent. |
Definition at line 378 of file berryWindow.cpp.
|
protected |
Sets this window's return code. The return code is automatically returned by open
if block on open is enabled. For non-blocking opens, the return code needs to be retrieved manually using getReturnCode
.
code | the return code |
Definition at line 384 of file berryWindow.cpp.
Referenced by HandleShellCloseEvent().
|
protected |
Sets the shell style bits. This method has no effect after the shell is created.
The shell style bits are used by the framework method createShell
when creating this window's shell.
newShellStyle | the new shell style bits |
Definition at line 389 of file berryWindow.cpp.
void berry::Window::SetWindowManager | ( | WindowManager * | manager | ) |
Sets the window manager of this window.
Note that this method is used by WindowManager
to maintain a backpointer. Clients must not call the method directly.
manager | the window manager, or null if none |
Definition at line 546 of file berryWindow.cpp.
|
static |
Standard return code constant (value 1) indicating that the window was canceled.
Definition at line 107 of file berryWindow.h.
Referenced by HandleShellCloseEvent().
|
static |
An array of images to be used for the window. It is expected that the array will contain the same icon rendered at different resolutions.
Definition at line 113 of file berryWindow.h.
Referenced by ConfigureShell(), GetDefaultImage(), GetDefaultImages(), SetDefaultImage(), and SetDefaultImages().