Window Interfaces

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 17:51, 2 January 2021 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



The window interfaces of the component window and container window control the Apache OpenOffice application windows. This chapter provides a short overview.

XWindow

The interface com.sun.star.awt.XWindow is supported by the component and controller windows. This interface comprises methods to resize a window, control its visibility, enable and disable it, and make it the focus for input device events. Listeners are informed about window events.

  [oneway] void setPosSize ( long X, long Y, long Width, long Height, short Flags ); 
  com::sun::star::awt::Rectangle getPosSize (); 
 
  [oneway] void setVisible ( boolean Visible ); 
  [oneway] void setEnable ( boolean Enable ); 
  [oneway] void setFocus (); 
 
  [oneway] void addWindowListener ( com::sun::star::awt::XWindowListener xListener ); 
  [oneway] void removeWindowListener ( com::sun::star::awt::XWindowListener xListener ); 
  [oneway] void addFocusListener ( com::sun::star::awt::XFocusListener xListener ); 
  [oneway] void removeFocusListener ( com::sun::star::awt::XFocusListener xListener ); 
  [oneway] void addKeyListener ( com::sun::star::awt::XKeyListener xListener ); 
  [oneway] void removeKeyListener ( com::sun::star::awt::XKeyListener xListener ); 
  [oneway] void addMouseListener ( com::sun::star::awt::XMouseListener xListener ); 
  [oneway] void removeMouseListener ( com::sun::star::awt::XMouseListener xListener ); 
  [oneway] void addMouseMotionListener ( com::sun::star::awt::XMouseMotionListener xListener ); 
  [oneway] void removeMouseMotionListener ( com::sun::star::awt::XMouseMotionListener xListener ); 
  [oneway] void addPaintListener ( com::sun::star::awt::XPaintListener xListener ); 
  [oneway] void removePaintListener ( com::sun::star::awt::XPaintListener xListener );

The com.sun.star.awt.XWindowListener gets the following notifications. The com.sun.star.awt.WindowEvent has members describing the size and position of the window.

  [oneway] void windowResized ( [in] com::sun::star::awt::WindowEvent e )
  [oneway] void windowMoved ( [in] com::sun::star::awt::WindowEvent e )
  [oneway] void windowShown ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowHidden ( [in] com::sun::star::lang::EventObject e );

What the other listeners do are evident by their names.

XTopWindow

The interface com.sun.star.awt.XTopWindow is available at container windows. It informs listeners about top window events, and it can put itself in front of other windows or withdraw into the background. It also has a method to control the current menu bar:

  [oneway] void addTopWindowListener ( com::sun::star::awt::XTopWindowListener xListener ); 
  [oneway] void removeTopWindowListener ( com::sun::star::awt::XTopWindowListener xListener ); 
  [oneway] void toFront (); 
  [oneway] void toBack (); 
  [oneway] void setMenuBar ( com::sun::star::awt::XMenuBar xMenu );
Documentation note.png Although the XTopWindow interface has a method setMenuBar(), this method is not usable at this time. The com.sun.star.awt.XMenuBar interface is deprecated.

The top window listener receives the following messages. All methods take a com.sun.star.lang.EventObject.

  [oneway] void windowOpened ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowClosing ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowClosed ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowMinimized ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowNormalized ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowActivated ( [in] com::sun::star::lang::EventObject e )
  [oneway] void windowDeactivated ( [in] com::sun::star::lang::EventObject e )

XWindowPeer

Each XWindow has a com.sun.star.awt.XWindowPeer. The com.sun.star.awt.XWindowPeer interface accesses the window toolkit implementation used to create it and provides the pointer of the pointing device, and controls the background color. It is also used to invalidate a window or portions of it to trigger a redraw cycle.

  com::sun::star::awt::XToolkit getToolkit ()
  [oneway] void setPointer ( [in] com::sun::star::awt::XPointer Pointer )
  [oneway] void setBackground ( [in] long Color ) 
  [oneway] void invalidate ( [in] short Flags )
  [oneway] void invalidateRect ( [in] com::sun::star::awt::Rectangle Rect, 
  [in] short Flags )
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages